Files
pixelheros/assets/script/game/map/RanksComp.ts
panw 2443dfce85 refactor(map): 为所有组件的onDestroy添加父类调用
统一修复组件销毁时未调用父类生命周期方法的问题,确保资源正确释放
2026-05-13 16:03:53 +08:00

83 lines
2.4 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.
/**
* @file RanksComp.ts
* @description 排行榜弹窗组件UI 视图层)
*
* 职责:
* 1. 展示排行榜界面,包含 Top1~Top3 特殊位和通用列表区域。
* 2. 提供关闭排行榜弹窗的按钮回调。
*
* 关键设计:
* - top1_node / top2_node / top3_node 用于展示前三名玩家的特殊样式。
* - lists_node 为滚动列表的容器节点。
* - list_prefab / melist_prefab 分别为普通排名项和"我的排名"项的预制体。
* - 当前 onLoad / onAdded 未实现具体逻辑,预留后期接入排行数据。
*
* 依赖:
* - UIID.Ranks —— 在 oops.gui 系统中注册的弹窗 ID
*/
import { _decorator, Animation, AnimationClip, Button, Event, Label, Node, NodeEventType, Sprite, resources, Prefab } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroInfo } from "../common/config/heroSet";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { Hero } from "../hero/Hero";
import { oops } from "db://oops-framework/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
import { mLogger } from "../common/Logger";
const {property, ccclass } = _decorator;
/**
* RanksComp —— 排行榜视图组件
*
* 通过 oops.gui.open(UIID.Ranks) 打开。
* 展示 Top3 + 通用列表 + 我的排名。
*/
@ccclass('RanksComp')
@ecs.register('RanksComp', false)
export class RanksComp extends CCComp {
/** 第 1 名展示节点 */
@property(Node)
top1_node=null!
/** 第 2 名展示节点 */
@property(Node)
top2_node=null!
/** 第 3 名展示节点 */
@property(Node)
top3_node=null!
/** 排名列表容器节点 */
@property(Node)
lists_node=null!
/** 普通排名项预制体 */
@property(Prefab)
list_prefab=null!
/** "我的排名"项预制体 */
@property(Prefab)
melist_prefab=null!
/** 预留:加载排行数据 */
onLoad() {
}
/** 预留:弹窗打开时接收参数 */
onAdded(args: any) {
}
onDestroy() {
super.onDestroy();
}
/** 关闭排行榜弹窗 */
closeRanks(){
oops.gui.remove(UIID.Ranks)
}
/** ECS 组件移除时销毁节点 */
reset() {
this.node.destroy();
}
}