29 lines
726 B
TypeScript
29 lines
726 B
TypeScript
import { _decorator, Component, Label, Node } from "cc";
|
|
import { PurchasePanel } from "../ui/panels/PurchasePanel";
|
|
import { PurchaseConfig } from "../../schema/schema";
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass("PurchasePanelItem")
|
|
export class PurchasePanelItem extends Component {
|
|
@property(Label)
|
|
count: Label;
|
|
@property(Label)
|
|
price: Label;
|
|
|
|
baseView: PurchasePanel;
|
|
data: PurchaseConfig;
|
|
public init(base: PurchasePanel, data: PurchaseConfig) {
|
|
this.baseView = base;
|
|
this.data = data;
|
|
}
|
|
|
|
public show() {
|
|
this.count.string = this.data.desc.toString();
|
|
this.price.string = this.data.count.toString();
|
|
}
|
|
|
|
onClickThis() {
|
|
this.baseView.setDiamondTag(this.data.id);
|
|
}
|
|
}
|