From c76a31593f19be20a0bb3da1134ab70b47745841 Mon Sep 17 00:00:00 2001 From: panw Date: Wed, 4 Feb 2026 09:16:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E6=B8=B8=E6=88=8F=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BB=A5=E7=AE=80=E5=8C=96=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除 SingletonModuleComp 中的 meat、exp、monsters 等未使用字段 - 移除 MissionComp 中的 chou_gold 和 lvup_gold 初始化 - 保留核心游戏状态字段,减少内存占用和维护复杂度 --- assets/script/game/common/SingletonModuleComp.ts | 8 +------- assets/script/game/map/MissionComp.ts | 2 -- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index 94b004b2..9d8311f8 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -52,8 +52,6 @@ export class SingletonModuleComp extends ecs.Comp { score:0, mission:1, diamond:100, //商店购买 及 双倍奖励资源 - meat:0, - exp:0, task:0, noStop:false, showInfo:true, @@ -62,7 +60,6 @@ export class SingletonModuleComp extends ecs.Comp { current_guide:number=0 fight_hero: number = 5001; // 单个出战英雄 heros:any= [5001] - monsters:any = []; vmdata: any = { game_over:false, game_pause:false, @@ -80,7 +77,6 @@ export class SingletonModuleComp extends ecs.Comp { }, scores: { score: 0, // 基础得分 - // 战斗统计 crt_count: 0, // 暴击次数 wf_count: 0, // 风怒次数 @@ -139,8 +135,6 @@ export class SingletonModuleComp extends ecs.Comp { friend:{uuid:0,count:0}, }, gold: 0, // 金币数据(MVVM绑定字段) - chou_gold: FightSet.CHOU_GOLD, - lvup_gold: FightSet.LVUP_GOLD_UP, }; @@ -224,7 +218,7 @@ export class SingletonModuleComp extends ecs.Comp { mLogger.log(this.debugMode, 'SMC', `[SMC] 升级! Lv.${h.lv - 1} -> Lv.${h.lv}, 下级所需: ${h.exp_max}`); } - + h.exp_pre=Math.round(h.exp/h.exp_max*100) if (isLevelUp) { // 发送升级事件 oops.message.dispatchEvent(GameEvent.CanUpdateLv, { lv: h.lv }); diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index 6a83af8d..53ccdc9c 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -260,8 +260,6 @@ do_ad(){ data_init(){ // 重置金币为初始值 (如果需要保留金币,请注释掉此行) smc.vmdata.gold = 0; - smc.vmdata.chou_gold = FightSet.CHOU_GOLD; - smc.vmdata.lvup_gold = FightSet.LVUP_GOLD_UP; //局内数据初始化 smc 数据初始化 smc.mission.play = true; smc.mission.pause = false;