1ee5910e-8727-49ae-9207-11e16bd4606e.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. "use strict";
  2. cc._RF.push(module, '1ee59EOhydJrpIHEeFr1GBu', 'Rank');
  3. // Script/Rank.ts
  4. "use strict";
  5. // import Global from "../../Script/Global";
  6. var __extends = (this && this.__extends) || (function () {
  7. var extendStatics = function (d, b) {
  8. extendStatics = Object.setPrototypeOf ||
  9. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  10. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  11. return extendStatics(d, b);
  12. };
  13. return function (d, b) {
  14. extendStatics(d, b);
  15. function __() { this.constructor = d; }
  16. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17. };
  18. })();
  19. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  20. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  21. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  22. 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;
  23. return c > 3 && r && Object.defineProperty(target, key, r), r;
  24. };
  25. Object.defineProperty(exports, "__esModule", { value: true });
  26. var Global_1 = require("./Global");
  27. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  28. var Rank = /** @class */ (function (_super) {
  29. __extends(Rank, _super);
  30. function Rank() {
  31. // LIFE-CYCLE CALLBACKS:
  32. var _this = _super !== null && _super.apply(this, arguments) || this;
  33. _this.Ani = null;
  34. _this.Anistate = null;
  35. return _this;
  36. }
  37. Rank.prototype.onLoad = function () {
  38. var RemoteS = Global_1.default.instance.GetS();
  39. var phb = this.node.getChildByName("phb").children;
  40. var phbRank;
  41. var phbName;
  42. var phbFloor;
  43. var j = 0;
  44. var i = RemoteS.length - 1;
  45. // let len;
  46. var x = 0;
  47. var f = false;
  48. if (RemoteS.length >= 8) {
  49. x = RemoteS.length - 8;
  50. }
  51. for (; j < phb.length - x;) { //length = 8
  52. for (; (i >= 0 && j < RemoteS.length - x); i--) {
  53. phbName = phb[j].getChildByName("id").getComponent(cc.Label);
  54. phbRank = phb[j].getChildByName("rank").getComponent(cc.Label);
  55. phbFloor = phb[j].getChildByName("floor").getComponent(cc.Label);
  56. if (phbName.string == RemoteS[i].userId) {
  57. i++;
  58. }
  59. phbName.string = RemoteS[i].userId.slice(4);
  60. phbRank.string = RemoteS[i].rank;
  61. phbFloor.string = RemoteS[i].score;
  62. if (phbName.string == Global_1.default.instance.GetUSer().userId.slice(4)) {
  63. this.node.getChildByName("phbd1").getChildByName("myrank").getComponent(cc.Label).string
  64. = phb[j].getChildByName("rank").getComponent(cc.Label).string;
  65. this.node.getChildByName("phbd1").getChildByName("myfloor").getComponent(cc.Label).string
  66. = phb[j].getChildByName("floor").getComponent(cc.Label).string;
  67. f = true;
  68. }
  69. switch (RemoteS[i].rank) {
  70. case 1: {
  71. phb[j].getChildByName("model").active = true;
  72. break;
  73. }
  74. case 2: {
  75. phb[j].getChildByName("model").active = true;
  76. break;
  77. }
  78. case 3: {
  79. phb[j].getChildByName("model").active = true;
  80. break;
  81. }
  82. default: {
  83. break;
  84. }
  85. }
  86. j++;
  87. }
  88. j++;
  89. }
  90. if (!f) {
  91. this.node.getChildByName("phbd1").getChildByName("myfloor").getComponent(cc.Label).string
  92. = Global_1.default.instance.getLocalScore().BestScore.toString();
  93. this.node.getChildByName("phbd1").getChildByName("myrank").getComponent(cc.Label).string
  94. = Global_1.default.instance.GetR();
  95. }
  96. };
  97. Rank.prototype.start = function () {
  98. };
  99. Rank.prototype.update = function (dt) {
  100. };
  101. /**
  102. * close the rank Scene and load the start scene.
  103. */
  104. Rank.prototype.CloseRank = function () {
  105. console.log("this button is used to close this rank Scene");
  106. this.destroy();
  107. Global_1.default.instance.OverFlag = false;
  108. cc.director.loadScene("StartScene");
  109. };
  110. Rank = __decorate([
  111. ccclass
  112. ], Rank);
  113. return Rank;
  114. }(cc.Component));
  115. exports.default = Rank;
  116. /**
  117. * 这里也需要修改:player的分数不在8名之内,
  118. * 需要读取player的名次。
  119. */
  120. cc._RF.pop();