Commit c353b819 authored by yu's avatar yu

图片调整

parent 8a86a238
......@@ -53,7 +53,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.ani_flower = cc.find("particle_star", this.node);
this.rightClip = cc.find('Canvas/res/audio/right').getComponent(cc.AudioSource).clip;
this.wrongClip = cc.find('Canvas/res/audio/wrong').getComponent(cc.AudioSource).clip;
pg.event.emit("mouse_num", 1);
pg.event.emit("mouse_num", this.data.item.group.length);
this.updateRound();
this.showGame();
......@@ -254,8 +254,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
private updateRound() {
let label_round = cc.find("bg/page/lable", this.node);
// label_round.getComponent(cc.Label).string = (this._drawIndex + 1) + "/" + this.data.item.group.length;
label_round.getComponent(cc.Label).string = "1/1";
label_round.getComponent(cc.Label).string = this._drawIndex + "/" + this.data.item.group.length;
// label_round.getComponent(cc.Label).string = "1/1";
}
private showGame() {
......@@ -288,6 +288,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
return item;
}
private getHeadSize(type) {
let size = {};
if (this.upArr.length == 5) {
if (type == 1) {
size = { w: 50, h: 50 }
} else {
size = { w: 400, h: 60 }
}
} else if (this.upArr.length == 4) {
if (type == 1) {
size = { w: 90, h: 90 }
} else {
size = { w: 255, h: 80 }
}
} else if (this.upArr.length == 3) {
if (type == 1) {
size = { w: 120, h: 115 }
} else {
size = { w: 255, h: 120 }
}
}
return size;
}
private showLayout() {
let data = this.data.item.group;
let lift = cc.find("lift", this.node);
......@@ -298,20 +321,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.upArr.forEach((item) => {
if (item.type == 1) {
let textItem = this.getItemNode(1);
this.initTextItem(textItem, item);
let size = this.getHeadSize(1);
this.initTextItem(textItem, item, 1);
textItem.parent = lift;
} else if (item.type == 0) {
let textItem = this.getItemNode(1);
let size = this.getHeadSize(1);
this.initPicItem(textItem, item, size);
textItem.parent = lift;
} else if (item.type == 2) {
this.initPicItem(item, lift);
}
});
this.downArr.forEach((item) => {
if (item.type == 1) {
let textItem = this.getItemNode(2);
let size = this.getHeadSize(2);
this.initTextItem(textItem, item);
textItem.parent = right;
} else if (item.type == 2) {
this.initPicItem(item, right);
} else if (item.type == 0) {
let textItem = this.getItemNode(2);
let size = this.getHeadSize(2);
this.initPicItem(textItem, item, size);
textItem.parent = right;
}
});
}
......@@ -350,12 +381,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
private initTextItem(item, data) {
private initTextItem(item, data, type = 2) {
item.data = data;
let img_laba02 = item.getChildByName("img_close");
let desc = item.getChildByName("desc");
desc.getComponent(cc.Label).string = data.text;
if (type == 1 && item.width - desc.width > 10) {
setTimeout(() => {
item.width = desc.width + 30;
}, 30);
}
item.on(cc.Node.EventType.TOUCH_END, () => {
setTimeout(() => {
this.checkLing();
......@@ -372,16 +407,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
item.x = 0;
}
private initPicItem(data, content) {
let item;
item = cc.instantiate(cc.find("items/type4", this.node));
private initPicItem(item, data, size) {
item.data = data;
let img_laba02 = item.getChildByName("img_close");
let desc = item.getChildByName("desc");
let head = item.getChildByName("head");
pg.view.setNetImg(head, data.pic_url, { w: 145, h: 125 });
pg.view.setNetImg(head, data.pic_url, size);
if (desc) desc.getComponent(cc.Label).string = data.text;
// if (desc) desc.getComponent(cc.Label).string = data.text;
item.on(cc.Node.EventType.TOUCH_END, () => {
setTimeout(() => {
......@@ -396,8 +429,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
item.audioClip = audioClip;
});
}
item.y = 0;
item.parent = content;
item.x = 0;
}
private checkLing() {
......@@ -507,8 +539,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
30
);
this._drawIndex++;
if (this._drawIndex >= this.data.item.group.length) {
this.updateRound();
pg.event.emit("mouse_add");
if (this._drawIndex >= this.data.item.group.length) {
setTimeout(() => {
let mouse_end = pg.view.find(this, "mouse_end");
mouse_end.active = true;
......
......@@ -4,12 +4,12 @@
// "text": "This is a test label.",
// "audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
// }
export const defaultData = {
export const defaultData ={
"aniEnter": {
"skeJsonData": {},
"texJsonData": {},
"texPngData": {},
"audioUrl": "http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3",
"audioUrl": null,
"time": 1
},
"item": {
......@@ -17,19 +17,19 @@ export const defaultData = {
"up": {
"type": 1,
"pic_url": "",
"text": "1",
"text": "1fdshkdshfksdhkfhdskdsk",
"audio_url": ""
},
"down": {
"type": 1,
"pic_url": "",
"pic_url": "http://staging-teach.cdn.ireadabc.com/6689e11c1646fba838a51c212b7770d2.png",
"text": "第三位发送到",
"audio_url": ""
"audio_url": "http://staging-teach.cdn.ireadabc.com/71348a317c47ec2a0b3056b0d7ca2e99.mp3"
}
}, {
"up": {
"type": 1,
"pic_url": "",
"type": 0,
"pic_url": "http://staging-teach.cdn.ireadabc.com/e359730cf593c396a58e020333026fac.png",
"text": "2",
"audio_url": ""
},
......@@ -41,9 +41,9 @@ export const defaultData = {
}
}, {
"up": {
"type": 1,
"pic_url": "",
"text": "3",
"type": 0,
"pic_url": "http://staging-teach.cdn.ireadabc.com/bcc13bb8f504b17ee9d07d8f5204b12f.png",
"text": "2",
"audio_url": ""
},
"down": {
......@@ -52,35 +52,118 @@ export const defaultData = {
"text": "萨大师赛所",
"audio_url": ""
}
}, {
"up": {
"type": 1,
"pic_url": "",
"text": "4",
"audio_url": ""
},
"down": {
"type": 1,
"pic_url": "",
"text": "那边不谷歌包",
"audio_url": ""
}
}, {
"up": {
"type": 1,
"pic_url": "",
"text": "5",
"audio_url": ""
},
"down": {
"type": 1,
"pic_url": "",
"text": "5345344343",
"audio_url": ""
}
}
// {
// "up": {
// "type": 0,
// "pic_url": "http://staging-teach.cdn.ireadabc.com/b84efeac2d0bc3f32f1dffb6734aeea6.png",
// "text": "4",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "那边不谷歌包",
// "audio_url": "http://staging-teach.cdn.ireadabc.com/9df3f14bc88bcffc49b6717c40428ed8.mp3"
// }
// },
// {
// "up": {
// "type": 0,
// "pic_url": "http://staging-teach.cdn.ireadabc.com/ce43980b533f674f9debe6ce9cae7b8d.png",
// "text": "5",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "5345344343",
// "audio_url": ""
// }
// }
],
"title": "电话客服劵花费",
"audio_title": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3"
}
}
// {
// "aniEnter": {
// "skeJsonData": {},
// "texJsonData": {},
// "texPngData": {},
// "audioUrl": "http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3",
// "time": 1
// },
// "item": {
// "group": [{
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "1",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "第三位发送到",
// "audio_url": ""
// }
// }, {
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "2",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "4534543",
// "audio_url": "http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3"
// }
// }, {
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "3",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "萨大师赛所",
// "audio_url": ""
// }
// }, {
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "4",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "那边不谷歌包",
// "audio_url": ""
// }
// }, {
// "up": {
// "type": 1,
// "pic_url": "",
// "text": "5",
// "audio_url": ""
// },
// "down": {
// "type": 1,
// "pic_url": "",
// "text": "5345344343",
// "audio_url": ""
// }
// }
// ],
// "title": "电话客服劵花费",
// "audio_title": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3"
// }
// }
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