This commit is contained in:
2025-09-15 16:11:15 +08:00
parent eb0163b3fc
commit 5a5014b024
26 changed files with 2400 additions and 754 deletions
@@ -2,11 +2,8 @@ import { _decorator, Component, Label, Node } from "cc";
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
import Utils from "db://assets/Scripts/Main/Common/Utils";
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
import {
NavigationManager,
PanelType,
} from "../../manager/NavigationManager";
import { NavigationManager, PanelType } from "../../manager/NavigationManager";
import { NavigationBtn } from "../items/NavigationBtn";
const { ccclass, property } = _decorator;
@@ -15,20 +12,21 @@ export class NavigationPanel extends li_BaseView {
private _nodeTab: any = {};
private currentActivePanel: PanelType = PanelType.THEME;
private themeBtn: Node;
private girlDetailBtn: Node;
private chatBtn: Node;
private settingBtn: Node;
private themeBtn: NavigationBtn;
private girlDetailBtn: NavigationBtn;
private chatBtn: NavigationBtn;
private settingBtn: NavigationBtn;
private loadingView: Node;
onLoadCT() {
Utils.parseNode(this.node, this._nodeTab);
this.themeBtn = this._nodeTab.themeBtn;
this.girlDetailBtn = this._nodeTab.girlDetailBtn;
this.chatBtn = this._nodeTab.chatBtn;
this.settingBtn = this._nodeTab.settingBtn;
this.themeBtn = this._nodeTab.themeBtn.getComponent(NavigationBtn);
this.girlDetailBtn =
this._nodeTab.girlDetailBtn.getComponent(NavigationBtn);
this.chatBtn = this._nodeTab.chatBtn.getComponent(NavigationBtn);
this.settingBtn = this._nodeTab.settingBtn.getComponent(NavigationBtn);
this.loadingView = this._nodeTab.loadingView;
this.hideLoading();
@@ -46,22 +44,24 @@ export class NavigationPanel extends li_BaseView {
private registerListener() {
// 所有按钮点击都通过NavigationManager处理
GButton.BandClick(
this.themeBtn,
() => NavigationManager.Instance.switchToPanel(PanelType.THEME),
this.themeBtn.node,
() => {
NavigationManager.Instance.switchToPanel(PanelType.THEME);
},
this
);
GButton.BandClick(
this.girlDetailBtn,
this.girlDetailBtn.node,
() => NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL),
this
);
GButton.BandClick(
this.chatBtn,
this.chatBtn.node,
() => NavigationManager.Instance.switchToPanel(PanelType.CHAT),
this
);
GButton.BandClick(
this.settingBtn,
this.settingBtn.node,
() => NavigationManager.Instance.switchToPanel(PanelType.SETTING),
this
);
@@ -75,6 +75,7 @@ export class NavigationPanel extends li_BaseView {
this.currentActivePanel = activePanel;
this._nodeTab.CurrentPanel.getComponent(Label).string =
this.currentActivePanel;
this.refreshButtonVisuals();
}
@@ -88,6 +89,13 @@ export class NavigationPanel extends li_BaseView {
"[NavigationPanel] Button states updated for:",
this.currentActivePanel
);
this.themeBtn.setFocus(this.currentActivePanel === PanelType.THEME);
this.girlDetailBtn.setFocus(
this.currentActivePanel === PanelType.GIRL_DETAIL
);
this.chatBtn.setFocus(this.currentActivePanel === PanelType.CHAT);
this.settingBtn.setFocus(this.currentActivePanel === PanelType.SETTING);
}
private initializeFirstPanel() {