This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-12-25 02:06:56 +08:00
parent 516d520c5e
commit 5366e3413c
18 changed files with 1054 additions and 441 deletions

View File

@@ -32,10 +32,10 @@ import { Component } from "cc";
// let WsPath = `ws://localhost:8080/websocket`
// let APIPath = `http://192.168.1.23:8080`
// let WsPath = `ws://192.168.1.23:8080/websocket`
let APIPath = `http://192.168.0.116:8080`
let WsPath = `ws://192.168.0.116:8080/websocket`
// let APIPath = `https://api.pet.jisol.cn`
// let WsPath = `wss://api.pet.jisol.cn/websocket`
// let APIPath = `http://192.168.0.116:8080`
// let WsPath = `ws://192.168.0.116:8080/websocket`
let APIPath = `https://api.pet.jisol.cn`
let WsPath = `wss://api.pet.jisol.cn/websocket`
//重写UI
class JNGLayer extends JNLayer{

View File

@@ -10,6 +10,8 @@ import { CCObject } from "cc";
import { Env, EnvCurrent } from "../Env";
import { TB } from "../config/data/schema";
import BattleResource from "../tools/BattleResource";
import { director } from "cc";
import { game } from "cc";
export enum BattleMode{
//无尽模式
@@ -127,6 +129,7 @@ export default class GBattleModeManager extends Singleton {
//资源加载完成则显示世界
app.sync.onReset();
game.step();
app.sync.onStart();
}

View File

@@ -67,14 +67,15 @@ export default class GAttackParabolicBangRemote implements GAttackBase{
))
})
.onComplete(() => {
//销毁
bullet.node.destroy();
if(!role.get()) return;
//生成爆炸特效
let effect = GEffectUtil.createOne(bang.ske);
role.mode.addGNode(effect.node,bullet.node.worldPosition);
//获取默认动画
effect.setAnimation(0,"animation",false);
//销毁
bullet.node.destroy();
GDetection.testAABBCenterRole(rect(effect.node.worldPosition.x,effect.node.worldPosition.y,aw,ah)).forEach(enemy =>{
GRoleAttack.onNormalAttack(role,enemy); //普通攻击

View File

@@ -117,7 +117,7 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
//调整相机
this.camera.enabled = true;
let camreaPos = this.camera.node.worldPosition;
this.camera.node.worldPosition = v3(0,800,camreaPos.z)
this.camera.node.worldPosition = v3(0,750,camreaPos.z)
//初始化状态机
this.fsm = new GFSMOnHookMode(this);
@@ -354,14 +354,13 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
//生成敌人
onResetGenerateEnemy(){
this.enemyRoles = [];
//获取敌人
let creeps = GOnHookManager.getIns().getNextCreeps();
if(!creeps) return; //没有获取到野怪则返回
let sign = TD.TbGOnHookMaps.get(GOnHookData.getIns().info.onHookMap).sign;
let table:{data:TbGEntity.TOnHookLevel} = TD[sign].get(GOnHookData.getIns().info.levelId);
for (let index = 0; index < table.data.petSize; index++) {
//获取敌人
let creeps = GOnHookManager.getIns().getNextCreeps();
if(!creeps) return; //没有获取到野怪则返回
this.onGenCreeps(index + 1,creeps);
}
// this.enemyInfo.roles.forEach((info,index) => this.onGenRole(GOnHookModePlayerEnum.ENEMY,index + 1,info));

View File

@@ -10,10 +10,15 @@ export default class GOnHookData extends BaseData{
info:ModeOnHookOV;
async onInit() {
this.info = await GAPI.GOnHookInfo();
await this.onUpdateInfo();
console.log("GOnHookData Info",this.info);
}
//刷新数据
async onUpdateInfo(){
this.info = await GAPI.GOnHookInfo();
}
//切换地图
async setMap(mapId:number){
@@ -22,5 +27,11 @@ export default class GOnHookData extends BaseData{
}
//下一关
async onNextLevel(){
await GAPI.GOnHookNextLevel();
await this.onUpdateInfo();
}
}

View File

@@ -53,7 +53,8 @@ export default class GOnHookManager extends Singleton{
//获取下一只野怪
getNextCreeps(){
if(!this.sreeps) return;
let creeps = this.sreeps.get(this.sreeps.keys().next()?.value)
let creeps = this.sreeps.get(this.sreeps.keys().next()?.value);
this.sreeps.delete(creeps.key);
return creeps;
}
@@ -129,18 +130,29 @@ export default class GOnHookManager extends Singleton{
app.event.emit(GOnHookManagerEvent.RESET_DATA);
}
//下一关
async onNextLevel(){
GOnHookData.getIns().onNextLevel();
app.layer.Open(GUI.Tips,{text:"下一关"});
this.onResetMap();
}
//切换场景
async setMap(mapId:number){
await GOnHookData.getIns().setMap(mapId);
this.onResetMap();
}
//重置场景
onResetMap(){
//通知地图已切换
app.event.emit(GOnHookManagerEvent.UPDATE_MAP);
//重置数据
this.onResetData();
//重置场景
GBattleModeManager.getIns().Open(BattleMode.OnHook,true);
}

View File

@@ -0,0 +1,33 @@
import { _decorator, Component, Node } from 'cc';
import GOnHookData from '../../../data/GOnHookData';
import { TD } from '../../../App';
import { Label } from 'cc';
import { TbGEntity } from '../../../config/data/schema';
const { ccclass, property } = _decorator;
@ccclass('GameDifficultyTitle')
export class GameDifficultyTitle extends Component {
@property(Label)
title:Label;
protected update(dt: number): void {
let info = GOnHookData.getIns().info;
let sign = null;
let levelId = info.levelId;
if(info && levelId){
sign = TD.TbGOnHookMaps.get(info.onHookMap)?.sign;
if(!sign) return;
}else return;
let table:{data:TbGEntity.TOnHookLevel} = TD[sign].get(GOnHookData.getIns().info.levelId);
//显示难度
this.title.string = `难度 : ${table.data.level}-${table.data.childLevel}`;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "b2374caf-5449-4193-88a5-ff17e311d29c",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,43 @@
import { _decorator, Component, Node } from 'cc';
import { app } from '../../../App';
import { GModeEvent } from '../../../battle/modes/GMode';
import { tween } from 'cc';
import { Vec3 } from 'cc';
import RandomUtil from '../../../../../extensions/ngame/assets/ngame/util/RandomUtil';
import { v3 } from 'cc';
const { ccclass, property } = _decorator;
//游戏震屏
@ccclass('ModeShakeScreen')
export class ModeShakeScreen extends Component {
local:Vec3;
onLoad(){
this.local = this.node.position.clone();
app.event.on(GModeEvent.HIT,this.onShakeScreen,this);
}
protected onDestroy(): void {
app.event.off(GModeEvent.HIT,this.onShakeScreen,this);
}
onShakeScreen(){
tween(this.node).
to(0.1, { position: this.local.clone().add(v3(RandomUtil.RandomInt(-5, 5), RandomUtil.RandomInt(-5, 0), 0)) })
.call(() => {
tween(this.node).to(0.1 / 2, { position: this.local.clone() }).start();
})
.start();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "c18bbd8c-6ce3-4ea1-84e3-2bb7bd368d31",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -7,6 +7,7 @@ import { JNGLayerBase } from '../../components/JNComponent';
import { app } from '../../App';
import { GAction } from '../../consts/GAction';
import { GAPI } from '../../consts/GAPI';
import GOnHookManager from '../../manager/battle/mode/GOnHookManager';
const { ccclass, property } = _decorator;
@ccclass('MainView')
@@ -63,8 +64,7 @@ export class MainView extends JNGLayerBase {
//点击下一关
async onClickNextLevel(){
await GAPI.GOnHookNextLevel();
app.layer.Open(GUI.Tips,{text:"下一关"});
GOnHookManager.getIns().onNextLevel();
}
}