mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -16,6 +16,8 @@ export enum BattleMode{
|
||||
OnHook = 0,
|
||||
//PVP 模式
|
||||
PVP = 1,
|
||||
//阵营守护
|
||||
CampGuardian = 2,
|
||||
}
|
||||
|
||||
export interface GBattleModeInfo{
|
||||
@@ -77,6 +79,7 @@ export default class GBattleModeManager extends Singleton {
|
||||
this.modes = info.modes || [];
|
||||
this.camera = info.camera;
|
||||
this.root = info.root;
|
||||
this.camera.enabled = false;
|
||||
|
||||
//监听帧同步 世界创建逻辑
|
||||
app.event.on(JNSyncFrameEvent.CLEAR,this.clear,this);
|
||||
@@ -158,6 +161,8 @@ export default class GBattleModeManager extends Singleton {
|
||||
private clear(){
|
||||
if(!this.isInit) return;
|
||||
this.root.destroyAllChildren();
|
||||
//关闭相机
|
||||
this.camera.enabled = false;
|
||||
}
|
||||
|
||||
//创建当前模式
|
||||
@@ -165,6 +170,8 @@ export default class GBattleModeManager extends Singleton {
|
||||
|
||||
if(!this.isInit || this.current == null) return;
|
||||
let mode = instantiate(this.modes[this.current]);
|
||||
//关闭相机
|
||||
this.camera.enabled = false;
|
||||
mode.getComponent(GBaseMode).camera = this.camera;
|
||||
mode.getComponent(GBaseMode).data = this.data;
|
||||
this.root.addChild(mode)
|
||||
|
@@ -1,10 +1,53 @@
|
||||
import { Vec2 } from "cc";
|
||||
import GDefaultMode from "./default/GDefaultMode";
|
||||
import { TB } from "../../../resources/config/data/schema";
|
||||
import GRoleDefault from "../base/role/GRoleDefault";
|
||||
|
||||
//阵营守护
|
||||
//玩家派兵攻击对方阵营 游戏参考
|
||||
export default class GCampGuardianMode extends GDefaultMode<{},{}>{
|
||||
|
||||
//玩家水晶位置
|
||||
playerPos: Vec2 = new Vec2(-400,0);
|
||||
//敌方位置
|
||||
enemyPos: Vec2 = new Vec2(400,0);
|
||||
|
||||
|
||||
onSyncInitSuccess(){
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// //生成宠物
|
||||
// onGenRole(info:TB.TbGRole):GRoleDefault {
|
||||
|
||||
// // let tactical = this.getInfo(type).tactical;
|
||||
// // let pos:Vec2 = this.getInfo(type).tactical.getPosition(index);
|
||||
// // if(!pos) return;
|
||||
// // let role = instantiate(this.rolePrefab);
|
||||
|
||||
// // let entity = role.getComponent(GRoleDefault);
|
||||
// // //初始化
|
||||
// // entity.onInit(type,info,tactical,index);
|
||||
|
||||
// // //绑定寻敌
|
||||
// // entity.onQueryEunmy = () => {
|
||||
// // return this.getEnumy(entity,type);
|
||||
// // }
|
||||
|
||||
// // //绑定死亡回调
|
||||
// // entity.addKillBackEvent(this.onRoleKillBack.bind(this))
|
||||
// // //绑定受击回调
|
||||
// // entity.addHitCallback(this.onHitBack.bind(this));
|
||||
|
||||
// // this.addGObject(entity,tactical.getPosition(index));
|
||||
|
||||
// // this.getOnesRole(type).push(entity);
|
||||
|
||||
// // return entity;
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
@@ -115,6 +115,7 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
console.log("GOnHookMode 模式初始化");
|
||||
|
||||
//调整相机
|
||||
this.camera.enabled = true;
|
||||
let camreaPos = this.camera.node.worldPosition;
|
||||
this.camera.node.worldPosition = v3(0,800,camreaPos.z)
|
||||
|
||||
|
@@ -110,6 +110,7 @@ export default class GPVPMode extends GBaseMode<{},GPVPStart>{
|
||||
onSyncInitSuccess(): void {
|
||||
|
||||
//调整相机
|
||||
this.camera.enabled = true;
|
||||
let camreaPos = this.camera.node.worldPosition;
|
||||
this.camera.node.worldPosition = v3(0,800,camreaPos.z)
|
||||
|
||||
|
@@ -17,6 +17,7 @@ export class HomeView extends JNGLayerBase {
|
||||
frameText:Label;
|
||||
|
||||
async onLoad(){
|
||||
|
||||
}
|
||||
|
||||
update(){
|
||||
|
@@ -32,7 +32,7 @@ export class MainView extends JNGLayerBase {
|
||||
|
||||
//打开Demo页面
|
||||
onOpenDemo(){
|
||||
app.layer.Open(GUI.Home);
|
||||
app.layer.Open(GUI.CampGuardianView);
|
||||
}
|
||||
|
||||
//打开聊天页面
|
||||
@@ -42,7 +42,7 @@ export class MainView extends JNGLayerBase {
|
||||
|
||||
//点击打开无限模式
|
||||
onOpenOnHook(){
|
||||
GBattleModeManager.getIns().Open(BattleMode.OnHook,true);
|
||||
GBattleModeManager.getIns().Open(BattleMode.CampGuardian,true);
|
||||
}
|
||||
|
||||
//点击PVP模式
|
||||
|
9
JisolGameCocos/assets/script/ui/Mode/CampGuardian.meta
Normal file
9
JisolGameCocos/assets/script/ui/Mode/CampGuardian.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "3c57e80f-8355-46fc-9f1a-aea424211ea4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { JNGLayerBase } from '../../../components/JNComponent';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('CampGuardianView')
|
||||
export class CampGuardianView extends JNGLayerBase {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d82fe384-5188-41e0-be33-86e8344bf6c0",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -27,6 +27,7 @@ export enum GUI{
|
||||
|
||||
/**游戏模式页面 */
|
||||
PVPModeMatchView = "PVPModeMatchView", //PVP模式匹配页面
|
||||
CampGuardianView = "CampGuardianView", //阵营守护战斗页面
|
||||
|
||||
Home = "Home", //主页面
|
||||
Main = "Main", //主页面2
|
||||
@@ -131,6 +132,11 @@ const UIGModeConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
uri: "prefab/ui/模式/PVP/PVP匹配页面",
|
||||
anims:BackOutScale
|
||||
},
|
||||
[GUI.CampGuardianView]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/模式/CampGuardian/阵营守护战斗页面",
|
||||
anims:BackOutScale
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user