mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
修复PVP 切换地图重置数据
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { GOnHookPet } from "../../../../../extensions/ngame/assets/ngame/message/proto";
|
||||
import Singleton from "../../../../../extensions/ngame/assets/ngame/util/Singleton";
|
||||
import { app } from "../../../App";
|
||||
import GBattleModeManager, { BattleMode } from "../../../battle/GBattleModeManager";
|
||||
import { PlayerPetOV } from "../../../consts/API";
|
||||
import { GAPI } from "../../../consts/GAPI";
|
||||
import GOnHookData from "../../../data/GOnHookData";
|
||||
@@ -12,6 +13,8 @@ export enum GOnHookManagerEvent{
|
||||
ADD_KILL_SREEP = "GOnHookManagerEvent_ADD_KILL_SREEP",
|
||||
//删除死亡野怪
|
||||
DEL_KILL_SREEP = "GOnHookManagerEvent_DEL_KILL_SREEP",
|
||||
//重置数据
|
||||
RESET_DATA = "GOnHookManagerEvent_RESET_DATA",
|
||||
//删除死亡野怪
|
||||
UPDATE_MAP = "GOnHookManagerEvent_UPDATE_MAP"
|
||||
}
|
||||
@@ -26,7 +29,7 @@ export default class GOnHookManager extends Singleton{
|
||||
if(!this._sreeps || !(this._sreeps.size)){
|
||||
//生成
|
||||
this.onSpawnSreeps();
|
||||
return null;
|
||||
return new Map();
|
||||
}
|
||||
return this._sreeps;
|
||||
}
|
||||
@@ -119,6 +122,13 @@ export default class GOnHookManager extends Singleton{
|
||||
return await GAPI.GOnHookSellCreeps(creeps.key);
|
||||
}
|
||||
|
||||
//重置数据
|
||||
onResetData(){
|
||||
this._sreeps = new Map();
|
||||
this.killSreeps = [];
|
||||
app.event.emit(GOnHookManagerEvent.RESET_DATA);
|
||||
}
|
||||
|
||||
//切换场景
|
||||
async setMap(mapId:number){
|
||||
|
||||
@@ -126,6 +136,10 @@ export default class GOnHookManager extends Singleton{
|
||||
|
||||
//通知地图已切换
|
||||
app.event.emit(GOnHookManagerEvent.UPDATE_MAP);
|
||||
//重置数据
|
||||
this.onResetData();
|
||||
//重置场景
|
||||
GBattleModeManager.getIns().Open(BattleMode.OnHook,true);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user