mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
简单PVP
This commit is contained in:
@@ -147,7 +147,7 @@
|
||||
},
|
||||
"_depth": 1,
|
||||
"_stencil": 0,
|
||||
"_clearFlags": 7,
|
||||
"_clearFlags": 6,
|
||||
"_rect": {
|
||||
"__type__": "cc.Rect",
|
||||
"x": 0,
|
||||
|
@@ -81,7 +81,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 720,
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@@ -4387,8 +4387,8 @@
|
||||
},
|
||||
"_alignFlags": 45,
|
||||
"_target": null,
|
||||
"_left": 720,
|
||||
"_right": -720,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
|
File diff suppressed because it is too large
Load Diff
9
JisolGameCocos/assets/resources/prefab/ui/模式.meta
Normal file
9
JisolGameCocos/assets/resources/prefab/ui/模式.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "80f8f41e-26fe-455a-873a-da26dfd9a169",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
9
JisolGameCocos/assets/resources/prefab/ui/模式/PVP.meta
Normal file
9
JisolGameCocos/assets/resources/prefab/ui/模式/PVP.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "394ad8cd-f975-4785-a104-d76c781c17b8",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
1034
JisolGameCocos/assets/resources/prefab/ui/模式/PVP/PVP匹配页面.prefab
Normal file
1034
JisolGameCocos/assets/resources/prefab/ui/模式/PVP/PVP匹配页面.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.49",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "d1bca093-45af-4ae2-a896-11ed7c6f9bda",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "PVP匹配页面"
|
||||
}
|
||||
}
|
@@ -2091,10 +2091,6 @@
|
||||
"views": {
|
||||
"__id__": 37
|
||||
},
|
||||
"petIconPrefab": {
|
||||
"__uuid__": "fc8eb7b6-f756-49f4-9102-ac3cca3a20ae",
|
||||
"__expectedType__": "cc.Prefab"
|
||||
},
|
||||
"spine": {
|
||||
"__id__": 8
|
||||
},
|
||||
|
@@ -24,11 +24,12 @@ import { GAction } from "./consts/GAction";
|
||||
import { StorageData, StorageEnum } from "./consts/GData";
|
||||
import { JAPI, JAPIConfig } from "../../extensions/ngame/assets/ngame/util/JAPI";
|
||||
import { AppData } from "./AppData";
|
||||
import AppAction from "./AppAction";
|
||||
|
||||
let APIPath = `http://localhost:8080`
|
||||
let WsPath = `ws://localhost:8080/websocket`
|
||||
// let APIPath = `http://192.168.0.123:8080`
|
||||
// let WsPath = `ws://192.168.0.123:8080/websocket`
|
||||
// let APIPath = `http://localhost:8080`
|
||||
// let WsPath = `ws://localhost:8080/websocket`
|
||||
let APIPath = `http://192.168.0.123:8080`
|
||||
let WsPath = `ws://192.168.0.123:8080/websocket`
|
||||
// let APIPath = `https://api.pet.jisol.cn`
|
||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||
|
||||
@@ -218,12 +219,13 @@ export const app = {
|
||||
config : new JNGConfig(), //配置文件
|
||||
battleRes : new JLoaderBattle("battle"), //battle包
|
||||
data : new AppData(), //游戏基础信息
|
||||
loading: new Loading({
|
||||
action : new AppAction(), //游戏行为
|
||||
loading : new Loading({
|
||||
[JNGConfig.loading]:{title:"加载配置文件"},
|
||||
[JLoaderBattle.loading]:{title:"加载战斗资源"},
|
||||
[JLoaderBattle.loadingInit]:{title:"初始化战斗资源"},
|
||||
[AppData.loading]:{title:"初始化信息"},
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
app.api.addRequestInterceptors((config:JAPIConfig) => {
|
||||
|
23
JisolGameCocos/assets/script/AppAction.ts
Normal file
23
JisolGameCocos/assets/script/AppAction.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import SystemBase from "../../extensions/ngame/assets/ngame/system/SystemBase";
|
||||
import BaseAction from "./action/BaseAction";
|
||||
import PVPAction from "./action/PVPAction";
|
||||
|
||||
export default class AppAction extends SystemBase{
|
||||
|
||||
loadings:BaseAction[] = [
|
||||
PVPAction.getIns(), //PVP Action
|
||||
];
|
||||
|
||||
async onInit(): Promise<any> {
|
||||
|
||||
//初始化所有数据类
|
||||
for (let index = 0; index < this.loadings.length; index++) {
|
||||
const data = this.loadings[index];
|
||||
await data.onInit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
9
JisolGameCocos/assets/script/AppAction.ts.meta
Normal file
9
JisolGameCocos/assets/script/AppAction.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b112702e-09c0-40a6-8887-ea797195488e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
9
JisolGameCocos/assets/script/action.meta
Normal file
9
JisolGameCocos/assets/script/action.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "df61d197-2845-4513-88af-2c4ae6cdc33f",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
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": {}
|
||||
}
|
@@ -64,7 +64,7 @@ export default class GPVPMode extends GBaseMode<{}>{
|
||||
|
||||
//调整相机
|
||||
let camreaPos = this.camera.node.worldPosition;
|
||||
this.camera.node.worldPosition = v3(0,100,camreaPos.z)
|
||||
this.camera.node.worldPosition = v3(0,800,camreaPos.z)
|
||||
|
||||
//初始化战斗
|
||||
console.log("GPVPMode 模式初始化");
|
||||
|
@@ -11,6 +11,6 @@ export const GAPI = {
|
||||
//捕捉野怪
|
||||
GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`)) as PlayerPetOV,
|
||||
//出售野怪
|
||||
GOnHookSellCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onSellCreeps/${creepId}`)),
|
||||
GOnHookSellCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onSellCreeps/${creepId}`)) as boolean,
|
||||
|
||||
}
|
@@ -6,7 +6,14 @@ export enum GAction {
|
||||
CHAT_MESSAGE = 2001, //发送聊天消息
|
||||
CHAT_RECEIVE_MESSAGE = 2002, //接受聊天消息
|
||||
|
||||
|
||||
/*************** 游戏模式 : 无尽模式(OnHook) **************/
|
||||
/*************** 游戏模式 : PVP模式 **************/
|
||||
S_MODE_PVP_JOIN = 3001, //加入PVP
|
||||
S_MODE_PVP_LEAVE = 3002, //离开PVP
|
||||
C_MODE_PVP_WAIT = 3003, //等待PVP开始
|
||||
C_MODE_PVP_START = 3004, //PVP开始
|
||||
C_MODE_PVP_END = 3005, //PVP结束
|
||||
C_MODE_PVP_START_WAIT = 3006, //开始等待PVP开始
|
||||
C_MODE_PVP_END_WAIT = 3007, //结束等待PVP开始
|
||||
|
||||
}
|
@@ -8,7 +8,10 @@ export enum GActionType {
|
||||
|
||||
|
||||
/*************** 游戏模式 : 无尽模式(OnHook) **************/
|
||||
GOnHookPet = "GOnHookPet", //野怪
|
||||
GOnHookPets = "GOnHookPets", //野怪列表
|
||||
GOnHookPet = "GOnHookPet", //野怪
|
||||
GOnHookPets = "GOnHookPets", //野怪列表
|
||||
|
||||
/*************** 游戏模式 : PVP **************/
|
||||
GPVPStart = "GPVPStart", //PVP 开始
|
||||
|
||||
}
|
@@ -5,6 +5,7 @@ import PlayerData from '../../data/PlayerData';
|
||||
import GBattleModeManager, { BattleMode } from '../../battle/GBattleModeManager';
|
||||
import { JNGLayerBase } from '../../components/JNComponent';
|
||||
import { app } from '../../App';
|
||||
import { GAction } from '../../consts/GAction';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainView')
|
||||
@@ -47,6 +48,11 @@ export class MainView extends JNGLayerBase {
|
||||
GBattleModeManager.getIns().Open(BattleMode.OnHook,true);
|
||||
}
|
||||
|
||||
//点击PVP模式
|
||||
onOpenPVP(){
|
||||
app.socket.Send(GAction.S_MODE_PVP_JOIN);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
9
JisolGameCocos/assets/script/ui/Mode.meta
Normal file
9
JisolGameCocos/assets/script/ui/Mode.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "7767a760-8e96-4bf8-8289-030e5a8c91c5",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
9
JisolGameCocos/assets/script/ui/Mode/PVP.meta
Normal file
9
JisolGameCocos/assets/script/ui/Mode/PVP.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "37638c81-4459-4c8d-8054-e5789bce2590",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
37
JisolGameCocos/assets/script/ui/Mode/PVP/PVPMatchView.ts
Normal file
37
JisolGameCocos/assets/script/ui/Mode/PVP/PVPMatchView.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { JNGLayerBase } from '../../../components/JNComponent';
|
||||
import { tween } from 'cc';
|
||||
import { v3 } from 'cc';
|
||||
import { app } from '../../../App';
|
||||
import { GAction } from '../../../consts/GAction';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* 游戏匹配页面
|
||||
*/
|
||||
@ccclass('PVPMatchView')
|
||||
export class PVPMatchView extends JNGLayerBase {
|
||||
|
||||
@property(Node)
|
||||
content:Node;
|
||||
|
||||
onJNLoad(data?: any): void {
|
||||
super.onJNLoad(data);
|
||||
tween(this.content)
|
||||
.repeatForever(
|
||||
tween()
|
||||
.to(.5,{scale:v3(.8,.8,.8)})
|
||||
.to(.5,{scale:v3(1,1,1)})
|
||||
)
|
||||
.start();
|
||||
|
||||
}
|
||||
|
||||
//取消匹配
|
||||
onClickCancel(){
|
||||
app.socket.Send(GAction.S_MODE_PVP_LEAVE)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "9979d56d-f754-44c3-8e29-c764eaeb0aaf",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -23,6 +23,9 @@ export enum GUI{
|
||||
|
||||
IntoBattleView = "IntoBattleView", //上阵页面
|
||||
|
||||
/**游戏模式页面 */
|
||||
PVPModeMatchView = "PVPModeMatchView", //PVP模式匹配页面
|
||||
|
||||
Home = "Home", //主页面
|
||||
Main = "Main", //主页面2
|
||||
}
|
||||
@@ -97,6 +100,17 @@ const UINoviceConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
|
||||
}
|
||||
|
||||
//游戏模式页面
|
||||
const UIGModeConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
|
||||
[GUI.PVPModeMatchView]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/模式/PVP/PVP匹配页面",
|
||||
anims:BackOutScale
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
export const UIConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
[GUI.Home]:{
|
||||
layer:GLayer.View,
|
||||
@@ -121,5 +135,6 @@ export const UIConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
...UISystemConfig, //系统页面
|
||||
...UINoviceConfig, //新手引导页面
|
||||
...UIMainConfig, //主页面
|
||||
...UIGModeConfig, //游戏模式页面
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user