92 lines
1.9 KiB
JavaScript
92 lines
1.9 KiB
JavaScript
/******************************************************************
|
|
* Copyright(C) 2019 - 2020 Nx Studio
|
|
*
|
|
* 首次进入引导场景
|
|
*
|
|
*
|
|
******************************************************************/
|
|
|
|
const BridgeWindow = require( "bridge.window" );
|
|
const PlotDefine = require( "plot.define" );
|
|
|
|
cc.Class( {
|
|
|
|
extends: BridgeWindow,
|
|
|
|
properties: {
|
|
},
|
|
|
|
// 显示
|
|
onEnable: function() {
|
|
|
|
// 视图监听
|
|
nx.bridge.plot.vbind( this, [
|
|
[ "id", this.onPlotChanged.bind( this ) ],
|
|
] );
|
|
|
|
// 强制引导
|
|
let id = nx.bridge.plot.configs.base.start;
|
|
nx.bridge.plot.fireForce( id, () => {
|
|
this.onPlotDone();
|
|
} );
|
|
|
|
},
|
|
|
|
// 关闭
|
|
onDisable: function() {
|
|
|
|
// 视图解绑
|
|
nx.bridge.plot.vunbind( this );
|
|
},
|
|
|
|
// 预加载主场景
|
|
preload: function() {
|
|
|
|
let queue = [
|
|
cc.path.join( "prefab/mainui", "scene_main" ),
|
|
];
|
|
|
|
let next = function() {
|
|
|
|
if( queue.length == 0 ) {
|
|
return;
|
|
}
|
|
|
|
nx.res.loadPrefab( queue.shift(), () => {
|
|
next();
|
|
} );
|
|
};
|
|
next();
|
|
|
|
},
|
|
|
|
// 剧情改变
|
|
onPlotChanged: function( _id ) {
|
|
|
|
let info = nx.bridge.plot.configs[ _id ];
|
|
if( info ) {
|
|
nx.bridge.createPanel( "WndPlotDialogue" );
|
|
}
|
|
},
|
|
|
|
// 引导结束
|
|
onPlotDone: function() {
|
|
|
|
// 首位秘书获取
|
|
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();
|
|
// } );
|
|
|
|
},
|
|
|
|
} );
|