docs: 为游戏地图模块添加详细的代码注释

为游戏地图模块的脚本文件添加全面的注释,说明每个组件的职责、关键设计、依赖关系和使用方式。注释覆盖了英雄信息面板、技能卡槽位管理器、排行榜弹窗、卡牌控制器、背景滚动组件等核心功能模块,提高了代码的可读性和维护性。

同时修复了英雄预制体的激活状态和技能效果预制体的尺寸参数。
This commit is contained in:
walkpan
2026-04-07 19:00:30 +08:00
parent 9a1d517aa9
commit e880613f8f
21 changed files with 1840 additions and 242 deletions

View File

@@ -1,3 +1,18 @@
/**
* @file SIconComp.ts
* @description 技能图标组件UI 视图层)
*
* 职责:
* 1. 根据技能 UUID 显示对应的技能图标。
* 2. 从预加载的资源中获取 SpriteFrame 并赋给子节点 "icon" 的 Sprite。
*
* 使用方式:
* 挂载在需要显示技能图标的节点上,外部调用 update_data(s_uuid) 传入技能 UUID。
*
* 依赖:
* - SkillSetSkillSet.ts—— 技能静态配置(含 icon 字段)
* - oops.res —— 已预加载的资源管理器
*/
import { _decorator, Sprite, SpriteFrame } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
@@ -6,22 +21,29 @@ import { oops } from "db://oops-framework/core/Oops";
const { ccclass, property } = _decorator;
/** 视图层对象 */
/**
* SIconCompComp —— 技能图标视图组件
*
* 从 SkillSet 查询技能配置获取 icon 路径,
* 通过 oops.res.get 获取已预加载的 SpriteFrame 并显示。
*/
@ccclass('SIconCompComp')
@ecs.register('SIconComp', false)
export class SIconCompComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
/**
* 更新技能图标显示。
* @param s_uuid 技能的唯一标识 UUID
*/
update_data(s_uuid:number){
let skill_data = SkillSet[s_uuid]
// 从预加载的资源中获取对应图标的 SpriteFrame 并赋值
this.node.getChildByName("icon").getComponent(Sprite).spriteFrame = oops.res.get("game/heros/cards/"+skill_data.icon, SpriteFrame)
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
/** ECS 组件移除时销毁节点 */
reset() {
this.node.destroy();
}