fix: 修复技能节点池逻辑并调整UI显示

- 修复技能节点池获取和回收时的有效性检查,避免无效节点
- 修复技能父节点查找逻辑,增加空值检查
- 调整卡牌UI的文本样式和宽度
- 启用SkillView调试日志以便问题排查
- 修复英雄后撤动画逻辑,取消注释
- 更新加载页面资源引用
This commit is contained in:
panw
2026-03-12 15:58:25 +08:00
parent 01bff64561
commit 9d86be80c7
6 changed files with 2092 additions and 1911 deletions

View File

@@ -22,7 +22,7 @@ export class SkillView extends CCComp {
atk_y: number = 0
@property({ tooltip: "是否启用调试日志" })
private debugMode: boolean = false;
private debugMode: boolean = true;
anim:Animation=null;
group:number=0;
@@ -105,50 +105,6 @@ export class SkillView extends CCComp {
mLogger.log(this.debugMode, 'SkillView', `[SkillView] [${this.SConf?.name}] 第${this.attackFrameCount}次攻击帧开启碰撞检测`);
}
// let dis=this.node.getComponent(UITransform).width/2
// let enemys:any=[]
// if( this.sData.fac==FacSet.HERO){
// enemys=ecs.query(ecs.allOf(MonMoveComp))
// }else{
// enemys=ecs.query(ecs.allOf(HeroMoveComp))
// }
// let IRTargets: HeroViewComp[] = []
// // 收集范围内所有敌方目标
// enemys.some(e => {
// const view = e.get(HeroViewComp);
// const model=e.get(HeroAttrsComp)
// const distance = Math.abs(this.node.position.x - view.node.position.x);
// if(distance <= dis&&!model.is_dead) {
// IRTargets.push(view);
// }
// });
// // 根据配置的hit_num决定攻击模式
// const hitNum = SkillSet[this.s_uuid].hit_num || 0;
// if(hitNum > 0) {
// // 限制目标数量按距离排序选择最近的N个目标
// if(IRTargets.length > 0) {
// // 按距离排序(从近到远)
// IRTargets.sort((a, b) => {
// const distanceA = Math.abs(this.node.position.x - a.node.position.x);
// const distanceB = Math.abs(this.node.position.x - b.node.position.x);
// return distanceA - distanceB;
// });
// // 限制目标数量
// const maxTargets = Math.min(hitNum, IRTargets.length);
// const sTargets = IRTargets.slice(0, maxTargets);
// sTargets.forEach(target => {
// this.apply_damage(target, false);
// });
// }
// } else {
// // 范围伤害:对所有范围内目标造成伤害
// if(IRTargets.length > 0) {
// IRTargets.forEach(target => {
// this.apply_damage(target, true);
// });
// }
// }
}
//伤害应用
apply_damage(target:HeroViewComp,is_range:boolean=false){
@@ -156,7 +112,12 @@ export class SkillView extends CCComp {
// 安全检查:如果目标实体已不存在,直接返回
if (!target.ent) return;
if (!this.SConf) return;
// 检查技能是否应该销毁
const max_hit_count=this.SConf.hit + this.sData.Attrs[Attrs.puncture]
if ( this.sData.hit_count >= max_hit_count ) {
this.close_collider()
return
}
// 对于非持续碰撞类型的技能,在造成伤害后立即关闭碰撞检测
// 这样可以避免同一帧内的重复伤害
if(this.SConf.EType !== EType.collision && this.collider) {
@@ -181,19 +142,23 @@ export class SkillView extends CCComp {
);
// 更新技能命中次数
this.sData.hit_count++
// 检查技能是否应该销毁
if (
this.sData.hit_count >= (this.SConf.hit + this.sData.Attrs[Attrs.puncture]) &&
(this.SConf.DTType != DTType.range) &&
(this.SConf.EType != EType.animationEnd) &&
(this.SConf.EType != EType.timeEnd)
) {
// 修复:物理回调中不能直接销毁刚体,需延迟到下一帧
this.scheduleOnce(() => {
if (this.ent) {
this.ent.destroy();
}
}, 0);
(this.SConf.DTType != DTType.range) &&
(this.SConf.EType != EType.animationEnd) &&
(this.SConf.EType != EType.timeEnd)
) {
// 修复:物理回调中不能直接销毁刚体,需延迟到下一帧
this.close_collider();
this.scheduleOnce(() => {
if (this.ent) {
this.ent.destroy();
}
}, 0);
}
}
close_collider(){
if (this.collider) {
this.collider.enabled = false;
}
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */