Commit e4229d77 authored by zjz1994's avatar zjz1994

代码暂存

parent 29b14f01
This diff is collapsed.
...@@ -48,9 +48,14 @@ function launchWithCustomModule(customModule) { ...@@ -48,9 +48,14 @@ function launchWithCustomModule(customModule) {
setTimeout(()=>{ setTimeout(()=>{
engine.globalEvent.dispatchEvent('pictures-initgame', { engine.globalEvent.dispatchEvent('pictures-initgame', {
gameUrls:[ gameUrls:[
"https://yun.duiba.com.cn/aurora/assets/7a9960acd582bb0b41bcfcdb24da68f354ccb1ff.jpg", "https://yun.duiba.com.cn/aurora/assets/5906e5670cb7061dfc77306087e9a79d4bbcb250.jpg",
"https://yun.duiba.com.cn/aurora/assets/61fd0754d7924305fd2851be86a480d71d2c2981.jpg", "https://yun.duiba.com.cn/aurora/assets/61fd0754d7924305fd2851be86a480d71d2c2981.jpg",
"https://yun.duiba.com.cn/aurora/assets/6b70d7ec626f35f21347bf5bc3e61bedc44167be.jpg" "https://yun.duiba.com.cn/aurora/assets/6b70d7ec626f35f21347bf5bc3e61bedc44167be.jpg"
],
gameTimes:[
10000,
10000,
10000,
] ]
}) })
},1000); },1000);
......
...@@ -39,14 +39,13 @@ ...@@ -39,14 +39,13 @@
//# sourceMappingURL=utils.js.map //# sourceMappingURL=utils.js.map
var qietu = (function (url, type1, rows, cols, parent) { return tslib.__awaiter(void 0, void 0, void 0, function () { var qietu = (function (url, type1, rows, cols, parent) { return tslib.__awaiter(void 0, void 0, void 0, function () {
var t, setimgwid, mwid1, mhei1, mwid, mhei, picarr, picnames, chax, chay, startlix, addlix, startliy, addliy, txt1, r, startx, endx, c, starty, endy, uvs, isprite, ispritename, e_1; var t, setimgwid, mwid1, mhei1, mwid, mhei, picarr, picnames, chax, chay, startlix, addlix, startliy, addliy, twid1, thei1, r, startx, c, starty, nsprite, isprite, nsp, ispritename, e_1;
return tslib.__generator(this, function (_a) { return tslib.__generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
_a.trys.push([0, 6, , 7]); _a.trys.push([0, 6, , 7]);
t = void 0; t = void 0;
if (!(type1 == 1)) return [3, 1]; if (!(type1 == 1)) return [3, 1];
console.log("直接使用已加载的tex");
t = url; t = url;
return [3, 3]; return [3, 3];
case 1: return [4, loadImageByUrl(url)]; case 1: return [4, loadImageByUrl(url)];
...@@ -60,7 +59,6 @@ ...@@ -60,7 +59,6 @@
mwid = t.width; mwid = t.width;
mhei = t.height; mhei = t.height;
if (!(mwid < 10 || mhei < 10)) return [3, 5]; if (!(mwid < 10 || mhei < 10)) return [3, 5];
console.log("调整222222222222");
return [4, new Promise(function (res) { return [4, new Promise(function (res) {
setTimeout(function () { setTimeout(function () {
res(); res();
...@@ -68,10 +66,8 @@ ...@@ -68,10 +66,8 @@
})]; })];
case 4: case 4:
_a.sent(); _a.sent();
return [2, qietu(t, 1, rows, cols, parent)]; return [2, qietu(t, 1, rows, cols)];
case 5: case 5:
console.log('图片', t);
console.log("图片获取尺寸", mwid, mhei);
if (mwid > mhei) { if (mwid > mhei) {
if (mhei < setimgwid) { if (mhei < setimgwid) {
mwid = mwid * setimgwid / mhei; mwid = mwid * setimgwid / mhei;
...@@ -84,7 +80,6 @@ ...@@ -84,7 +80,6 @@
mwid = setimgwid; mwid = setimgwid;
} }
} }
console.log("适配后的图片尺寸", mwid, mhei);
picarr = {}; picarr = {};
picnames = []; picnames = [];
chax = void 0; chax = void 0;
...@@ -93,12 +88,16 @@ ...@@ -93,12 +88,16 @@
addlix = void 0; addlix = void 0;
startliy = void 0; startliy = void 0;
addliy = void 0; addliy = void 0;
twid1 = void 0;
thei1 = void 0;
if (mwid > mhei) { if (mwid > mhei) {
chax = (mwid - mhei) / 2; chax = (mwid - mhei) / 2;
startlix = chax / mwid; startlix = chax / mwid;
addlix = (mhei / cols) / mwid; addlix = (mhei / cols) / mwid;
startliy = 0; startliy = 0;
addliy = 1 / rows; addliy = 1 / rows;
twid1 = mwid * setimgwid / mhei;
thei1 = setimgwid;
} }
else { else {
startlix = 0; startlix = 0;
...@@ -106,37 +105,31 @@ ...@@ -106,37 +105,31 @@
chay = (mhei - mwid) / 2; chay = (mhei - mwid) / 2;
startliy = chay / mhei; startliy = chay / mhei;
addliy = (mwid / rows) / mhei; addliy = (mwid / rows) / mhei;
thei1 = mhei * setimgwid / mwid;
twid1 = setimgwid;
} }
console.log("切图准备", startlix, addlix, startliy, addliy, mwid, mhei);
txt1 = new engine.Label();
txt1.fillColor = "red";
txt1.size = 24;
txt1.text = startlix.toFixed(2) + ";" + addlix.toFixed(2) + ";" + startliy.toFixed(2) + ";" + addliy.toFixed(2) + ";" + mwid.toFixed(2) + ";" + mhei.toFixed(2) + ";";
parent.addChild(txt1);
txt1.y = -100;
for (r = 0; r < rows; r++) { for (r = 0; r < rows; r++) {
startx = startlix + addlix * r; startx = startlix + addlix * r;
endx = startx + addlix;
for (c = 0; c < cols; c++) { for (c = 0; c < cols; c++) {
starty = startliy + addliy * c; starty = startliy + addliy * c;
endy = starty + addliy; nsprite = new engine.Container();
uvs = new Float32Array([ isprite = new engine.ScrollView();
starty, nsp = new engine.Sprite(t);
startx, isprite.addChild(nsp);
endy, nsp.width = twid1;
startx, nsp.height = thei1;
endy, isprite.mouseEnabled = false;
endx, isprite.mouseChildren = false;
starty, nsp.x = -starty * twid1;
endx nsp.y = -startx * thei1;
]);
isprite = new engine.Sprite(t);
isprite.uvs = uvs;
isprite.width = mwid1; isprite.width = mwid1;
isprite.height = mhei1; isprite.height = mhei1;
nsprite.addChild(isprite);
nsprite.width = mwid1;
nsprite.height = mhei1;
ispritename = "pic_" + c + "_" + r; ispritename = "pic_" + c + "_" + r;
isprite.name = ispritename; nsprite.name = ispritename;
picarr[ispritename] = isprite; picarr[ispritename] = nsprite;
picnames.push(ispritename); picnames.push(ispritename);
} }
} }
...@@ -149,8 +142,6 @@ ...@@ -149,8 +142,6 @@
}]; }];
case 6: case 6:
e_1 = _a.sent(); e_1 = _a.sent();
console.error("图片加载失败", e_1);
console.log(url, rows, cols);
return [2, { return [2, {
res: false res: false
}]; }];
...@@ -158,6 +149,7 @@ ...@@ -158,6 +149,7 @@
} }
}); });
}); }); }); });
//# sourceMappingURL=qietu.js.map
var GameView = (function (_super) { var GameView = (function (_super) {
tslib.__extends(GameView, _super); tslib.__extends(GameView, _super);
...@@ -331,7 +323,6 @@ ...@@ -331,7 +323,6 @@
engine.globalEvent.dispatchEvent("pictures-time-passtime", { engine.globalEvent.dispatchEvent("pictures-time-passtime", {
passtime: this.passtime passtime: this.passtime
}); });
console.log("start-----------------", actidx);
this.rows = props.rows; this.rows = props.rows;
this.cols = props.cols; this.cols = props.cols;
this.nselectimg = null; this.nselectimg = null;
...@@ -549,7 +540,6 @@ ...@@ -549,7 +540,6 @@
}; };
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) { var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super); tslib.__extends(GameWrapper, _super);
......
This diff is collapsed.
...@@ -193,7 +193,6 @@ export default class GameView extends engine.Container { ...@@ -193,7 +193,6 @@ export default class GameView extends engine.Container {
engine.globalEvent.dispatchEvent("pictures-time-passtime",{ engine.globalEvent.dispatchEvent("pictures-time-passtime",{
passtime:this.passtime passtime:this.passtime
}); });
console.log("start-----------------",actidx);
this.rows = props.rows; this.rows = props.rows;
this.cols = props.cols; this.cols = props.cols;
......
...@@ -8,7 +8,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -8,7 +8,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
try{ try{
let t:engine.Texture; let t:engine.Texture;
if(type1==1){ if(type1==1){
console.log("直接使用已加载的tex");
t = url; t = url;
}else{ }else{
t = await loadImageByUrl(url) as engine.Texture; t = await loadImageByUrl(url) as engine.Texture;
...@@ -21,7 +20,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -21,7 +20,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
let mwid = t.width; let mwid = t.width;
let mhei = t.height; let mhei = t.height;
if(mwid<10||mhei<10){ if(mwid<10||mhei<10){
console.log("调整222222222222");
await new Promise(res=>{ await new Promise(res=>{
setTimeout(function(){ setTimeout(function(){
res(); res();
...@@ -29,8 +27,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -29,8 +27,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
}) })
return qietu(t,1,rows,cols,parent); return qietu(t,1,rows,cols,parent);
} }
console.log('图片',t);
console.log("图片获取尺寸",mwid,mhei);
if(mwid>mhei){ if(mwid>mhei){
if(mhei<setimgwid){ if(mhei<setimgwid){
mwid = mwid*setimgwid/mhei; mwid = mwid*setimgwid/mhei;
...@@ -42,7 +38,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -42,7 +38,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
mwid = setimgwid; mwid = setimgwid;
} }
} }
console.log("适配后的图片尺寸",mwid,mhei);
let picarr = {}; let picarr = {};
let picnames = []; let picnames = [];
...@@ -53,6 +48,9 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -53,6 +48,9 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
let addlix; let addlix;
let startliy; let startliy;
let addliy; let addliy;
let twid1;
let thei1;
if(mwid>mhei){ if(mwid>mhei){
chax = (mwid-mhei)/2; chax = (mwid-mhei)/2;
startlix = chax/mwid; startlix = chax/mwid;
...@@ -60,6 +58,9 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -60,6 +58,9 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
startliy = 0; startliy = 0;
addliy = 1/rows; addliy = 1/rows;
twid1 = mwid*setimgwid/mhei;
thei1 = setimgwid;
}else{ }else{
startlix = 0; startlix = 0;
addlix = 1/cols; addlix = 1/cols;
...@@ -67,15 +68,18 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -67,15 +68,18 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
chay = (mhei-mwid)/2; chay = (mhei-mwid)/2;
startliy = chay/mhei; startliy = chay/mhei;
addliy = (mwid/rows)/mhei; addliy = (mwid/rows)/mhei;
thei1 = mhei*setimgwid/mwid;
twid1 = setimgwid;
} }
console.log("切图准备",startlix,addlix,startliy,addliy,mwid,mhei); // console.log("切图准备",startlix,addlix,startliy,addliy,mwid,mhei);
let txt1 = new engine.Label(); // let txt1 = new engine.Label();
txt1.fillColor = "red"; // txt1.fillColor = "red";
txt1.size = 24; // txt1.size = 24;
txt1.text = startlix.toFixed(2)+";"+addlix.toFixed(2)+";"+startliy.toFixed(2)+";"+addliy.toFixed(2)+";"+mwid.toFixed(2)+";"+mhei.toFixed(2)+";" // txt1.text = startlix.toFixed(2)+";"+addlix.toFixed(2)+";"+startliy.toFixed(2)+";"+addliy.toFixed(2)+";"+mwid.toFixed(2)+";"+mhei.toFixed(2)+";"
parent.addChild(txt1); // parent.addChild(txt1);
txt1.y = -100; // txt1.y = -100;
for(let r=0;r<rows;r++){ for(let r=0;r<rows;r++){
let startx = startlix+addlix*r; let startx = startlix+addlix*r;
let endx = startx + addlix; let endx = startx + addlix;
...@@ -93,16 +97,32 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -93,16 +97,32 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
starty, starty,
endx endx
]) ])
let isprite = new engine.Sprite(t); // let isprite = new engine.Sprite(t);
isprite.uvs = uvs; // isprite.uvs = uvs;
let nsprite = new engine.Container();
let isprite = new engine.ScrollView();
let nsp = new engine.Sprite(t);
isprite.addChild(nsp);
nsp.width = twid1;
nsp.height = thei1;
isprite.mouseEnabled = false;
isprite.mouseChildren = false;
nsp.x = -starty*twid1;
nsp.y = -startx*thei1;
isprite.width = mwid1; isprite.width = mwid1;
isprite.height = mhei1; isprite.height = mhei1;
nsprite.addChild(isprite);
nsprite.width = mwid1;
nsprite.height = mhei1;
let ispritename = "pic_"+c+"_"+r; let ispritename = "pic_"+c+"_"+r;
isprite.name = ispritename; nsprite.name = ispritename;
picarr[ispritename] = isprite; picarr[ispritename] = nsprite;
picnames.push(ispritename); picnames.push(ispritename);
} }
} }
...@@ -114,8 +134,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin ...@@ -114,8 +134,6 @@ export default async(url:any,type1:number, rows:number, cols:number,parent:engin
picnames:picnames picnames:picnames
}; };
}catch(e){ }catch(e){
console.error("图片加载失败",e);
console.log(url,rows,cols);
return { return {
res:false res:false
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment