From c46230a22c9a4976fb1db289057ac8903c44992f Mon Sep 17 00:00:00 2001 From: "DESKTOP-5RP3AKU\\Jisol" <2858626794@qq.com> Date: Tue, 26 Dec 2023 03:55:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JisolGameCocos/assets/script/App.ts | 8 +++---- .../script/battle/GBattleModeManager.ts | 23 +++++++------------ JisolGameCocos/assets/script/consts/GAPI.ts | 2 +- .../manager/battle/mode/GOnHookManager.ts | 2 ++ JisolGameCocos/extensions/ngame | 2 +- .../Main/src/main/resources/application.yml | 4 ++-- 6 files changed, 18 insertions(+), 23 deletions(-) diff --git a/JisolGameCocos/assets/script/App.ts b/JisolGameCocos/assets/script/App.ts index 417ed072..d08d170c 100644 --- a/JisolGameCocos/assets/script/App.ts +++ b/JisolGameCocos/assets/script/App.ts @@ -28,14 +28,14 @@ import AppAction from "./AppAction"; import { Asset } from "cc"; import { Component } from "cc"; -// let APIPath = `http://localhost:8080` -// let WsPath = `ws://localhost:8080/websocket` +let APIPath = `http://localhost:8080` +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 = `https://api.pet.jisol.cn` +// let WsPath = `wss://api.pet.jisol.cn/websocket` //重写UI class JNGLayer extends JNLayer{ diff --git a/JisolGameCocos/assets/script/battle/GBattleModeManager.ts b/JisolGameCocos/assets/script/battle/GBattleModeManager.ts index 1af83ad1..beb78215 100644 --- a/JisolGameCocos/assets/script/battle/GBattleModeManager.ts +++ b/JisolGameCocos/assets/script/battle/GBattleModeManager.ts @@ -63,9 +63,6 @@ export default class GBattleModeManager extends Singleton { //默认模式 default:BattleMode = BattleMode.OnHook; //默认无限模式 - //当前帧不切换模式 - frameNoSwitch:boolean = false; - //模式数据 data:any; @@ -97,10 +94,6 @@ export default class GBattleModeManager extends Singleton { // res 资源加载列表 (因为是帧同步所以打开模式前必须提前加载可能使用的资源) async Open(mode:BattleMode = null,isAuto:boolean = false,data:any = this.data){ - this.Close(); - - this.data = data; - if(!this.current && mode == null){ //裁决员不允许默认模式 if(EnvCurrent == Env.Server) return; @@ -109,7 +102,11 @@ export default class GBattleModeManager extends Singleton { }else if(mode == null){ return; } + this.current = mode; + this.Close(); + this.current = mode; + this.data = data; this.setAuto(isAuto); //加载资源 @@ -120,18 +117,16 @@ export default class GBattleModeManager extends Singleton { await BattleResource.loadResource(mode,data); console.log("[GBattleModeManager] 加载结束",loadingIndex,this.loadingIndex); if(this.loadingIndex == loadingIndex){ + //资源加载完成则显示世界 + app.sync.onReset(); this.isLoadingResource = false; app.event.emit(GBattleModeEvent.EndLoadingResource); + app.sync.onStart(); }else{ //如果加载中途切换了模式则直接返回 return; } - //资源加载完成则显示世界 - app.sync.onReset(); - game.step(); - app.sync.onStart(); - } //重置当前模式 @@ -147,7 +142,6 @@ export default class GBattleModeManager extends Singleton { app.sync.onReset(); let current = this.current; this.current = null; - this.frameNoSwitch = true; //结束通知 app.event.emit(GBattleModeEvent.Close,current,data); @@ -195,10 +189,9 @@ export default class GBattleModeManager extends Singleton { this.onAutoFrame(dt); //如果当前模式是空则默认模式 - if(this.current == null && !this.frameNoSwitch){ + if(this.current == null){ this.Open(); } - this.frameNoSwitch = false; } diff --git a/JisolGameCocos/assets/script/consts/GAPI.ts b/JisolGameCocos/assets/script/consts/GAPI.ts index 133af419..3d429ecc 100644 --- a/JisolGameCocos/assets/script/consts/GAPI.ts +++ b/JisolGameCocos/assets/script/consts/GAPI.ts @@ -19,7 +19,7 @@ export const GAPI = { //切换游戏 GOnHookSetMap : async (mapId) => RData(await app.api.post(`/game/mode/onHook/setMapId/${mapId}`)) as ModeOnHookOV, //生成野怪 - GOnHookSpawnCreeps : async () => RProto(await app.api.get(`/game/mode/onHook/onSpawnCreeps`,{responseType:'arraybuffer'}),GActionType.GOnHookPets) as GOnHookPets, + GOnHookSpawnCreeps : async () => RProto(await app.api.get(`/game/mode/onHook/onSpawnCreeps`,{responseType:'arraybuffer'},true),GActionType.GOnHookPets) as GOnHookPets, //捕捉野怪 GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`)) as PlayerPetOV, //出售野怪 diff --git a/JisolGameCocos/assets/script/manager/battle/mode/GOnHookManager.ts b/JisolGameCocos/assets/script/manager/battle/mode/GOnHookManager.ts index 835de372..37323dbe 100644 --- a/JisolGameCocos/assets/script/manager/battle/mode/GOnHookManager.ts +++ b/JisolGameCocos/assets/script/manager/battle/mode/GOnHookManager.ts @@ -22,6 +22,8 @@ export enum GOnHookManagerEvent{ //游戏模式 OnHook 管理器 export default class GOnHookManager extends Singleton{ + isSpawn:boolean = false; + //野怪列表 _sreeps:Map = new Map(); get sreeps(){ diff --git a/JisolGameCocos/extensions/ngame b/JisolGameCocos/extensions/ngame index 34f12bac..e05dfeef 160000 --- a/JisolGameCocos/extensions/ngame +++ b/JisolGameCocos/extensions/ngame @@ -1 +1 @@ -Subproject commit 34f12bac5650f7782074cd6b369f77fa3e814641 +Subproject commit e05dfeef697c7c803221b2d8b2fc721b73fca7d3 diff --git a/JisolGameServer/Main/src/main/resources/application.yml b/JisolGameServer/Main/src/main/resources/application.yml index 364ad07d..9e0d9877 100644 --- a/JisolGameServer/Main/src/main/resources/application.yml +++ b/JisolGameServer/Main/src/main/resources/application.yml @@ -4,8 +4,8 @@ spring: datasource: username: pet_jisol_cn password: sThsBwjfDcaw2wJR -# url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 - url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 + url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 +# url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 driver-class-name: com.mysql.cj.jdbc.Driver jackson: serialization: