This commit is contained in:
2025-08-13 23:52:44 +08:00
parent 672e987c70
commit 66acc50c49
14 changed files with 21201 additions and 4322 deletions

View File

@@ -55,6 +55,9 @@ export class SingletonModuleComp extends ecs.Comp {
score:0,//分数
diamond:0,//钻石
mission:1,//关卡
chapter:1,//章节
level:1,//关卡等级
max_mission:10,//最大关卡
meat:0,//肉
mon_num:0,//怪物数量
hero_num:0,//英雄数量
@@ -407,6 +410,11 @@ export class SingletonModuleComp extends ecs.Comp {
this.vmdata.mission_data.diamond=this.getGameProperty("diamond", 0)
this.vmdata.mission_data.mission=this.getGameProperty("mission", 1)
this.vmdata.mission_data.score=this.getGameProperty("score", 0)
// 计算章节和关卡等级
const currentMission = this.getGameProperty("mission", 1)
this.vmdata.mission_data.chapter = Math.floor((currentMission - 1) / 10) + 1
this.vmdata.mission_data.level = ((currentMission - 1) % 10) + 1
}
initReward(){
this.vmdata.reward.gold=0
@@ -493,6 +501,22 @@ export class SingletonModuleComp extends ecs.Comp {
}
}
/**
* 增加关卡进度
* @param amount 增加的关卡数 (默认1)
* @param autoSave 是否自动保存 (默认true)
*/
addMission(amount: number = 1, autoSave: boolean = true) {
const currentMission = this.getGameProperty("mission", 1);
const newMission = currentMission + amount;
this.setGameProperty("mission", newMission, autoSave);
console.log(`[SMC]: 关卡进度增加: ${currentMission} -> ${newMission} (+${amount})`);
// 计算章节和关卡等级
this.vmdata.mission_data.chapter = Math.floor((newMission - 1) / 10) + 1
this.vmdata.mission_data.level = ((newMission - 1) % 10) + 1
return newMission;
}
/**
* 获取当前关卡进度
*/