Commit 004c7d01 authored by yu's avatar yu

1

parent 412e7ac8
......@@ -131,7 +131,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.event.on('layer_coin_show_coin_end', () => {
let over = Game.getIns().addPage();
if (!over) {
pg.event.emit('layer_ending_show', { coin: this.coin })
// pg.event.emit('layer_ending_show', { coin: this.coin })
const midd = cc.find('middleLayer');
if (!midd) return this.log("no middleLayer");
let middleLayer = midd.getComponent('middleLayer');
middleLayer.saveGolds(this.coin); // 保存金币数量;num 是获得金币的数量,数字类型;
middleLayer.goNextPage(); // 跳转到下一页
} else {
this.gameStart();
}
......@@ -185,11 +190,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
let isBig = data.wordArr.length > 5;
let count = data.count;
this.layout_up.removeAllChildren();
this.layout_up.getComponent(cc.Layout).enabled = true;
data.wordArr.forEach(async (dt) => {
let item = isBig ? cc.instantiate(this.item4) : cc.instantiate(this.item3);
let word = cc.find("word", item);
let box1 = cc.find("box1", item);
let box = cc.find("box", item);
// let xian = cc.find("xian", item);
word.getComponent(cc.Label).string = dt.text.split(" ").join("");
item.active = true;
......@@ -206,6 +213,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
word.getComponent(cc.Label).string = "";
} else {
if (box1) box1.active = true;
if (box) box.active = false;
}
})
this.layout_up.active = true;
......@@ -239,9 +247,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// this.layout_down.getComponent(cc.Layout).spacingX = 70;
} else {
// this.layout_down.getComponent(cc.Layout).spacingX = -100;
this.layout_up.getComponent(cc.Layout).spacingX = 0;
this.layout_up.getComponent(cc.Layout).spacingX = 10;
}
this.layout_up.getComponent(cc.Sprite).enabled = data.wordArr.length > 5;
// this.layout_up.getComponent(cc.Sprite).enabled = data.wordArr.length > 5;
this.layout_down.getComponent(cc.Layout).spacingX = count == 5 ? 10 : count < 5 ? 60 : -100;
this.layout_down.children.forEach((ch, idx) => {
......@@ -257,11 +265,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
.start();
})
this.layout_down.getComponent(cc.Layout).updateLayout();
this.layout_up.getComponent(cc.Layout).updateLayout();
let box_up = cc.find("box_up", this.layout_game);
box_up.active = false;
await asyncDelay(0.03);
box_up.active = isBig;
this.isClick = true;
if (isBig && this.layout_up.width < this.layout_down.width) {
this.layout_up.getComponent(cc.Layout).enabled = false;
this.layout_up.width = this.layout_down.width;
}
box_up.width = this.layout_up.width;
}
private iniItem(item, text) {
let card = cc.find("card", item);
......
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