"use strict"; cc._RF.push(module, '08ec2SZNqRHfJj89TZnpxKq', 'ShopPanel'); // Script/view/shopView/ShopPanel.ts "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var BaseView_1 = require("../../../lightMVC/core/base/BaseView"); var gameScene_1 = require("../../gameScene"); var App_1 = require("../../Manager/App"); var hallModel_1 = require("../../model/hallModel"); var TipPanel_1 = require("../tipPanel/TipPanel"); var TipPanelMediator_1 = require("../tipPanel/TipPanelMediator"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var ShopPanel = /** @class */ (function (_super) { __extends(ShopPanel, _super); function ShopPanel() { return _super !== null && _super.apply(this, arguments) || this; } // private goodsTip: any = ["体力恢复速度*2", "通关金币产出*2", "签到奖励*2"]; ShopPanel.prototype.drawView = function () { var _this = this; var closeBtn = this.ui.getNode("close"); closeBtn.on(cc.Node.EventType.TOUCH_END, function () { _this.closeView(); }, this); var _loop_1 = function (i) { var btnItem = this_1.ui.getNode("btnItem" + i); // btnItem.on(cc.Node.EventType.TOUCH_END, () => { // App.Facade.popView(TipPanelMediator, TipPanel, this.goodsTip[i], false); // }, this); var btn_goumai = btnItem.getChildByName("btn_goumai"); btn_goumai.on(cc.Node.EventType.TOUCH_END, function () { if (App_1.App.DataManager.UserCoin >= App_1.App.DataManager.propPrice[i]) { App_1.App.DataManager.PropNum[i] += 3; App_1.App.DataManager.UserCoin -= App_1.App.DataManager.propPrice[i]; App_1.App.Facade.getModel(hallModel_1.default).updateCoinNumber(); App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Coin, App_1.App.DataManager.UserCoin); App_1.App.LocalStorageUtil.setJsonObj(App_1.App.LocalStorageUtil.lst_PropNum, App_1.App.DataManager.PropNum); if (cc.director.getScene().name == "gameScene") { gameScene_1.default.instance.initProp(); } App_1.App.Facade.popView(TipPanelMediator_1.default, TipPanel_1.default, "purchase succeeds", false); } else { App_1.App.Facade.popView(TipPanelMediator_1.default, TipPanel_1.default, "Not enough gold coins", false); } }, this_1); }; var this_1 = this; for (var i = 0; i < 5; i++) { _loop_1(i); } }; ShopPanel.path = function () { return "hallScene/prefabs/ShopPanel"; }; ShopPanel = __decorate([ ccclass ], ShopPanel); return ShopPanel; }(BaseView_1.BaseView)); exports.default = ShopPanel; cc._RF.pop();