mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
简单PVP
This commit is contained in:
8
JisolGameCocos/assets/script/action/BaseAction.ts
Normal file
8
JisolGameCocos/assets/script/action/BaseAction.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import Singleton from "../../../extensions/ngame/assets/ngame/util/Singleton";
|
||||
|
||||
export default abstract class BaseAction extends Singleton {
|
||||
|
||||
//初始化
|
||||
abstract onInit();
|
||||
|
||||
}
|
9
JisolGameCocos/assets/script/action/BaseAction.ts.meta
Normal file
9
JisolGameCocos/assets/script/action/BaseAction.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "60baf66e-7156-4234-847b-ea520c1e0cc1",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
41
JisolGameCocos/assets/script/action/PVPAction.ts
Normal file
41
JisolGameCocos/assets/script/action/PVPAction.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { app } from "../App";
|
||||
import GBattleModeManager, { BattleMode } from "../battle/GBattleModeManager";
|
||||
import { GAction } from "../consts/GAction";
|
||||
import { GActionType } from "../consts/GActionType";
|
||||
import { GUI } from "../ui/UIConfig";
|
||||
import BaseAction from "./BaseAction";
|
||||
|
||||
export interface GPVPStart{
|
||||
leftTactical:string;
|
||||
rightTactical:string;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//PVP开始等待
|
||||
onModePVPStartWait(){
|
||||
//PVP 匹配页面
|
||||
app.layer.Open(GUI.PVPModeMatchView);
|
||||
}
|
||||
|
||||
//PVP结束等待
|
||||
onModePVPEndWait(){
|
||||
//PVP 匹配页面
|
||||
app.layer.Close(GUI.PVPModeMatchView);
|
||||
}
|
||||
|
||||
//开始PVP
|
||||
onModePVPStart(info:GPVPStart){
|
||||
console.log("开始PVP",info);
|
||||
GBattleModeManager.getIns().Open(BattleMode.PVP,true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
9
JisolGameCocos/assets/script/action/PVPAction.ts.meta
Normal file
9
JisolGameCocos/assets/script/action/PVPAction.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "20d83911-fbc5-40d3-b970-b48ab4a529bf",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user