Commit 6f65aa47 authored by haiyoucuv's avatar haiyoucuv

init

parent 9455655e
...@@ -80,18 +80,18 @@ export class HomeScene extends Scene { ...@@ -80,18 +80,18 @@ export class HomeScene extends Scene {
if (+status === 2 || +status === 3) { if (+status === 2 || +status === 3) {
sp.spriteFrame = this[`boxStatus${status}`]; sp.spriteFrame = this[`boxStatus${status}`];
maxIndex = Math.max(maxIndex, i + 1); maxIndex = Math.max(maxIndex, i);
} else { } else {
sp.spriteFrame = this.boxStatus1; sp.spriteFrame = this.boxStatus1;
} }
this.boxRoot.addChild(item); this.boxRoot.addChild(item);
item.setPosition(-500 / 2 + (i + 1) / len * 500, 0); item.setPosition(-500 / 2 + i / Math.max(1, len - 1) * 500, 0);
item.on(Button.EventType.CLICK, this.openBox.bind(this, boxConfigs[i]), this); item.on(Button.EventType.CLICK, this.openBox.bind(this, boxConfigs[i]), this);
} }
this.progress.progress = maxIndex / len; this.progress.progress = maxIndex / Math.max(1, len - 1);
} }
......
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