"use strict"; cc._RF.push(module, '87f1eJpiIlJ1okfTVenQlb0', 'GameSceneUnlockTool'); // scripts/ui/gameScene/GameSceneUnlockTool.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 BattleConst_1 = require("../../kernel/battle/BattleConst"); var TableDefine_1 = require("../../kernel/table/TableDefine"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var GameSceneUnlockTool = /** @class */ (function (_super) { __extends(GameSceneUnlockTool, _super); function GameSceneUnlockTool() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._configId = 0; _this._config = null; _this._disableNode = null; _this._enableNode = null; return _this; //#endregion } Object.defineProperty(GameSceneUnlockTool.prototype, "config", { get: function () { return this._config; }, enumerable: false, configurable: true }); //#region LIFE-CYCLE CALLBACKS: GameSceneUnlockTool.prototype.onLoad = function () { this._disableNode = this.node.getChildByName('btn').getChildByName('disableNode'); this._enableNode = this.node.getChildByName('btn').getChildByName('enableNode'); this._disableNode.active = true; this._enableNode.active = false; }; GameSceneUnlockTool.prototype.start = function () { }; GameSceneUnlockTool.prototype.onEnable = function () { BattleConst_1.getGlobalNode().on(Global_1.GlobalEvent.CHANGE_EVENT_STAR, this.refresh, this); this.refresh(); }; GameSceneUnlockTool.prototype.onDisable = function () { BattleConst_1.getGlobalNode().off(Global_1.GlobalEvent.CHANGE_EVENT_STAR, this.refresh, this); }; // update (dt) {} //#endregion //#region public method GameSceneUnlockTool.prototype.setObjId = function (id) { this._configId = id; this._config = Global_1.tMgr.getConfig(TableDefine_1.TableName.GAME_SCENE_OBJ, id); this.refresh(); }; //#endregion //#region private method GameSceneUnlockTool.prototype.refresh = function () { if (this._config) { this._disableNode.active = SaveDataManager_1.SaveDataManager.ins.runtimeData.star < this._config.Star; this._enableNode.active = !this._disableNode.active; } }; GameSceneUnlockTool = __decorate([ ccclass ], GameSceneUnlockTool); return GameSceneUnlockTool; }(cc.Component)); exports.default = GameSceneUnlockTool; cc._RF.pop();