refactor: 移除未使用的游戏数据字段以简化状态管理
- 删除 SingletonModuleComp 中的 meat、exp、monsters 等未使用字段 - 移除 MissionComp 中的 chou_gold 和 lvup_gold 初始化 - 保留核心游戏状态字段,减少内存占用和维护复杂度
This commit is contained in:
@@ -52,8 +52,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
score:0,
|
score:0,
|
||||||
mission:1,
|
mission:1,
|
||||||
diamond:100, //商店购买 及 双倍奖励资源
|
diamond:100, //商店购买 及 双倍奖励资源
|
||||||
meat:0,
|
|
||||||
exp:0,
|
|
||||||
task:0,
|
task:0,
|
||||||
noStop:false,
|
noStop:false,
|
||||||
showInfo:true,
|
showInfo:true,
|
||||||
@@ -62,7 +60,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
current_guide:number=0
|
current_guide:number=0
|
||||||
fight_hero: number = 5001; // 单个出战英雄
|
fight_hero: number = 5001; // 单个出战英雄
|
||||||
heros:any= [5001]
|
heros:any= [5001]
|
||||||
monsters:any = [];
|
|
||||||
vmdata: any = {
|
vmdata: any = {
|
||||||
game_over:false,
|
game_over:false,
|
||||||
game_pause:false,
|
game_pause:false,
|
||||||
@@ -80,7 +77,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
},
|
},
|
||||||
scores: {
|
scores: {
|
||||||
score: 0, // 基础得分
|
score: 0, // 基础得分
|
||||||
|
|
||||||
// 战斗统计
|
// 战斗统计
|
||||||
crt_count: 0, // 暴击次数
|
crt_count: 0, // 暴击次数
|
||||||
wf_count: 0, // 风怒次数
|
wf_count: 0, // 风怒次数
|
||||||
@@ -139,8 +135,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
friend:{uuid:0,count:0},
|
friend:{uuid:0,count:0},
|
||||||
},
|
},
|
||||||
gold: 0, // 金币数据(MVVM绑定字段)
|
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}`);
|
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) {
|
if (isLevelUp) {
|
||||||
// 发送升级事件
|
// 发送升级事件
|
||||||
oops.message.dispatchEvent(GameEvent.CanUpdateLv, { lv: h.lv });
|
oops.message.dispatchEvent(GameEvent.CanUpdateLv, { lv: h.lv });
|
||||||
|
|||||||
@@ -260,8 +260,6 @@ do_ad(){
|
|||||||
data_init(){
|
data_init(){
|
||||||
// 重置金币为初始值 (如果需要保留金币,请注释掉此行)
|
// 重置金币为初始值 (如果需要保留金币,请注释掉此行)
|
||||||
smc.vmdata.gold = 0;
|
smc.vmdata.gold = 0;
|
||||||
smc.vmdata.chou_gold = FightSet.CHOU_GOLD;
|
|
||||||
smc.vmdata.lvup_gold = FightSet.LVUP_GOLD_UP;
|
|
||||||
//局内数据初始化 smc 数据初始化
|
//局内数据初始化 smc 数据初始化
|
||||||
smc.mission.play = true;
|
smc.mission.play = true;
|
||||||
smc.mission.pause = false;
|
smc.mission.pause = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user