refactor(ui): 调整UI页面管理方式,改为节点显隐控制
1. 注释并禁用了Ranks、Heros、Talents三个UIID的全局弹窗配置 2. 将三个页面改为通过MissionHomeComp控制节点显隐切换 3. 移除了原有的gui.open/remove弹窗调用逻辑,改为设置active状态 4. 调整了组件生命周期,改用onEnable替代onAdded处理显示逻辑 5. 更新了对应组件的注释和文档说明
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*
|
||||
* 依赖:
|
||||
* - GameEvent.MissionStart / MissionEnd —— 游戏生命周期事件
|
||||
* - UIID.Ranks —— 排行榜弹窗 ID
|
||||
* - UIID.Mission —— 战斗界面 ID
|
||||
*/
|
||||
import { _decorator, instantiate, Prefab, resources, Sprite, SpriteAtlas, UITransform ,Node} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
@@ -92,15 +92,26 @@ export class MissionHomeComp extends CCComp {
|
||||
|
||||
}
|
||||
|
||||
/** 打开排行榜弹窗 */
|
||||
openRanks(){
|
||||
oops.gui.open(UIID.Ranks)
|
||||
private showPage(page: Node) {
|
||||
this.heros_page.active = (page === this.heros_page)
|
||||
this.talents_page.active = (page === this.talents_page)
|
||||
this.ranks_page.active = (page === this.ranks_page)
|
||||
}
|
||||
openHero(){
|
||||
oops.gui.open(UIID.Heros)
|
||||
|
||||
private hideAllPages() {
|
||||
this.heros_page.active = false
|
||||
this.talents_page.active = false
|
||||
this.ranks_page.active = false
|
||||
}
|
||||
openTalents(){
|
||||
oops.gui.open(UIID.Talents)
|
||||
|
||||
openRanks() {
|
||||
this.showPage(this.ranks_page)
|
||||
}
|
||||
openHero() {
|
||||
this.showPage(this.heros_page)
|
||||
}
|
||||
openTalents() {
|
||||
this.showPage(this.talents_page)
|
||||
}
|
||||
/** 任务结束回调:重新显示主页 */
|
||||
mission_end(){
|
||||
@@ -111,8 +122,8 @@ export class MissionHomeComp extends CCComp {
|
||||
/** 激活主页显示:刷新数据并显示节点 */
|
||||
home_active(){
|
||||
this.uodate_data()
|
||||
this.hideAllPages()
|
||||
this.node.active=true
|
||||
|
||||
}
|
||||
|
||||
/** 更新主页显示数据(预留) */
|
||||
|
||||
Reference in New Issue
Block a user