更新页面 商店、主题
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user