提交完美的无头模式

This commit is contained in:
PC-20230316NUNE\Administrator
2023-11-22 17:46:08 +08:00
parent 7389f6d716
commit f890be0728
17 changed files with 975 additions and 175 deletions

View File

@@ -1,7 +1,6 @@
import { JNSyncFrameEvent } from "../../../extensions/ngame/assets/ngame/sync/frame/JNSyncFrame";
import { app } from "../App";
import { Env, EnvCurrent } from "../Env";
import GBattleModeManager, { BattleMode } from "../battle/GBattleModeManager";
import GBattleModeManager, { BattleMode, GBattleModeEvent } from "../battle/GBattleModeManager";
import { GAction } from "../consts/GAction";
import { GActionType } from "../consts/GActionType";
import { GUI } from "../ui/UIConfig";
@@ -12,6 +11,8 @@ export interface GPVPStart{
leftPets:{[key:number]:string}; //左边玩家的宠物
rightTactical:string; //右边玩家的阵法
rightPets:{[key:number]:string}; //左边玩家的宠物
leftPlayerId:number; //左边的玩家Id
rightPlayerId:number; //右边的玩家Id
}
@@ -22,6 +23,7 @@ export interface GPVPText{
export default class PVPAction extends BaseAction {
onInit(){
app.socket.on(GAction.C_MODE_PVP_START_WAIT,this.onModePVPStartWait,this);
app.socket.on(GAction.C_MODE_PVP_END_WAIT,this.onModePVPEndWait,this);
app.socket.on(GAction.C_MODE_PVP_START,this.onModePVPStart,this,GActionType.GPVPStart);
@@ -29,7 +31,9 @@ export default class PVPAction extends BaseAction {
if(EnvCurrent == Env.Server){
app.socket.on(GAction.CR_REFEREE_PVP_MODE,this.onCrReferee,this,GActionType.GPVPStart); //监听PVP裁决
app.event.on(GBattleModeEvent.Close,this.onBattleRefereeClose,this); //模式结束运行
}
}
//PVP开始等待
@@ -63,6 +67,16 @@ export default class PVPAction extends BaseAction {
app.layer.Open(GUI.Tips,{text:info.text})
}
//裁决结束返回
onBattleRefereeClose(type:BattleMode,data?:number){
if(type == BattleMode.PVP){
console.log("裁决结束胜利玩家",data)
app.socket.Send(GAction.CR_REFEREE_PVP_END,{
winnerId:data
},GActionType.GPVPRefereeInfo)
}
}
}