"use strict"; cc._RF.push(module, '4aaa0PZkP9LqahPve8Qm3xM', 'NodeLevel'); // Script/view/chooseLevel/NodeLevel.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 hallScene_1 = require("../../hallScene"); var App_1 = require("../../Manager/App"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var NodeLevel = /** @class */ (function (_super) { __extends(NodeLevel, _super); function NodeLevel() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.labelDiamond = []; _this.key = []; _this.star = []; _this.labelExp = null; _this.btnStart = null; return _this; // update (dt) {} } NodeLevel.prototype.onLoad = function () { for (var i = 0; i < 3; i++) { this.labelDiamond[i] = this.node.getChildByName("LabelRewardDiamond" + i).getComponent(cc.Label); this.key[i] = this.node.getChildByName("key" + i); this.star[i] = this.node.getChildByName("star" + i); } this.btnStart.node.on("click", this.clickGameStart.bind(this), this); }; NodeLevel.prototype.start = function () { this.findPlayerLevel(); }; NodeLevel.prototype.findPlayerLevel = function () { var curlevel = App_1.App.DataManager.PlayLevel; this.freshLevelNum(curlevel); }; NodeLevel.prototype.freshLevelNum = function (index) { App_1.App.DataManager.PlayLevel = index; this.labelExp.string = "Level " + index + "_" + App_1.App.DataManager.PassProgress[index]; for (var i = 0; i < this.labelDiamond.length; i++) { this.star[i].active = App_1.App.DataManager.PassProgress[index] >= i + 1; this.key[i].active = App_1.App.DataManager.keyPos[index - 1] == i + 1; this.labelDiamond[i].string = App_1.App.DataManager.diamondNum[index - 1][i] + ""; } }; NodeLevel.prototype.clickGameStart = function () { hallScene_1.default.instance.StartGame(App_1.App.DataManager.PlayLevel); }; __decorate([ property(cc.Label) ], NodeLevel.prototype, "labelExp", void 0); __decorate([ property(cc.Button) ], NodeLevel.prototype, "btnStart", void 0); NodeLevel = __decorate([ ccclass ], NodeLevel); return NodeLevel; }(cc.Component)); exports.default = NodeLevel; cc._RF.pop();