"use strict"; cc._RF.push(module, '188d2UWFZ9IAI1F4P7Vil6E', 'cmp.adventure.relive'); // Scripts/mod/pve/adventure/cmp/cmp.adventure.relive.js "use strict"; var BridgeWindow = require("bridge.window"); var ADVCT = require("adventure_controller"); cc.Class({ "extends": BridgeWindow, properties: { ico: { "default": null, type: cc.Node }, num: { "default": null, type: cc.Node } }, // LIFE-CYCLE CALLBACKS: onLoad: function onLoad() { this.ctrl = ADVCT.getInstance(); this.is_relive = false; //是否有復活幣 this.endless_relive_ids = [2077, 3053, 4077, 1062]; this.weekly_relive_ids = [20170, 30146, 40170, 50170]; }, start: function start() {}, //msg不需要定位,detail需要設置位置 onOpenConfigs: function onOpenConfigs(params) { this.model_type = this.ctrl.getPlayModel(); this.showRelive(); }, showRelive: function showRelive() { var idx = []; if (this.model_type == 1) { idx = this.endless_relive_ids; } else { idx = this.weekly_relive_ids; } for (var i = 0; i < idx.length; i++) { var id = idx[i]; var item = this.ctrl.getItemBybid(id); if (item) { if (item.num > 0) { var res_id = null; if (this.model_type == 1) { res_id = game.configs.adventure_endless_data.data_item_icon[item.bid]; } else { res_id = game.configs.adventure_weekly_data.data_adventure_event[item.bid].item_icon; } nx.gui.setSpriteFrame(this.ico, "", cc.js.formatStr("prefab/pve/starlost/icons/%s", res_id)); nx.gui.setString(this.num, "", item.num); this.relive_id = item.bid; this.is_relive = true; break; } } else { var _res_id = null; if (this.model_type == 1) { _res_id = game.configs.adventure_endless_data.data_item_icon[id]; } else { _res_id = game.configs.adventure_weekly_data.data_adventure_event[id].item_icon; } nx.gui.setSpriteFrame(this.ico, "", cc.js.formatStr("prefab/pve/starlost/icons/%s", _res_id)); nx.gui.setString(this.num, "", 0); } } }, onPreClosed: function onPreClosed() {}, clickRelive: function clickRelive() { if (this.is_relive) { if (!this.relive_id) return; this.ctrl.send29507(this.relive_id, this.model_type); this.close(); } else { nx.tbox("AdvenNoRelive"); } }, clickEnd: function clickEnd() { if (this.model_type == 1) { this.ctrl.send29512(); } this.close(); } }); cc._RF.pop();