"use strict";
cc._RF.push(module, 'c5692vnhwNF5J9nI7VNKQNW', 'GameConfig');
// Script/module/Config/GameConfig.ts

"use strict";
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 });
exports.GameConfig = void 0;
var share_1 = require("../Share/share");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var GameConfig = /** @class */ (function () {
    function GameConfig() {
    }
    GameConfig_1 = GameConfig;
    Object.defineProperty(GameConfig, "Instance", {
        get: function () {
            if (this._instance == null) {
                this._instance = new GameConfig_1();
            }
            return this._instance;
        },
        enumerable: false,
        configurable: true
    });
    GameConfig.getKey = function (key) {
        var reg = new RegExp('(^|&)' + key + '=([^&]*)(&|$)', 'i');
        var r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return unescape(r[2]);
        }
        return "";
    };
    GameConfig.init = function () {
        this.GM_INFO_init();
        this.CLICK_init();
        this.LEVEL_INFO_init();
        var self = this;
        cc.resources.load('Json/GM_INFO', function (err, res) {
            if (err) {
                share_1.WeChat.setShare(location.href);
                self.Authentication();
                return;
            }
            var jsonData = res.json;
            self.GM_INFO = jsonData["data"];
            self.setCode(self.getKey("scode"));
            share_1.WeChat.setShare(location.href);
            self.Authentication();
        });
        cc.resources.load('Json/CLICK_DATA', function (err, res) {
            if (err) {
                return;
            }
            var jsonData = res.json;
            self.CLICK_DATA = jsonData["data"];
        });
        cc.resources.load('Json/LEVEL_INFO', function (err, res) {
            if (err) {
                return;
            }
            var jsonData = res.json;
            self.LEVEL_INFO = jsonData["data"];
        });
        //GAME_DATA 废弃了，暂时不删除以防后面修改回 一整局传一次
        self.GAME_DATA = [];
    };
    //数据备用
    GameConfig.GM_INFO_init = function () {
        this.GM_INFO = {
            // isEnd: false,
            mean_Time: 0,
            total: 0,
            currSeed: 203213,
            gameId: '100009',
            userId: 0,
            scode: "",
            guide: true,
            url: "https://api.sparkus.cn",
            success: false,
            matchId: null,
            custom: 0 //用于测试跳关卡
        };
        this.setCode(this.getKey("scode"));
    };
    GameConfig.CLICK_init = function () {
        this.CLICK_DATA =
            {
                type: 1,
                success: false,
                round: 0,
                totalSunCount: 0,
                movedSunCount: 0,
                sunSpeed: 0,
                overlapSunCount: 0,
                colorList: [],
                duration: 0,
                difficultyLevel: 0,
                sunList: [],
                stepTimeList: [],
                remainder: 120 //游戏剩余时间
            };
    };
    GameConfig.LEVEL_INFO_init = function () {
        this.LEVEL_INFO = [
            {
                number: 3,
                moveNumber: 0,
                moveSpeed: 0,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0 //是否重叠，现在0 不重叠 1 重叠1个
            },
            {
                number: 4,
                moveNumber: 0,
                moveSpeed: 0,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 4,
                moveNumber: 0,
                moveSpeed: 0,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 5,
                moveNumber: 1,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 5,
                moveNumber: 0,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 6,
                moveNumber: 0,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 6,
                moveNumber: 3,
                moveSpeed: 4,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 7,
                moveNumber: 0,
                moveSpeed: 4,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 7,
                moveNumber: 3,
                moveSpeed: 4,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 7,
                moveNumber: 3,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 8,
                moveNumber: 3,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 8,
                moveNumber: 5,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 9,
                moveNumber: 3,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 9,
                moveNumber: 5,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 10,
                moveNumber: 5,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 3,
                moveNumber: 0,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 4,
                moveNumber: 0,
                moveSpeed: 0,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 4,
                moveNumber: 1,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 4,
                moveNumber: 0,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 4,
                moveNumber: 1,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 5,
                moveNumber: 1,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 0
            },
            {
                number: 5,
                moveNumber: 0,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 5,
                moveNumber: 1,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 5,
                moveNumber: 2,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            },
            {
                number: 5,
                moveNumber: 3,
                moveSpeed: 6,
                maxDistance: 200,
                maxMove: 1200,
                repeat: 1
            }
        ];
    };
    GameConfig.Authentication = function () {
        cc.fx.GameTool.Authentication();
    };
    GameConfig.setCode = function (code) {
        this.GM_INFO.scode = code;
    };
    var GameConfig_1;
    //所有控制信息都通过GameAppStart内控制
    GameConfig._instance = null;
    GameConfig = GameConfig_1 = __decorate([
        ccclass('GameConfig')
    ], GameConfig);
    return GameConfig;
}());
exports.GameConfig = GameConfig;

cc._RF.pop();