Commit 3c0dd949 authored by limingzhe's avatar limingzhe

fix: debug

parent b5aaa443
No preview for this file type
...@@ -446,22 +446,22 @@ cc.Class({ ...@@ -446,22 +446,22 @@ cc.Class({
)); ));
}, },
length, starLen: null,
addStar() { addStar() {
if (!this.length) { if (!this.starLen) {
this.length = 0; this.starLen = 0;
} }
this.length++; this.starLen++;
let length = this.length; let starLen = this.starLen;
const starLayout = cc.find('Canvas/layout'); const starLayout = cc.find('Canvas/layout');
starLayout.removeAllChildren(); starLayout.removeAllChildren();
const paddingY = starLayout.getComponent(cc.Layout).spacingY; const paddingY = starLayout.getComponent(cc.Layout).spacingY;
for (let i = 0; i < length; i++) { for (let i = 0; i < starLen; i++) {
const starBase = cc.instantiate(cc.find('StarBase')); const starBase = cc.instantiate(cc.find('StarBase'));
starBase.name = `starBase_${i}`; starBase.name = `starBase_${i}`;
starBase.scale = this.Between(0.5, (starLayout.height / length - paddingY) / starBase.height, 1); starBase.scale = this.Between(0.5, (starLayout.height / starLen - paddingY) / starBase.height, 1);
starBase.parent = starLayout; starBase.parent = starLayout;
} }
this.currentStarIdx = 0; this.currentStarIdx = 0;
......
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