update
This commit is contained in:
@@ -23,6 +23,7 @@ import { ImagePopup } from "../components/ImagePopup";
|
||||
import { TipsPanel } from "./TipsPanel";
|
||||
import ResManager from "../../../Main/Manager/ResManager";
|
||||
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
||||
import { NavigationManager } from "../../manager/NavigationManager";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -35,9 +36,6 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
private resId: number;
|
||||
private type: proto.cs.EnmResType;
|
||||
private base: DetailImageItem | ImagePopup;
|
||||
private balanceCount: Label;
|
||||
|
||||
private desc: Label;
|
||||
|
||||
img: Sprite;
|
||||
uitransform: UITransform;
|
||||
@@ -55,11 +53,8 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
.start();
|
||||
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
this.desc = this._nodeTab.content.getComponent(Label);
|
||||
this.uitransform = this._nodeTab.Img_Frame.getComponent(UITransform);
|
||||
this.img = this._nodeTab.img.getComponent(Sprite);
|
||||
let descText = LanguageUtils.getText("popupgirldetailpanel.content");
|
||||
this.balanceCount = this._nodeTab.balanceCount.getComponent(Label);
|
||||
this.refreshCoinNum();
|
||||
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
@@ -104,18 +99,17 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
ResManager.I.changeRemoteSpriteFrame(this.img, newPath, () => {
|
||||
this.scaleToFillItem();
|
||||
});
|
||||
this.desc.string = descText.replace("{price}", this.priceLabel.string);
|
||||
|
||||
this.registerListener();
|
||||
}
|
||||
registerListener() {
|
||||
GButton.BandClick(this._nodeTab.BuyBtn, this.buyCharacter, this);
|
||||
GButton.BandClick(this._nodeTab.BuyBtn, this.buyAsset, this);
|
||||
GButton.BandClick(this._nodeTab.CloseBtn, this.Close, this);
|
||||
}
|
||||
Close() {
|
||||
this.close();
|
||||
}
|
||||
async buyCharacter() {
|
||||
async buyAsset() {
|
||||
// 购买id为girlId的女生
|
||||
logger.log(this.girlId + "---" + this.resId);
|
||||
|
||||
@@ -147,17 +141,16 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
} else {
|
||||
this.base.refreshSelf();
|
||||
}
|
||||
this.close();
|
||||
TipsPanel.show("Buy Succeed");
|
||||
NavigationManager.Instance.openPopupPanel("ReleasePanel");
|
||||
} else {
|
||||
TipsPanel.show("Insufficient balance, need to purchase");
|
||||
NavigationManager.Instance.openPopupPanel("ChargePopPanel");
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
// 刷新余额
|
||||
private refreshCoinNum() {
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
const balance = walletData.getOriginalBalance();
|
||||
this.balanceCount.string = balance.toString();
|
||||
}
|
||||
scaleToFillItem() {
|
||||
if (!this.img || !this.img.spriteFrame) return;
|
||||
|
||||
Reference in New Issue
Block a user