1234567891011121314151617181920212223242526272829303132333435363738394041 |
- const JMAlertBase = require('JMAlertBase');
- cc.Class({
- extends: JMAlertBase,
- editor: {
- menu: 'Shop/ShopItemAlert'
- },
- properties: {
- shopItemPrefab: cc.Prefab,
- shopItemNode: cc.Node
- },
- reloadData(data) {
- this._data = data;
- this.initUI();
- },
- initUI () {
- if (!this._data) return;
- let itemNode = cc.instantiate(this.shopItemPrefab);
- let shopItemCtr = itemNode.getComponent('ShopItem');
- shopItemCtr.reloadData(this._data);
- shopItemCtr.enabelClick(false);
- this.shopItemNode.addChild(itemNode);
- },
- certainOnClicked () {
- let goldNum = G.BagMgr.getItemNumById(JMC.ITEM_ID.GOLD);
- if (goldNum < this._data.cost) {
- G.AppUtils.getSceneCtrl().addToast('金币不足,分解饰品可获得');
- }
- else {
- G.ShopMgr.requestShopBuyItem(this._data.config.id, 1);
- this.close();
- }
- }
- });
|