fix: 修复合成规则默认值和进度条组件类型错误

- 将 MissionCardComp 中的合成规则默认值改为从 FightSet 配置读取,避免硬编码
- 修复 VictoryComp 中进度条组件类型错误,将 Sprite 改为 ProgressBar 并更新属性设置
This commit is contained in:
walkpan
2026-04-25 23:57:38 +08:00
parent b97ea5027d
commit 7427419670
3 changed files with 1408 additions and 1753 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -45,7 +45,7 @@ import { HInfoComp } from "./HInfoComp";
import { smc } from "../common/SingletonModuleComp";
import { HeroInfo, HType } from "../common/config/heroSet";
import { HeroViewComp } from "../hero/HeroViewComp";
import { FacSet } from "../common/config/GameSet";
import { FacSet, FightSet } from "../common/config/GameSet";
import { MoveComp } from "../hero/MoveComp";
import { MissionHeroCompComp } from "./MissionHeroComp";
@@ -454,13 +454,13 @@ export class MissionCardComp extends CCComp {
* @returns { needCount: 合成所需数量, maxLv: 最大合成等级 }
*/
private getMergeRule(): { needCount: number, maxLv: number } {
let needCount = 3;
let maxLv = 2; // 兜底值改为2与 MissionHeroComp 保持一致
let needCount = FightSet.MERGE_NEED === 2 ? 2 : 3;
let maxLv = Math.max(1, Math.floor(FightSet.MERGE_MAX ?? 3));
ecs.query(ecs.allOf(MissionHeroCompComp)).forEach((entity: ecs.Entity) => {
const comp = entity.get(MissionHeroCompComp);
if (!comp) return;
needCount = comp.merge_need_count === 2 ? 2 : 3;
maxLv = Math.max(1, Math.floor(comp.merge_max_lv ?? 2));
maxLv = Math.max(1, Math.floor(comp.merge_max_lv ?? 3));
});
return { needCount, maxLv };
}

View File

@@ -18,7 +18,7 @@
* - ScoreWeightsScoreSet—— 得分权重配置
* - GameEvent.MissionEnd / MissionStart —— 游戏生命周期事件
*/
import { _decorator, instantiate, Label ,Prefab,Node, Sprite, Animation, AnimationClip, resources, UITransform, Widget } from "cc";
import { _decorator, instantiate, Label ,Prefab,Node, Sprite, Animation, AnimationClip, resources, UITransform, Widget, ProgressBar } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
@@ -418,12 +418,12 @@ export class VictoryComp extends CCComp {
const lab = node.getChildByName("score_label")?.getComponent(Label);
if (lab) lab.string = `${score}`;
const bar = node.getChildByName("progress_bar")?.getComponent(Sprite);
const bar = node.getChildByName("progress_bar")?.getComponent(ProgressBar);
if (bar) {
// 根据该维度得分占“预期满分”的比例设置进度条fillRange
bar.fillRange = Math.min(1, Math.max(0, score / maxScore));
bar.progress = Math.min(1, Math.max(0, score / maxScore));
}
};
};
// TODO: 进度条的最大值可按设计期望自行调整,目前为占位预估值
renderDim(this.combat_node, s.score_combat, 3000);