mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
修复bug
This commit is contained in:
@@ -63,9 +63,6 @@ export default class GBattleModeManager extends Singleton {
|
||||
//默认模式
|
||||
default:BattleMode = BattleMode.OnHook; //默认无限模式
|
||||
|
||||
//当前帧不切换模式
|
||||
frameNoSwitch:boolean = false;
|
||||
|
||||
//模式数据
|
||||
data:any;
|
||||
|
||||
@@ -97,10 +94,6 @@ export default class GBattleModeManager extends Singleton {
|
||||
// res 资源加载列表 (因为是帧同步所以打开模式前必须提前加载可能使用的资源)
|
||||
async Open(mode:BattleMode = null,isAuto:boolean = false,data:any = this.data){
|
||||
|
||||
this.Close();
|
||||
|
||||
this.data = data;
|
||||
|
||||
if(!this.current && mode == null){
|
||||
//裁决员不允许默认模式
|
||||
if(EnvCurrent == Env.Server) return;
|
||||
@@ -109,7 +102,11 @@ export default class GBattleModeManager extends Singleton {
|
||||
}else if(mode == null){
|
||||
return;
|
||||
}
|
||||
|
||||
this.current = mode;
|
||||
this.Close();
|
||||
this.current = mode;
|
||||
this.data = data;
|
||||
this.setAuto(isAuto);
|
||||
|
||||
//加载资源
|
||||
@@ -120,18 +117,16 @@ export default class GBattleModeManager extends Singleton {
|
||||
await BattleResource.loadResource(mode,data);
|
||||
console.log("[GBattleModeManager] 加载结束",loadingIndex,this.loadingIndex);
|
||||
if(this.loadingIndex == loadingIndex){
|
||||
//资源加载完成则显示世界
|
||||
app.sync.onReset();
|
||||
this.isLoadingResource = false;
|
||||
app.event.emit(GBattleModeEvent.EndLoadingResource);
|
||||
app.sync.onStart();
|
||||
}else{
|
||||
//如果加载中途切换了模式则直接返回
|
||||
return;
|
||||
}
|
||||
|
||||
//资源加载完成则显示世界
|
||||
app.sync.onReset();
|
||||
game.step();
|
||||
app.sync.onStart();
|
||||
|
||||
}
|
||||
|
||||
//重置当前模式
|
||||
@@ -147,7 +142,6 @@ export default class GBattleModeManager extends Singleton {
|
||||
app.sync.onReset();
|
||||
let current = this.current;
|
||||
this.current = null;
|
||||
this.frameNoSwitch = true;
|
||||
|
||||
//结束通知
|
||||
app.event.emit(GBattleModeEvent.Close,current,data);
|
||||
@@ -195,10 +189,9 @@ export default class GBattleModeManager extends Singleton {
|
||||
this.onAutoFrame(dt);
|
||||
|
||||
//如果当前模式是空则默认模式
|
||||
if(this.current == null && !this.frameNoSwitch){
|
||||
if(this.current == null){
|
||||
this.Open();
|
||||
}
|
||||
this.frameNoSwitch = false;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user