import AudioUtil from "../ts/core/AudioUtil"; import GameModel from "../ts/core/GameModel"; import GameUtil from "../ts/core/GameUtil"; import ChangeNameAlert from "../ts/game/role/ChangeNameAlert"; import MsgAlert from "../ts/game/msg/MsgAlert" import zhenfa from "../ts/zhenFa/zhenfa" import myXinwu from "../ts/zhenFa/myXinwu" import tuJian from "../ts/zhenFa/activeZhenFa" import zhenFa from "../ts/zhenFa/zhenfa"; import equipList from "../ts/zhenFa/equip_list"; import active_panel from "../ts/zhenFa/active_panel"; let CPubFunction = require('../game/PubFunction'); cc.Class({ extends: cc.Component, properties: { shuxingNode: cc.Node, kangxingNode: cc.Node, jinengNode: cc.Node, bazhtu: cc.Node, info:null, index: 0, lv: 0, // xwItemList: cc.Node, }, onLoad() { this.loadRoleInfo(); this.name = 'RolePanel'; this.SetMoneyInfo(); this.info = null this.index = 0 this.lv = 0 this.bazhtu.getComponent('RoleZhenfa').init() this.node.on("OpenWxList",this.OpenWxList, this) this.node.on("OpenZhenFaPanel",this.onDownTuJian, this) GameModel.send('c2s_getZhenFaInfo', { roleid: GameModel.player.roleid, }) }, onPanelBtnClicked(e, d) { // if (d == 4) { // MsgAlert.addMsg("功能開發中") // return // } // this.xwItemList.active = false this.bazhtu.active = false this.shuxingNode.active = false; this.kangxingNode.active = false; this.jinengNode.active = false; if (d == 1) { this.shuxingNode.active = true; } else if (d == 2) { this.kangxingNode.active = true; } else if (d == 3) { this.jinengNode.active = true; } else if (d == 4) { this.bazhtu.active = true } //zfy --分頁音效 AudioUtil.playFenyeAudio(); }, loadRoleInfo() { this.resid = GameModel.player.resid; let self = this; CPubFunction.SetSpineAvatars(cc.find('back/role', this.node),null,this.resid);//加載spine骨骼動畫 cc.find('back/name', this.node).getComponent(cc.Label).string = GameModel.player.name; let level_lb = cc.find('back/level', this.node).getComponent(cc.Label); GameUtil.setReliveLabel(level_lb, 0, GameModel.player.relive, GameModel.player.level); cc.find('back/number', this.node).getComponent(cc.Label).string = '編號:' + GameModel.player.roleid; cc.find('back/race/' + GameModel.player.race, this.node).active = true; }, loadGameData() { this.shuxingNode.getComponent('RolePropertyPanel').loadGameData(); this.kangxingNode.getComponent('RoleDefendPanel').loadGameData(); this.jinengNode.getComponent('RoleSkillPanel').loadGameData(); }, SetMoneyInfo() { // cc.find('topNode/yinliang/ui_common_icon_yinliang/yinliangLabel', this.node).getComponent(cc.Label).string = GameModel.player.gameData.money; // cc.find('topNode/xianyu/ui_common_icon_xianyu/xianyuLabel', this.node).getComponent(cc.Label).string = GameModel.player.gameData.jade; let topnode = cc.find('topInfo', this.node); let toplogic = topnode.getComponent('TopInfo'); toplogic.updateGameMoney(); }, changNameBtnClicked(event, data) { ChangeNameAlert.shared.show(GameModel.player.roleid, 1, GameModel.player.name); }, resetRoleName(name) { GameModel.player.name = name; cc.find('back/name', this.node).getComponent(cc.Label).string = GameModel.player.name; }, onCloseBtnClicked(e, d) { //zfy --關閉音效 AudioUtil.playCloseAudio(); this.node.destroy(); }, //點擊我的信物 onDownMyXinWu(e, d) { AudioUtil.playCloseAudio(); this.unscheduleAllCallbacks(); myXinwu.Instance.setDelegte(this) myXinwu.Instance.openMyXinwu(); }, //點擊八陣圖 onDownBaZhenTu(e, d) { AudioUtil.playCloseAudio(); this.unscheduleAllCallbacks(); zhenfa.Instance.setDelegte(this) zhenfa.Instance.openZhenFa() }, //點擊圖鑑 onDownTuJian(e, d) { AudioUtil.playCloseAudio(); this.unscheduleAllCallbacks(); tuJian.Instance.setDelegte(this) tuJian.Instance.openTujian() }, //打開信物列表 OpenWxList(result) { // var valid = false // var pos = GameModel.game_conf.ZhenFa[this.index].valid_pos // for (let index = 0; index < pos.length; index++) { // if(result.index == pos[index]){ // valid = true // } // } // if(valid == false) return AudioUtil.playCloseAudio(); this.unscheduleAllCallbacks(); equipList.Instance.setDelegte(this) equipList.Instance.openItemList(result.index) }, //更新面板 updatePanel(info) { if (!info) { zhenFa.Instance.updateUI() zhenFa.Instance.clearInfo() } else { this.index = info.active_index this.lv = info.active_level this.info = info.info this.list = info.list this.bazhtu.getComponent('RoleZhenfa').updateUI(this.index,this.info) tuJian.Instance.updateUI() } }, });