增加游戏开始/结束接口

This commit is contained in:
yuexin 2020-12-24 16:45:31 +08:00
parent e13f2730d5
commit 7fc5a76f18
3 changed files with 14 additions and 4 deletions

View File

@ -560,7 +560,12 @@ export class BattleHandler {
* *
*/ */
public onGameEnd(){ public onGameEnd(){
this._players.forEach((item: PlayerHandler) => {
item.clear(true);
});
this._players.clear();
this._playerids.clear();
this._gamestart = false;
}; };
// end-------------------------------------------------- // end--------------------------------------------------

View File

@ -379,12 +379,14 @@ export class PetHandler {
return this._rebornskill != null && !this._isSilent && !this._hasreborned; return this._rebornskill != null && !this._isSilent && !this._hasreborned;
}; };
public clear(){ public clear(resetAll: boolean = false){
if(this._halos.length > 0){ if(this._halos.length > 0){
this._halos.length = 0; this._halos.length = 0;
this.clearEffHalos(); this.clearEffHalos();
if(!resetAll){
this._owner.onHaloRemove(this); this._owner.onHaloRemove(this);
} }
}
this._waitskills.length = 0; this._waitskills.length = 0;
}; };

View File

@ -45,8 +45,11 @@ export class PlayerHandler {
this._unitcfg = this._playercfg && CfgMan.findUnitCfg(this._playercfg.herounit_id); this._unitcfg = this._playercfg && CfgMan.findUnitCfg(this._playercfg.herounit_id);
}; };
public clear(){ public clear(bresetAll: boolean = false){
this._self = null; this._self = null;
this._pets.forEach((item: PetHandler)=>{
item.clear(bresetAll);
});
this._pets.length = 0; this._pets.length = 0;
}; };