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 { smc } from "../common/SingletonModuleComp";
|
||||||
import { HeroInfo, HType } from "../common/config/heroSet";
|
import { HeroInfo, HType } from "../common/config/heroSet";
|
||||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||||
import { FacSet } from "../common/config/GameSet";
|
import { FacSet, FightSet } from "../common/config/GameSet";
|
||||||
import { MoveComp } from "../hero/MoveComp";
|
import { MoveComp } from "../hero/MoveComp";
|
||||||
import { MissionHeroCompComp } from "./MissionHeroComp";
|
import { MissionHeroCompComp } from "./MissionHeroComp";
|
||||||
|
|
||||||
@@ -454,13 +454,13 @@ export class MissionCardComp extends CCComp {
|
|||||||
* @returns { needCount: 合成所需数量, maxLv: 最大合成等级 }
|
* @returns { needCount: 合成所需数量, maxLv: 最大合成等级 }
|
||||||
*/
|
*/
|
||||||
private getMergeRule(): { needCount: number, maxLv: number } {
|
private getMergeRule(): { needCount: number, maxLv: number } {
|
||||||
let needCount = 3;
|
let needCount = FightSet.MERGE_NEED === 2 ? 2 : 3;
|
||||||
let maxLv = 2; // 兜底值改为2,与 MissionHeroComp 保持一致
|
let maxLv = Math.max(1, Math.floor(FightSet.MERGE_MAX ?? 3));
|
||||||
ecs.query(ecs.allOf(MissionHeroCompComp)).forEach((entity: ecs.Entity) => {
|
ecs.query(ecs.allOf(MissionHeroCompComp)).forEach((entity: ecs.Entity) => {
|
||||||
const comp = entity.get(MissionHeroCompComp);
|
const comp = entity.get(MissionHeroCompComp);
|
||||||
if (!comp) return;
|
if (!comp) return;
|
||||||
needCount = comp.merge_need_count === 2 ? 2 : 3;
|
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 };
|
return { needCount, maxLv };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
* - ScoreWeights(ScoreSet)—— 得分权重配置
|
* - ScoreWeights(ScoreSet)—— 得分权重配置
|
||||||
* - GameEvent.MissionEnd / MissionStart —— 游戏生命周期事件
|
* - 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 { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
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);
|
const lab = node.getChildByName("score_label")?.getComponent(Label);
|
||||||
if (lab) lab.string = `${score}`;
|
if (lab) lab.string = `${score}`;
|
||||||
|
|
||||||
const bar = node.getChildByName("progress_bar")?.getComponent(Sprite);
|
const bar = node.getChildByName("progress_bar")?.getComponent(ProgressBar);
|
||||||
if (bar) {
|
if (bar) {
|
||||||
// 根据该维度得分占“预期满分”的比例设置进度条(fillRange)
|
// 根据该维度得分占“预期满分”的比例设置进度条(fillRange)
|
||||||
bar.fillRange = Math.min(1, Math.max(0, score / maxScore));
|
bar.progress = Math.min(1, Math.max(0, score / maxScore));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: 进度条的最大值可按设计期望自行调整,目前为占位预估值
|
// TODO: 进度条的最大值可按设计期望自行调整,目前为占位预估值
|
||||||
renderDim(this.combat_node, s.score_combat, 3000);
|
renderDim(this.combat_node, s.score_combat, 3000);
|
||||||
|
|||||||
Reference in New Issue
Block a user