feat(技能系统): 添加施法者实体ID字段用于安全校验

在SDataCom组件中添加casterEid字段,并在Skill和SkillView中使用该字段替代原有的链式访问,提高代码安全性和可读性
This commit is contained in:
walkpan
2026-01-06 14:20:45 +08:00
parent a32aa5ad08
commit 31321a1a45
3 changed files with 4 additions and 1 deletions

View File

@@ -59,7 +59,7 @@ export class SkillView extends CCComp {
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
// 安全获取双方信息用于日志
const casterName = this.sData.caster?.ent?.get(HeroAttrsComp)?.hero_name ?? '未知施法者';
const casterEid = this.sData.caster?.ent?.eid ?? '未知EID';
const casterEid = this.sData.casterEid;
const targetView = oCol.getComponent(HeroViewComp);
const targetName = targetView?.ent?.get(HeroAttrsComp)?.hero_name ?? '非英雄对象';
const targetEid = targetView?.ent?.eid ?? '未知EID';