refactor(game): 优化属性卡牌配置与UI更新逻辑
- 将AttrSet中的`note`字段统一重命名为`name`,提高字段语义清晰度 - 在CardSet中修正属性卡和药水卡名称的获取逻辑,使用新的`name`字段 - 调整HeroViewComp的health方法,增加血量变化小于等于99时不显示特效的优化 - 将HeroAttrsSystem中的自然回复计时器从1秒改为5秒,并更新相关注释 - 移除HeroViewComp中已注释的冗余UI更新代码,保持代码整洁
This commit is contained in:
@@ -31,7 +31,7 @@ export class HeroAttrSystem extends ecs.ComblockSystem
|
||||
private entityCount: number = 0; // 本帧处理的实体数
|
||||
private frameCount: number = 0; // 总帧数
|
||||
public debugMode: boolean = false; // 是否启用调试模式
|
||||
private timer:Timer=new Timer(1)
|
||||
private RTimer:Timer=new Timer(5)
|
||||
/**
|
||||
* 过滤器:只处理拥有 HeroAttrsComp 的实体
|
||||
*/
|
||||
@@ -83,9 +83,9 @@ export class HeroAttrSystem extends ecs.ComblockSystem
|
||||
// 记录MP变化前的值
|
||||
const oldMp = model.mp;
|
||||
|
||||
if(this.timer.update(this.dt)){
|
||||
// 2. HP/MP 自然回复(业务规则)
|
||||
// 加上回血/回蓝属性的影响
|
||||
if(this.RTimer.update(this.dt)){
|
||||
|
||||
// 每5秒回血1次
|
||||
const hpRegen = model.Attrs[Attrs.HP_REGEN] || 0;
|
||||
// 回血逻辑 + 视图表现
|
||||
const totalHpRegen = HRegen.HP + hpRegen;
|
||||
|
||||
@@ -342,13 +342,11 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
health(hp: number = 0) {
|
||||
// ✅ 仅显示特效和提示,不调用 hp_show()
|
||||
if(hp<=99) return;
|
||||
this.heathed();
|
||||
this.hp_tip(TooltipTypes.health, hp.toFixed(0));
|
||||
this.top_node.active = true;
|
||||
this.lastBarUpdateTime = Date.now() / 1000;
|
||||
|
||||
// ❌ 移除:UI更新由脏标签机制处理
|
||||
// this.hp_show();
|
||||
}
|
||||
|
||||
mp_add(mp: number = 0) {
|
||||
@@ -356,9 +354,6 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp_tip(TooltipTypes.addmp, mp.toFixed(0));
|
||||
this.top_node.active = true;
|
||||
this.lastBarUpdateTime = Date.now() / 1000;
|
||||
|
||||
// ❌ 移除:UI更新由脏标签机制处理
|
||||
// this.mp_show();
|
||||
}
|
||||
|
||||
alive(){
|
||||
|
||||
Reference in New Issue
Block a user