|
@@ -242,6 +242,9 @@ cc.Class({
|
|
|
// 配置界面上的金币
|
|
|
this.configCoins();
|
|
|
|
|
|
+ // 配置界面上的道具
|
|
|
+ this.configProp();
|
|
|
+
|
|
|
},
|
|
|
|
|
|
onDestroy() {
|
|
@@ -379,19 +382,33 @@ cc.Class({
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- configProp(propData) {
|
|
|
+ configProp() {
|
|
|
+
|
|
|
+ let propNode = cc.instantiate(this.propPrefab)
|
|
|
+ this.propScript = propNode.getComponent('LevelHomePropItem')
|
|
|
+ this.propWrap.addChild(propNode);
|
|
|
+ this.propScript.node.position = cc.v2(150, -108);
|
|
|
+ this.propScript.node.active = false;
|
|
|
+ this.propScript.isPlay = false;
|
|
|
+ this.propScript.isPlaying = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ showProp(propData, isPlayAnimation=true) {
|
|
|
|
|
|
if (!this.isHasProp) {
|
|
|
- let propNode = cc.instantiate(this.propPrefab)
|
|
|
- this.propScript = propNode.getComponent('LevelHomePropItem')
|
|
|
this.isHasProp = true;
|
|
|
this.propScript.init(this.buildingInfo.buildingId, propData, () => {
|
|
|
this.propScript = null;
|
|
|
this.isHasProp = false;
|
|
|
});
|
|
|
- this.propWrap.addChild(propNode);
|
|
|
+ if (isPlayAnimation) {
|
|
|
+ this.propScript.showAnimation();
|
|
|
+ } else {
|
|
|
+ this.propScript.node.position = cc.v2(150, -28);
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.propScript.updateProp(propData)
|
|
|
+ this.propScript.updateProp(propData);
|
|
|
+ this.propScript.updateAnimation();
|
|
|
}
|
|
|
},
|
|
|
|