mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交完美的无头模式
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user