增加更新拼图的方法
This commit is contained in:
parent
2cfd778e4e
commit
5e85db76f1
@ -9,13 +9,14 @@ cc.Class({
|
|||||||
imageNode: {
|
imageNode: {
|
||||||
default: null,
|
default: null,
|
||||||
type: cc.Node
|
type: cc.Node
|
||||||
}
|
},
|
||||||
|
imgs: []
|
||||||
},
|
},
|
||||||
|
|
||||||
// LIFE-CYCLE CALLBACKS:
|
// LIFE-CYCLE CALLBACKS:
|
||||||
|
|
||||||
onLoad () {
|
onLoad () {
|
||||||
for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 9; i++) {
|
||||||
var img = cc.instantiate(this.imagePrefab);
|
var img = cc.instantiate(this.imagePrefab);
|
||||||
img.getComponent('puzzleImage').imgIndex = i;
|
img.getComponent('puzzleImage').imgIndex = i;
|
||||||
img.getComponent('puzzleImage').type = 0;
|
img.getComponent('puzzleImage').type = 0;
|
||||||
@ -33,6 +34,8 @@ cc.Class({
|
|||||||
x = 202;
|
x = 202;
|
||||||
}
|
}
|
||||||
img.setPosition(cc.v2(x, y));
|
img.setPosition(cc.v2(x, y));
|
||||||
|
img.active = false;
|
||||||
|
this.imgs.push(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -41,4 +44,9 @@ cc.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// update (dt) {},
|
// update (dt) {},
|
||||||
|
updateValues(valArr) {
|
||||||
|
for(let i = 0; i < this.imgs.length; i++) {
|
||||||
|
this.imgs[i].active = !!valArr[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -83,6 +83,7 @@ cc.Class({
|
|||||||
let self = this;
|
let self = this;
|
||||||
this.scheduleOnce(function () {
|
this.scheduleOnce(function () {
|
||||||
processBar.getComponent('progressBar').updateShow(35000);
|
processBar.getComponent('progressBar').updateShow(35000);
|
||||||
|
puzzle.getComponent('puzzle').updateValues([0,1,0,1,0,1,1,0,1])
|
||||||
}, 5);
|
}, 5);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user