更新页面 商店、主题

This commit is contained in:
2025-09-18 14:06:53 +08:00
parent 015bc1c2f7
commit 246d83f7bc
134 changed files with 14949 additions and 4424 deletions
@@ -1,9 +1,10 @@
import { _decorator, Component, Label, Node } from "cc";
import { _decorator, Component, Label, Node, Sprite } from "cc";
import { PurchasePanel } from "../ui/panels/PurchasePanel";
import { PurchaseConfig } from "../../schema/schema";
import { DataManager, DataId } from "../data/DataManager";
import { ShopData } from "../data/ShopData";
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
import ResManager from "../../Main/Manager/ResManager";
const { ccclass, property } = _decorator;
@@ -14,21 +15,40 @@ export class PurchasePanelItem extends Component {
@property(Label)
price: Label;
@property(Sprite)
icon: Sprite;
baseView: PurchasePanel;
goodId: number;
public init(base: PurchasePanel, goodId: number) {
public init(base: PurchasePanel) {
this.baseView = base;
this.goodId = goodId;
GButton.BandClick(this.node, this.onClickThis, this);
}
public refresh(goodId: number) {
this.goodId = goodId;
this.show();
}
public show() {
const shopData = DataManager.I.getDataById<ShopData>(DataId.Shop);
const count = shopData.getCountById(this.goodId);
this.count.string = count.toString();
const price = shopData.getOriginalPriceById(this.goodId);
this.price.string = price.toString();
let path = "";
if (this.goodId > 2000) {
// web3币
path += "ui/shop/coin/";
} //cash
else {
path += "ui/shop/cash/";
}
path += this.goodId;
ResManager.I.changeResourceSpriteFrame(this.icon, path);
}
async onClickThis() {
+26 -9
View File
@@ -2,7 +2,10 @@ import { _decorator, Component, Label, Node, Sprite, UITransform } from "cc";
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
import Utils from "db://assets/Scripts/Main/Common/Utils";
import { NavigationManager, PageTransitionType } from "../manager/NavigationManager";
import {
NavigationManager,
PageTransitionType,
} from "../manager/NavigationManager";
import LanguageUtils from "../../Main/Common/LanguageUtils";
import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
import { DataManager, DataId } from "../data/DataManager";
@@ -18,6 +21,8 @@ export class ThemeItem extends Component {
lockCover: Sprite;
@property(Label)
titleName: Label;
@property(UITransform)
titleNameBg: UITransform;
@property(Node)
loading: Node;
@@ -34,17 +39,28 @@ export class ThemeItem extends Component {
key: string;
protected onLoad(): void {
Utils.addInnerEL(InnerMsgCode.LanguageChange, this, () => {
this.titleName.string = LanguageUtils.getText(this.key);
this.updateTitle();
});
}
protected onDestroy(): void {
Utils.removeInnerEL(InnerMsgCode.LanguageChange, this, () => {
this.titleName.string = LanguageUtils.getText(this.key);
this.updateTitle();
});
}
updateTitle() {
this.titleName.string = LanguageUtils.getText(this.key);
this.scheduleOnce(() => {
const size = this.titleName.getComponent(UITransform).contentSize;
this.titleNameBg.setContentSize(
size.x + 65,
this.titleNameBg.contentSize.y
);
}, 0);
}
refresh(themeId: number, parentPanel?: any) {
this.loading.active = true;
if (this.loading) this.loading.active = true;
this.parentPanel = parentPanel;
// 主题数据
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
@@ -52,9 +68,7 @@ export class ThemeItem extends Component {
!themeData.getIsReleaseById(themeId);
this.isLocked = !themeData.getIsReleaseById(themeId);
this.key = themeData.getLanKeyById(themeId);
this.titleName.string = LanguageUtils.getText(
themeData.getLanKeyById(themeId)
);
this.updateTitle();
this.category = themeData.getCategoryById(themeId);
ResManager.I.changeBundleSpriteFrame(
this.img,
@@ -63,7 +77,7 @@ export class ThemeItem extends Component {
() => {
let sizeTran = this.img.node.parent.getComponent(UITransform);
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.img.node, 3);
this.loading.active = false;
if (this.loading) this.loading.active = false;
}
);
GButton.RemoveAndBandClick(this.node, this.OnClickThis, this);
@@ -74,7 +88,10 @@ export class ThemeItem extends Component {
return;
}
console.log("[ThemeItem] Opening GirlListPanel for category:", this.category);
console.log(
"[ThemeItem] Opening GirlListPanel for category:",
this.category
);
// 不使用过渡动画,直接打开
NavigationManager.Instance.navigateToGirlList(this.category);
}