Files
pixelheros/assets/script/game/map/SBox.ts
panFD ac0891ccdd feat: 实现药水卡限时强化功能,支持自定义数值覆写
1. 新增Buff数值覆写机制,支持药水卡自定义buff效果数值
2. 重构属性计算逻辑,支持读取药水卡传递的覆写值
3. 新增多组限时强化Buff与药水卡配置
4. 优化UI数值显示,实时展示最终属性值
5. 新增多维度调试日志方便排查问题
2026-07-23 23:00:49 +08:00

54 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { instantiate, Prefab, Vec3, Node } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { smc } from "../common/SingletonModuleComp";
import { SkillBoxComp } from "./SkillBoxComp";
import { SkillOverrides } from "../common/config/SkillSet";
/** SBox 实体:负责技能卡效果节点创建、初始化与销毁流程 */
@ecs.register(`SBox`)
export class SBox extends ecs.Entity {
/** 技能盒子视图和逻辑组件引用 */
SkillBox!: SkillBoxComp;
protected init() {
// 如果有纯逻辑数据组件可以在这里 addComponents
}
/** 销毁实体并释放视图节点,防止残留 */
destroy(): void {
const view = this.get(SkillBoxComp);
if (view && view.node && view.node.isValid) {
view.node.destroy();
}
this.remove(SkillBoxComp);
super.destroy();
}
/**
* 加载并初始化技能盒子
* 1) 创建节点并挂到 SKILL 层
* 2) 初始化表现与属性数据
*/
load(uuid: number, card_lv: number, pos: Vec3, prefab: Prefab, overrides?: SkillOverrides): Node {
let node = instantiate(prefab);
let scene = smc.map.MapView.scene;
// 统一挂到实体显示层 SKILL 节点下
let parent = scene.entityLayer!.node!.getChildByName("SKILL");
if (parent) {
node.parent = parent;
}
node.setPosition(pos);
// 获取并注册组件
let sboxComp = node.getComponent(SkillBoxComp) || node.addComponent(SkillBoxComp);
this.add(sboxComp);
// 初始化业务逻辑(透传药水卡 overrides含 buff_value
sboxComp.init(uuid, card_lv, overrides);
return node;
}
}