4aaa03d9-90ff-4ba9-a84f-bdef109b7c4c.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. "use strict";
  2. cc._RF.push(module, '4aaa0PZkP9LqahPve8Qm3xM', 'NodeLevel');
  3. // Script/view/chooseLevel/NodeLevel.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. 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;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var hallScene_1 = require("../../hallScene");
  26. var App_1 = require("../../Manager/App");
  27. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  28. var NodeLevel = /** @class */ (function (_super) {
  29. __extends(NodeLevel, _super);
  30. function NodeLevel() {
  31. var _this = _super !== null && _super.apply(this, arguments) || this;
  32. _this.labelDiamond = [];
  33. _this.key = [];
  34. _this.star = [];
  35. _this.labelExp = null;
  36. _this.btnStart = null;
  37. return _this;
  38. // update (dt) {}
  39. }
  40. NodeLevel.prototype.onLoad = function () {
  41. for (var i = 0; i < 3; i++) {
  42. this.labelDiamond[i] = this.node.getChildByName("LabelRewardDiamond" + i).getComponent(cc.Label);
  43. this.key[i] = this.node.getChildByName("key" + i);
  44. this.star[i] = this.node.getChildByName("star" + i);
  45. }
  46. this.btnStart.node.on("click", this.clickGameStart.bind(this), this);
  47. };
  48. NodeLevel.prototype.start = function () {
  49. this.findPlayerLevel();
  50. };
  51. NodeLevel.prototype.findPlayerLevel = function () {
  52. var curlevel = App_1.App.DataManager.PlayLevel;
  53. this.freshLevelNum(curlevel);
  54. };
  55. NodeLevel.prototype.freshLevelNum = function (index) {
  56. App_1.App.DataManager.PlayLevel = index;
  57. this.labelExp.string = "Level " + index + "_" + App_1.App.DataManager.PassProgress[index];
  58. for (var i = 0; i < this.labelDiamond.length; i++) {
  59. this.star[i].active = App_1.App.DataManager.PassProgress[index] >= i + 1;
  60. this.key[i].active = App_1.App.DataManager.keyPos[index - 1] == i + 1;
  61. this.labelDiamond[i].string = App_1.App.DataManager.diamondNum[index - 1][i] + "";
  62. }
  63. };
  64. NodeLevel.prototype.clickGameStart = function () {
  65. hallScene_1.default.instance.StartGame(App_1.App.DataManager.PlayLevel);
  66. };
  67. __decorate([
  68. property(cc.Label)
  69. ], NodeLevel.prototype, "labelExp", void 0);
  70. __decorate([
  71. property(cc.Button)
  72. ], NodeLevel.prototype, "btnStart", void 0);
  73. NodeLevel = __decorate([
  74. ccclass
  75. ], NodeLevel);
  76. return NodeLevel;
  77. }(cc.Component));
  78. exports.default = NodeLevel;
  79. cc._RF.pop();