个人信息页入版
This commit is contained in:
@@ -62,7 +62,7 @@ export class NavigationPanel extends li_BaseView {
|
||||
);
|
||||
GButton.BandClick(
|
||||
this.settingBtn.node,
|
||||
() => NavigationManager.Instance.switchToPanel(PanelType.SETTING),
|
||||
() => NavigationManager.Instance.switchToPanel(PanelType.PERSONAL),
|
||||
this
|
||||
);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ export class NavigationPanel extends li_BaseView {
|
||||
this.currentActivePanel === PanelType.GIRL_DETAIL
|
||||
);
|
||||
this.chatBtn.setFocus(this.currentActivePanel === PanelType.CHAT);
|
||||
this.settingBtn.setFocus(this.currentActivePanel === PanelType.SETTING);
|
||||
this.settingBtn.setFocus(this.currentActivePanel === PanelType.PERSONAL);
|
||||
}
|
||||
|
||||
private initializeFirstPanel() {
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
import {
|
||||
_decorator,
|
||||
Component,
|
||||
Node,
|
||||
Label,
|
||||
Sprite,
|
||||
Button,
|
||||
tween,
|
||||
Vec3,
|
||||
} from "cc";
|
||||
import Utils from "../../../Main/Common/Utils";
|
||||
import li_BaseView from "../../../Main/Common/li_BaseView";
|
||||
import { GButton } from "../../../Main/Common/GButton";
|
||||
import PlayerDataManager from "../../../Main/Manager/PlayerDataManager";
|
||||
import { DataManager, DataId } from "../../data/DataManager";
|
||||
import { PlayerData } from "../../data/PlayerData";
|
||||
import { AccountData } from "../../data/AccountData";
|
||||
import { WalletData } from "../../data/WalletData";
|
||||
import LanguageUtils, {
|
||||
LanguageType,
|
||||
} from "../../../Main/Common/LanguageUtils";
|
||||
import AudioManager from "../../../Main/Manager/AudioManager";
|
||||
import { NavigationManager } from "../../manager/NavigationManager";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("PersonalPanel")
|
||||
export class PersonalPanel extends li_BaseView {
|
||||
private _nodeTab: any = {};
|
||||
|
||||
@property(Label)
|
||||
private userNameLabel: Label = null;
|
||||
|
||||
@property(Label)
|
||||
private userIdLabel: Label = null;
|
||||
|
||||
@property(Label)
|
||||
private balanceLabel: Label = null;
|
||||
|
||||
@property(Label)
|
||||
private vipStatusLabel: Label = null;
|
||||
|
||||
@property(Sprite)
|
||||
private avatarSprite: Sprite = null;
|
||||
|
||||
private playerData: PlayerData = null;
|
||||
private accountData: AccountData = null;
|
||||
private walletData: WalletData = null;
|
||||
|
||||
protected start(): void {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
this.initUI();
|
||||
this.registerListener();
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
onEnable() {
|
||||
this.initData();
|
||||
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
private initData(): void {
|
||||
this.playerData = DataManager.I.getDataById<PlayerData>(DataId.Player);
|
||||
this.accountData = DataManager.I.getDataById<AccountData>(DataId.Account);
|
||||
this.walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
}
|
||||
|
||||
private initUI(): void {}
|
||||
|
||||
private registerListener(): void {
|
||||
// 注册关闭按钮
|
||||
if (this._nodeTab.closeBtn) {
|
||||
GButton.BandClick(this._nodeTab.closeBtn, this.close, this);
|
||||
}
|
||||
if (this._nodeTab.WalletBtn) {
|
||||
GButton.BandClick(this._nodeTab.WalletBtn, this.openPurchase, this);
|
||||
}
|
||||
|
||||
// 注册设置按钮
|
||||
if (this._nodeTab.settingBtn) {
|
||||
GButton.BandClick(this._nodeTab.settingBtn, this.openSettings, this);
|
||||
}
|
||||
}
|
||||
|
||||
private refresh(): void {
|
||||
this.updateUserInfo();
|
||||
this.updateBalance();
|
||||
this.updateVipStatus();
|
||||
}
|
||||
|
||||
private updateUserInfo(): void {
|
||||
// 更新用户名
|
||||
if (this.userNameLabel && this.playerData) {
|
||||
const userName = this.playerData.name || "未设置";
|
||||
this.userNameLabel.string = userName;
|
||||
}
|
||||
|
||||
// 更新用户ID
|
||||
if (this.userIdLabel && this.accountData) {
|
||||
const userId = this.accountData.accId || "游客";
|
||||
this.userIdLabel.string = `uid: ${userId}`;
|
||||
}
|
||||
|
||||
// 头像暂时留空,等待资源配置
|
||||
if (this.avatarSprite) {
|
||||
// TODO: 设置默认头像或从数据中获取头像
|
||||
}
|
||||
}
|
||||
|
||||
private updateBalance(): void {
|
||||
if (this.balanceLabel && this.walletData) {
|
||||
const balance = this.walletData.getOriginalBalance();
|
||||
this.balanceLabel.string = `余额: ${balance}`;
|
||||
}
|
||||
}
|
||||
|
||||
private updateVipStatus(): void {
|
||||
if (this.vipStatusLabel && this.walletData) {
|
||||
const vipExpire = this.walletData.vipExpire;
|
||||
if (vipExpire && vipExpire > Date.now()) {
|
||||
const expireDate = new Date(vipExpire);
|
||||
this.vipStatusLabel.string = `VIP至: ${expireDate.toLocaleDateString()}`;
|
||||
} else {
|
||||
this.vipStatusLabel.string = "普通用户";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private openSettings(): void {
|
||||
// TODO: 打开设置面板
|
||||
NavigationManager.Instance.openSubPanel("SettingPanel", this.node);
|
||||
}
|
||||
private openPurchase() {
|
||||
NavigationManager.Instance.openSubPanel("PurchasePanel", this.node);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "a12352fe-e052-4f12-b1d0-59763379c145",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -331,8 +331,8 @@ export class ThemePanel extends li_BaseView {
|
||||
}
|
||||
|
||||
openSetting() {
|
||||
// 通过NavigationManager切换到设置面板,保持动画和状态同步
|
||||
NavigationManager.Instance.switchToPanel(PanelType.SETTING);
|
||||
// 通过NavigationManager切换到个人信息面板,保持动画和状态同步
|
||||
NavigationManager.Instance.switchToPanel(PanelType.PERSONAL);
|
||||
}
|
||||
|
||||
openMsgBox() {
|
||||
|
||||
Reference in New Issue
Block a user