74 lines
1.9 KiB
JavaScript
74 lines
1.9 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '4fa7bqsTt9LUJ7indu/gRjj', 'cmp.first.enter.wnd');
|
|
// Scripts/mod/mainui/cmp/cmp.first.enter.wnd.js
|
|
|
|
"use strict";
|
|
|
|
/******************************************************************
|
|
* Copyright(C) 2019 - 2020 Nx Studio
|
|
*
|
|
* 首次进入引导场景
|
|
*
|
|
*
|
|
******************************************************************/
|
|
|
|
var BridgeWindow = require("bridge.window");
|
|
var PlotDefine = require("plot.define");
|
|
cc.Class({
|
|
"extends": BridgeWindow,
|
|
properties: {},
|
|
// 显示
|
|
onEnable: function onEnable() {
|
|
var _this = this;
|
|
// 视图监听
|
|
nx.bridge.plot.vbind(this, [["id", this.onPlotChanged.bind(this)]]);
|
|
|
|
// 强制引导
|
|
var id = nx.bridge.plot.configs.base.start;
|
|
nx.bridge.plot.fireForce(id, function () {
|
|
_this.onPlotDone();
|
|
});
|
|
},
|
|
// 关闭
|
|
onDisable: function onDisable() {
|
|
// 视图解绑
|
|
nx.bridge.plot.vunbind(this);
|
|
},
|
|
// 预加载主场景
|
|
preload: function preload() {
|
|
var queue = [cc.path.join("prefab/mainui", "scene_main")];
|
|
var next = function next() {
|
|
if (queue.length == 0) {
|
|
return;
|
|
}
|
|
nx.res.loadPrefab(queue.shift(), function () {
|
|
next();
|
|
});
|
|
};
|
|
next();
|
|
},
|
|
// 剧情改变
|
|
onPlotChanged: function onPlotChanged(_id) {
|
|
var info = nx.bridge.plot.configs[_id];
|
|
if (info) {
|
|
nx.bridge.createPanel("WndPlotDialogue");
|
|
}
|
|
},
|
|
// 引导结束
|
|
onPlotDone: function onPlotDone() {
|
|
// 首位秘书获取
|
|
if (nx.bridge.clerks) {
|
|
nx.bridge.clerks.reqFetch();
|
|
}
|
|
nx.bridge.plot.openPlot(true);
|
|
nx.bridge.game.enterGame();
|
|
// 引导开关询问
|
|
// nx.mbox( "PlotOpenAsk", ['PlotOpenNo','PlotOpenYes'], ( _key, _box ) => {
|
|
// _box.close();
|
|
// nx.bridge.plot.openPlot( _key == "PlotOpenYes" );
|
|
// nx.bridge.game.enterGame();
|
|
// } );
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |