fix: 修复合成规则默认值和进度条组件类型错误
- 将 MissionCardComp 中的合成规则默认值改为从 FightSet 配置读取,避免硬编码 - 修复 VictoryComp 中进度条组件类型错误,将 Sprite 改为 ProgressBar 并更新属性设置
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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 };
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* - ScoreWeights(ScoreSet)—— 得分权重配置
|
||||
* - 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,10 +418,10 @@ 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));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user