|
@@ -242,6 +242,9 @@ cc.Class({
|
|
|
// 配置界面上的金币
|
|
|
this.configCoins();
|
|
|
|
|
|
+ // 配置界面上的道具
|
|
|
+ this.configProp();
|
|
|
+
|
|
|
},
|
|
|
|
|
|
onDestroy() {
|
|
@@ -379,11 +382,21 @@ 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;
|
|
|
+ this.propWrap.addChild(propNode);
|
|
|
+ },
|
|
|
+
|
|
|
+ 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, (showFrame, showText) => {
|
|
|
this.propScript = null;
|
|
@@ -391,9 +404,15 @@ cc.Class({
|
|
|
// 显示领取动画
|
|
|
this.parent.showActGift(showFrame, showText)
|
|
|
});
|
|
|
- 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();
|
|
|
}
|
|
|
},
|
|
|
|