"use strict"; cc._RF.push(module, '0be97XKX21Gl7sDySb26n4S', 'cmp.acts.first.wnd'); // Scripts/mod/acts/firstcharge/cmp/cmp.acts.first.wnd.js "use strict"; /****************************************************************** * * 首充 * ******************************************************************/ var BridgeWindow = require("bridge.window"); var ActDefine = require("acts.define"); cc.Class({ "extends": BridgeWindow, properties: { nodWin: { "default": null, type: cc.Node } }, // 重载:参数打开 onOpenConfigs: function onOpenConfigs(_params) { var _this = this; // 无效参数 if (nx.dt.objEmpty(_params) || !nx.dt.numPositive(_params.theme_id, false)) { this.delayClose(); return; } this.configs = _params; // 列表构建 this.menus = _params.theme_holiday_list || []; this.menus.sort(function (a, b) { return a.sort - b.sort; }); // 默认页 var def = 0; if (nx.dt.numGood(_params.focus)) { for (var i = 0; i < this.menus.length; ++i) { var t = this.menus[i]; if (t && t.camp_id == _params.focus) { def = i; break; } } } // 延迟跳转 this.scheduleOnce(function () { _this.onSelectMenu({ mdata: _this.menus[def] }); }, 0.1); }, // 关闭 onDisable: function onDisable() {}, // 菜单切换 onSelectMenu: function onSelectMenu(_item) { var _this2 = this; if (!_item.mdata) { return; } // 加载 var mod = ActDefine.ActsMods[_item.mdata.source]; if (!mod) { nx.error("$Acts:无效活动页:", _item.mdata.source); return; } var path = cc.path.join("prefab/acts", mod.prefab); nx.res.loadPrefab(path, function (_err, _data) { if (_err) { return; } var node = cc.instantiate(_data); var cmp = node.getComponent("act.page.base"); if (cmp) { cmp.build(_item.mdata); } node.parent = _this2.nodWin; }); } }); cc._RF.pop();