2025-04-24 17:03:28 +08:00

109 lines
2.5 KiB
JavaScript

import AudioUtil from "../ts/core/AudioUtil";
import GameModel from "../ts/core/GameModel";
import GameUtil from "../ts/core/GameUtil";
cc.Class({
extends: cc.Component,
properties: {
bangNode: cc.Node,
addNode: cc.Node,
createNode: cc.Node,
xiulianNode: cc.Node,
requestNode: cc.Node,
upgradeNode: cc.Node,
biddingNode: cc.Node,
},
onLoad() {
if (GameModel.player.bangid == 0) {
this.showAddlayer();
GameModel.send('c2s_getbanglist', {
roleid: GameModel.player.roleid
});
}
else {
this.showBangLayer();
GameModel.send('c2s_getbanginfo', {
roleid: GameModel.player.roleid,
bangid: GameModel.player.bangid
});
}
// 創建幫派 需要消費金額
this.createNode.getChildByName("ui_common_btn_ngt0").getChildByName("New Label").getComponent(cc.Label).string= GameUtil.childJade;
},
// 顯示我的幫派信息
showBangLayer() {
this.bangNode.active = true;
this.addNode.active = false;
this.createNode.active = false;
this.xiulianNode.active = false;
},
// 顯示創建幫派加入幫派
showAddlayer() {
if (GameModel.player.bangid != 0) {
this.showBangLayer();
return
}
this.bangNode.active = false;
this.addNode.active = true;
this.createNode.active = false;
this.xiulianNode.active = false;
},
createBtnClicked(e, d) {
this.createNode.active = true;
},
xiulianBtnClicked(e, d) {
this.xiulianNode.active = true;
this.xiulianNode.getComponent('BangXiulian').loadInfo();
},
upgradeBtnClicked(e, d) {
this.upgradeNode.active = true;
this.upgradeNode.getComponent('BangUpgrade').loadInfo();
},
showBangInfo(data) {
this.bangNode.getComponent('BangInfo').loadBangInfo(data);
// this.requestNode.getComponent('BangList').showRequestList(data.requestlist);
},
showBangList(data) {
this.addNode.getComponent('BangAdd').loadBangList(data);
},
showBidding() {
this.biddingNode.active = true;
this.biddingNode.getComponent('BiddingPanel').onReset();
},
hideBidding() {
this.biddingNode.active = false;
},
backToBang() {
this.node.destroy();
let gamelogic = this.node.parent.getComponent('GameLogic');
gamelogic.mapLogic.changeMap(3002);
},
onRequestBtnClicked(e, d) {
this.requestNode.active = true;
GameModel.send('c2s_getbangrequest', {
roleid: GameModel.player.roleid,
bangid: GameModel.player.bangid
});
},
onCloseBtnClicked(e, d) {
//zfy --關閉音效
AudioUtil.playAudio('ui/ui_guanbi');
this.bangNode.getComponent('BangInfo').clear();
this.node.destroy();
},
});