"use strict"; cc._RF.push(module, '88744zRsc5DNrKMTeiTPJT3', 'UIGoldenAim'); // scripts/ui/uiView/UIGoldenAim.ts "use strict"; // Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html 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 SaveDataManager_1 = require("../../component/SaveDataManager"); var Global_1 = require("../../Global"); var TableDefine_1 = require("../../kernel/table/TableDefine"); var UIBase_1 = require("../UIBase"); var UIManager_1 = require("../UIManager"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var UIGoldenAim = /** @class */ (function (_super) { __extends(UIGoldenAim, _super); function UIGoldenAim() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.btn_ad = null; _this.btn_start = null; _this.btn_bonus = null; _this.openCount = 0; return _this; } UIGoldenAim.prototype.onEnable = function () { var price = Global_1.tMgr.getConfig(TableDefine_1.TableName.GAME_PLAY, 15).Value; this.node.getChildByName('btnDiamond').getComponentInChildren(cc.Label).string = price.toString(); this.btn_ad.getChildByName('Background').getChildByName('UI_General_Btn_yellow_ckgg').active = true; this.btn_ad.getChildByName('Background').getChildByName('UI_Finish_kxsx').active = false; this.openCount++; if (this.openCount > 1) { this.BtnPos_Change(); } }; //按钮位置轮换 UIGoldenAim.prototype.BtnPos_Change = function () { var tempPos = this.btn_start.position; this.btn_start.position = this.btn_bonus.position; this.btn_bonus.position = this.btn_ad.position; this.btn_ad.position = tempPos; }; UIGoldenAim.prototype.onCloseClick = function () { this.close(); }; UIGoldenAim.prototype.onBuyClick = function () { var price = Global_1.tMgr.getConfig(TableDefine_1.TableName.GAME_PLAY, 15).Value; // this.node.getChildByName('btnDiamond').getComponentInChildren(cc.Label).string = price if (SaveDataManager_1.SaveDataManager.ins.adjustDiamond(-price)) { var sec = Global_1.tMgr.getConfig(TableDefine_1.TableName.GAME_PLAY, 31).Value; var endTime = Date.now() + sec * 1000; SaveDataManager_1.SaveDataManager.ins.runtimeData.goldenAimEndTime = endTime; SaveDataManager_1.SaveDataManager.ins.saveData(); this.close(); } }; UIGoldenAim.prototype.onAdTryClick = function () { //AD 放广告,放完后调用 onTry // HeyGamePlatform.instance.showVideoAd(ADID.ADID_ADDCOIN, (_result) => { if (true) { this.onTry(); } else { console.log('视频播放失败'); } // }); }; UIGoldenAim.prototype.onTry = function () { SaveDataManager_1.SaveDataManager.ins.runtimeData.goldenAimTry = true; this.close(); }; UIGoldenAim.prototype.close = function () { UIManager_1.UIManager.ins.closeWindow(Global_1.WindowName.GOLDEN_AIM); // HeyGamePlatform.instance.hideGameNativeAd(); }; __decorate([ property(cc.Node) ], UIGoldenAim.prototype, "btn_ad", void 0); __decorate([ property(cc.Node) ], UIGoldenAim.prototype, "btn_start", void 0); __decorate([ property(cc.Node) ], UIGoldenAim.prototype, "btn_bonus", void 0); UIGoldenAim = __decorate([ ccclass ], UIGoldenAim); return UIGoldenAim; }(UIBase_1.UIBase)); exports.default = UIGoldenAim; cc._RF.pop();