Commit e4229d77 authored by zjz1994's avatar zjz1994

代码暂存

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