"use strict"; cc._RF.push(module, '8fb1acB8wlHYprn83UZ7HGk', 'cmp.adventure.msg'); // Scripts/mod/pve/adventure/cmp/cmp.adventure.msg.js "use strict"; var BridgeWindow = require("bridge.window"); var ADVCT = require("adventure_controller"); var ADEVT = require("adventure_event"); cc.Class({ "extends": BridgeWindow, properties: { msgNd: { "default": null, type: cc.Node }, detailNd: { "default": null, type: cc.Node }, useLb: { "default": null, type: cc.Node } }, // LIFE-CYCLE CALLBACKS: onLoad: function onLoad() { this.ctrl = ADVCT.getInstance(); }, start: function start() {}, //msg不需要定位,detail需要設置位置 onOpenConfigs: function onOpenConfigs(params) { this.type = params.type; this.model_type = this.ctrl.getPlayModel(); this.data = params.data; this.setUIWind(); }, onPreClosed: function onPreClosed() {}, setUIWind: function setUIWind() { if (this.type == 1) { this.msgNd.active = true; } else if (this.type == 2) { this.detailNd.active = true; nx.gui.setActive(this.detailNd, "buff", true); } else if (this.type == 3) { this.detailNd.active = true; nx.gui.setActive(this.detailNd, "good", true); } this.setInfomation(); }, setInfomation: function setInfomation() { var cfg = null; if (this.type == 1) { var evt_info = null; var buff_data = null; if (this.model_type == 1) { cfg = game.configs.adventure_endless_data.data_buff_icon[this.data.evt_id]; evt_info = game.configs.adventure_endless_data.data_evt_desc[this.data.evt_id]; buff_data = game.configs.adventure_endless_data.data_buff[this.data.evt_id]; } else { cfg = game.configs.adventure_weekly_data.data_buff_icon[this.data.evt_id]; evt_info = game.configs.adventure_weekly_data.data_adventure_event[this.data.evt_id]; buff_data = evt_info; } if (cfg) { var res_path = cc.js.formatStr("prefab/pve/starlost/icons/%s", cfg.icon[0]); nx.gui.setSpriteFrame(this.msgNd, "ico", res_path); } if (!evt_info) return; nx.gui.setString(this.msgNd, "desc", evt_info.desc); if (!buff_data) return; gcore.GlobalEvent.fire(ADEVT.Update_Role_Good_Status, buff_data.effect); } else if (this.type == 2) { cfg = this.data; nx.gui.setString(this.detailNd, "buff/desc", cfg.desc); } else if (this.type == 3) { nx.gui.setString(this.useLb, "", nx.text.getKey("Use")); if (this.data.can_use == 0) { nx.gui.setString(this.useLb, "", nx.text.getKey("close")); } if (this.model_type == 1) { cfg = game.configs.adventure_endless_data.data_evt_desc[this.data.bid]; var res_path2 = cc.js.formatStr("prefab/pve/starlost/icons/%s", game.configs.adventure_endless_data.data_item_icon[this.data.bid]); nx.gui.setSpriteFrame(this.detailNd, "good/item/ico", res_path2); } else { cfg = game.configs.adventure_weekly_data.data_adventure_event[this.data.bid]; var res_path3 = cc.js.formatStr("prefab/pve/starlost/icons/%s", cfg.item_icon); nx.gui.setSpriteFrame(this.detailNd, "good/item/ico", res_path3); } nx.gui.setString(this.detailNd, "good/desc", cfg.desc); } }, // update (dt) {}, useProp: function useProp() { if (this.ctrl.getDeadStatus()) { return nx.tbox("AdvenDead"); //已死亡 } if (this.data.can_use == 1) { this.ctrl.send29507(this.data.bid, this.model_type, function () { gcore.GlobalEvent.fire(ADEVT.Update_Role_Good_Status, "E66001"); }); } this.close(); } }); cc._RF.pop();