35 lines
1019 B
TypeScript
35 lines
1019 B
TypeScript
import { _decorator, Component, Label, Node } from "cc";
|
|
import { PurchasePanel } from "../ui/panels/PurchasePanel";
|
|
import { PurchaseConfig } from "../../schema/schema";
|
|
import { DataManager, DataId } from "../data/DataManager";
|
|
import { ShopData } from "../data/ShopData";
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass("PurchasePanelItem")
|
|
export class PurchasePanelItem extends Component {
|
|
@property(Label)
|
|
count: Label;
|
|
@property(Label)
|
|
price: Label;
|
|
|
|
baseView: PurchasePanel;
|
|
goodId: number;
|
|
public init(base: PurchasePanel, goodId: number) {
|
|
this.baseView = base;
|
|
this.goodId = goodId;
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
onClickThis() {
|
|
this.baseView.setDiamondTag(this.goodId);
|
|
console.log("点击了");
|
|
}
|
|
}
|