SamsaraGame/assets/Script/panel/ShenBingCombinePanel.js

58 lines
1.1 KiB
JavaScript
Raw Normal View History

2025-04-24 17:03:28 +08:00
import GameModel from "../ts/core/GameModel";
import MsgAlert from "../ts/game/msg/MsgAlert";
cc.Class({
extends: cc.Component,
properties: {
cntLab: cc.Label,
ItemNode: cc.Node,
EquipNode: cc.Node,
},
onLoad() {
this.node.name = 'ShenBingCombinePanel';
this.showInfo();
},
finishedCombine(info) {
if (info) {
this.EquipNode.getComponent('EquipItem').loadInfo(info);
}
},
showInfo() {
this.ItemNode.getComponent('BagItem').loadInfo({ itemid: 10408, count: 1 });
let curcnt = GameModel.player.itemList[10408] == null ? 0 : GameModel.player.itemList[10408];
if (curcnt >= 50) {
this.cntLab.node.color = cc.Color.GREEN;
}
else {
this.cntLab.node.color = cc.Color.RED;
}
this.cntLab.string = curcnt;
},
onCombineBtnClicked(e, d) {
let curcnt = GameModel.player.itemList[10408] == null ? 0 : GameModel.player.itemList[10408];
if (curcnt < 50) {
MsgAlert.addMsg("神兵碎片不足");
return;
}
let params = {
type: 2,
roleid: GameModel.player.roleid,
index: 0,
is: 1
};
GameModel.send('c2s_creat_equip', params);
},
onCloseBtnClicked(e, d) {
this.node.destroy();
}
});