refactor(skill): 重构技能组件目录结构并重命名施法请求组件

将技能相关组件从hero目录移动到skill目录
将CastSkillRequestComp重命名为CSRequestComp
更新相关引用和文档说明
This commit is contained in:
2025-10-31 09:22:50 +08:00
parent a1c605238d
commit b38e63e200
14 changed files with 47 additions and 129 deletions

View File

@@ -1,17 +1,20 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { BoxSet } from "../common/config/BoxSet";
import { HeroViewComp } from "../hero/HeroViewComp";
/** 业务层对象 */
@ecs.register('SDataCom')
export class SDataCom extends ecs.Comp {
/** 业务层组件移除时,重置所有数据为默认值 */
attrs:any=null
caster:HeroViewComp=null
group:BoxSet=BoxSet.HERO
s_uuid:number=0
reset() {
this.attrs=null
this.group=0
this.s_uuid=0
this.caster=null
}
}

View File

@@ -0,0 +1,47 @@
import { Vec3, v3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { BezierMove } from "../BezierMove/BezierMove";
import { RType, SkillSet } from "../common/config/SkillSet";
/**
* 技能移动数据组件
* 存储技能实体的移动相关数据
*/
@ecs.register('SMoveData')
export class SMoveDataComp extends ecs.Comp {
/** 起始位置 */
startPos: Vec3 = v3();
/** 目标位置 */
targetPos: Vec3 = v3();
/** 移动速度 */
speed: number = 500;
/** 移动持续时间 */
duration: number = 0;
/** 移动方向 */
direction: Vec3 = v3();
/** 是否自动销毁(到达目标后) */
autoDestroy: boolean = true;
s_uuid:number=0;
reset() {
this.startPos.set(0, 0, 0);
this.targetPos.set(0, 0, 0);
this.speed = 500;
this.duration = 0;
this.direction.set(0, 0, 0);
this.autoDestroy = true;
}
}
// /** 业务层业务逻辑处理对象 */
// export class SMoveSystem extends ecs.ComblockSystem implements ecs.IEntityEnterSystem {
// filter(): ecs.IMatcher {
// return ecs.allOf(SMoveDataComp);
// }
// entityEnter(e: ecs.Entity): void {
// // 注:自定义业务逻辑
// let s_uuid=e.get(SMoveDataComp).s_uuid
// let SConf=SkillSet[s_uuid]
// e.remove(SMoveDataComp);
// }
// }

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "d0c2d505-f2c3-4cf3-82f7-490f9d14e096",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,53 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Vec3 } from "cc";
/**
* ==================== 施法请求标记组件 ====================
*
* 用途:
* - 标记角色想要施放某个技能
* - 由外部如AI系统、玩家输入添加
* - 施法系统处理后自动移除
*/
@ecs.register('CSRequest')
export class CSRequestComp extends ecs.Comp {
/** 技能索引(在 HeroSkillsComp.skills 中的位置) */
skillIndex: number = 0;
/** 目标位置数组(由请求者提供) */
targets: Vec3[] = [];
reset() {
this.skillIndex = 0;
this.targets = [];
}
}
/**
* ==================== 技能命中标记组件 ====================
*
* 用途:
* - 标记技能已命中目标
* - 记录命中信息
* - 伤害系统处理后移除
*/
@ecs.register('SkillHit')
export class SkillHitComp extends ecs.Comp {
/** 技能ID */
s_uuid: number = 0;
/** 命中位置 */
hitPosition: Vec3 = new Vec3();
/** 伤害值 */
damage: number = 0;
/** 施法者实体ID */
casterId: number = 0;
reset() {
this.s_uuid = 0;
this.hitPosition.set(0, 0, 0);
this.damage = 0;
this.casterId = 0;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "37d898a0-b376-4f18-8559-2acf6f4e7db7",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -12,7 +12,7 @@ import { HType } from "../common/config/heroSet";
import { SkillView } from "./SkillView";
import { SDataCom } from "./SDataCom";
import { Attrs } from "../common/config/HeroAttrs";
import { SMoveDataComp } from "../hero/SMoveComp";
import { SMoveDataComp } from "../skill/SMoveComp";
/** Skill 模块 */
@ecs.register(`Skill`)

View File

@@ -6,7 +6,7 @@ import { DTType, RType, SkillSet } from "../common/config/SkillSet";
import { BezierMove } from "../BezierMove/BezierMove";
import { BoxSet } from "../common/config/BoxSet";
import { SDataCom } from "./SDataCom";
import { SMoveDataComp } from "../hero/SMoveComp";
import { SMoveDataComp } from "./SMoveComp";
const { ccclass, property } = _decorator;