"use strict"; cc._RF.push(module, '1ee59EOhydJrpIHEeFr1GBu', 'Rank'); // Script/Rank.ts "use strict"; // import Global from "../../Script/Global"; 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 Global_1 = require("./Global"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var Rank = /** @class */ (function (_super) { __extends(Rank, _super); function Rank() { // LIFE-CYCLE CALLBACKS: var _this = _super !== null && _super.apply(this, arguments) || this; _this.Ani = null; _this.Anistate = null; return _this; } Rank.prototype.onLoad = function () { var RemoteS = Global_1.default.instance.GetS(); var phb = this.node.getChildByName("phb").children; var phbRank; var phbName; var phbFloor; var j = 0; var i = RemoteS.length - 1; // let len; var x = 0; var f = false; if (RemoteS.length >= 8) { x = RemoteS.length - 8; } for (; j < phb.length - x;) { //length = 8 for (; (i >= 0 && j < RemoteS.length - x); i--) { phbName = phb[j].getChildByName("id").getComponent(cc.Label); phbRank = phb[j].getChildByName("rank").getComponent(cc.Label); phbFloor = phb[j].getChildByName("floor").getComponent(cc.Label); if (phbName.string == RemoteS[i].userId) { i++; } phbName.string = RemoteS[i].userId.slice(4); phbRank.string = RemoteS[i].rank; phbFloor.string = RemoteS[i].score; if (phbName.string == Global_1.default.instance.GetUSer().userId.slice(4)) { this.node.getChildByName("phbd1").getChildByName("myrank").getComponent(cc.Label).string = phb[j].getChildByName("rank").getComponent(cc.Label).string; this.node.getChildByName("phbd1").getChildByName("myfloor").getComponent(cc.Label).string = phb[j].getChildByName("floor").getComponent(cc.Label).string; f = true; } switch (RemoteS[i].rank) { case 1: { phb[j].getChildByName("model").active = true; break; } case 2: { phb[j].getChildByName("model").active = true; break; } case 3: { phb[j].getChildByName("model").active = true; break; } default: { break; } } j++; } j++; } if (!f) { this.node.getChildByName("phbd1").getChildByName("myfloor").getComponent(cc.Label).string = Global_1.default.instance.getLocalScore().BestScore.toString(); this.node.getChildByName("phbd1").getChildByName("myrank").getComponent(cc.Label).string = Global_1.default.instance.GetR(); } }; Rank.prototype.start = function () { }; Rank.prototype.update = function (dt) { }; /** * close the rank Scene and load the start scene. */ Rank.prototype.CloseRank = function () { console.log("this button is used to close this rank Scene"); this.destroy(); Global_1.default.instance.OverFlag = false; cc.director.loadScene("StartScene"); }; Rank = __decorate([ ccclass ], Rank); return Rank; }(cc.Component)); exports.default = Rank; /** * 这里也需要修改:player的分数不在8名之内, * 需要读取player的名次。 */ cc._RF.pop();