修复bug

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-12-26 03:55:58 +08:00
parent fbb8c862e9
commit c46230a22c
6 changed files with 18 additions and 23 deletions

View File

@@ -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{

View File

@@ -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;
}

View File

@@ -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,
//出售野怪

View File

@@ -22,6 +22,8 @@ export enum GOnHookManagerEvent{
//游戏模式 OnHook 管理器
export default class GOnHookManager extends Singleton{
isSpawn:boolean = false;
//野怪列表
_sreeps:Map<string,GOnHookPet> = new Map();
get sreeps(){