协议调试:商城
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
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")
|
||||
@@ -11,18 +13,22 @@ export class PurchasePanelItem extends Component {
|
||||
price: Label;
|
||||
|
||||
baseView: PurchasePanel;
|
||||
data: PurchaseConfig;
|
||||
public init(base: PurchasePanel, data: PurchaseConfig) {
|
||||
goodId: number;
|
||||
public init(base: PurchasePanel, goodId: number) {
|
||||
this.baseView = base;
|
||||
this.data = data;
|
||||
this.goodId = goodId;
|
||||
}
|
||||
|
||||
public show() {
|
||||
this.count.string = this.data.count.toString();
|
||||
this.price.string = this.data.price.toString();
|
||||
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.data.id);
|
||||
this.baseView.setDiamondTag(this.goodId);
|
||||
console.log("点击了");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user