"use strict";
cc._RF.push(module, '805c6nf399HWZeuWnNB9CTH', 'GameOver');
// Script/GameOver.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 _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var NewClass = /** @class */ (function (_super) {
    __extends(NewClass, _super);
    function NewClass() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.count = null;
        _this.time = null;
        _this.selfNode = null;
        _this.one = null;
        _this.two = null;
        _this.three = null;
        _this.four = null;
        _this.five = null;
        return _this;
    }
    // onLoad () {}
    NewClass.prototype.start = function () {
        this.init();
    };
    //初始化数据
    NewClass.prototype.init = function () {
        this.listData = [];
        this.selfData = null;
        // this.getRank();
    };
    //打开排行榜
    NewClass.prototype.openRank = function () {
        // alert("跳转");
        cc.director.loadScene("LoadScene");
    };
    //重新开始玩
    NewClass.prototype.again = function () {
        // let levelTemp = cc.fx.GameConfig.GM_INFO.level;
        cc.fx.GameConfig.GM_INFO_init();
        // if(cc.fx.GameConfig.GM_INFO.isCustom){
        //     cc.fx.GameConfig.GM_INFO.level = levelTemp;
        // }
        cc.director.loadScene("GameScene");
    };
    //获取排行榜
    NewClass.prototype.getRank = function () {
        var _this = this;
        //获取排行榜数据  所需数据量
        var dataFile = {
            length: 5
        };
        cc.fx.GameTool.getRank(dataFile, function (data) { return _this.getRankData(data); });
    };
    //设置排行信息
    NewClass.prototype.getRankData = function (data) {
        if (data) {
            cc.fx.GameTool.getRankData(data, this, 4);
            cc.fx.GameTool.setPic(this.selfNode.getChildByName("pic").getChildByName("icon"), this.selfData.pic);
            for (var i = 0; i <= 4; i++) {
                this.setRank(i, this.listData[i]);
            }
        }
    };
    //根据内容填充排行榜
    NewClass.prototype.setRank = function (num, data) {
        var hitNode = null;
        if (num == 0) {
            hitNode = this.one;
        }
        else if (num == 1) {
            hitNode = this.two;
        }
        else if (num == 2) {
            hitNode = this.three;
        }
        else if (num == 3) {
            hitNode = this.four;
        }
        else if (num == 4) {
            hitNode = this.five;
        }
        if (hitNode) {
            hitNode.active = true;
            cc.fx.GameTool.subName(data.nickName, 4);
            hitNode.getChildByName("name").getComponent(cc.Label).string = data.nickName;
            hitNode.getChildByName("total").getComponent(cc.Label).string = data.totalSunCount;
            cc.fx.GameTool.setPic(hitNode.getChildByName("pic").getChildByName("icon"), data.pic);
        }
    };
    __decorate([
        property(cc.Label)
    ], NewClass.prototype, "count", void 0);
    __decorate([
        property(cc.Label)
    ], NewClass.prototype, "time", void 0);
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "selfNode", void 0);
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "one", void 0);
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "two", void 0);
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "three", void 0);
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "four", void 0);
    __decorate([
        property(cc.Node)
    ], NewClass.prototype, "five", void 0);
    NewClass = __decorate([
        ccclass
    ], NewClass);
    return NewClass;
}(cc.Component));
exports.default = NewClass;

cc._RF.pop();