"use strict"; cc._RF.push(module, '62d9ftnCIhPZ5bNehPQo4al', 'cmp.wing.scientfic.reward'); // Scripts/mod/partner/wings/cmp/cmp.wing.scientfic.reward.js "use strict"; /****************************************************************** * * 奖励弹窗 * ******************************************************************/ var BridgeWindow = require("bridge.window"); var BackPackConst = require("backpack_const"); var FxSpine = require("nx.fx.spine"); cc.Class({ "extends": BridgeWindow, properties: { spAnim: { "default": null, type: FxSpine }, nodRewards: { "default": null, type: cc.Node }, nodTouch: { "default": null, type: cc.Node } }, // 重载:参数打开 onOpenConfigs: function onOpenConfigs(_params) { this.params = _params ? _params.list : null; /**** * awards":[{"item_bid":10040,"item_num":3},{"item_bid":111001,"item_num":1}]} */ // 判空 if (nx.dt.arrEmpty(this.params)) { this.close(); nx.error("[REWARD]无效的道具表!"); return; } this.items = []; this.sprites = []; for (var i = 0; i < this.params.length; i++) { var item = this.params[i]; var cfg = game.configs.sprite_data.data_elfin_data[item.item_bid]; if (!cfg) { this.items.push(item); } else { this.sprites.push(item); } } for (var j = 0; j < this.sprites.length; j++) { var sp = this.sprites[j]; var sfg = gdata("sprite_data", "data_elfin_data", sp.item_bid); var ifg = gdata("item_data", "data_unit9", sp.item_bid); if (ifg) { nx.bridge.setIcon(this.nodRewards, "wing", ifg.imageid); if (sfg) { var skill = gdata("skill_data4", "data_get_skill", sfg.skill); nx.gui.getComponent(this.nodRewards, "skill", "cmp.skill.base").setData(sfg.skill); } nx.gui.setString(this.nodRewards, "name", ifg.name); nx.gui.setString(this.nodRewards, "type", ifg.use_desc); // console.log( JSON.stringify( ifg ) + "当前的奖励" + JSON.stringify( this.items[0] ) ); // self.scheduleOnce( () => { // nx.gui.setActive( self.nodSpecial, "", true ); // }, 0.2 ); } } nx.gui.setActive(this.nodRewards, "items", nx.dt.arrNEmpty(this.items)); nx.gui.gocChildren(this.nodRewards, "items/items", this.items.length); var chd = nx.gui.find(this.nodRewards, "items/items").children; for (var l = 0; l < chd.length; l++) { var p = chd[l]; var cmp = p.getComponent("cmp.item.base"); if (this.items[l]) { if (cmp) { cmp.setData(this.items[l].item_bid); } nx.gui.setString(p, "count", this.items[l].item_num); } } nx.gui.setActive(this.nodRewards, "", false); // 动画流程 this.doAnimation(); }, showRewards: function showRewards() { nx.gui.setActive(this.nodSpecial, "", false); }, // 动画流程 doAnimation: function doAnimation() { var _this = this; this.spAnim.action("action", false, function (_key, _name) { if (_key == "reward") { _this.nodRewards.active = true; return; } // 第二阶段 if (_key == "complete") { _this.spAnim.action("action2", true); return; } }); } }); cc._RF.pop();