feat(missionHome): 添加天赋按钮并优化底部栏选中状态
1. 新增天赋按钮节点引用与相关页面切换逻辑 2. 封装setBarActive方法统一处理按钮选中态显示 3. 调整页面切换时的按钮状态更新逻辑
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -49,7 +49,11 @@ export class MissionHomeComp extends CCComp {
|
||||
/** 排行榜按钮节点 */
|
||||
@property(Node)
|
||||
rank_btn=null!
|
||||
/** 排行榜按钮节点 */
|
||||
/** 天赋按钮节点 */
|
||||
@property(Node)
|
||||
tals_btn=null!
|
||||
|
||||
|
||||
@property(Node)
|
||||
heros_page=null!
|
||||
@property(Node)
|
||||
@@ -96,12 +100,28 @@ export class MissionHomeComp extends CCComp {
|
||||
this.heros_page.active = (page === this.heros_page)
|
||||
this.talents_page.active = (page === this.talents_page)
|
||||
this.ranks_page.active = (page === this.ranks_page)
|
||||
|
||||
this.setBarActive(this.hero_btn, page === this.heros_page)
|
||||
this.setBarActive(this.tals_btn, page === this.talents_page)
|
||||
this.setBarActive(this.rank_btn, page === this.ranks_page)
|
||||
this.setBarActive(this.home_btn, false)
|
||||
}
|
||||
|
||||
private hideAllPages() {
|
||||
this.heros_page.active = false
|
||||
this.talents_page.active = false
|
||||
this.ranks_page.active = false
|
||||
|
||||
this.setBarActive(this.home_btn, true)
|
||||
this.setBarActive(this.hero_btn, false)
|
||||
this.setBarActive(this.tals_btn, false)
|
||||
this.setBarActive(this.rank_btn, false)
|
||||
}
|
||||
|
||||
private setBarActive(btn: Node, active: boolean) {
|
||||
if (!btn) return
|
||||
const child = btn.getChildByName("active")
|
||||
if (child) child.active = active
|
||||
}
|
||||
|
||||
openRanks() {
|
||||
|
||||
Reference in New Issue
Block a user