Files
pixelheros/assets/script/game/map/RanksComp.ts
panw ad0539d238 refactor(ui): 调整UI页面管理方式,改为节点显隐控制
1. 注释并禁用了Ranks、Heros、Talents三个UIID的全局弹窗配置
2. 将三个页面改为通过MissionHomeComp控制节点显隐切换
3. 移除了原有的gui.open/remove弹窗调用逻辑,改为设置active状态
4. 调整了组件生命周期,改用onEnable替代onAdded处理显示逻辑
5. 更新了对应组件的注释和文档说明
2026-05-27 16:18:26 +08:00

78 lines
2.1 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 分别为普通排名项和"我的排名"项的预制体。
*
* 依赖:
* - MissionHomeComp —— 通过节点 active 显隐控制页面切换
*/
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 { mLogger } from "../common/Logger";
const {property, ccclass } = _decorator;
/**
* RanksComp —— 排行榜视图组件
*
* 通过 MissionHomeComp 页面切换显示。
* 展示 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() {
}
protected onEnable(): void {
}
onDestroy() {
super.onDestroy();
}
/** 关闭排行榜页面 */
closeRanks(){
this.node.active = false
}
/** ECS 组件移除时销毁节点 */
reset() {
this.node.destroy();
}
}