ui修改
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
_decorator,
|
||||
Label,
|
||||
Sprite,
|
||||
} from "cc";
|
||||
import { _decorator, isCCObject, Label, Node, Sprite } from "cc";
|
||||
import Utils from "../../../Main/Common/Utils";
|
||||
import li_BaseView from "../../../Main/Common/li_BaseView";
|
||||
import { GButton } from "../../../Main/Common/GButton";
|
||||
@@ -10,8 +6,7 @@ import { DataManager, DataId } from "../../data/DataManager";
|
||||
import { PlayerData } from "../../data/PlayerData";
|
||||
import { AccountData } from "../../data/AccountData";
|
||||
import { WalletData } from "../../data/WalletData";
|
||||
import LanguageUtils, {
|
||||
} from "../../../Main/Common/LanguageUtils";
|
||||
import LanguageUtils from "../../../Main/Common/LanguageUtils";
|
||||
import {
|
||||
NavigationManager,
|
||||
PageTransitionType,
|
||||
@@ -19,6 +14,7 @@ import {
|
||||
import { PlayerDataService } from "../../network/services/PlayerDataService";
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
||||
import { TipsPanel } from "./TipsPanel";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -41,6 +37,12 @@ export class PersonalPanel extends li_BaseView {
|
||||
@property(Sprite)
|
||||
private avatarSprite: Sprite = null;
|
||||
|
||||
@property([Node])
|
||||
private vipStuff: Node[] = [];
|
||||
|
||||
@property([Node])
|
||||
private notVipStuff: Node[] = [];
|
||||
|
||||
private playerData: PlayerData = null;
|
||||
private accountData: AccountData = null;
|
||||
private walletData: WalletData = null;
|
||||
@@ -79,6 +81,11 @@ export class PersonalPanel extends li_BaseView {
|
||||
if (this._nodeTab.settingBtn) {
|
||||
GButton.BandClick(this._nodeTab.settingBtn, this.openSettings, this);
|
||||
}
|
||||
|
||||
//
|
||||
if (this._nodeTab.favoritesBtn) {
|
||||
GButton.BandClick(this._nodeTab.favoritesBtn, this.openFavorites, this);
|
||||
}
|
||||
}
|
||||
|
||||
private async refresh() {
|
||||
@@ -125,20 +132,25 @@ export class PersonalPanel extends li_BaseView {
|
||||
}
|
||||
|
||||
private updateVipStatus(): void {
|
||||
let isVip = false;
|
||||
if (this.vipStatusLabel && this.walletData) {
|
||||
const vipExpire = this.walletData.vipExpire;
|
||||
if (vipExpire && vipExpire > Date.now()) {
|
||||
const expireDate = new Date(vipExpire);
|
||||
|
||||
this.vipStatusLabel.string = `${LanguageUtils.getText(
|
||||
"purchasepanel.vip_left"
|
||||
)} ${expireDate.toLocaleDateString()}`;
|
||||
if (vipExpire && this.walletData.isVip) {
|
||||
const leftTime = Utils.formatVipLeftTime(vipExpire);
|
||||
|
||||
this.vipStatusLabel.string = leftTime;
|
||||
|
||||
isVip = true;
|
||||
} else {
|
||||
this.vipStatusLabel.string = LanguageUtils.getText(
|
||||
"purchasepanel.notvip"
|
||||
);
|
||||
// this.vipStatusLabel.string = LanguageUtils.getText(
|
||||
// "purchasepanel.notvip"
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
this.vipStuff.forEach((n) => (n.active = isVip));
|
||||
this.notVipStuff.forEach((n) => (n.active = !isVip));
|
||||
}
|
||||
|
||||
private openSettings(): void {
|
||||
@@ -156,4 +168,8 @@ export class PersonalPanel extends li_BaseView {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private openFavorites() {
|
||||
TipsPanel.show("敬请期待~");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user