- 在 MissionHeroComp 中召唤英雄后派发 MasterCalled 事件,以更新英雄信息面板 - 调整 hnode.prefab 中多个节点的位置和尺寸,优化界面布局 - 为多个 TypeScript 组件文件添加详细注释,说明职责、关键设计和依赖关系 - 在 MissionCardComp 中完善英雄信息面板的创建、排序和布局逻辑
73 lines
2.2 KiB
TypeScript
73 lines
2.2 KiB
TypeScript
/**
|
||
* @file SkillLayer.ts
|
||
* @description 技能效果图层组件(场景显示层)
|
||
*
|
||
* 职责:
|
||
* 1. 作为所有技能效果节点(弹道、范围指示器、特效等)的 **父容器**。
|
||
* 2. 预留 doSkill() 方法用于外部触发技能视觉效果。
|
||
* 3. 提供 clear() 方法清除所有技能效果子节点。
|
||
* 4. 持有 light 预制体引用(预留,用于技能光效实例化)。
|
||
*
|
||
* 关键设计:
|
||
* - 与 EntityLayer 类似,使用 Timer 降频处理。
|
||
* - 深度排序逻辑当前已注释(预留)。
|
||
* - clear() 遍历子节点但未执行实际清理(需后续补充)。
|
||
*
|
||
* 依赖:
|
||
* - Timer(oops-framework)—— 降频计时器
|
||
* - BoxSet —— 游戏常量配置
|
||
*/
|
||
/*
|
||
* @Author: dgflash
|
||
* @Date: 2022-08-04 15:22:33
|
||
* @LastEditors: dgflash
|
||
* @LastEditTime: 2023-05-12 18:04:45
|
||
*/
|
||
import { Component, Node, Prefab, _decorator ,instantiate} from 'cc';
|
||
import { Timer } from '../../../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer';
|
||
import {oops} from "../../../../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||
import { BoxSet } from '../../../../common/config/GameSet';
|
||
const { ccclass, property } = _decorator;
|
||
|
||
/**
|
||
* SkillLayer —— 技能效果图层
|
||
*
|
||
* 所有技能视觉效果节点的父容器,预留排序和技能触发功能。
|
||
*/
|
||
@ccclass('SkillLayer')
|
||
export default class SkillLayer extends Component {
|
||
/** 降频计时器(0.2 秒间隔) */
|
||
private timer: Timer = new Timer(0.2);
|
||
|
||
/** 技能光效预制体(在编辑器中绑定,预留) */
|
||
@property(Prefab)
|
||
light: Prefab = null;
|
||
|
||
/** 初始化:预留全局事件监听位 */
|
||
onLoad(){
|
||
// oops.message.on("do_use_skill", this.doSkill, this);
|
||
|
||
}
|
||
|
||
/** 外部触发技能效果(预留) */
|
||
doSkill(){
|
||
}
|
||
|
||
/** 帧更新(预留深度排序逻辑) */
|
||
update(dt: number) {
|
||
// this.timer.update(dt)
|
||
// if (this.timer.update(dt))
|
||
// this.node.children.sort(this.zIndexSort);
|
||
}
|
||
|
||
start(){
|
||
}
|
||
|
||
/** 清除图层下的所有技能效果节点(预留实现) */
|
||
public clear() {
|
||
this.node.children.forEach(n => {
|
||
|
||
});
|
||
}
|
||
}
|