(function () {
    'use strict';

    class ImageRunTime extends Laya.Image {
        constructor() {
            super();
            this.scaleTime = 80;
            this.clickId = false;
            this.on(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
            this.on(Laya.Event.MOUSE_OVER, this, this.overs);
            this.on(Laya.Event.MOUSE_UP, this, this.scaleBig);
            this.on(Laya.Event.MOUSE_OUT, this, this.mouseout);
        }
        scaleBig(e) {
            if (!this.clickId)
                return;
            this.clickId = false;
            this.alpha = 1;
            if (this.CZ) {
                this.CZ();
            }
        }
        overs() {
            this.alpha = 0.7;
        }
        mouseout() {
            this.alpha = 1;
        }
        scaleSmall(e) {
            this.clickId = true;
        }
        onDestroy() {
            this.ClearRunTime();
        }
        ClearRunTime() {
            this.off(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
            this.off(Laya.Event.MOUSE_UP, this, this.scaleBig);
            this.off(Laya.Event.MOUSE_OUT, this, this.mouseout);
            this.off(Laya.Event.MOUSE_OVER, this, this.overs);
            this.CZ = null;
        }
    }

    class GameConfig {
        constructor() { }
        static init() {
            var reg = Laya.ClassUtils.regClass;
            reg("Window/Com/ButtonRunTime.ts", ImageRunTime);
        }
    }
    GameConfig.width = 720;
    GameConfig.height = 1280;
    GameConfig.scaleMode = "fixedwidth";
    GameConfig.screenMode = "vertical";
    GameConfig.alignV = "middle";
    GameConfig.alignH = "center";
    GameConfig.startScene = "ShadeView.scene";
    GameConfig.sceneRoot = "";
    GameConfig.debug = false;
    GameConfig.stat = false;
    GameConfig.physicsDebug = false;
    GameConfig.exportSceneToJson = true;
    GameConfig.init();

    class GameSetting {
    }
    GameSetting.VER = "1.0.7";
    GameSetting.CFG = "CFG";
    GameSetting.wxValue = "";
    GameSetting.isX = false;
    GameSetting.mSharePeopleScene = null;

    var SoundManager = Laya.SoundManager;
    var SoundType;
    (function (SoundType) {
        SoundType[SoundType["hit"] = 0] = "hit";
        SoundType[SoundType["click"] = 1] = "click";
        SoundType[SoundType["win"] = 2] = "win";
        SoundType[SoundType["defeat"] = 3] = "defeat";
    })(SoundType || (SoundType = {}));
    class SettingController {
        constructor() {
            this.vibrate = true;
            this.sound = true;
            this.SoundS = {
                click: "subpackage1/sound/click.mp3",
                win: "subpackage1/sound/vector.mp3",
                defeat: "subpackage1/sound/defeat.mp3",
                car_crush_1: "subpackage1/sound/car_crush_1.mp3",
                car_crush_2: "subpackage1/sound/car_crush_2.mp3",
                car_crush_3: "subpackage1/sound/car_crush_3.mp3",
                explotion1: "subpackage1/sound/explotion1.mp3",
                explotion2: "subpackage1/sound/explotion2.mp3",
                gun_fire_1: "subpackage1/sound/gun_fire_1.mp3",
                gun_fire_2: "subpackage1/sound/gun_fire_2.mp3",
                gun_fire_3: "subpackage1/sound/gun_fire_3.mp3",
                reload_gun_1: "subpackage1/sound/reload_gun_1.mp3",
                reload_gun_2: "subpackage1/sound/reload_gun_2.mp3",
                hitcar: "subpackage1/sound/hitcar.mp3",
                hitrole: "subpackage1/sound/hitrole.mp3",
                hit: "subpackage1/sound/hit.mp3"
            };
            this.bg = "subpackage1/sound/bgm.mp3";
        }
        static get Instance() {
            return this.instasnce || (this.instasnce = new SettingController());
        }
        Init() {
            var v = Laya.LocalStorage.getItem("vibrate");
            this.vibrate = Number(v) ? v == "1" ? true : false : true;
            var s = Laya.LocalStorage.getItem("sound");
            this.sound = Number(s) ? s == "1" ? true : false : true;
        }
        SettingSound(value) {
            if (this.soundChannel)
                this.soundChannel.volume = value;
        }
        _playMusic(on) {
            if (on == null)
                on = this.sound;
            if (on) {
                if (this.soundChannel == null) {
                    this.soundChannel = SoundManager.playMusic(this.bg, 0, new Laya.Handler(this, () => {
                        this.soundChannel.play();
                    }));
                }
                else {
                    this.soundChannel.resume();
                }
            }
            else {
                if (this.soundChannel) {
                    this.soundChannel.pause();
                }
            }
        }
        SetSoundV(value) {
        }
        PlaySound(type) {
            if (!this.sound)
                return;
            var _name = SoundType[type];
            SoundManager.playSound(this.SoundS[_name]);
        }
        StopSound(type) {
            if (!this.sound)
                return;
            var _name = SoundType[type];
            SoundManager.stopSound(this.SoundS[_name]);
        }
    }

    class Dictionary {
        constructor() {
            this._container = {};
            this._length = 0;
        }
        get container() {
            return this._container;
        }
        get size() {
            return this._length;
        }
        set(key, value) {
            if (!this._container.hasOwnProperty(key)) {
                this._length++;
            }
            this._container[key] = value;
        }
        delete(key) {
            if (this._container.hasOwnProperty(key)) {
                delete this._container[key];
                this._length--;
            }
        }
        has(key) {
            return this._container.hasOwnProperty(key) ? true : false;
        }
        get(key) {
            if (this._container.hasOwnProperty(key)) {
                return this._container[key];
            }
            else {
                return undefined;
            }
        }
        clear() {
            this._container = {};
            this._length = 0;
        }
    }

    class DispatcherManager {
        static get Disispatcher() {
            return DispatcherManager.disispatcher || (DispatcherManager.disispatcher = new Laya.EventDispatcher());
        }
        static on(type, call, data) {
            this.Disispatcher.on(type, call, data);
        }
        static off(type, call, data) {
            this.Disispatcher.off(type, call, data);
        }
        static event(type, data = null) {
            this.Disispatcher.event(type, data);
        }
    }
    class EventType {
    }
    EventType.Event = {
        CamFollowArg: "CamFollowArg",
        SetAimPos: "SetAimPos",
        RefreshBulletCount: "RefreshBulletCount",
        RefreshRemainEnemyCount: "RefreshRemainEnemyCount",
        GameShowTips: "GameShowTips",
        StartShot: 'StartShot',
        StopShot: 'StopShot',
        ShowMainUi: "ShowMainUi",
        SetMonery: "SetMonery",
        SetStage: "SetStage",
        SetStagePro: "SetStagePro"
    };

    var Vector3 = Laya.Vector3;
    class GameTool {
        static GetObjKey(obj) {
            if (obj == null)
                return null;
            for (const key in obj) {
                if (obj.hasOwnProperty(key)) {
                    return key;
                }
            }
        }
        static randomInt(min, max) {
            if (max < min)
                return parseInt(min);
            return parseInt(Math.random() * (max - min + 1) + min);
        }
        static randomFl(from, to) {
            if (from >= to) {
                return 0;
            }
            var size = to - from;
            var curNumber = Math.random() * size + from;
            return curNumber;
        }
        static getAng(xx, yy, obl) {
            return 180 / Math.PI * GameTool.getRad(xx, yy, obl);
        }
        static getRad(xx, yy, obl) {
            var rad = yy < 0 ? Math.acos(xx / obl) : (Math.PI * 2 - Math.acos(xx / obl));
            return rad;
        }
        static getM_Vector(v1, v2) {
            let temp = new Laya.Vector3();
            Laya.Vector3.add(v1, v2, temp);
            return new Laya.Vector3(temp.x * 0.5, temp.y * 0.5, temp.z * 0.5);
        }
        static SpliteString(s, sp) {
            var _sp = sp ? sp : ";";
            let s_s = s.split(_sp);
            let result = [];
            for (let i = 0; i < s_s.length; i++) {
                result.push(s_s[i]);
            }
            return result;
        }
        static random_1to1() {
            var iszheng = Math.random() > 0.5 ? -1 : 1;
            return Math.random() * iszheng;
        }
        static GetWeight(s) {
            let arr = GameTool.SpliteString(s);
            var sum = 0;
            for (var i = 0; i < arr.length; i++) {
                sum += Number(arr[i]);
            }
            let result = GameTool.randomInt(1, sum);
            let temp_sum = 0;
            for (let i = 0; i < arr.length; i++) {
                temp_sum += Number(arr[i]);
                if (result <= temp_sum) {
                    return i;
                }
            }
        }
        static get64Encode(str) {
            var c1, c2, c3;
            var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
            var i = 0, len = str.length, string = '';
            while (i < len) {
                c1 = str.charCodeAt(i++) & 0xff;
                if (i == len) {
                    string += base64EncodeChars.charAt(c1 >> 2);
                    string += base64EncodeChars.charAt((c1 & 0x3) << 4);
                    string += "==";
                    break;
                }
                c2 = str.charCodeAt(i++);
                if (i == len) {
                    string += base64EncodeChars.charAt(c1 >> 2);
                    string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
                    string += base64EncodeChars.charAt((c2 & 0xF) << 2);
                    string += "=";
                    break;
                }
                c3 = str.charCodeAt(i++);
                string += base64EncodeChars.charAt(c1 >> 2);
                string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
                string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
                string += base64EncodeChars.charAt(c3 & 0x3F);
            }
            return string;
        }
        static makeRandomArr(arrList, num) {
            if (num > arrList.length) {
                return;
            }
            var tempArr = arrList.slice(0);
            var newArrList = [];
            for (var i = 0; i < num; i++) {
                var random = Math.floor(Math.random() * (tempArr.length - 1));
                var arr = tempArr[random];
                tempArr.splice(random, 1);
                newArrList.push(arr);
            }
            return newArrList;
        }
        static CopyArr(o) {
            var arr = [];
            for (let index = 0; index < o.length; index++) {
                const element = o[index];
                arr.push(element);
            }
            return arr;
        }
        static clamp(n, min, max) {
            return n > max ? max : (n < min ? min : n);
        }
        static GetVecByArr(arr) {
            if (!arr)
                return null;
            var vec = new Vector3();
            vec.x = arr[0];
            vec.y = arr[1];
            vec.z = arr[2];
            return vec;
        }
        static IsNext() {
            let uuid = Laya.LocalStorage.getItem("isNext");
            if (uuid) {
                let lastSignTime = new Date(Number(Laya.LocalStorage.getItem("isNext")));
                let todayZero = new Date(Laya.timer.currTimer);
                todayZero.setHours(0, 0, 0, 0);
                if (lastSignTime.valueOf() < todayZero.valueOf()) {
                    Laya.LocalStorage.setItem("isNext", Laya.timer.currTimer.toString());
                    return true;
                }
                else {
                    return false;
                }
            }
            else {
                Laya.LocalStorage.setItem("isNext", Laya.timer.currTimer.toString());
                return true;
            }
        }
        static ToTimeStr1(l) {
            let str = "";
            let minute = 0;
            let second = 0;
            second = l;
            if (second > 60) {
                minute = Math.floor(second / 60);
                second = second % 60;
            }
            str = second < 10 ? "0" + second : second + "";
            return (minute + ":" + str);
        }
        static ToTimeStr(l, isHour = false) {
            let hour = 0;
            let minute = 0;
            let second = 0;
            second = l;
            if (second > 60) {
                minute = Math.floor(second / 60);
                second = second % 60;
            }
            if (isHour && minute > 60) {
                hour = Math.floor(minute / 60);
                minute = minute % 60;
                let ss = second >= 10 ? second + "" : "0" + second.toString();
                let mm = minute >= 10 ? minute + "" : "0" + minute.toString();
                let hh = hour >= 10 ? hour + "" : "0" + hour.toString();
                return (hh + ":" + mm + ":" + ss);
            }
            else {
                if (minute > 60) {
                    minute = Math.floor(second / 60);
                    second = second % 60;
                }
                let ss = second >= 10 ? second + "" : "0" + second.toString();
                let mm = minute >= 10 ? minute + "" : "0" + minute.toString();
                return (mm + ":" + ss);
            }
        }
    }

    class CfgManager {
        static get Instance() {
            return this.instance || (this.instance = new CfgManager());
        }
        GetSign(id) {
            if (this.sign) {
                return this.sign[id - 1];
            }
        }
        GetReward(id) {
            if (this.rewards) {
                for (let index = 0; index < this.rewards.length; index++) {
                    const element = this.rewards[index];
                    if (element.id == id) {
                        return element;
                    }
                }
            }
        }
        GetMission(id) {
            if (this.mission) {
                return this.mission[id - 1];
            }
            return null;
        }
        GetEnemyTeam(id) {
            if (this.enemyteam) {
                return this.enemyteam[id - 1];
            }
            return null;
        }
        GetRole(id) {
            if (this.role) {
                return this.role[id - 1];
            }
            return null;
        }
        GetLevel(id) {
            if (this._level) {
                return this._level[id - 1];
            }
            return null;
        }
        GetRoad(id) {
            if (this._road) {
                return this._road[id - 1];
            }
            return null;
        }
        GetBlock(id) {
            if (this._block) {
                return this._block[id - 1];
            }
            return null;
        }
        GetThing(id) {
            if (this._thing) {
                return this._thing[id - 1];
            }
            return null;
        }
        GetAtk(id) {
            if (this._atk) {
                return this._atk[id - 1];
            }
            return null;
        }
        GetRate(id) {
            if (this._rate) {
                return this._rate[id - 1];
            }
            return null;
        }
        GetCar(id) {
            if (this.car) {
                return this.car[id - 1];
            }
            return null;
        }
        GetGlobe(key) {
            if (this._globe) {
                for (let index = 0; index < this._globe.length; index++) {
                    const element = this._globe[index];
                    if (element.key == key) {
                        return element.value;
                    }
                }
            }
        }
        GetTheme(id) {
            if (this._theme) {
                return this._theme[id - 1];
            }
            return null;
        }
        GetLottery(id) {
            if (this._lottery) {
                return this._lottery[id - 1];
            }
            return null;
        }
        GetAchievement(type, level) {
            if (this._achievement) {
                for (let index = 0; index < this._achievement.length; index++) {
                    if (this._achievement[index].type == type) {
                        if (this._achievement[index].level == level) {
                            return this._achievement[index];
                        }
                    }
                }
            }
        }
        GetTypeLevel(type) {
            var count = 0;
            if (this._achievement) {
                for (let index = 0; index < this._achievement.length; index++) {
                    if (this._achievement[index].type == type) {
                        count++;
                    }
                }
                return count;
            }
        }
        GetachieveType() {
            if (this._achieveType == null) {
                if (this._achievement) {
                    for (let index = 0; index < this._achievement.length; index++) {
                        this._achieveType = this._achievement[index].type;
                    }
                }
            }
            return this._achieveType;
        }
    }

    class AssetPath {
    }
    AssetPath.main_path = "subpackage/LayaScene_main/Conventional/main.ls";
    AssetPath.player_path = ["subpackage/LayaScene_role/Conventional/player1.lh",
        "subpackage/LayaScene_role/Conventional/player2.lh",
        "subpackage/LayaScene_role/Conventional/player3.lh",
        "subpackage/LayaScene_role/Conventional/player4.lh",
        "subpackage/LayaScene_role/Conventional/player5.lh",
        "subpackage/LayaScene_role/Conventional/player6.lh",
        "subpackage/LayaScene_role/Conventional/player7.lh",
    ];
    AssetPath.enemytexture = [
        "subpackage/EnemyTexture/enemy_1.png",
        "subpackage/EnemyTexture/enemy_2.png",
        "subpackage/EnemyTexture/enemy_3.png",
    ];
    AssetPath.enemy_path = "subpackage/LayaScene_role/Conventional/enemy.lh";
    AssetPath.playerBullet_path = "subpackage/LayaScene_prop/Conventional/PlayerBullet.lh";
    AssetPath.tower_path = "subpackage/LayaScene_prop/Conventional/Tower.lh";
    AssetPath.barrier_paths = [
        "subpackage/LayaScene_barrier/Conventional/barrier_1.lh",
        "subpackage/LayaScene_barrier/Conventional/barrier_2.lh",
        "subpackage/LayaScene_barrier/Conventional/barrier_3.lh",
        "subpackage/LayaScene_barrier/Conventional/barrier_4.lh",
        "subpackage/LayaScene_barrier/Conventional/move_barrier.lh",
        "subpackage/LayaScene_barrier/Conventional/stone_1.lh",
        "subpackage/LayaScene_barrier/Conventional/stone_2.lh",
        "subpackage/LayaScene_barrier/Conventional/stone_3.lh",
        "subpackage/LayaScene_barrier/Conventional/stone_4.lh",
        "subpackage/LayaScene_barrier/Conventional/Block1.lh",
    ];
    AssetPath.effect_path = [
        "subpackage/LayaScene_effect/Conventional/boom.lh",
        "subpackage/LayaScene_effect/Conventional/hit.lh",
        "subpackage/LayaScene_effect/Conventional/xue.lh",
    ];
    AssetPath.muchs = [
        "100万",
        "61万",
        "8万",
        "16万", "55万",
        "123万",
        "1004万",
        "88万",
        "69万",
        "90万",
        "7万",
        "14万",
        "6万",
        "12万",
    ];
    AssetPath.tableName = {
        level: "level",
        road: "road",
        block: "block",
        thing: "thing",
        atk: "atk",
        rate: "rate",
        global: "global",
        theme: "theme"
    };
    class AppSetting {
    }
    AppSetting.moveTime = 1;

    class PlayerManager {
        constructor() {
            this.stage = 1;
            this.killCount = 0;
            this.istry = false;
            this.equipId = 1;
        }
        static get Instance() {
            return PlayerManager.instance || (PlayerManager.instance = new PlayerManager());
        }
        ;
        SetTheme() {
        }
        SetTryOutById(id) {
        }
        static SetGlobe() {
            PlayerManager.tower_reward = Number(CfgManager.Instance.GetGlobe("tower_reward"));
            PlayerManager.block_reward = Number(CfgManager.Instance.GetGlobe("block_reward"));
            PlayerManager.enemy_reward = Number(CfgManager.Instance.GetGlobe("enemy_reward"));
        }
        SetPlayer() {
            var usermodel = UserModel.Instance.CurModel;
            PlayerManager.instance.stage = (Number(usermodel.GetUserAttr(UserAttr.stage)) + 1);
            PlayerManager.instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
            this.SetArr();
        }
        SetArr() {
            let power = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["power"];
            if (power)
                this.powerLevel = Number(power);
            else
                this.powerLevel = 1;
            let al = CfgManager.Instance._atk.length;
            let t = this.powerLevel > al ? al : this.powerLevel;
            PlayerManager.bulletAttack = CfgManager.Instance.GetAtk(t)["atk"];
            let rate = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["rate"];
            if (rate)
                this.rateLevel = Number(rate);
            else
                this.rateLevel = 1;
            let al1 = CfgManager.Instance._rate.length;
            let t1 = this.rateLevel > al1 ? al1 : this.rateLevel;
            PlayerManager.bulletTime = CfgManager.Instance.GetRate(t1)["rate"];
        }
        GradePower(level, chanel, count, callback) {
            let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "power" }, { "level": level }, { "channel": chanel }, { "amount": count }];
            NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
                if (callback)
                    callback(true);
            }, (data) => {
                if (callback)
                    callback(false);
            });
        }
        GradeRate(level, chanel, count, callback) {
            let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "rate" }, { "level": level }, { "channel": chanel }, { "amount": count }];
            NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
                if (callback)
                    callback(true);
            }, (data) => {
                if (callback)
                    callback(false);
            });
        }
    }
    PlayerManager.bulletAttack = 1;
    PlayerManager.bulletTime = 0.3;

    class GlobalVariable {
    }
    GlobalVariable.playerspeed = 0.1;
    GlobalVariable.friendspeed = 0.2;
    GlobalVariable.bulletspeed = 0.8;
    GlobalVariable.sliderFactor = 0.02;
    GlobalVariable.playerMoveMaxX = 4.5;
    GlobalVariable.playerRayLengthF = 1.3;
    GlobalVariable.playerRayLengthLR = 0.3;
    GlobalVariable.bulletRayLength = 1;
    GlobalVariable.bulletMaxDis = 40;
    GlobalVariable.barrierRoadLength = 50;
    GlobalVariable.barrierRoadAverageNum = 50;
    GlobalVariable.hitmaxcount = 2;
    GlobalVariable.boommaxcount = 2;
    GlobalVariable.blockLRmoveMaxDis = 5;
    GlobalVariable.arriveStandWidth = 5;
    GlobalVariable.enemySpeed = 0.1;

    class UserInfoManager {
        static GameInfo() {
            PlayerManager.Instance.SetPlayer();
        }
        static SetCfg(cfg) {
            CfgManager.Instance._level = cfg[AssetPath.tableName.level];
            CfgManager.Instance._road = cfg[AssetPath.tableName.road];
            CfgManager.Instance._block = cfg[AssetPath.tableName.block];
            CfgManager.Instance._thing = cfg[AssetPath.tableName.thing];
            CfgManager.Instance._atk = cfg[AssetPath.tableName.atk];
            CfgManager.Instance._rate = cfg[AssetPath.tableName.rate];
            CfgManager.Instance._theme = cfg[AssetPath.tableName.theme];
            CfgManager.Instance._globe = cfg[AssetPath.tableName.global];
            PlayerManager.SetGlobe();
        }
        static Appseting(data) {
            AppSetting.shareimage = data["shareimage"];
            AppSetting.sharetitle = data["sharetitle"];
            AppSetting.bannerCanMove = Number(data["bannerCanMove"]);
            AppSetting.moveTime = Number(data["moveTime"]);
            AppSetting.OpenSceneValue = Number(data["OpenSceneValue"]);
            AppSetting.freeUpdateVideotime = Number(data["freeUpdateVideotime"]);
            AppSetting.freecoinValue = Number(data["freecoinValue"]);
            AppSetting.freeGetcoinTime = Number(data["freeGetcoinTime"]);
            GlobalVariable.playerspeed = Number(data["playerspeed"]);
            GlobalVariable.friendspeed = Number(data["friendspeed"]);
            GlobalVariable.bulletspeed = Number(data["bulletspeed"]);
            GlobalVariable.sliderFactor = Number(data["sliderFactor"]);
            GlobalVariable.playerMoveMaxX = Number(data["playerMoveMaxX"]);
            GlobalVariable.playerRayLengthF = Number(data["playerRayLengthF"]);
            GlobalVariable.playerRayLengthLR = Number(data["playerRayLengthLR"]);
            GlobalVariable.bulletRayLength = Number(data["bulletRayLength"]);
            GlobalVariable.bulletMaxDis = Number(data["bulletMaxDis"]);
            GlobalVariable.barrierRoadLength = Number(data["barrierRoadLength"]);
            GlobalVariable.barrierRoadAverageNum = Number(data["barrierRoadAverageNum"]);
            GlobalVariable.hitmaxcount = Number(data["hitmaxcount"]);
            GlobalVariable.boommaxcount = Number(data["boommaxcount"]);
            GlobalVariable.blockLRmoveMaxDis = Number(data["blockLRmoveMaxDis"]);
            GlobalVariable.arriveStandWidth = Number(data["arriveStandWidth"]);
            GlobalVariable.enemySpeed = Number(data["enemySpeed"]);
        }
    }

    var Event = Laya.Event;
    var HttpRequest = Laya.HttpRequest;
    const PROTOCOL_URL = "https://gungangapi.xwxgame.com/";
    class PROTOCOLS {
    }
    PROTOCOLS.protocols = {
        Login: "user/login",
        Userauth: "user/auth",
        BuyLand: "shop/land",
        UserSync: "user/sync",
        ShopBuild: "shop/build",
        ShopUpgrade: "shop/upgrade",
        ShopSale: "shop/sale",
        RoleUpgrade: "role/upgrade",
        Fissionvd: "fission/vd",
        DailyTaskrefresh: "dailytask/refresh",
        DailyTaskrewards: "dailytask/rewards",
        Rankingvmoney: "ranking/vmoney",
        Lotterylottery: "lottery/lottery",
        AchievementgetRewards: "achievement/getRewards",
        Fissiondeduct: "fission/deduct",
        Sign: "sign/sign",
        InvitegetRewards: "invite/getRewards",
        InvitetargetRewards: "invite/targetRewards",
        GameResult: "game/play",
        Easter: "game/revival",
        GetCfg: "config/table",
        DoubleAward: "fission/vd",
        KunDiscard: "kun/discard",
        KunEquip: "kun/equip",
        KunMove: "kun/move",
        KunBuy: "kun/buy",
        Opentreasure: "treasure/open",
        Entertreasure: "treasure/enter",
        Buy: "theme/buy",
        Equip: "theme/equip",
        themefission: "theme/fission",
        Start: "game/start",
        UpgradeAttr: "attr/upgrade"
    };
    class NetManager {
        PostTokenRequest(protocol, completecb, errorcb, isload = true) {
            let args = "";
            let url = PROTOCOL_URL + protocol;
            args = args = `token=${UserModel.Instance.CurModel.m_token}`;
            let httpRequest = new HttpRequest();
            httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
            httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
            httpRequest.send(url, args, "post", "text");
            if (isload) {
                WXSdk.ShowLoading("");
            }
        }
        onHttpRequestComplete(succeedcb, failurecb, httpRequest, isload) {
            let data;
            if (isload) {
                WXSdk.HideLoading();
            }
            data = JSON.parse(httpRequest.data);
            console.log("请求成功:" + JSON.stringify(data));
            if (data["code"] == 0) {
                UserModel.Instance.RefreshModel(data);
                if (succeedcb != null) {
                    succeedcb(data);
                }
            }
            else {
                if (failurecb != null) {
                    var mess = GameTool.SpliteString(data["message"], ",")[0];
                    failurecb(mess);
                }
            }
        }
        onHttpRequestError(errorcb, httpRequest, isload) {
            if (errorcb != null) {
                var data = JSON.parse(httpRequest.data);
                errorcb(data);
            }
            console.log("Error! Http request error, code: " + data);
            if (isload) {
                WXSdk.HideLoading();
            }
        }
        static get Instance() {
            return NetManager.instance || (NetManager.instance = new NetManager());
        }
        login(progresscb, completecb, errorcb) {
            console.log("发送登录请求");
            var userInfor = UserModel.Instance;
            var ver = GameSetting.VER;
            let args = `code=${userInfor.m_code}&nickname=${userInfor.m_nickname}&avatar=${userInfor.m_avatar}&gender=${userInfor.m_gender}&country=${userInfor.m_country}&province=${userInfor.m_province}&city=${userInfor.m_city}&device=${userInfor.m_device}&share_id=${userInfor.m_share_id}&scene=${userInfor.channel}&v=${ver}`;
            console.log("登录 参数:  " + args);
            let httpRequest = new HttpRequest();
            httpRequest.once(Event.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]);
            httpRequest.once(Event.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]);
            httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
            httpRequest.send(PROTOCOL_URL + PROTOCOLS.protocols.Login, args, "post", "text");
        }
        onHttpRequestProgress() {
        }
        onLoginRequestComplete(completecb, httpRequest) {
            let data = JSON.parse(httpRequest.data);
            console.log(data);
            console.log("登录完成");
            if (data["code"] != "0") {
                var errInfo = JSON.stringify(httpRequest.data);
                console.log("登录异常错误！错误信息：", errInfo);
                completecb(data);
                return;
            }
            UserModel.Instance.SetUserModel(new NetUserModel(data["token"], data["configs"], data["app_setting"], data["user"], data["user_base"], data["user_invite"], data["user_lottery"], data["user_treasure"], data["t"], data["user_achievement"], data["user_sign"], data["user_arena"], data["is_new"], data["user_shop"], data["user_daily_task"], data["user_video"]));
            UserInfoManager.Appseting(data["app_setting"]);
            var ver = data["table_version"];
            UserModel.Instance.CurModel.JundgCfg(ver, (c) => {
                if (c) {
                    UserInfoManager.GameInfo();
                    completecb(data);
                }
            });
            WXSdk.ShareMessage();
        }
        PostCfgRequest(completecb, errorcb) {
            let args = "";
            let url = PROTOCOL_URL + PROTOCOLS.protocols.GetCfg;
            args = `token=${UserModel.Instance.CurModel.m_token}`;
            let httpRequest = new HttpRequest();
            httpRequest.once(Event.COMPLETE, this, () => {
                var data = JSON.parse(httpRequest.data);
                if (data["code"] == 0) {
                    if (completecb != null) {
                        if (data["configs"]) {
                            completecb(data["configs"]);
                        }
                    }
                }
                else {
                    if (errorcb != null) {
                        errorcb(data);
                    }
                }
            });
            httpRequest.once(Event.ERROR, this, () => {
                var data = JSON.parse(httpRequest.data);
                if (errorcb != null) {
                    errorcb(data);
                }
            });
            httpRequest.send(url, args, "post", "text");
        }
        HttpPostRequest(protocol, param, completecb, errorcb, hasToken = true, isload = true) {
            let args = "";
            let url = PROTOCOL_URL + protocol;
            if (hasToken == true) {
                args = `token=${UserModel.Instance.CurModel.m_token}&`;
            }
            if (protocol == PROTOCOLS.protocols.UserSync || protocol == PROTOCOLS.protocols.Fissionvd || protocol == PROTOCOLS.protocols.Lotterylottery
                || protocol == PROTOCOLS.protocols.Fissiondeduct || protocol == PROTOCOLS.protocols.KunBuy || protocol == PROTOCOLS.protocols.KunDiscard
                || protocol == PROTOCOLS.protocols.KunEquip || protocol == PROTOCOLS.protocols.KunMove || protocol == PROTOCOLS.protocols.Start || protocol == PROTOCOLS.protocols.GameResult
                || protocol == PROTOCOLS.protocols.themefission || protocol == PROTOCOLS.protocols.Opentreasure || protocol == PROTOCOLS.protocols.UpgradeAttr) {
                let str = "abcdefghijkimnopqrstuvwxyz0123456789";
                let code = "{";
                let mask = "";
                for (let i = 0; i < 4; i++) {
                    mask += str[Math.floor(Math.random() * 100) % str.length];
                }
                for (let i = 0; i < param.length; i++) {
                    for (let key in param[i]) {
                        code += "\"" + key + "\":";
                        if (typeof param[i][key] === 'string') {
                            code += "\"" + param[i][key] + "\"";
                        }
                        else {
                            code += param[i][key];
                        }
                    }
                    if (i < param.length - 1) {
                        code += ",";
                    }
                    else {
                        code += "}";
                    }
                }
                args += "_r=" + mask + GameTool.get64Encode(code);
            }
            else {
                if (param != null) {
                    for (let i = 0; i < param.length; i++) {
                        for (let key in param[i]) {
                            let val = param[i][key];
                            args += `${key}=${val}`;
                            if (i < param.length - 1) {
                                args += "&";
                            }
                        }
                    }
                }
            }
            let httpRequest = new HttpRequest();
            httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
            httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest, isload]);
            httpRequest.send(url, args, "post", "text");
            if (isload) {
                WXSdk.ShowLoading("");
            }
        }
        static errorRequest(arg, callback) {
            let httpRequest = new Laya.HttpRequest();
            if (callback) {
                httpRequest.once(Laya.Event.PROGRESS, this, () => { callback.progress && callback.progress(httpRequest); });
                httpRequest.once(Laya.Event.ERROR, this, () => { callback.error && callback.error(httpRequest); });
                httpRequest.once(Laya.Event.COMPLETE, this, () => { callback.complete && callback.complete(httpRequest); });
            }
            httpRequest.send("https://r.94xj.net/e", arg, "post", "json", ["Content-Type", "application/json"]);
        }
        static ErrorReport() {
            let arg = {
                "code": 1003,
                "msg": "invalid code",
                "user_id": 0,
                "game": "parkourrace",
                "type": "backend",
                "platform": "weixin"
            };
            this.errorRequest(arg, {
                complete: (request) => {
                },
                error: (request) => {
                }
            });
        }
    }

    var UserConfigName;
    (function (UserConfigName) {
        UserConfigName[UserConfigName["train"] = 0] = "train";
        UserConfigName[UserConfigName["sign"] = 1] = "sign";
        UserConfigName[UserConfigName["rewards"] = 2] = "rewards";
    })(UserConfigName || (UserConfigName = {}));
    var UserAttr;
    (function (UserAttr) {
        UserAttr[UserAttr["user_id"] = 0] = "user_id";
        UserAttr[UserAttr["diamond"] = 1] = "diamond";
        UserAttr[UserAttr["energy"] = 2] = "energy";
        UserAttr[UserAttr["list_kun"] = 3] = "list_kun";
        UserAttr[UserAttr["stage"] = 4] = "stage";
        UserAttr[UserAttr["vmoney"] = 5] = "vmoney";
        UserAttr[UserAttr["equip_kun"] = 6] = "equip_kun";
        UserAttr[UserAttr["unlock_kun"] = 7] = "unlock_kun";
        UserAttr[UserAttr["buyed_kun"] = 8] = "buyed_kun";
        UserAttr[UserAttr["money"] = 9] = "money";
        UserAttr[UserAttr["progress_themes"] = 10] = "progress_themes";
        UserAttr[UserAttr["equip_themes"] = 11] = "equip_themes";
        UserAttr[UserAttr["get_themes"] = 12] = "get_themes";
        UserAttr[UserAttr["attrs"] = 13] = "attrs";
    })(UserAttr || (UserAttr = {}));
    class NetUserModel {
        constructor(_token, _config, _appSetting, _user, _userbase, _useInvite, _user_lottery, _user_treasure, t, _user_achievement, _user_sign, _user_arena, is_new, user_shop, user_daily_task, user_video) {
            this.loginSeverTime = 0;
            this.m_avatar = "";
            this.localTime = Laya.timer.currTimer;
            this.loginSeverTime = t;
            this.m_token = _token;
            this.m_user = _user;
            this.m_base = _userbase;
            this.m_invite = _useInvite;
            this.m_lottery = _user_lottery;
            this.m_treasure = _user_treasure;
            this.m_achievement = _user_achievement;
            this.m_sign = _user_sign;
            this.m_arena = _user_arena;
            this.m_shop = user_shop;
            this.user_video = user_video;
            this.user_daily_task = user_daily_task;
            this.m_userid = this.m_user["user_id"];
            this.m_openid = this.m_base["openid"];
            this.m_nickname = this.m_base["nickname"];
            this.is_new = Number(is_new);
        }
        GetUserAttr(_attr) {
            var attr = UserAttr[_attr];
            return this.m_user[attr];
        }
        get ServerTime() {
            let time = Laya.timer.currTimer;
            let stime = this.loginSeverTime + Math.ceil((time - this.localTime) / 1000);
            return stime;
        }
        HasTheme(_id) {
            var data = this.GetUserAttr(UserAttr.get_themes);
            for (var i = 0; i < data.length; i++) {
                var hd = data[i];
                if (_id == hd) {
                    return true;
                }
            }
            return false;
        }
        GetThemeProgress(_id) {
            var config = this.GetUserAttr(UserAttr.progress_themes);
            var progress = config[_id] ? config[_id] : 0;
            return progress;
        }
        JundgCfg(ver, callball) {
            var cfg = Laya.LocalStorage.getJSON(GameSetting.CFG);
            if (cfg) {
                if (cfg.VER == ver) {
                    console.log("已经拥有,不用更新");
                    UserInfoManager.SetCfg(cfg);
                    callball(true);
                }
                else {
                    console.log("cfg存在但是过期了");
                    Laya.LocalStorage.removeItem(GameSetting.CFG);
                    NetManager.Instance.PostCfgRequest((data) => {
                        data.VER = ver;
                        Laya.LocalStorage.setJSON(GameSetting.CFG, data);
                        UserInfoManager.SetCfg(data);
                        callball(true);
                    }, (data) => {
                        console.log("配置获取失败" + data);
                        callball(false);
                        return;
                    });
                }
            }
            else {
                console.log("本地没有cfg");
                NetManager.Instance.PostCfgRequest((data) => {
                    console.log("cfg" + data);
                    data.VER = ver;
                    Laya.LocalStorage.setJSON(GameSetting.CFG, data);
                    UserInfoManager.SetCfg(data);
                    callball(true);
                }, (data) => {
                    console.log("配置获取失败" + data);
                });
            }
        }
    }
    class UserModel {
        get CurModel() {
            return this.curModel;
        }
        constructor(code, nickname, avatar, gender, country, province, city, device, share_id, channel) {
            UserModel.instance = this;
            this.m_code = code;
            this.m_nickname = nickname ? nickname : "";
            this.m_avatar = avatar ? avatar : "";
            this.m_gender = gender ? gender : 0;
            this.m_city = city ? city : "";
            this.m_device = device ? device : "";
            this.m_share_id = share_id ? share_id : "";
            this.channel = channel ? channel : "";
            this.m_country = country ? country : "";
            this.m_province = province ? province : "";
        }
        static get Instance() {
            if (UserModel.instance) {
                return UserModel.instance;
            }
            else {
                UserModel.instance = new UserModel("11", "", "", 0, "", "", "", "", "", "");
                return UserModel.instance;
            }
        }
        SetUserModel(_model) {
            this.curModel = _model;
        }
        RefreshModel(data) {
            if (data["user"])
                this.curModel.m_user = data["user"];
            if (data["user_invite"])
                this.curModel.m_invite = data["user_invite"];
            if (data["user_lottery"])
                this.curModel.m_lottery = data["user_lottery"];
            if (data["user_achievement"]) {
                this.curModel.m_achievement = data["user_achievement"];
            }
            if (data["user_sign"])
                this.curModel.m_sign = data["user_sign"];
            if (data["user_shop"])
                this.curModel.m_shop = data["user_shop"];
            if (data["user_daily_task"])
                this.curModel.user_daily_task = data["user_daily_task"];
            if (data["user_video"])
                this.curModel.user_video = data["user_video"];
        }
    }

    var Sprite3D = Laya.Sprite3D;
    var PoolType;
    (function (PoolType) {
        PoolType[PoolType["WarnTips"] = 1] = "WarnTips";
        PoolType[PoolType["HpText"] = 2] = "HpText";
    })(PoolType || (PoolType = {}));
    class GamePool {
        constructor() {
            this.poolDic = new Dictionary();
            this.prefabDic = new Dictionary();
            this.singleobjDic = new Dictionary();
        }
        static get Instance() {
            return GamePool.instance || (GamePool.instance = new GamePool());
        }
        InitData(name, prefab) {
            if (prefab != null) {
                if (!this.prefabDic.has(name))
                    this.prefabDic.set(name, prefab);
            }
        }
        HasSprInPool(name) {
            return this.prefabDic.has(name);
        }
        SetActiveObject(name) {
            if (name == "PlayerBullet")
                GamePool.bulletCount++;
            if (this.poolDic.has(name)) {
                if (this.poolDic.get(name).length > 0) {
                    var result = this.poolDic.get(name).shift();
                    result.active = true;
                    return result;
                }
                else {
                    if (this.prefabDic.has(name)) {
                        var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
                        curObj.name = name;
                        console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
                        return curObj;
                    }
                    else {
                        return null;
                    }
                }
            }
            else {
                if (this.prefabDic.has(name)) {
                    var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
                    curObj.name = name;
                    console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
                    return curObj;
                }
                else {
                    return null;
                }
            }
        }
        SetActiveForUi(type) {
            if (this.singleobjDic.has(type)) {
                if (this.singleobjDic.get(type).length > 0) {
                    var result = this.singleobjDic.get(type).shift();
                    result.visible = true;
                    return result;
                }
                else {
                    return this.GetByType(type);
                }
            }
            else {
                return this.GetByType(type);
            }
        }
        GetByType(type) {
            if (type == PoolType.WarnTips) {
                var _t = new Laya.Text();
                _t.width = 720;
                _t.height = 60;
                _t.align = "center";
                _t.valign = "middle";
                _t.fontSize = 35;
                _t.bold = true;
                _t.pivotX = 360;
                _t.pivotY = 30;
                _t.color = "#ffffff";
                _t.stroke = 5;
                _t.strokeColor = "#000000";
                return _t;
            }
            else if (type == PoolType.HpText) {
                var _t = new Laya.Text();
                _t.font = "Microsoft YaHei";
                _t.width = 260;
                _t.height = 50;
                _t.align = "center";
                _t.valign = "middle";
                _t.fontSize = 30;
                _t.bold = true;
                _t.pivotX = 130;
                _t.pivotY = 25;
                _t.color = "#ffffff";
                return _t;
            }
        }
        SetDisableForUi(type, go) {
            go.visible = false;
            go.removeSelf();
            if (!this.singleobjDic.has(type)) {
                this.singleobjDic.set(type, new Array());
            }
            this.singleobjDic.get(type).push(go);
        }
        SetDisableObject(go) {
            if (!go)
                return;
            go.active = false;
            go.removeSelf();
            var key = go.name;
            if (!this.poolDic.has(key)) {
                this.poolDic.set(key, new Array());
            }
            this.poolDic.get(key).push(go);
        }
        SetDisableMutiObject(go, timer) {
            Laya.timer.once(timer, this, () => {
                if (go)
                    go.active = false;
                var key = go.name;
                if (!this.poolDic.has(key)) {
                    this.poolDic.set(key, new Array());
                }
                this.poolDic.get(key).push(go);
            });
        }
    }
    GamePool.pooltype = {
        Tower: "Tower",
        PlayerBullet: "PlayerBullet",
        player: "player",
        enemy: "enemy"
    };
    GamePool.bulletCount = 0;

    class Mathf {
        static GetData(value) {
            var theTime = Math.floor(value);
            var theTime1 = 0;
            var theTime2 = 0;
            var theTime3 = 0;
            if (theTime > 60) {
                theTime1 = Math.floor(theTime / 60);
                theTime = theTime % 60;
                if (theTime1 > 60) {
                    theTime2 = Math.floor(theTime1 / 60);
                    theTime1 = theTime1 % 60;
                    if (theTime2 > 24) {
                        theTime3 = Math.floor(theTime2 / 24);
                        theTime2 = theTime2 % 24;
                    }
                }
            }
            var result = '';
            result = "" + theTime1 + "分" + result;
            result = "" + theTime2 + "时" + result;
            result = "" + theTime3 + "天" + result;
            return result;
        }
        static GetNumAccuracy(num) {
            var b = Math.ceil(num * 10) / 10;
            if (Math.abs(b - num) < 0.0001) {
                return b;
            }
            var a = Math.floor(num * 10) / 10;
            if (Math.abs(a - num) < 0.0001) {
                return a;
            }
            return num;
        }
        static get VecZero() {
            return new Laya.Vector3();
        }
        static RandomNumber(from, to) {
            if (from >= to) {
                return 0;
            }
            var size = to - from;
            var curNumber = Math.random() * size + from;
            return curNumber;
        }
        static SpToCam(v3) {
            v3.x = -v3.x;
            v3.y = v3.y - 180;
            v3.z = -v3.z;
            return v3;
        }
        static get Gravity() {
            return new Laya.Vector3(0, -10, 0);
        }
        static MixVector3(from, to, t, res = null) {
            if (res == null) {
                res = this.m_mixVector;
            }
            res.x = Mathf.MixNumber(from.x, to.x, t);
            res.y = Mathf.MixNumber(from.y, to.y, t);
            res.z = Mathf.MixNumber(from.z, to.z, t);
            return res;
        }
        static MixVector4(from, to, t, res) {
            res.x = Mathf.MixNumber(from.x, to.x, t);
            res.y = Mathf.MixNumber(from.y, to.y, t);
            res.z = Mathf.MixNumber(from.z, to.z, t);
            res.w = Mathf.MixNumber(from.w, to.w, t);
            return res;
        }
        static MixNumber(from, to, t) {
            t = Mathf.Clamp(t, 0, 1);
            from = (to - from) * t + from;
            return from;
        }
        static Clamp(value, from, to) {
            if (value < from) {
                value = from;
            }
            if (value > to) {
                value = to;
            }
            return value;
        }
    }
    Mathf.m_mixVector = new Laya.Vector3();
    class FollowNumber {
        constructor(t, from = 0, to = 0, tiny = 0) {
            this.m_t = 0;
            this.target = 0;
            this.follow = 0;
            this.m_tiny = 0;
            this.m_t = t;
            this.target = to;
            this.follow = from;
            this.m_tiny = tiny;
        }
        ChangeT(value) {
            this.m_t = value;
        }
        get t() { return this.m_t; }
        update() {
            this.follow = Mathf.MixNumber(this.follow, this.target, this.m_t);
            if (this.m_tiny != 0 && this.target != this.follow) {
                if (Math.abs(this.target - this.follow) <= this.m_tiny) {
                    this.follow = this.target;
                }
            }
        }
    }

    var ColliderGroup;
    (function (ColliderGroup) {
        ColliderGroup[ColliderGroup["mound"] = 8] = "mound";
        ColliderGroup[ColliderGroup["wall"] = 9] = "wall";
        ColliderGroup[ColliderGroup["opponent"] = 10] = "opponent";
        ColliderGroup[ColliderGroup["obstacle1"] = 11] = "obstacle1";
        ColliderGroup[ColliderGroup["obstacle2"] = 12] = "obstacle2";
        ColliderGroup[ColliderGroup["obstacle3"] = 13] = "obstacle3";
    })(ColliderGroup || (ColliderGroup = {}));
    class MusicType {
    }
    MusicType.Idle = "Idle";
    MusicType.CrouchFiring = "CrouchFiring";
    MusicType.Dance = "Dance";
    MusicType.RunAndGun = "RunAndGun";
    MusicType.RunningHysteric = "RunningHysteric";

    class CameraManager {
        static get Instance() {
            return this.instance || (this.instance = new CameraManager());
        }
        Init(cam, startPos) {
            this.startPosTra = startPos.transform;
            if (cam) {
                this._camer = cam;
                this.Camera = this._camer.addComponent(Camera);
                this.Camera.Init();
            }
        }
        SetCamState(type, arg) {
            if (this.Camera)
                this.Camera.SetCameraByState(type, arg);
        }
        CameraMoveIngame(z) {
            if (this.Camera)
                this.Camera.MoveGame(z);
        }
    }

    class ConstructManager {
        constructor() {
            this.tarDis = 100;
            this.buildArr = [];
        }
        static get Instance() {
            return this.instance || (this.instance = new ConstructManager());
        }
        Init(builds) {
            this.buildArr.push(builds.getChildAt(1));
            this.buildArr.push(builds.getChildAt(0));
        }
        SetBuild() {
            for (let index = this.buildArr.length - 1; index >= 0; index--) {
                const element = this.buildArr[index];
                element.transform.localPositionZ = (1 - index) * 100;
            }
            this.tarDis = 70;
        }
        CheckPlayerRoadPos(_zp) {
            let d = this.tarDis - _zp;
            if (d > 0)
                return;
            this.SwitchRoad();
        }
        SwitchRoad() {
            let rs = this.buildArr.pop();
            rs.transform.localPositionZ = this.tarDis + 30 + 100;
            this.buildArr.unshift(rs);
            this.tarDis = this.tarDis + 100;
        }
    }

    class Level {
        constructor() {
            this.road_list = [];
            this.fail_gold = 0;
        }
        SetLevel(data) {
            this.road_list = GameTool.SpliteString(data["road_list"]);
            this.gold = Number(data["gold"]);
            this.fail_gold = Number(data["fail_gold"]);
            this.enemy = data["enemy"];
            this.enemy_hp = data["enemy_hp"];
            this.isgold = Number(data["isgold"]) == 1;
            this.enemy_cloth = data["enemy_cloth"] ? Number(data["enemy_cloth"]) : 1;
        }
    }
    class LevelController {
        static get Instance() {
            return LevelController.instance || (LevelController.instance = new LevelController());
        }
        SetLevel(level) {
            let len = CfgManager.Instance._level.length;
            let index = PlayerManager.Instance.stage;
            if (PlayerManager.Instance.stage > len)
                index = GameTool.randomInt(1, len);
            this.curLevelData = CfgManager.Instance.GetLevel(index);
            if (!this._level)
                this._level = new Level();
            this._level.SetLevel(this.curLevelData);
        }
    }

    class MoundManager {
        static get Instance() {
            return this.instance || (this.instance = new MoundManager());
        }
        constructor() {
            this.towerDic = new Dictionary();
        }
        Init(da) {
            this.towerContainer = da;
        }
        CreateTower(data) {
            let tower = GamePool.Instance.SetActiveObject(GamePool.pooltype.Tower);
            if (!tower)
                return;
            this.towerContainer.addChild(tower);
            let ts = tower.getComponent(Mound);
            if (!ts)
                ts = tower.addComponent(Mound);
            ts.SetTower(data);
            this.towerDic.set(tower.id, ts);
        }
        RemoveTower(sp) {
            this.towerDic.delete(sp.id);
        }
        CreateHpText() {
            return GamePool.Instance.SetActiveForUi(PoolType.HpText);
        }
        Reset() {
            let arr = [];
            for (const key in this.towerDic.container) {
                arr.push(key);
            }
            if (arr.length > 0) {
                for (let index = 0; index < arr.length; index++) {
                    const element = arr[index];
                    let s = this.towerDic.get(element);
                    if (s)
                        s.Des();
                }
            }
            console.log("this.towerDic.size", this.towerDic.size);
        }
    }

    class MatrixTransform {
        static WorldToScreen2(camera, point) {
            var pointA = this.InverseTransformPoint(camera.transform, point);
            var distance = pointA.z;
            var out = new Laya.Vector3();
            camera.viewport.project(point, camera.projectionViewMatrix, out);
            var value = new Laya.Vector3(out.x / Laya.stage.clientScaleX, out.y / Laya.stage.clientScaleY, distance);
            return value;
        }
        static ScreenToWorld(camera, point) {
            var halfFOV = (camera.fieldOfView * 0.5) * Math.PI / 180;
            let height = point.z * Math.tan(halfFOV);
            let width = height * camera.aspectRatio;
            let lowerLeft = this.GetLowerLeft(camera.transform, point.z, width, height);
            let v = this.GetScreenScale(width, height);
            var value = new Laya.Vector3();
            var lowerLeftA = this.InverseTransformPoint(camera.transform, lowerLeft);
            value = new Laya.Vector3(-point.x / v.x, point.y / v.y, 0);
            Laya.Vector3.add(lowerLeftA, value, value);
            value = this.TransformPoint(camera.transform, value);
            return value;
        }
        static GetScreenScale(width, height) {
            var v = new Laya.Vector3();
            v.x = Laya.stage.width / width / 2;
            v.y = Laya.stage.height / height / 2;
            return v;
        }
        static GetLowerLeft(transform, distance, width, height) {
            var lowerLeft = new Laya.Vector3();
            var right = new Laya.Vector3();
            transform.getRight(right);
            Laya.Vector3.normalize(right, right);
            var xx = new Laya.Vector3(right.x * width, right.y * width, right.z * width);
            Laya.Vector3.add(transform.position, xx, lowerLeft);
            var up = new Laya.Vector3();
            transform.getUp(up);
            Laya.Vector3.normalize(up, up);
            var yy = new Laya.Vector3(up.x * height, up.y * height, up.z * height);
            Laya.Vector3.subtract(lowerLeft, yy, lowerLeft);
            var forward = new Laya.Vector3();
            transform.getForward(forward);
            Laya.Vector3.normalize(forward, forward);
            var zz = new Laya.Vector3(forward.x * distance, forward.y * distance, forward.z * distance);
            Laya.Vector3.subtract(lowerLeft, zz, lowerLeft);
            return lowerLeft;
        }
        static InverseTransformPoint(origin, point) {
            var xx = new Laya.Vector3();
            origin.getRight(xx);
            var yy = new Laya.Vector3();
            origin.getUp(yy);
            var zz = new Laya.Vector3();
            origin.getForward(zz);
            var zz1 = new Laya.Vector3(-zz.x, -zz.y, -zz.z);
            var x = this.ProjectDistance(point, origin.position, xx);
            var y = this.ProjectDistance(point, origin.position, yy);
            var z = this.ProjectDistance(point, origin.position, zz1);
            var value = new Laya.Vector3(x, y, z);
            return value;
        }
        static TransformPoint(origin, point) {
            var value = new Laya.Vector3();
            Laya.Vector3.transformQuat(point, origin.rotation, value);
            Laya.Vector3.add(value, origin.position, value);
            return value;
        }
        static ProjectDistance(A, C, B) {
            var CA = new Laya.Vector3();
            Laya.Vector3.subtract(A, C, CA);
            var angle = this.Angle2(CA, B) * Math.PI / 180;
            var distance = Laya.Vector3.distance(A, C);
            distance *= Math.cos(angle);
            return distance;
        }
        static Angle2(ma, mb) {
            var v1 = (ma.x * mb.x) + (ma.y * mb.y) + (ma.z * mb.z);
            var ma_val = Math.sqrt(ma.x * ma.x + ma.y * ma.y + ma.z * ma.z);
            var mb_val = Math.sqrt(mb.x * mb.x + mb.y * mb.y + mb.z * mb.z);
            var cosM = v1 / (ma_val * mb_val);
            if (cosM < -1)
                cosM = -1;
            if (cosM > 1)
                cosM = 1;
            var angleAMB = Math.acos(cosM) * 180 / Math.PI;
            return angleAMB;
        }
    }

    class ParticleManager {
        constructor() {
            this.hitmaxcount = 0;
            this.boommaxcount = 0;
        }
        static get Instance() {
            return ParticleManager.instance || (ParticleManager.instance = new ParticleManager());
        }
        CreateHitEffect(pos) {
            if (this.hitmaxcount >= GlobalVariable.hitmaxcount)
                return;
            let h = GamePool.Instance.SetActiveObject("hit");
            h.transform.position = pos;
            Scene3DManager.Instance.effectCon.addChild(h);
            this.hitmaxcount++;
            Laya.timer.once(800, this, this.DisSpH, [h], false);
        }
        DisSpH(sp) {
            GamePool.Instance.SetDisableObject(sp);
            this.hitmaxcount--;
        }
        CreateBoomEffect(pos) {
            if (this.boommaxcount >= GlobalVariable.boommaxcount)
                return;
            let h = GamePool.Instance.SetActiveObject("boom");
            h.transform.position = pos;
            Scene3DManager.Instance.effectCon.addChild(h);
            this.boommaxcount++;
            Laya.timer.once(800, this, this.DisSpB, [h], false);
        }
        DisSpB(sp) {
            GamePool.Instance.SetDisableObject(sp);
            this.boommaxcount--;
        }
        CreateXueEffect(pos) {
            let h = GamePool.Instance.SetActiveObject("xue");
            h.transform.position = pos;
            Scene3DManager.Instance.effectCon.addChild(h);
            Laya.timer.once(800, this, this.DisSpX, [h], false);
        }
        DisSpX(sp) {
            GamePool.Instance.SetDisableObject(sp);
        }
    }
    ParticleManager.effectName = {
        hit: "hit",
        xue: "xue",
        boom: "boom"
    };

    var Event$1 = Laya.Event;
    var MouseManager = Laya.MouseManager;
    class MouseEvent {
        constructor() {
            this._switch = false;
            this._isCanClick = true;
            this.clickD = false;
            this._mousePos = Mathf.VecZero;
            this.tempMouse = Mathf.VecZero;
            this.clickCount = 0;
        }
        static get Instance() {
            return this.instance || (this.instance = new MouseEvent());
        }
        InitMouseEvent() {
            Laya.stage.on(Event$1.MOUSE_DOWN, this, this.OnClickDown);
            Laya.stage.on(Event$1.MOUSE_OUT, this, this.OnClickUp);
        }
        OnClickDown(e) {
            if (!this._isCanClick || !this._switch)
                return;
            if (e.target instanceof Laya.UIComponent)
                return;
            this.clickD = true;
            Laya.stage.on(Event$1.MOUSE_UP, this, this.OnClickUp);
            Laya.stage.on(Event$1.MOUSE_MOVE, this, this.OnSlider);
            this._mousePos.x = MouseManager.instance.mouseX;
            this._mousePos.y = MouseManager.instance.mouseY;
            this.MouseD();
        }
        StartGameClick() {
            this._switch = true;
            if (!this._isCanClick)
                return;
            this.clickD = true;
            Laya.stage.on(Event$1.MOUSE_UP, this, this.OnClickUp);
            Laya.stage.on(Event$1.MOUSE_MOVE, this, this.OnSlider);
            this._mousePos.x = MouseManager.instance.mouseX;
            this.MouseD();
        }
        MouseD() {
            MainRoleManager.Instance.SetPlayerPos(this._mousePos.x);
            MainRoleManager.Instance.CreateBullet();
        }
        OnClickUp(e) {
            if (!this._isCanClick || !this._switch)
                return;
            if (!this.clickD)
                return;
            this.MouseU();
        }
        OffMouseEvent() {
            Laya.stage.off(Event$1.MOUSE_DOWN, this, this.OnClickDown);
            Laya.stage.off(Event$1.MOUSE_UP, this, this.OnClickUp);
            Laya.stage.off(Event$1.MOUSE_OUT, this, this.OnClickUp);
        }
        MouseU() {
            this.clickD = false;
            Laya.stage.off(Event$1.MOUSE_MOVE, this, this.OnSlider);
            Laya.stage.off(Event$1.MOUSE_UP, this, this.OnClickUp);
        }
        OnSlider(e) {
            this.tempMouse.x = MouseManager.instance.mouseX;
            let offestX = this.tempMouse.x - this._mousePos.x;
            if (offestX >= 0)
                offestX = offestX < 20 ? offestX : 20;
            if (offestX < 0)
                offestX = offestX > -20 ? offestX : -20;
            MainRoleManager.Instance.SliderPlayer(-offestX);
            this._mousePos.x = this.tempMouse.x;
            this._mousePos.y = this.tempMouse.y;
        }
        OpenInput() {
            this.clickCount++;
            if (this.clickCount > 1)
                return;
            this._isCanClick = true;
        }
        CloseInput() {
            this.clickCount--;
            if (this.clickCount > 0)
                return;
            this._isCanClick = false;
            this.clickD = false;
        }
        set _Switch(value) {
            this._switch = value;
        }
    }

    class Street extends Laya.Script3D {
        constructor() {
            super(...arguments);
            this.rotate = Mathf.VecZero;
            this.speed = Mathf.VecZero;
        }
        onAwake() {
            this.selfobj = this.owner;
            this.tran = this.selfobj.transform;
        }
        SetBlock(thing) {
            this.tran.localPositionZ = Number(thing.z);
            this.tran.localPositionX = Number(thing.x);
            this.tran.rotationEuler = Mathf.VecZero;
            this.thing = thing;
            if (!MainRoleManager.Instance.player)
                return;
            this.tarTran = MainRoleManager.Instance.player.transform;
            this.SetDate();
        }
        SetDate() {
            if (this.thing.type == 5) {
                this.ttttt = this.selfobj.getChildAt(0).transform;
            }
            else {
                this.ttttt = this.tran;
                if (this.thing.type == 4) {
                    StreetManager.Instance.AddCubeBlock(this.selfobj);
                }
            }
            if (this.thing.moveType == 1) {
                Laya.timer.frameLoop(3, this, this.Cheack);
                return;
            }
            else if (this.thing.moveType == 2) {
                this.rotate.x = 0;
                this.rotate.y = -this.thing.moveSpeed;
                this.rotate.z = 0;
                Laya.timer.frameLoop(2, this, this.Move2);
            }
            else if (this.thing.moveType == 3) {
                this.rotate.x = 0;
                this.rotate.y = this.thing.moveSpeed;
                this.rotate.z = 0;
                Laya.timer.frameLoop(2, this, this.Move2);
            }
            else if (this.thing.moveType == 4) {
                this.rotate.x = 0;
                this.rotate.y = 0;
                this.rotate.z = this.thing.moveSpeed;
                Laya.timer.frameLoop(1, this, this.Move3);
            }
            else if (this.thing.moveType == 5) {
                this.rotate.x = 0;
                this.rotate.y = 0;
                this.rotate.z = -this.thing.moveSpeed;
                Laya.timer.frameLoop(1, this, this.Move3);
            }
            else if (this.thing.moveType == 6) {
                this.speed.x = -this.thing.moveSpeed;
                this.speed.y = 0;
                this.speed.z = 0;
                Laya.timer.frameLoop(1, this, this.Move4);
            }
            else if (this.thing.moveType == 7) {
                this.speed.x = this.thing.moveSpeed;
                this.speed.y = 0;
                this.speed.z = 0;
                Laya.timer.frameLoop(1, this, this.Move4);
            }
            else if (this.thing.moveType == 8) ;
            else if (this.thing.moveType == 9) ;
        }
        Move2() {
            this.ttttt.rotate(this.rotate);
            this.Cheack();
        }
        Move3() {
            this.ttttt.rotate(this.rotate);
            if (Math.abs(this.ttttt.localRotationEulerZ) >= 50)
                this.rotate.z = -this.rotate.z;
            this.Cheack();
        }
        Move4() {
            this.ttttt.translate(this.speed);
            if (Math.abs(this.ttttt.localPositionX) >= GlobalVariable.blockLRmoveMaxDis)
                this.speed.x = -this.speed.x;
            this.Cheack();
        }
        Cheack() {
            if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 10) {
                console.log("回收block", this.selfobj.name);
                this.Des();
                return;
            }
        }
        Des() {
            if (this.thing.type) {
                StreetManager.Instance.ResetCubBlock(this.selfobj.id);
            }
            Laya.timer.clearAll(this);
            StreetManager.Instance.RemoveBlock(this.selfobj);
            GamePool.Instance.SetDisableObject(this.selfobj);
        }
        onDestroy() {
        }
    }

    var REG = Laya.ClassUtils.regClass;
    var ui;
    (function (ui) {
        class AttributeUpViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(AttributeUpViewUI.uiView);
            }
        }
        AttributeUpViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8, "sizeGrid": "18,18,15,19" }, "compId": 3 }, { "type": "Box", "props": { "x": 52, "width": 636, "height": 538, "centerY": -41 }, "compId": 4, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/d0bg-shengji.png", "right": 0, "left": 0, "bottom": 0, "sizeGrid": "13,14,14,15" }, "compId": 31, "child": [{ "type": "Image", "props": { "y": -43, "x": 134, "skin": "gameRes1/aasudu-bg-2 (2).png" }, "compId": 32 }] }, { "type": "Button", "props": { "y": 116, "x": 342, "var": "rateBtn", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (1).png" }, "compId": 34, "child": [{ "type": "Image", "props": { "y": 19, "x": 44, "skin": "gameRes1/aasudu-bg-2 (5).png" }, "compId": 35 }, { "type": "Image", "props": { "y": 124, "x": 11, "var": "_rate", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 36, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 37 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "gameRes1/aasudu-bg-2 (6).png" }, "compId": 38, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 39 }] }] }, { "type": "Text", "props": { "y": 71, "x": 72, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 40 }, { "type": "Image", "props": { "y": 124, "x": 11, "visible": false, "var": "_rateVideo", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 42 }, { "type": "Image", "props": { "y": 12, "x": 117, "skin": "gameRes1/aasudu-bg-2 (10).png" }, "compId": 43 }] }, { "type": "Image", "props": { "y": 154, "x": 137, "var": "click2", "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 49 }] }, { "type": "Button", "props": { "y": 116, "x": 46, "var": "atkBtn", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (3).png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 19, "x": 66, "skin": "gameRes1/aasudu-bg-2 (4).png" }, "compId": 10 }, { "type": "Image", "props": { "y": 124, "x": 11, "var": "_atk", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 33 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "gameRes1/aasudu-bg-2 (6).png" }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 71, "x": 57, "width": 136, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 124, "x": 11, "visible": false, "var": "_atkVideo", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 46 }, { "type": "Image", "props": { "y": 12, "x": 117, "skin": "gameRes1/aasudu-bg-2 (10).png" }, "compId": 47 }] }, { "type": "Image", "props": { "y": 154.5, "x": 137, "var": "click1", "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 48 }] }, { "type": "Image", "props": { "y": 426, "x": 209, "var": "backBtn", "skin": "gameRes1/aasudu-bg-2 (7).png", "runtime": "Window/Com/ButtonRunTime.ts", "centerY": 180 }, "compId": 8 }] }], "animations": [{ "nodes": [{ "target": 48, "keyframes": { "y": [{ "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 0 }, { "value": 207, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 10 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 49, "keyframes": { "y": [{ "value": 154, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 0 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 10 }] } }], "name": "ani2", "id": 2, "frameRate": 24, "action": 2 }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/d0bg-shengji.png", "gameRes1/aasudu-bg-2 (2).png", "gameRes1/aasudu-bg-2 (1).png", "gameRes1/aasudu-bg-2 (5).png", "gameRes1/aasudu-bg-2 (8).png", "gameRes1/aasudu-bg-2 (9).png", "gameRes1/aasudu-bg-2 (6).png", "gameRes1/aasudu-bg-2 (10).png", "gameRes1/shou.png", "gameRes1/aasudu-bg-2 (3).png", "gameRes1/aasudu-bg-2 (4).png", "gameRes1/aasudu-bg-2 (7).png"], "loadList3D": [] };
        ui.AttributeUpViewUI = AttributeUpViewUI;
        REG("ui.AttributeUpViewUI", AttributeUpViewUI);
        class CompleteViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(CompleteViewUI.uiView);
            }
        }
        CompleteViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.9, "sizeGrid": "18,18,15,19" }, "compId": 22 }, { "type": "Box", "props": { "x": 178, "width": 364, "var": "winbtnBox", "height": 226, "bottom": 292 }, "compId": 47, "child": [{ "type": "Image", "props": { "x": 130, "var": "nextBtn", "skin": "gameRes1/no.png", "runtime": "Window/Com/ButtonRunTime.ts", "bottom": 0 }, "compId": 46 }, { "type": "Image", "props": { "y": 0, "x": 9, "var": "doublegetBtn", "skin": "gameRes1/sanbei-bt.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 28 }, { "type": "Image", "props": { "y": 74, "x": 33, "skin": "gameRes1/jinbi-da.png" }, "compId": 66, "child": [{ "type": "Text", "props": { "y": 3, "x": 81, "width": 218, "var": "doubleText", "valign": "middle", "text": "50", "strokeColor": "#714800", "stroke": 2, "height": 71, "fontSize": 56, "color": "#bc3e01", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 67 }] }] }, { "type": "Image", "props": { "x": 80, "var": "shibaiTop", "skin": "gameRes1/shibai.png", "centerY": -481 }, "compId": 68 }, { "type": "Image", "props": { "x": 92, "var": "winTop", "skin": "gameRes1/win-biao.png", "centerY": -481 }, "compId": 44 }, { "type": "Image", "props": { "x": 238, "width": 60, "skin": "gameRes1/jinbi-da.png", "height": 60, "centerY": 82 }, "compId": 69, "child": [{ "type": "Text", "props": { "y": -8, "x": 77, "width": 165, "var": "valueText", "valign": "middle", "text": "50(+100)", "height": 75, "fontSize": 40, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 70 }] }, { "type": "Box", "props": { "y": 258, "x": 138, "width": 444, "height": 429, "centerY": -168 }, "compId": 71, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 72, "child": [{ "type": "Image", "props": { "y": 31, "x": 52, "skin": "gameRes1/jianxingzhuang.png" }, "compId": 73 }, { "type": "Image", "props": { "y": 31, "x": 343, "skin": "gameRes1/jianxingzhuang.png" }, "compId": 74 }, { "type": "Image", "props": { "y": 31, "x": 177, "skin": "gameRes1/jiangli.png" }, "compId": 75 }] }, { "type": "Image", "props": { "y": 107, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 76, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "gameRes1/baolei.png" }, "compId": 80 }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "gameRes1/jinbi-da.png", "height": 50 }, "compId": 83 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "towerValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 82 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "towerCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 81 }] }, { "type": "Image", "props": { "y": 214, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 84, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "gameRes1/rentu.png" }, "compId": 85 }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "gameRes1/jinbi-da.png", "height": 50 }, "compId": 88 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "roleCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 86 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "roleValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 87 }] }, { "type": "Image", "props": { "y": 321, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "gameRes1/baohe.png" }, "compId": 90 }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "gameRes1/jinbi-da.png", "height": 50 }, "compId": 93 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "blockCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "blockValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 92 }] }] }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "duohuituiSp" }, "compId": 94 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 95 }], "animations": [{ "nodes": [{ "target": 18, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 40 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 40 }] } }], "name": "aim", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/no.png", "gameRes1/sanbei-bt.png", "gameRes1/jinbi-da.png", "gameRes1/shibai.png", "gameRes1/win-biao.png", "gameRes1/zhengchang-di.png", "gameRes1/jianxingzhuang.png", "gameRes1/jiangli.png", "gameRes1/baolei.png", "gameRes1/rentu.png", "gameRes1/baohe.png"], "loadList3D": [] };
        ui.CompleteViewUI = CompleteViewUI;
        REG("ui.CompleteViewUI", CompleteViewUI);
        class GuideViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(GuideViewUI.uiView);
            }
        }
        GuideViewUI.uiView = { "type": "Scene", "props": { "width": 720, "mouseThrough": true, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "y": 30, "x": 958, "width": 104, "var": "guide1Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 3, "x": -3, "skin": "gameRes1/zzzzzzguangquan(1).png" }, "compId": 8 }, { "type": "Image", "props": { "y": -123, "x": 2, "skin": "gameRes1/zzzzz1.png" }, "compId": 9 }] }, { "type": "Box", "props": { "y": 154, "x": 969, "width": 207, "var": "guide2Box", "scaleY": 0.8, "scaleX": 0.8, "height": 56, "anchorY": 0.5, "anchorX": 0 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 28, "x": 207, "width": 0, "skin": "gameRes1/zzzzzuoyou-jiantou(1).png", "rotation": 180, "pivotY": 48, "height": 96 }, "compId": 12 }, { "type": "Image", "props": { "y": 15, "x": 181, "skin": "gameRes1/shou.png" }, "compId": 11 }] }, { "type": "Box", "props": { "y": 298, "x": 1790, "width": 207, "var": "guide3Box", "scaleY": 0.8, "scaleX": 0.8, "height": 48, "anchorY": 0.5, "anchorX": 1 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 22, "x": 0, "width": 0, "skin": "gameRes1/zzzzzuoyou-jiantou(1).png", "pivotY": 48, "height": 96 }, "compId": 14 }, { "type": "Image", "props": { "y": 6, "x": -17, "width": 61, "skin": "gameRes1/shou.png" }, "compId": 15 }] }, { "type": "Box", "props": { "y": 278, "x": -163, "width": 104, "var": "guide4Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 19, "child": [{ "type": "Image", "props": { "y": -106, "x": 4, "skin": "gameRes1/zzzzz1.png" }, "compId": 21 }] }, { "type": "Image", "props": { "x": 203, "var": "guide1Image", "skin": "gameRes1/zzzzbiaoyu(2).png", "bottom": 213 }, "compId": 16 }, { "type": "Image", "props": { "x": 164, "var": "guide2Image", "skin": "gameRes1/zzzzbiaoyu(1).png", "bottom": 218 }, "compId": 17 }, { "type": "Image", "props": { "x": 136, "var": "guide3Image", "skin": "gameRes1/zzzzbiaoyu.png", "bottom": 220 }, "compId": 18 }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "y": [{ "value": -116, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 0 }, { "value": -197, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 5 }, { "value": -115, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 10 }] } }], "name": "guide1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 11, "keyframes": { "x": [{ "value": 181, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 0 }, { "value": 21, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 10 }] } }, { "target": 12, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 0 }, { "value": 188, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 10 }] } }], "name": "guide2", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 15, "keyframes": { "x": [{ "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 0 }, { "value": 122, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 10 }] } }, { "target": 14, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 0 }, { "value": 149, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 10 }] } }], "name": "guide3", "id": 3, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 21, "keyframes": { "y": [{ "value": -212, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 0 }, { "value": -106, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 10 }] } }], "name": "guide4", "id": 4, "frameRate": 24, "action": 0 }], "loadList": ["gameRes1/zzzzzzguangquan(1).png", "gameRes1/zzzzz1.png", "gameRes1/zzzzzuoyou-jiantou(1).png", "gameRes1/shou.png", "gameRes1/zzzzbiaoyu(2).png", "gameRes1/zzzzbiaoyu(1).png", "gameRes1/zzzzbiaoyu.png"], "loadList3D": [] };
        ui.GuideViewUI = GuideViewUI;
        REG("ui.GuideViewUI", GuideViewUI);
        class InGameViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(InGameViewUI.uiView);
            }
        }
        InGameViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
        ui.InGameViewUI = InGameViewUI;
        REG("ui.InGameViewUI", InGameViewUI);
        class IntensifyViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(IntensifyViewUI.uiView);
            }
        }
        IntensifyViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/111111.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8, "sizeGrid": "22,12,11,12" }, "compId": 3 }, { "type": "Box", "props": { "x": 52, "width": 636, "height": 626, "centerY": -18 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 636, "var": "atkBox", "skin": "gameRes1/11.png", "height": 185, "sizeGrid": "21,22,21,22" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 43, "x": 183, "skin": "gameRes1/gongji-2.png" }, "compId": 10 }, { "type": "Image", "props": { "y": 43, "x": 34, "skin": "gameRes1/gongji-icon.png" }, "compId": 9 }, { "type": "Image", "props": { "y": 125, "x": 179, "skin": "gameRes1/gongji-1.png" }, "compId": 11 }, { "type": "Button", "props": { "y": 89, "x": 412, "var": "atkBtn", "stateNum": 1, "skin": "gameRes1/lv-di.png" }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 13, "x": 12, "width": 45, "skin": "gameRes1/jinbi.png", "height": 45 }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 31, "x": 449, "width": 106, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }] }, { "type": "Image", "props": { "y": 226, "x": 0, "width": 636, "var": "rateBox", "skin": "gameRes1/11.png", "height": 185, "sizeGrid": "21,22,21,22" }, "compId": 6, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "gameRes1/sudu-2.png" }, "compId": 17 }, { "type": "Image", "props": { "y": 43, "x": 34, "skin": "gameRes1/iconqiang.png" }, "compId": 18 }, { "type": "Image", "props": { "y": 125, "x": 164, "skin": "gameRes1/sudu-1(1).png" }, "compId": 19 }, { "type": "Button", "props": { "y": 89, "x": 412, "var": "rateBtn", "stateNum": 1, "skin": "gameRes1/lv-di.png" }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 13, "x": 12, "width": 45, "skin": "gameRes1/jinbi.png", "height": 45 }, "compId": 22, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }] }, { "type": "Text", "props": { "y": 31, "x": 449, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 21 }] }, { "type": "Image", "props": { "y": 444, "x": 0, "width": 636, "visible": true, "var": "coinBox", "skin": "gameRes1/11.png", "height": 185, "sizeGrid": "21,22,21,22" }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "gameRes1/huode.png" }, "compId": 24 }, { "type": "Image", "props": { "y": 43, "x": 34, "skin": "gameRes1/jinbi (2).png" }, "compId": 25 }, { "type": "Image", "props": { "y": 125, "x": 156, "skin": "gameRes1/tishengjinbi3.png" }, "compId": 26 }, { "type": "Button", "props": { "y": 57, "x": 412, "var": "coinBtn", "stateNum": 1, "skin": "gameRes1/lv-di.png" }, "compId": 27, "child": [{ "type": "Image", "props": { "y": 13, "x": 12, "width": 45, "skin": "gameRes1/shipin-icon.png", "height": 45 }, "compId": 29, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "coinValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 30 }] }] }] }] }, { "type": "Image", "props": { "x": 17, "var": "backBtn", "skin": "gameRes1/p__fanhui.png", "runtime": "Window/Com/ButtonRunTime.ts", "centerY": -436 }, "compId": 8 }, { "type": "Image", "props": { "x": 290, "skin": "gameRes1/shengji.png", "centerY": -478 }, "compId": 31 }], "loadList": ["gameRes1/111111.png", "gameRes1/11.png", "gameRes1/gongji-2.png", "gameRes1/gongji-icon.png", "gameRes1/gongji-1.png", "gameRes1/lv-di.png", "gameRes1/jinbi.png", "gameRes1/sudu-2.png", "gameRes1/iconqiang.png", "gameRes1/sudu-1(1).png", "gameRes1/huode.png", "gameRes1/jinbi (2).png", "gameRes1/tishengjinbi3.png", "gameRes1/shipin-icon.png", "gameRes1/p__fanhui.png", "gameRes1/shengji.png"], "loadList3D": [] };
        ui.IntensifyViewUI = IntensifyViewUI;
        REG("ui.IntensifyViewUI", IntensifyViewUI);
        class LoadViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(LoadViewUI.uiView);
            }
        }
        LoadViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "load/bg.jpg", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 6 }, { "type": "Image", "props": { "x": 360, "var": "prepan", "centerY": -68 }, "compId": 14 }, { "type": "Image", "props": { "y": 124, "x": 52, "skin": "load/logo.png", "centerY": -360 }, "compId": 17 }, { "type": "Image", "props": { "y": 932, "x": 137, "var": "pro", "skin": "load/jindu-1.png", "centerY": 309 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 4, "x": 4, "width": 438, "var": "pro1", "skin": "load/jindu-2.png" }, "compId": 21 }, { "type": "Image", "props": { "y": 52, "x": 174, "skin": "load/jiazai-1-2.png" }, "compId": 8, "child": [{ "type": "Image", "props": { "x": 105, "width": 6, "skin": "load/jiazai-1-3.png", "height": 6, "bottom": 9 }, "compId": 9 }, { "type": "Image", "props": { "x": 120, "skin": "load/jiazai-1-3.png", "bottom": 10 }, "compId": 10 }, { "type": "Image", "props": { "x": 136, "skin": "load/jiazai-1-3.png", "bottom": 10 }, "compId": 11 }] }, { "type": "Text", "props": { "y": 0, "x": 2, "width": 442, "var": "proTex", "valign": "middle", "text": "100%", "height": 38, "fontSize": 28, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 22 }] }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 20 }] } }, { "target": 10, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 10 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 20 }] } }, { "target": 11, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 20 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["load/bg.jpg", "load/logo.png", "load/jindu-1.png", "load/jindu-2.png", "load/jiazai-1-2.png", "load/jiazai-1-3.png"], "loadList3D": [] };
        ui.LoadViewUI = LoadViewUI;
        REG("ui.LoadViewUI", LoadViewUI);
        class MainViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(MainViewUI.uiView);
            }
        }
        MainViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "x": 0, "top": 82, "right": 0, "left": 0, "height": 70 }, "compId": 265, "child": [{ "type": "Image", "props": { "y": 21, "x": 282, "width": 157, "var": "pro", "skin": "gameRes1/jindu-duan.png" }, "compId": 302, "child": [{ "type": "Image", "props": { "y": 4, "x": 0, "var": "pro1", "skin": "gameRes1/jindu-guan-do.png" }, "compId": 305 }, { "type": "Image", "props": { "y": -11, "x": -49, "skin": "gameRes1/guanshu.png" }, "compId": 303, "child": [{ "type": "Text", "props": { "y": -1, "x": -3, "width": 54, "var": "stageValue", "valign": "middle", "text": "10", "height": 51, "fontSize": 32, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 264 }] }, { "type": "Image", "props": { "y": -11, "x": 155, "skin": "gameRes1/shadi.png" }, "compId": 304 }] }, { "type": "Image", "props": { "x": 533, "width": 187, "top": 85, "skin": "gameRes1/jinbi-bg.png", "right": 0 }, "compId": 261, "child": [{ "type": "Image", "props": { "y": 11, "x": 5, "skin": "gameRes1/jinbi.png" }, "compId": 262 }, { "type": "Text", "props": { "y": 6, "x": 41, "width": 142, "var": "countValue", "valign": "middle", "text": "100000", "italic": true, "height": 47, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 263 }] }] }, { "type": "Box", "props": { "var": "mainBox", "top": 0, "right": 0, "name": "mainBox", "left": 0, "bottom": 0 }, "compId": 284, "child": [{ "type": "Button", "props": { "var": "coutiBtn", "stateNum": 1, "skin": "gameRes1/Begin-gengduoyouxi.png", "left": 0, "centerY": 0 }, "compId": 294 }, { "type": "Image", "props": { "x": 24, "var": "settingBtn", "top": 101, "skin": "gameRes1/setBtn.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 260 }, { "type": "Box", "props": { "x": 29, "width": 63, "visible": false, "var": "settingBox", "top": 179, "height": 134 }, "compId": 291, "child": [{ "type": "Button", "props": { "x": 2, "width": 59, "var": "shake_btn", "stateNum": 1, "height": 59 }, "compId": 285, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "gameRes1/ButtonVibrationOn.png", "name": "kai" }, "compId": 287 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "gameRes1/ButtonVibrationOff.png", "name": "guan" }, "compId": 288 }] }, { "type": "Button", "props": { "y": 74, "width": 62, "var": "sound_btn", "stateNum": 1, "height": 60 }, "compId": 286, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "gameRes1/Icon_SoundOn.png", "name": "kai" }, "compId": 289 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "gameRes1/Icon_SoundOff.png", "name": "guan" }, "compId": 290 }] }] }, { "type": "Box", "props": { "var": "startBox", "right": 0, "left": 0, "height": 5, "bottom": 208 }, "compId": 259, "child": [{ "type": "Image", "props": { "var": "updateBtn", "skin": "gameRes1/updateBtn.png", "runtime": "Window/Com/ButtonRunTime.ts", "left": 0, "bottom": 0 }, "compId": 257 }, { "type": "Image", "props": { "var": "skinBtn", "skin": "gameRes1/skinBtn.png", "runtime": "Window/Com/ButtonRunTime.ts", "right": 0, "bottom": 0 }, "compId": 258 }] }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 194, "var": "user_id", "valign": "middle", "text": "user_id:12", "height": 25, "fontSize": 25, "color": "#000000", "runtime": "laya.display.Text" }, "compId": 270 }, { "type": "Button", "props": { "var": "moreGameBtn", "stateNum": 1, "skin": "youziTexture/btn-entrance-nogift.png", "left": 587, "centerY": 133 }, "compId": 311 }] }, { "type": "Image", "props": { "x": 195, "var": "sliderBox", "skin": "gameRes1/huadong-tiao.png", "gray": false, "bottom": 304 }, "compId": 253, "child": [{ "type": "Image", "props": { "y": -45, "x": 95, "skin": "gameRes1/huadong.png" }, "compId": 292 }, { "type": "Image", "props": { "y": 0, "x": 164, "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 293 }] }, { "type": "Sprite", "props": { "var": "duohuituiSp" }, "compId": 312 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 313 }], "animations": [{ "nodes": [{ "target": 293, "keyframes": { "x": [{ "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 15 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 30 }, { "value": 326, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 45 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 60 }] } }, { "target": 292, "keyframes": { "x": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 292, "key": "x", "index": 0 }], "skin": [{ "value": "gameRes1/pause1.png", "tweenMethod": "linearNone", "tween": false, "target": 292, "key": "skin", "index": 0 }] } }], "name": "gameStart", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["gameRes1/jindu-duan.png", "gameRes1/jindu-guan-do.png", "gameRes1/guanshu.png", "gameRes1/shadi.png", "gameRes1/jinbi-bg.png", "gameRes1/jinbi.png", "gameRes1/Begin-gengduoyouxi.png", "gameRes1/setBtn.png", "gameRes1/ButtonVibrationOn.png", "gameRes1/ButtonVibrationOff.png", "gameRes1/Icon_SoundOn.png", "gameRes1/Icon_SoundOff.png", "gameRes1/updateBtn.png", "gameRes1/skinBtn.png", "youziTexture/btn-entrance-nogift.png", "gameRes1/huadong-tiao.png", "gameRes1/huadong.png", "gameRes1/shou.png", "gameRes1/pause1.png"], "loadList3D": [] };
        ui.MainViewUI = MainViewUI;
        REG("ui.MainViewUI", MainViewUI);
        class ShadeViewUI extends Laya.View {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(ShadeViewUI.uiView);
            }
        }
        ShadeViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
        ui.ShadeViewUI = ShadeViewUI;
        REG("ui.ShadeViewUI", ShadeViewUI);
        class SkinShopViewUI extends Laya.View {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(SkinShopViewUI.uiView);
            }
        }
        SkinShopViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/sssdi-3.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "x": 17, "var": "backBtn", "skin": "gameRes1/pppguanbi-bt.png", "runtime": "Window/Com/ButtonRunTime.ts", "centerY": -529 }, "compId": 87 }, { "type": "Image", "props": { "skin": "gameRes1/ppppifu-biaoti.png", "centerY": -399 }, "compId": 92 }, { "type": "Box", "props": { "x": 50, "width": 626, "height": 102, "centerY": -70 }, "compId": 100, "child": [{ "type": "Button", "props": { "width": 102, "var": "leftBtn", "stateNum": 1, "height": 102 }, "compId": 93, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppwu-zuo.png", "name": "leftFalse" }, "compId": 95 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppyou-zuo.png", "name": "leftTrue" }, "compId": 96 }] }, { "type": "Button", "props": { "x": 521, "width": 102, "var": "rightBtn", "stateNum": 1, "height": 102 }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppwu-you.png", "name": "rightFalse" }, "compId": 98 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppyou-you.png", "name": "rightTrue" }, "compId": 99 }] }] }, { "type": "Image", "props": { "y": 813, "x": 167, "skin": "gameRes1/sssren-di-2.png", "centerY": 227 }, "compId": 101 }, { "type": "Image", "props": { "y": 469, "x": 209, "width": 302, "var": "viewPort", "height": 398, "centerY": 28 }, "compId": 102 }, { "type": "Box", "props": { "x": 196, "width": 331, "var": "btnBox", "height": 127, "centerY": 396 }, "compId": 113, "child": [{ "type": "Image", "props": { "var": "using", "skin": "gameRes1/pppbt-bg.png" }, "compId": 103, "child": [{ "type": "Text", "props": { "y": 31, "x": 63, "width": 202, "valign": "middle", "text": "使用中", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Image", "props": { "var": "use", "skin": "gameRes1/pppbt-bg.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 105, "child": [{ "type": "Text", "props": { "y": 31, "x": 63, "width": 202, "valign": "middle", "text": "使用", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }] }, { "type": "Image", "props": { "var": "coin", "skin": "gameRes1/pppbt-bg.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 22, "x": 25, "skin": "gameRes1/jinbi-da.png" }, "compId": 109, "child": [{ "type": "Text", "props": { "y": 8, "x": 63, "width": 202, "valign": "middle", "text": "500", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }] }, { "type": "Image", "props": { "var": "video", "skin": "gameRes1/pppbt-bg.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 110, "child": [{ "type": "Image", "props": { "y": 33, "x": 54, "width": 65, "skin": "gameRes1/aasudu-bg-2 (10).png", "height": 61 }, "compId": 111, "child": [{ "type": "Text", "props": { "y": -2, "x": 63, "width": 202, "valign": "middle", "text": "1/3", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 112 }] }] }] }], "loadList": ["gameRes1/sssdi-3.png", "gameRes1/pppguanbi-bt.png", "gameRes1/ppppifu-biaoti.png", "gameRes1/pppwu-zuo.png", "gameRes1/pppyou-zuo.png", "gameRes1/pppwu-you.png", "gameRes1/pppyou-you.png", "gameRes1/sssren-di-2.png", "gameRes1/pppbt-bg.png", "gameRes1/jinbi-da.png", "gameRes1/aasudu-bg-2 (10).png"], "loadList3D": [] };
        ui.SkinShopViewUI = SkinShopViewUI;
        REG("ui.SkinShopViewUI", SkinShopViewUI);
        class TopTipUiUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(TopTipUiUI.uiView);
            }
        }
        TopTipUiUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0, "sizeGrid": "18,18,15,19" }, "compId": 3 }, { "type": "Image", "props": { "y": 647, "x": 159, "width": 402, "var": "sliderBox", "skin": "gameRes1/huadong-tiao.png", "height": 33, "gray": false, "centerY": 23 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 124, "x": 37, "skin": "gameRes1/pause1.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 0, "x": 201, "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 6 }] }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "x": [{ "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 13, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 15 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 30 }, { "value": 402, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 45 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 60 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/huadong-tiao.png", "gameRes1/pause1.png", "gameRes1/shou.png"], "loadList3D": [] };
        ui.TopTipUiUI = TopTipUiUI;
        REG("ui.TopTipUiUI", TopTipUiUI);
        class TrialViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(TrialViewUI.uiView);
            }
        }
        TrialViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "sizeGrid": "18,18,15,19" }, "compId": 3 }, { "type": "Image", "props": { "x": 125, "skin": "gameRes1/sssbiaoti.png", "centerY": -503 }, "compId": 4 }, { "type": "Image", "props": { "x": 104, "visible": false, "skin": "gameRes1/sssdi-3.png", "centerY": -100 }, "compId": 5 }, { "type": "Image", "props": { "x": 167, "skin": "gameRes1/sssren-di-2.png", "centerY": 85 }, "compId": 6 }, { "type": "Image", "props": { "x": 209, "width": 302, "var": "viewPort", "height": 398, "centerY": -108 }, "compId": 8 }, { "type": "Image", "props": { "x": 245, "skin": "gameRes1/x3.png", "centerY": -374 }, "compId": 12 }, { "type": "Box", "props": { "x": 196, "width": 325, "var": "btnBox", "height": 191, "bottom": 289 }, "compId": 11, "child": [{ "type": "Image", "props": { "y": 145, "x": 92, "var": "backBtn", "skin": "gameRes1/sssno-bt.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 9 }, { "type": "Image", "props": { "var": "videoBtn", "skin": "gameRes1/sssbt.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 10 }] }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/sssbiaoti.png", "gameRes1/sssdi-3.png", "gameRes1/sssren-di-2.png", "gameRes1/x3.png", "gameRes1/sssno-bt.png", "gameRes1/sssbt.png"], "loadList3D": [] };
        ui.TrialViewUI = TrialViewUI;
        REG("ui.TrialViewUI", TrialViewUI);
    })(ui || (ui = {}));

    class GuideView extends ui.GuideViewUI {
        constructor() {
            super();
            this.isguide2or3 = false;
            this.guide1pos = Mathf.VecZero;
            this.guide1Com = false;
            GuideView.instance = this;
            this.resizeHander();
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        static get Instance() {
            return GuideView.instance;
        }
        OnShow(data) {
            this.InitHandler();
            this.InitDate();
            this.InitHandler();
            this.InitUi();
        }
        InitUi() {
        }
        InitDate() {
        }
        InitHandler() {
        }
        SetGuide(type) {
            if (!this.playerTran)
                this.playerTran = MainRoleManager.Instance.playerTra;
            if (!this._camera)
                this._camera = CameraManager.Instance._camer;
            if (type == 1) {
                this.guide1Image.visible = true;
                this.guide2Image.visible = false;
                this.guide3Image.visible = false;
                this.guide1Box.visible = true;
                this.guide1.play(0, true);
                this.guide4Box.visible = false;
                if (this.playerTran.localPositionX <= GuideController.Instance.guide1pos.x) {
                    this.guide2Box.visible = true;
                    this.guide3Box.visible = false;
                    this.isguide2or3 = true;
                    this.guide2.play(0, true);
                }
                else {
                    this.guide2Box.visible = false;
                    this.guide3Box.visible = true;
                    this.isguide2or3 = false;
                    this.guide3.play(0, true);
                }
                this.guide1pos = GuideController.Instance.guide1pos.clone();
                Laya.timer.frameLoop(1, this, this._guide1);
                this.guide1Com = false;
            }
        }
        _guide1() {
            if (!this.guide1Com) {
                let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guide1pos.clone());
                this.guide1Box.pos(p.x, p.y);
                this.guide1pos.z = this.playerTran.localPositionZ + 10;
                let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
                if (this.isguide2or3) {
                    this.guide2Box.pos(p1.x, p1.y);
                }
                else {
                    this.guide3Box.pos(p1.x, p1.y);
                }
                if (this.playerTran.localPositionZ >= GuideController.Instance.guide1pos.z - 5) {
                    this.guide2.stop();
                    this.guide3.stop();
                    this.guide2Box.visible = false;
                    this.guide3Box.visible = false;
                    this.guide1Box.visible = false;
                    this.guide1Com = true;
                    this.guide1Image.visible = false;
                }
            }
            else {
                if (this.playerTran.localPositionZ >= GuideController.Instance.guide1pos.z) {
                    console.log(111);
                    Laya.timer.clear(this, this._guide1);
                    this.Guide2();
                }
            }
        }
        Guide2() {
            this.guide3Box.visible = true;
            this.guide4Box.visible = true;
            this.guide2Image.visible = true;
            this.guide3.play(0, true);
            this.guide4.play(0, true);
            Laya.timer.frameLoop(1, this, this._guide2);
            this.guide1pos.x = -4.5;
            this.guide1pos.y = 0;
        }
        _guide2() {
            let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guide2Pos.clone());
            this.guide4Box.pos(p.x, p.y);
            this.guide1pos.z = this.playerTran.localPositionZ + 5;
            let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
            this.guide3Box.pos(p1.x, p1.y);
            if (this.playerTran.localPositionZ >= GuideController.Instance.guide2Pos.z - 10) {
                this.guide3Box.visible = false;
                this.guide4Box.visible = false;
                this.guide2Image.visible = false;
                this.guide3Image.visible = true;
                this.guide3.stop();
                this.guide4.stop();
                Laya.timer.clear(this, this._guide2);
                Laya.timer.once(5000, this, () => {
                    GuideController.Instance.OverGuide();
                });
            }
        }
        OnClose() {
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
            GuideView.instance = null;
            Laya.timer.clearAll(this);
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
    }

    class GuideController {
        constructor() {
            this.isguide = false;
            this.guide1pos = new Laya.Vector3(2.5, 0, 59.4);
            this.guide2Pos = new Laya.Vector3(-5, 2, 104.4);
            this.index = 0;
        }
        static get Instance() {
            return this.instance || (this.instance = new GuideController());
        }
        IsGuide() {
            let t = Laya.LocalStorage.getItem("guide");
            if (PlayerManager.Instance.stage == 1) {
                Laya.LocalStorage.setItem("guide", "1");
                this.isguide = true;
                return true;
            }
            this.isguide = false;
            return false;
        }
        SetGuidePos(p) {
            if (this.index == 0) {
                this.guide1pos.z = p;
                this.index++;
            }
            else if (this.index == 1) {
                this.guide2Pos.z = p;
                this.index++;
            }
        }
        StartGuide() {
            if (this.isguide) {
                Laya.timer.once(500, this, this.Guide1);
            }
        }
        OverGuide() {
            this.isguide = false;
            ViewManager.Instance.CloseGuideView();
        }
        Guide1() {
            ViewManager.Instance.ShowGuideView();
            if (GuideView.Instance) {
                GuideView.Instance.SetGuide(1);
            }
        }
        GameDied() {
            if (this.isguide) {
                ViewManager.Instance.CloseGuideView();
            }
        }
    }

    class RoadArr {
        constructor(blocks, blockPos) {
            this.blocks = blocks;
            this.blockPos = blockPos;
        }
    }
    class BlockArr {
        constructor(things, thingPos, blockHp) {
            this.things = things;
            this.thingPos = thingPos;
            this.blockHp = blockHp;
        }
    }
    class ThingArr {
        constructor(type, prrfabName, moveType, moveSpeed) {
            this.type = type;
            this.prrfabName = prrfabName;
            this.moveType = moveType;
            this.moveSpeed = moveSpeed;
        }
    }
    class StreetManager {
        constructor() {
            this.isover = false;
            this.curindex = 1;
            this.blockDic = new Dictionary();
            this.cubeBlockDic = new Dictionary();
        }
        static get Instance() {
            return StreetManager.instance || (StreetManager.instance = new StreetManager());
        }
        Init(BlockContainer) {
            this.BlockContainer = BlockContainer;
        }
        SetBlock() {
            this.isover = false;
            this.curindex = 1;
            this.CreateBlock();
        }
        CreateBlock() {
            let road_list = LevelController.Instance._level.road_list;
            if (this.curindex > road_list.length - 1) {
                this.isover = true;
                console.log("没有障碍物了");
                return;
            }
            this.tarDis =
                this.curindex * GlobalVariable.barrierRoadLength;
            let roadindex = road_list[this.curindex];
            if (roadindex == 0)
                return;
            let roads = CfgManager.Instance.GetRoad(roadindex);
            if (!roads)
                return;
            let blocks = GameTool.SpliteString(roads["blocks"]);
            let blockPoss = GameTool.SpliteString(roads["position"]);
            let bps = [];
            let d = GlobalVariable.barrierRoadLength / GlobalVariable.barrierRoadAverageNum;
            blockPoss.forEach(element => {
                bps.push(this.tarDis + element * d);
            });
            let bbs = [];
            blocks.forEach(element => {
                let thing = CfgManager.Instance.GetBlock(element);
                let tss = GameTool.SpliteString(thing["block_things"]);
                let tps = GameTool.SpliteString(thing["thing_position"]);
                let ths = GameTool.SpliteString(thing["block_hp"]);
                let ttt = [];
                tss.forEach(element1 => {
                    let t = CfgManager.Instance.GetThing(element1);
                    let tt = new ThingArr(t["type"], t["prefabs"], t["dynamic_type"], t["dynamic_speed"]);
                    ttt.push(tt);
                });
                let things = new BlockArr(ttt, tps, ths);
                bbs.push(things);
            });
            let blockB = new RoadArr(bbs, bps);
            this.CreateSp(blockB);
        }
        CheckPlayerRoadPos(_zp) {
            if (this.isover)
                return;
            let d = this.tarDis - _zp;
            if (d > 0)
                return;
            this.SwitchBlock();
        }
        SwitchBlock() {
            this.curindex++;
            console.log("到达一个障碍物");
            this.CreateBlock();
        }
        CreateSp(road) {
            if (GuideController.Instance.isguide) {
                GuideController.Instance.SetGuidePos(road.blockPos[0]);
            }
            let blocks = road.blocks;
            let blockPos = road.blockPos;
            let j = 0;
            for (let index = 0; index < blocks.length; index++) {
                const element = blocks[index];
                const p = blockPos[index];
                let things = element.things;
                let thingPos = element.thingPos;
                let blockHp = element.blockHp;
                let isr = blockHp.length > 1;
                for (let index = 0; index < things.length; index++) {
                    const element1 = things[index];
                    element1.z = p;
                    element1.x = thingPos[index];
                    element1.towerR = isr;
                    element1.hp = blockHp[index];
                    j++;
                    Laya.timer.frameOnce(j, this, this._crete, [element1], false);
                }
            }
        }
        _crete(thing) {
            if (thing.type == 1 || thing.type == 2) {
                MoundManager.Instance.CreateTower(thing);
            }
            else {
                let p = GamePool.Instance.SetActiveObject(thing.prrfabName);
                if (!p)
                    return;
                this.BlockContainer.addChild(p);
                let ts = p.getComponent(Street);
                if (!ts)
                    ts = p.addComponent(Street);
                ts.SetBlock(thing);
                this.blockDic.set(p.id, ts);
            }
        }
        RemoveBlock(sp) {
            this.blockDic.delete(sp.id);
        }
        AddCubeBlock(sp) {
            if (this.cubeBlockDic.has(sp.id))
                return;
            this.cubeBlockDic.set(sp.id, sp);
        }
        ResetCubBlock(id) {
            let sp = this.cubeBlockDic.get(id);
            this.cubeBlockDic.delete(id);
            if (!sp)
                return;
            console.log("回收CubeBlock,", sp.name);
            for (let index = 0; index < sp.numChildren; index++) {
                const element = sp.getChildAt(index);
                element.active = true;
            }
        }
        CubeBlockAtked(sp) {
            sp.active = false;
            ParticleManager.Instance.CreateBoomEffect(sp.transform.position);
        }
        Reset() {
            this.isover = false;
            let arr = [];
            for (const key in this.blockDic.container) {
                arr.push(key);
            }
            let j = 1;
            if (arr.length > 0) {
                for (let index = 0; index < arr.length; index++) {
                    const element = arr[index];
                    let s = this.blockDic.get(element);
                    if (s)
                        s.Des();
                    if (this.cubeBlockDic.has(element)) {
                        Laya.timer.frameOnce(j, this, this.ResetCubBlock, [element], false);
                        j++;
                    }
                }
            }
            console.log("this.blockDic.size", this.blockDic.size);
        }
    }

    var Vector3$1 = Laya.Vector3;
    var Quaternion = Laya.Quaternion;
    class Opponent extends Laya.Script3D {
        constructor() {
            super(...arguments);
            this._up = new Vector3$1(0, 1, 0);
            this.isArrive1 = false;
        }
        onAwake() {
            this.selfobj = this.owner;
            this.tran = this.selfobj.transform;
            this.mat = (this.selfobj.getChildAt(0).getChildByName("enemy").skinnedMeshRenderer.material);
            this.forW = Mathf.VecZero;
            this.speed = GlobalVariable.enemySpeed;
            this.quaternion1 = new Quaternion();
        }
        SetTar(tar, hp, cloth) {
            this.tarSp = tar;
            this.isArrive1 = false;
            if (this.tarSp == null)
                return;
            this.tarPos = this.tarSp.transform.position.clone();
            if (this.tarPos.x > 0) {
                this.tarPos = PlaneManager.Instance.toured1.clone();
            }
            else {
                this.tarPos = PlaneManager.Instance.toured2.clone();
            }
            this.hp = hp;
            this.mat.albedoTexture = AssetController.Instance.cloth[cloth - 1];
            this.mat.emissionTexture = AssetController.Instance.cloth[cloth - 1];
            Laya.timer.frameLoop(1, this, this.Move);
        }
        Move() {
            if (this.isArrive1) {
                if (this.tarSp == null)
                    return;
                if (!this.tarSp.active) {
                    this.tarSp = RoleManager.Instance.GetTar();
                    if (this.tarSp == null)
                        return;
                    this.tarPos = this.tarSp.transform.position.clone();
                }
                Vector3$1.subtract(this.tarPos, this.tran.position, this.forW);
                Vector3$1.normalize(this.forW, this.forW);
                this.forW = new Vector3$1(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
                this.tran.translate(this.forW, false);
                if (Vector3$1.distance(this.tran.position, this.tarPos) < 0.1) {
                    return;
                }
                Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
                this.quaternion1.invert(this.quaternion1);
                this.tran.rotation = this.quaternion1.clone();
            }
            else {
                Vector3$1.subtract(this.tarPos, this.tran.position, this.forW);
                Vector3$1.normalize(this.forW, this.forW);
                this.forW = new Vector3$1(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
                this.tran.translate(this.forW, false);
                if (Vector3$1.distance(this.tran.position, this.tarPos) < 0.1) {
                    this.tarSp = RoleManager.Instance.GetTar();
                    this.isArrive1 = true;
                    if (this.tarSp == null)
                        return;
                    this.tarPos = this.tarSp.transform.position.clone();
                    return;
                }
                Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
                this.quaternion1.invert(this.quaternion1);
                this.tran.rotation = this.quaternion1.clone();
            }
        }
        Atked(hitpos) {
            this.hp -= PlayerManager.bulletAttack;
            if (this.hp <= 0) {
                this.Died();
                return;
            }
            ParticleManager.Instance.CreateHitEffect(hitpos);
        }
        Died() {
            ParticleManager.Instance.CreateXueEffect(this.tran.position);
            this.Des();
            RoleManager.Instance.CheackGame();
            GameManager.Instance.roleCount++;
        }
        Des() {
            Laya.timer.clearAll(this);
            RoleManager.Instance.RemoveEnemy(this.selfobj);
            GamePool.Instance.SetDisableObject(this.selfobj);
        }
        onDestroy() {
        }
    }

    class RoleManager {
        constructor() {
            this.frameCount = 10;
            this.enemyDic = new Dictionary();
        }
        static get Instance() {
            return this.instance || (this.instance = new RoleManager());
        }
        CreateEnemy(startPos) {
            this.startPos = startPos;
            let count = LevelController.Instance._level.enemy;
            let hp = LevelController.Instance._level.enemy_hp;
            let texture = LevelController.Instance._level.enemy_cloth;
            for (let index = 0; index < count; index++) {
                let a = index;
                Laya.timer.frameOnce(a * this.frameCount, this, this._crete, [hp, texture], false);
            }
        }
        _crete(hp, texture) {
            let e = GamePool.Instance.SetActiveObject(GamePool.pooltype.enemy);
            if (!e)
                return;
            MainRoleManager.Instance.playerContainer.addChild(e);
            e.transform.position = this.startPos.clone();
            let ps = e.getComponent(Opponent);
            if (!ps)
                ps = e.addComponent(Opponent);
            let sp = this.GetTar();
            ps.SetTar(sp, hp, texture);
            this.enemyDic.set(e.id, ps);
        }
        GetTar() {
            let p = MainRoleManager.Instance.ArriveIsdead();
            if (!p) {
                if (Math.random() > 0.5) {
                    return MainRoleManager.Instance.playerBehavior.body;
                }
                else {
                    let s = MateManager.Instance.GetGetSp();
                    if (!s)
                        return MainRoleManager.Instance.playerBehavior.body;
                    else
                        return s;
                }
            }
            else {
                let s = MateManager.Instance.GetGetSp();
                if (!s)
                    return null;
                else
                    return s;
            }
        }
        RemoveEnemy(sp) {
            this.enemyDic.delete(sp.id);
        }
        CheackGame() {
            if (this.enemyDic.size == 0) {
                MouseEvent.Instance.OnClickUp();
                MainRoleManager.Instance.StopCreate();
                GameManager.Instance.ToDance();
            }
        }
        PlayerGetEnemy() {
            for (const key in this.enemyDic.container) {
                const element = this.enemyDic.get(key);
                return element.selfobj;
            }
            return null;
        }
        Reset() {
            let arr = [];
            for (const key in this.enemyDic.container) {
                arr.push(key);
            }
            if (arr.length > 0) {
                for (let index = 0; index < arr.length; index++) {
                    const element = arr[index];
                    let s = this.enemyDic.get(element);
                    if (s)
                        s.Des();
                }
            }
            console.log("this.enemyDic.size", this.enemyDic.size);
        }
    }

    class BannerAndVideo1 {
        static InitVideo() {
            if (!GameSetting.isWx)
                return;
            let index = Math.random() > 0.5 ? 0 : 1;
            BannerAndVideo1.curVideo = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: BannerAndVideo1.videlAdUnitId[index] });
            BannerAndVideo1.curVideo.onLoad(() => {
                console.log('激励视频 广告加载成功');
                this.videoLoadCom = true;
            });
            BannerAndVideo1.curVideo.onError(err => {
                console.log("激励视屏加载失败:" + err);
                this.videoLoadCom = false;
            });
            BannerAndVideo1.curVideo.onClose(res => {
                console.log("激励视频关闭:" + res.isEnded);
                if (res && res.isEnded || res === undefined) {
                    this.videoCallback && this.videoCallback(true);
                }
                else {
                    this.videoCallback && this.videoCallback(false);
                }
            });
        }
        static ShowVideo(callback) {
            if (GameSetting.isWx) {
                if (BannerAndVideo1.videoLoadCom) {
                    console.log("showVideoAd:" + BannerAndVideo1.videoLoadCom);
                    BannerAndVideo1.videoCallback = callback;
                    BannerAndVideo1.curVideo.show().catch(err => {
                        BannerAndVideo1.curVideo.load().then(() => {
                            BannerAndVideo1.curVideo.show();
                        });
                    });
                }
                else {
                    WXSdk.Game_Share(callback);
                }
            }
            else {
                ViewManager.Instance.ShowTips("暂未开放");
                callback(true);
            }
        }
        static OpenBanner(callVack = null, iswait = false) {
            if (!(GameSetting.isWx))
                return;
            BannerAndVideo1.canshowbanner = true;
            var idd;
            this.curBannerId++;
            if (this.curBannerId > 1)
                this.curBannerId = 0;
            idd = BannerAndVideo1.bannerAdUnitId[this.curBannerId];
            console.log("adUnitId:" + idd);
            let newBanner = Laya.Browser.window.wx.createBannerAd({
                adUnitId: idd,
                style: {
                    left: 0,
                    top: 0,
                    width: 460
                }
            });
            newBanner.onError(err => {
                console.log(err);
                callVack(null);
            });
            newBanner.onLoad(() => {
                console.log("新的");
                if (this.curbanner)
                    this.curbanner.destroy();
                this.curbanner = newBanner;
                let info = Laya.Browser.window.wx.getSystemInfoSync();
                this.curbanner.style.width = info.windowWidth;
                this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - 5;
                var hight = Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
                if (callVack != null) {
                    callVack(hight);
                }
                if (this.canshowbanner && !iswait) {
                    this.curbanner.show();
                }
                else {
                    this.curbanner.hide();
                }
            });
        }
        static Clear() {
            Laya.timer.clearAll(BannerAndVideo1);
            Laya.Tween.clearAll(BannerAndVideo1);
            BannerAndVideo1.canshowbanner = false;
            if (BannerAndVideo1.curbanner)
                BannerAndVideo1.curbanner.hide();
        }
        static showbanner() {
            if (!GameSetting.isWx)
                return;
            if (BannerAndVideo1.curbanner)
                BannerAndVideo1.curbanner.show();
        }
        static CheatBanner(btn, complete = null) {
            if (!AppSetting.bannerCanMove || !btn || !this.WXignore()) {
                console.log("ignorecheat");
                BannerAndVideo1.OpenBanner();
            }
            else {
                btn.bottom = NaN;
                btn.y = Laya.stage.height - btn.height - 40;
                BannerAndVideo1.OpenBanner((height) => {
                    if (!height) {
                        return;
                    }
                    else {
                        console.log("cheatstart", "bottom:100");
                        btn.mouseEnabled = false;
                        var end = Laya.stage.height - height - btn.height - 20;
                        console.log("y:" + end);
                        Laya.timer.once(AppSetting.moveTime * 1000, this, () => {
                            btn.mouseEnabled = true;
                            this.showbanner();
                            Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
                                if (complete != null) {
                                    complete();
                                }
                            }));
                        });
                    }
                }, true);
            }
        }
        static WXignore() {
            if (!AppSetting.OpenSceneValue) {
                return true;
            }
            if (GameSetting.wxValue == "1044" || GameSetting.wxValue == "1104" || GameSetting.wxValue == "00000" || GameSetting.wxValue == "1058" || GameSetting.wxValue == "1067" || GameSetting.wxValue == "1095"
                || GameSetting.wxValue == "1089" || GameSetting.wxValue == "1001" || GameSetting.wxValue == "1037" || GameSetting.wxValue == "1007") {
                return true;
            }
            return false;
        }
    }
    BannerAndVideo1.videlAdUnitId = ["adunit-be9371877a88ed51", "adunit-3881e83f08f8b7c9"];
    BannerAndVideo1.bannerAdUnitId = ["adunit-e4f1a4e63109e4ba", "adunit-541ca055934fd3f1"];
    BannerAndVideo1.curBannerId = 0;
    BannerAndVideo1.videoLoadCom = false;
    BannerAndVideo1.canshowbanner = true;

    class GameManager {
        constructor() {
            this.towerCount = 0;
            this.roleCount = 0;
            this.blockCount = 0;
            this.easterCount = 0;
        }
        static get Instance() {
            return GameManager.instance || (GameManager.instance = new GameManager());
        }
        GameStart() {
            this.towerCount = 0;
            this.roleCount = 0;
            this.blockCount = 0;
        }
        GameWin() {
            WXSdk.LongVibrate();
            BannerAndVideo1.Clear();
            ViewManager.Instance.AddView(ViewType.CompleteView, true);
            MoundManager.Instance.Reset();
            StreetManager.Instance.Reset();
            MateManager.Instance.Reset();
            MainRoleManager.Instance.Reset();
            RoleManager.Instance.Reset();
        }
        ToDance(isglod = false) {
            BannerAndVideo1.CheatBanner(null);
            MainRoleManager.Instance.GoToDance();
            if (isglod)
                MateManager.Instance.GoToDance1();
            else
                MateManager.Instance.GoToDance();
            CameraManager.Instance.SetCamState(CameraState.jump, 0.03);
            Laya.timer.once(4000, this, this.GameWin);
        }
        GameOver() {
            GuideController.Instance.GameDied();
            MouseEvent.Instance.OnClickUp();
            MainRoleManager.Instance.StopCreate();
            MouseEvent.Instance._Switch = false;
            WXSdk.LongVibrate();
            BannerAndVideo1.Clear();
            ViewManager.Instance.AddView(ViewType.CompleteView, false);
            MoundManager.Instance.Reset();
            StreetManager.Instance.Reset();
            MateManager.Instance.Reset();
            MainRoleManager.Instance.Reset();
            MainRoleManager.Instance.SetActiveFalse();
            RoleManager.Instance.Reset();
        }
        Pause() {
            if (this.easterCount >= 1) {
                this.GameOver();
                return;
            }
            this.easterCount++;
        }
        Easter() {
        }
        Arrive() {
            MoundManager.Instance.Reset();
            StreetManager.Instance.Reset();
        }
        NextLevel() {
            PlayerManager.Instance.stage++;
            Scene3DManager.Instance.InItScene();
            ViewManager.Instance.CloseView(ViewType.CompleteView);
            DispatcherManager.event(EventType.Event.ShowMainUi);
            DispatcherManager.event(EventType.Event.SetStage);
            DispatcherManager.event(EventType.Event.SetStagePro, 0);
        }
        ReStart() {
            MateManager.Instance.Reset();
            Scene3DManager.Instance.InItScene();
            DispatcherManager.event(EventType.Event.ShowMainUi);
            DispatcherManager.event(EventType.Event.SetStagePro, 0);
        }
        huituiFunc(ist) {
            if (ist) ;
            else {
                console.log("result Close huitui");
            }
        }
        ShowTopTip() {
        }
    }

    class Mound extends Laya.Script3D {
        onAwake() {
            this.selfobj = this.owner;
            this.tran = this.selfobj.transform;
            this.FriendSpawnPoint = this.selfobj.getChildByName("FriendSpawnPoint").transform;
            this.HealthText = this.selfobj.getChildByName("HealthText").transform;
            let we = this.selfobj.getChildByName("WallsEnd");
            this.WallsEnd = we.transform;
            this.mat = we.getChildAt(0).meshRenderer.material;
        }
        Cheack() {
            if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 5) {
                console.log("回收tower");
                this.Des();
                return;
            }
            this.MoveHpText();
        }
        MoveHpText() {
            let p = MatrixTransform.WorldToScreen2(this._camera, this.HealthText.position.clone());
            if (p.x <= 0 || p.x >= Laya.stage.width || p.y <= 0 || p.y >= Laya.stage.height)
                this.hpText.visible = false;
            else {
                if (!this.hpText.visible)
                    this.hpText.visible = true;
                this.hpText.x = p.x;
                this.hpText.y = p.y;
            }
        }
        SetTower(data) {
            this._firend = null;
            this.tarTran = MainRoleManager.Instance.player.transform;
            this.tran.localPositionX = data.x;
            this.tran.localPositionY = 0;
            this.tran.localPositionZ = data.z;
            if (data.towerR)
                this.WallsEnd.localRotationEulerY = 30;
            else
                this.WallsEnd.localRotationEulerY = 0;
            if (data.type == 1) {
                this._createFriend();
            }
            this._hp = data.hp;
            if (!this.hpText) {
                this.hpText = MoundManager.Instance.CreateHpText();
                this.hpText.text = this._hp.toString();
                if (!this._camera)
                    this._camera = CameraManager.Instance._camer;
                ViewManager.Instance.popNode.addChild(this.hpText);
            }
            this.MoveHpText();
            Laya.timer.frameLoop(1, this, this.Cheack);
        }
        _createFriend() {
            this._firend = MateManager.Instance.CreateFriend(this.FriendSpawnPoint);
        }
        SaveFriend() {
            if (this._firend) {
                this._firend.TweenFall();
                this._firend = null;
            }
        }
        Atked(hitpos) {
            this._hp -= PlayerManager.bulletAttack;
            if (this._hp <= 0) {
                this.SaveFriend();
                ParticleManager.Instance.CreateBoomEffect(this.tran.position);
                this.Des();
                GameManager.Instance.towerCount++;
                return;
            }
            ParticleManager.Instance.CreateHitEffect(hitpos);
            let t = Math.ceil(this._hp);
            this.hpText.text = t.toString();
            this.SetMat();
        }
        SetMat() {
            this.mat.albedoIntensity = 4;
            Laya.timer.once(100, this, () => {
                this.mat.albedoIntensity = 1;
            });
        }
        Des() {
            Laya.timer.clearAll(this);
            if (this.hpText) {
                GamePool.Instance.SetDisableForUi(PoolType.HpText, this.hpText);
                this.hpText = null;
            }
            this.mat.albedoIntensity = 1;
            MoundManager.Instance.RemoveTower(this.selfobj);
            GamePool.Instance.SetDisableObject(this.selfobj);
            if (this._firend) {
                this._firend.Des();
                this._firend = null;
            }
        }
        onDisable() {
        }
        onDestroy() {
        }
    }

    var Vector3$2 = Laya.Vector3;
    class MainRoleShot extends Laya.Script3D {
        constructor() {
            super(...arguments);
            this.speed = Mathf.VecZero;
            this._forward = new Vector3$2(0, 0, 1);
            this.over = false;
        }
        onAwake() {
            this.selfobj = this.owner;
            this.tran = this.selfobj.transform;
            this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
            this.speed.z = GlobalVariable.bulletspeed;
        }
        StartMove(tarTran, isover = false) {
            this.tarTran = tarTran;
            this.over = isover;
            Laya.timer.frameLoop(1, this, this._MOVE);
        }
        _MOVE() {
            this.tran.translate(this.speed);
            let d = Vector3$2.distance(this.tarTran.position, this.tran.position);
            if (d >= GlobalVariable.bulletMaxDis) {
                this.Des();
                return;
            }
            this.CreateRay();
        }
        CreateRay() {
            let origP = this.rayPoint.position.clone();
            if (!this._scene) {
                this._scene = Scene3DManager.Instance._mainscene;
            }
            if (!this.ray) {
                if (!this.forward)
                    this.forward = Mathf.VecZero;
                this.ray = new Laya.Ray(Mathf.VecZero, this._forward);
                this.outHit = new Laya.HitResult();
            }
            this.ray.origin = origP;
            if (this.over) {
                this.tran.getForward(this.forward);
                this.forward.x = -this.forward.x;
                this.forward.y = -this.forward.y;
                this.forward.z = -this.forward.z;
                this.ray.direction = this.forward;
            }
            else {
                this.ray.direction = this._forward;
            }
            let isHItF = this._scene.physicsSimulation.rayCast(this.ray, this.outHit, GlobalVariable.bulletRayLength);
            if (isHItF) {
                let obj = this.outHit.collider.owner;
                if (obj.layer == ColliderGroup.mound) {
                    let tower = obj.getComponent(Mound);
                    if (tower) {
                        tower.Atked(this.outHit.point);
                    }
                }
                else if (obj.layer == ColliderGroup.opponent) {
                    let tower = obj.getComponent(Opponent);
                    if (tower) {
                        tower.Atked(this.outHit.point);
                    }
                }
                else if (obj.layer == ColliderGroup.obstacle1 || obj.layer == ColliderGroup.obstacle2 || obj.layer == ColliderGroup.obstacle3) {
                    StreetManager.Instance.CubeBlockAtked(obj);
                    GameManager.Instance.blockCount++;
                }
                else {
                    ParticleManager.Instance.CreateHitEffect(this.outHit.point);
                }
                this.Des();
                return;
            }
        }
        Des() {
            Laya.timer.clearAll(this);
            GamePool.Instance.SetDisableObject(this.selfobj);
            GamePool.bulletCount--;
        }
        onDestroy() {
        }
    }

    var Vector3$3 = Laya.Vector3;
    var Quaternion$1 = Laya.Quaternion;
    class Mate extends Laya.Script3D {
        constructor() {
            super(...arguments);
            this._up = new Vector3$3(0, 1, 0);
            this.isreturn = false;
            this.isover = false;
            this.isClickCom = true;
            this.isStop = true;
            this.ts = new Vector3$3(0, 0, 0.01);
            this.isFristShoot = true;
        }
        onAwake() {
            this.selfobj = this.owner;
            this.tran = this.selfobj.transform;
            this.animator = this.selfobj.getChildAt(0).getComponent(Laya.Animator);
            this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
            this.bulletPos = this.selfobj.getChildByName("bulletPos").transform;
            this.forW = Mathf.VecZero;
            this.speed = GlobalVariable.friendspeed;
            this.quaternion1 = new Quaternion$1();
        }
        SetTar() {
            this.isreturn = false;
            this.isClickCom = true;
            this.isStop = true;
            this.isover = false;
            this.PlayAni(MusicType.Idle, 1);
            DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
        }
        TryAddFriend(dataPar) {
            this.PlayAni(MusicType.Idle, 1);
            this.dataPar = dataPar;
            this.dataPar["ishave"] = true;
            this.isClickCom = true;
            this.isStop = true;
            this.isreturn = true;
            this.isover = false;
            MateManager.Instance.AddGetDic(this.selfobj.id, this);
            this.BulletHandler();
            if (MainRoleManager.Instance.IsBulleting())
                this.CreateBullet();
            Laya.timer.frameLoop(1, this, this.Move);
        }
        TweenFall() {
            let tween = Laya.Tween.to(this.tran, { localPositionY: 0 }, 400, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
                let dataPar = MainRoleManager.Instance.GetFrindPar();
                if (!dataPar) {
                    console.warn("friendPar没有位置了");
                    return;
                }
                this.dataPar = dataPar;
                this.dataPar["ishave"] = true;
                this.tar = this.dataPar["sp"];
                this.tarTra = this.tar.transform;
                tween.clear();
                this.StartMove();
            }, null, false));
        }
        StartMove() {
            this.PlayAni(MusicType.RunAndGun, 2);
            this.isreturn = false;
            this.isClickCom = true;
            this.isStop = true;
            this.isover = false;
            Laya.timer.frameLoop(1, this, this.Move);
        }
        _createRay() {
            this.CreateRay();
        }
        Move() {
            if (this.isreturn) {
                this._createRay();
                return;
            }
            let tarPos = this.tarTra.position.clone();
            Vector3$3.subtract(tarPos, this.tran.position, this.forW);
            Vector3$3.normalize(this.forW, this.forW);
            this.forW = new Vector3$3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
            this.tran.translate(this.forW, false);
            if (Vector3$3.distance(this.tran.position, tarPos) < 0.1) {
                this.ArriveTarPos();
                return;
            }
            Quaternion$1.lookAt(tarPos, this.tran.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            Quaternion$1.slerp(this.tran.rotation, this.quaternion1, 0.1, this.quaternion1);
            this.tran.rotation = this.quaternion1.clone();
        }
        ArriveTarPos() {
            this.isClickCom = true;
            this.isStop = true;
            this.isreturn = true;
            this.tar.addChild(this.selfobj);
            this.tran.localPosition = Mathf.VecZero;
            this.PlayAni(MusicType.RunAndGun, 2);
            MateManager.Instance.AddGetDic(this.selfobj.id, this);
            let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
                tween.clear();
                this.tran.localRotationEuler = Mathf.VecZero;
                this.BulletHandler();
                this.CreateBullet();
            }, null, false));
        }
        CreateRay() {
            let origP = this.rayPoint.position;
            if (!this._scene) {
                this._scene = Scene3DManager.Instance._mainscene;
            }
            if (!this.rayF) {
                this.rayF = new Laya.Ray(Mathf.VecZero, new Vector3$3(0, 0, 1));
                this.outHitF = new Laya.HitResult();
            }
            this.rayF.origin = origP;
            let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalVariable.playerRayLengthF);
            if (isHItF) {
                let obj = this.outHitF.collider.owner;
                this.Died(this.outHitF.point);
                return;
            }
            if (!this.rayL) {
                this.rayL = new Laya.Ray(Mathf.VecZero, new Vector3$3(1, 0, 0));
                this.outHitL = new Laya.HitResult();
            }
            this.rayL.origin = origP;
            let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalVariable.playerRayLengthLR);
            if (isHItL) {
                let obj = this.outHitL.collider.owner;
                this.Died(this.outHitL.point);
                return;
            }
            if (!this.rayR) {
                this.rayR = new Laya.Ray(Mathf.VecZero, new Vector3$3(-1, 0, 0));
                this.outHitR = new Laya.HitResult();
            }
            this.rayR.origin = origP;
            let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalVariable.playerRayLengthLR);
            if (isHItR) {
                let obj = this.outHitR.collider.owner;
                this.Died(this.outHitR.point);
                return;
            }
        }
        PlayAni(clip, speed, callback) {
            this.animator.play(clip);
            if (!speed)
                speed = 1;
            this.animator.speed = speed;
        }
        BulletHandler() {
            DispatcherManager.on(EventType.Event.StopShot, this, this.StopCreate);
        }
        CreateBullet() {
            this.isStop = false;
            if (!this.isClickCom)
                return;
            this.isClickCom = false;
            this._CreateBullet();
            Laya.timer.loop(PlayerManager.bulletTime * 2 * 1000, this, this.LoopCreate);
        }
        LoopCreate() {
            if (this.isStop) {
                Laya.timer.clear(this, this.LoopCreate);
                this.isClickCom = true;
                return;
            }
            this._CreateBullet();
        }
        _CreateBullet() {
            let bu = GamePool.Instance.SetActiveObject(GamePool.pooltype.PlayerBullet);
            if (bu) {
                Scene3DManager.Instance.bulletCon.addChild(bu);
                bu.transform.position = this.bulletPos.position.clone();
                bu.transform.localRotationEuler = this.bulletPos.rotationEuler.clone();
                let pb = bu.getComponent(MainRoleShot);
                if (!pb)
                    pb = bu.addComponent(MainRoleShot);
                pb.StartMove(this.bulletPos, this.isover);
            }
        }
        StopCreate() {
            this.isStop = true;
        }
        Died(pos) {
            if (this.dataPar)
                this.dataPar["ishave"] = false;
            ParticleManager.Instance.CreateXueEffect(pos);
            MateManager.Instance.RemoveGet(this.selfobj);
            this.Des();
            MainRoleManager.Instance.CheackGame();
        }
        SetPar() {
            let t = this.tran.position.clone();
            MainRoleManager.Instance.playerContainer.addChild(this.selfobj);
            this.tran.position = t.clone();
        }
        ToStand(pos) {
            this.SetPar();
            this.tp = pos;
            Quaternion$1.lookAt(pos, this.tran.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this.tran.rotation = this.quaternion1.clone();
            this.PlayAni(MusicType.CrouchFiring, 1);
            Laya.timer.frameLoop(1, this, this._TOSTAND);
        }
        _TOSTAND() {
            Vector3$3.subtract(this.tp, this.tran.position, this.forW);
            Vector3$3.normalize(this.forW, this.forW);
            this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
            this.tran.translate(this.forW, false);
            if (Vector3$3.distance(this.tran.position, this.tp) < 0.1) {
                Laya.timer.clear(this, this._TOSTAND);
                let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
                    tween.clear();
                }, null, false));
                return;
            }
            Quaternion$1.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this.tran.rotation = this.quaternion1.clone();
        }
        Dance(sp) {
            this.PlayAni(MusicType.RunAndGun, 2);
            this.danceP = sp.position.clone();
            this.r = sp.rotationEuler.clone();
            Laya.timer.frameLoop(1, this, this._Dance);
        }
        _Dance() {
            Vector3$3.subtract(this.danceP, this.tran.position, this.forW);
            Vector3$3.normalize(this.forW, this.forW);
            this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
            this.tran.translate(this.forW);
            if (Vector3$3.distance(this.tran.position, this.danceP) < 0.15) {
                Laya.timer.clear(this, this._Dance);
                this.tran.position = this.danceP.clone();
                this.tran.rotationEuler = this.r.clone();
                this.PlayAni(MusicType.Dance, 1);
                return;
            }
            Quaternion$1.lookAt(this.danceP, this.tran.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this.tran.rotation = this.quaternion1.clone();
        }
        StartAtkEnemy() {
            Laya.timer.clear(this, this._TOSTAND);
            this.isover = true;
            this.isFristShoot = true;
            this.enemyTar = null;
            Laya.timer.frameLoop(1, this, this._atkEnemy);
        }
        _atkEnemy() {
            if (this.enemyTar == null) {
                this.enemyTar = RoleManager.Instance.PlayerGetEnemy();
                if (this.enemyTar != null) {
                    this.ATKp = this.enemyTar.transform.position.clone();
                    Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
                    this.quaternion1.invert(this.quaternion1);
                    this.tran.rotation = this.quaternion1.clone();
                }
            }
            else {
                if (!this.enemyTar.active) {
                    this.enemyTar = RoleManager.Instance.PlayerGetEnemy();
                    if (this.enemyTar != null) {
                        this.ATKp = this.enemyTar.transform.position.clone();
                        Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
                        this.quaternion1.invert(this.quaternion1);
                        this.tran.rotation = this.quaternion1.clone();
                    }
                }
                if (this.enemyTar == null) {
                    this.StopCreate();
                    this.isFristShoot = true;
                    return;
                }
                if (this.isFristShoot) {
                    this.isFristShoot = false;
                    this.CreateBullet();
                }
                this.ATKp = this.enemyTar.transform.position.clone();
                Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
                this.quaternion1.invert(this.quaternion1);
                this.tran.rotation = this.quaternion1.clone();
            }
        }
        Des() {
            if (this.dataPar) {
                this.dataPar["ishave"] = false;
                this.dataPar = null;
            }
            MateManager.Instance.RemoveFriend(this.selfobj);
            MateManager.Instance.RemoveGet(this.selfobj);
            Laya.timer.clearAll(this);
            Laya.Tween.clearAll(this);
            DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
            GamePool.Instance.SetDisableObject(this.selfobj);
        }
        onDestroy() {
        }
    }

    class MateManager {
        constructor() {
            this.v3 = Mathf.VecZero;
            this.friendDic = new Dictionary();
            this.getDic = new Dictionary();
        }
        static get Instance() {
            return this.instance || (this.instance = new MateManager());
        }
        CreateFriend(tra) {
            let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + PlayerManager.Instance.equipId);
            if (p) {
                p.transform.position = tra.position.clone();
                p.transform.rotationEuler = tra.rotationEuler.clone();
                MainRoleManager.Instance.playerContainer.addChild(p);
                let ps = p.getComponent(Mate);
                if (!ps)
                    ps = p.addComponent(Mate);
                ps.SetTar();
                this.friendDic.set(p.id, ps);
                return ps;
            }
            return null;
        }
        CreateTryOut() {
            for (let index = 0; index < 3; index++) {
                Laya.timer.frameOnce(index, this, this._createtryout, null, false);
            }
        }
        _createtryout() {
            let dataPar = MainRoleManager.Instance.GetFrindPar();
            if (!dataPar) {
                console.warn("friendPar没有位置了");
                return;
            }
            let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + PlayerManager.Instance.equipId);
            if (p) {
                let tar = dataPar["sp"];
                tar.addChild(p);
                p.transform.localPosition = Mathf.VecZero;
                p.transform.localRotationEuler = Mathf.VecZero;
                let ps = p.getComponent(Mate);
                if (!ps)
                    ps = p.addComponent(Mate);
                ps.TryAddFriend(dataPar);
                this.friendDic.set(p.id, ps);
            }
        }
        TryOutFriendPlayAni() {
            for (const key in this.friendDic.container) {
                const element = this.friendDic.get(key);
                element.CreateBullet();
                element.PlayAni(MusicType.RunAndGun, 2);
            }
        }
        RemoveFriend(sp) {
            this.friendDic.delete(sp.id);
        }
        AddGetDic(id, fr) {
            console.log(22222222);
            this.getDic.set(id, fr);
        }
        RemoveGet(sp) {
            this.getDic.delete(sp.id);
        }
        GetArrive() {
            return this.getDic.size;
        }
        ToArrive(count, zs) {
            if (count == 1) {
                for (const key in this.getDic.container) {
                    const element = this.getDic.get(key);
                    this.v3.x = 0;
                    element.ToStand(this.v3.clone());
                }
                return;
            }
            let len = 2 * GlobalVariable.arriveStandWidth;
            let avr = len / (count - 1);
            let index = 0;
            this.v3.z = zs;
            for (const key in this.getDic.container) {
                const element = this.getDic.get(key);
                this.v3.x = GlobalVariable.arriveStandWidth - index * avr;
                element.ToStand(this.v3.clone());
                index++;
            }
        }
        StartAtkEnemy() {
            for (const key in this.getDic.container) {
                const element = this.getDic.get(key);
                element.StartAtkEnemy();
            }
        }
        GetGetSp() {
            let count = this.getDic.size;
            let a = GameTool.randomInt(1, count);
            let tindex = 1;
            for (const key in this.getDic.container) {
                if (tindex == a) {
                    const element = this.getDic.get(key);
                    return element.selfobj;
                }
                tindex++;
            }
            return null;
        }
        GoToDance() {
            for (const key in this.getDic.container) {
                let t = PlaneManager.Instance.GetDancePos();
                if (!t)
                    return;
                const element = this.getDic.get(key);
                element.Dance(t);
            }
        }
        GoToDance1() {
            for (const key in this.getDic.container) {
                let t = PlaneManager.Instance.GetDancePos();
                const element = this.getDic.get(key);
                element.SetPar();
                if (t) {
                    element.Dance(t);
                }
            }
        }
        Reset() {
            let arr = [];
            for (const key in this.friendDic.container) {
                arr.push(key);
            }
            if (arr.length > 0) {
                for (let index = 0; index < arr.length; index++) {
                    const element = arr[index];
                    let s = this.friendDic.get(element);
                    if (s)
                        s.Des();
                }
            }
            console.log("this.friendDic.size", this.friendDic.size);
            this.getDic.clear();
        }
    }

    class PlaneManager {
        constructor() {
            this.airisshow = false;
            this.danceindex = 0;
        }
        static get Instance() {
            return this.instance || (this.instance = new PlaneManager());
        }
        Init(finalP) {
            if (!finalP) {
                console.error("飞机不存在");
                return;
            }
            this.finalTra = finalP.transform;
            this.jumpCamTra = finalP.getChildByName("jumpCamPos").transform;
            this.FinalBlock = finalP.getChildAt(0);
            this.EnemySpawnPoint = this.FinalBlock.getChildByName("EnemySpawnPoint").transform;
            this.PlayerDancePoint = this.FinalBlock.getChildByName("PlayerDancePoint");
            this.helicopter = this.FinalBlock.getChildByName("helicopter");
            this.toured = this.FinalBlock.getChildByName("toured").transform;
            this.FinalBlock.active = false;
        }
        SetAir() {
            this.danceindex = 0;
            this.airisshow = false;
            this.FinalBlock.active = false;
            let count = LevelController.Instance._level.road_list.length;
            this.winPos = (count) * GlobalVariable.barrierRoadLength;
            this.finalTra.localPositionZ = this.winPos;
            this.stageProLen = this.winPos - MainRoleManager.Instance.playerStartTra.localPositionZ;
            let isgold = LevelController.Instance._level.isgold;
            this.helicopter.active = isgold;
            this.toured1 = this.FinalBlock.getChildByName("toured1").transform.position.clone();
            this.toured2 = this.FinalBlock.getChildByName("toured2").transform.position.clone();
        }
        CheckPlayerRoadPos(_zp) {
            let d = this.winPos - _zp;
            if (d <= 60 && !this.airisshow) {
                this.ShowAir();
                return;
            }
            DispatcherManager.event(EventType.Event.SetStagePro, (this.stageProLen - d) / this.stageProLen);
            if (d <= 0) {
                this.ArriveFinal();
            }
        }
        ShowAir() {
            this.airisshow = true;
            this.FinalBlock.active = true;
        }
        ArriveFinal() {
            MainRoleManager.Instance.ArriveFinal();
            if (LevelController.Instance._level.isgold) {
                GameManager.Instance.ToDance(true);
            }
            else {
                let count = 0;
                let isdesd = MainRoleManager.Instance.ArriveIsdead();
                if (!isdesd) {
                    count++;
                }
                let num = MateManager.Instance.GetArrive();
                count += num;
                if (count == 0)
                    return;
                MateManager.Instance.ToArrive(count, this.toured.position.z);
                if (!isdesd)
                    MainRoleManager.Instance.ToArrive(count, this.toured.position.z);
                Laya.timer.once(1300, this, this.CreateEnemy);
            }
        }
        CreateEnemy() {
            MainRoleManager.Instance.StartAtkEnemy();
            MateManager.Instance.StartAtkEnemy();
            RoleManager.Instance.CreateEnemy(this.EnemySpawnPoint.position.clone());
        }
        GetDancePos() {
            if (this.danceindex > this.PlayerDancePoint.numChildren - 1)
                return null;
            let t = this.PlayerDancePoint.getChildAt(this.danceindex).transform;
            this.danceindex++;
            return t;
        }
    }

    var Vector3$4 = Laya.Vector3;
    var Quaternion$2 = Laya.Quaternion;
    class MainRole extends Laya.Script3D {
        constructor() {
            super(...arguments);
            this.isarrive = false;
            this.isdead = false;
            this._up = new Vector3$4(0, 1, 0);
            this.ts = new Vector3$4(0, 0, 0.01);
            this.isFristShoot = true;
        }
        onAwake() {
            this.selfobj = this.owner;
            this.tran = this.selfobj.transform;
            this.body = this.selfobj.getChildAt(0);
            this.animator = this.body.getComponent(Laya.Animator);
            this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
            this.bulletPos = this.selfobj.getChildByName("bulletPos").transform;
            this._speed = Mathf.VecZero;
            this._speed.z = GlobalVariable.playerspeed;
            this.forW = Mathf.VecZero;
            this.quaternion1 = new Quaternion$2();
        }
        StartMove() {
            this.isdead = false;
            this.isarrive = false;
            Laya.timer.frameLoop(1, this, this.Move);
        }
        Move() {
            if (this.isarrive) {
                if (this.isdead)
                    return;
                this.CreateRay();
                return;
            }
            this.tran.translate(this._speed);
            let pz = this.tran.localPositionZ;
            ConstructManager.Instance.CheckPlayerRoadPos(pz);
            PlaneManager.Instance.CheckPlayerRoadPos(pz);
            StreetManager.Instance.CheckPlayerRoadPos(pz);
            CameraManager.Instance.CameraMoveIngame(pz);
            if (this.isdead)
                return;
            this.CreateRay();
        }
        Arrive() {
            this.isarrive = true;
        }
        CreateRay() {
            let origP = this.rayPoint.position;
            if (!this._scene) {
                this._scene = Scene3DManager.Instance._mainscene;
            }
            if (!this.rayF) {
                this.rayF = new Laya.Ray(Mathf.VecZero, new Vector3$4(0, 0, 1));
                this.outHitF = new Laya.HitResult();
            }
            this.rayF.origin = origP;
            let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalVariable.playerRayLengthF);
            if (isHItF) {
                let obj = this.outHitF.collider.owner;
                this.Died(this.outHitF.point);
                return;
            }
            if (!this.rayL) {
                this.rayL = new Laya.Ray(Mathf.VecZero, new Vector3$4(1, 0, 0));
                this.outHitL = new Laya.HitResult();
            }
            this.rayL.origin = origP;
            let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalVariable.playerRayLengthLR);
            if (isHItL) {
                let obj = this.outHitL.collider.owner;
                this.Died(this.outHitL.point);
                return;
            }
            if (!this.rayR) {
                this.rayR = new Laya.Ray(Mathf.VecZero, new Vector3$4(-1, 0, 0));
                this.outHitR = new Laya.HitResult();
            }
            this.rayR.origin = origP;
            let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalVariable.playerRayLengthLR);
            if (isHItR) {
                let obj = this.outHitR.collider.owner;
                this.Died(this.outHitR.point);
                return;
            }
        }
        PlayAni(clip, speed, callback) {
            this.animator.play(clip);
            if (!speed)
                speed = 1;
            this.animator.speed = speed;
        }
        Slider(x) {
            this.tran.localPositionX += x;
            let px = this.tran.localPositionX;
            let abs = Math.abs(px);
            if (abs > GlobalVariable.playerMoveMaxX) {
                if (px > 0)
                    this.tran.localPositionX = GlobalVariable.playerMoveMaxX;
                else
                    this.tran.localPositionX = -GlobalVariable.playerMoveMaxX;
            }
        }
        CreateBullet() {
            if (this.isdead)
                return null;
            return this.bulletPos;
        }
        Died(pos) {
            this.isdead = true;
            this.body.active = false;
            ParticleManager.Instance.CreateXueEffect(pos);
            MainRoleManager.Instance.CheackGame(true);
        }
        Reset() {
            this.body.active = true;
            this.PlayAni(MusicType.Idle, 1);
            Laya.timer.clearAll(this);
        }
        ToStand(pos) {
            if (this.isdead)
                return;
            this.tp = pos;
            Quaternion$2.lookAt(pos, this.tran.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this.tran.rotation = this.quaternion1.clone();
            this.PlayAni(MusicType.CrouchFiring, 1);
            Laya.timer.frameLoop(1, this, this._TOSTAND);
        }
        _TOSTAND() {
            Vector3$4.subtract(this.tp, this.tran.position, this.forW);
            Vector3$4.normalize(this.forW, this.forW);
            this.forW = new Vector3$4(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
            this.tran.translate(this.forW);
            if (Vector3$4.distance(this.tran.position, this.tp) < 0.1) {
                Laya.timer.clear(this, this._TOSTAND);
                return;
            }
            Quaternion$2.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this.tran.rotation = this.quaternion1.clone();
        }
        StartAtkEnemy() {
            Laya.timer.clear(this, this._TOSTAND);
            this.isFristShoot = true;
            this.enemyTar = null;
            Laya.timer.frameLoop(1, this, this._atkEnemy);
        }
        _atkEnemy() {
            if (this.isdead)
                return;
            if (this.enemyTar == null) {
                this.enemyTar = RoleManager.Instance.PlayerGetEnemy();
                if (this.enemyTar != null) {
                    this.tp = this.enemyTar.transform.position.clone();
                    Quaternion$2.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
                    this.quaternion1.invert(this.quaternion1);
                    this.tran.rotation = this.quaternion1.clone();
                }
            }
            else {
                if (!this.enemyTar.active) {
                    this.enemyTar = RoleManager.Instance.PlayerGetEnemy();
                    if (this.enemyTar != null) {
                        this.tp = this.enemyTar.transform.position.clone();
                        Quaternion$2.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
                        this.quaternion1.invert(this.quaternion1);
                        this.tran.rotation = this.quaternion1.clone();
                    }
                }
                if (this.enemyTar == null) {
                    MainRoleManager.Instance.StopCreate(true);
                    this.isFristShoot = true;
                    return;
                }
                if (this.isFristShoot) {
                    this.isFristShoot = false;
                    MainRoleManager.Instance.CreateBullet(true);
                }
                this.tp = this.enemyTar.transform.position.clone();
                Quaternion$2.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
                this.quaternion1.invert(this.quaternion1);
                this.tran.rotation = this.quaternion1.clone();
            }
        }
        Dance(sp) {
            this.PlayAni(MusicType.RunAndGun, 2);
            this.dancepos = sp.position.clone();
            this.r = sp.rotationEuler.clone();
            Laya.timer.frameLoop(1, this, this._Dance);
        }
        _Dance() {
            Vector3$4.subtract(this.dancepos, this.tran.position, this.forW);
            Vector3$4.normalize(this.forW, this.forW);
            this.forW = new Vector3$4(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
            this.tran.translate(this.forW);
            if (Vector3$4.distance(this.tran.position, this.dancepos) < 0.15) {
                Laya.timer.clear(this, this._Dance);
                this.tran.position = this.dancepos.clone();
                this.tran.rotationEuler = this.r.clone();
                this.PlayAni(MusicType.Dance, 1);
                return;
            }
            Quaternion$2.lookAt(this.dancepos, this.tran.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this.tran.rotation = this.quaternion1.clone();
        }
        onDisable() {
        }
        onDestroy() {
        }
    }

    var Vector3$5 = Laya.Vector3;
    class MainRoleManager {
        constructor() {
            this.isover = false;
            this.isClickCom = true;
            this.isStop = true;
        }
        static get Instance() {
            return this.instance || (this.instance = new MainRoleManager());
        }
        Init(startPos, playerCon) {
            this.playerStartTra = startPos.transform;
            this.playerContainer = playerCon;
        }
        CreatePlayer() {
            let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + PlayerManager.Instance.equipId);
            if (p) {
                this.player = p;
                this.SetFriendPoint(p);
                this.playerTra = this.player.transform;
                this.playerTra.position = this.playerStartTra.position.clone();
                this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
                this.playerContainer.addChild(this.player);
                let ps = this.player.getComponent(MainRole);
                if (ps)
                    this.playerBehavior = ps;
                else
                    this.playerBehavior = this.player.addComponent(MainRole);
            }
            else {
                console.error("player不存在");
            }
        }
        InitPlayerPos() {
            this.player.active = true;
            this.playerTra.position = this.playerStartTra.position.clone();
            this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
            this.playerBehavior.PlayAni(MusicType.Idle, 1);
        }
        ChangePlayer() {
            if (this.player)
                GamePool.Instance.SetDisableObject(this.player);
            let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + PlayerManager.Instance.equipId);
            if (p) {
                this.player = p;
                this.SetFriendPoint(p);
                this.playerTra = this.player.transform;
                this.playerTra.position = this.playerStartTra.position.clone();
                this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
                this.playerContainer.addChild(this.player);
                let ps = this.player.getComponent(MainRole);
                if (ps)
                    this.playerBehavior = ps;
                else
                    this.playerBehavior = this.player.addComponent(MainRole);
            }
        }
        SetFriendPoint(player) {
            this.FriendArrPos = [];
            let par = player.getChildByName("FriendSpawPos");
            if (!par)
                console.error("friend父物体不存在");
            for (let index = 0; index < par.numChildren; index++) {
                let data = {};
                data["ishave"] = false;
                data["sp"] = par.getChildAt(index);
                this.FriendArrPos.push(data);
            }
        }
        GetFrindPar() {
            for (let index = 0; index < this.FriendArrPos.length; index++) {
                const element = this.FriendArrPos[index];
                if (!element["ishave"])
                    return element;
            }
            return null;
        }
        SetPlayerPos(x) {
            if (!this.player) {
                this.CreatePlayer();
                this.InitPlayerPos();
            }
            if (!this._camera) {
                this._camera = CameraManager.Instance._camer;
                this._dis = -Vector3$5.distance(this.playerTra.position, this._camera.transform.position);
                this._y = MatrixTransform.WorldToScreen2(this._camera, this.playerTra.position).y;
            }
            let uiP = new Vector3$5(x, this._y, this._dis);
            let p = MatrixTransform.ScreenToWorld(this._camera, uiP);
            this.playerTra.localPositionX = p.x;
        }
        StartGame() {
            if (this.playerBehavior) {
                this.playerBehavior.StartMove();
                this.playerBehavior.PlayAni(MusicType.RunAndGun, 2);
            }
        }
        SliderPlayer(offsetX) {
            let x = offsetX.toFixed(2);
            let x1 = Number(x) * GlobalVariable.sliderFactor;
            if (this.playerBehavior)
                this.playerBehavior.Slider(x1);
        }
        CreateBullet(isgameover = false) {
            if (!this.playerBehavior)
                return;
            this.isStop = false;
            if (!this.isClickCom)
                return;
            console.log("开始创建子弹");
            this.isClickCom = false;
            this._CreateBullet();
            Laya.timer.loop(PlayerManager.bulletTime * 1000, this, this.LoopCreate);
        }
        LoopCreate() {
            if (this.isStop) {
                Laya.timer.clear(this, this.LoopCreate);
                this.isClickCom = true;
                return;
            }
            this._CreateBullet();
        }
        _CreateBullet() {
            WXSdk.ShortVibrate();
            SettingController.Instance.PlaySound(SoundType.hit);
            let bulletPos = this.playerBehavior.CreateBullet();
            if (bulletPos == null)
                return;
            let bu = GamePool.Instance.SetActiveObject(GamePool.pooltype.PlayerBullet);
            if (bu) {
                Scene3DManager.Instance.bulletCon.addChild(bu);
                bu.transform.position = bulletPos.position.clone();
                bu.transform.localRotationEuler = bulletPos.rotationEuler.clone();
                let pb = bu.getComponent(MainRoleShot);
                if (!pb)
                    pb = bu.addComponent(MainRoleShot);
                pb.StartMove(bulletPos, this.isover);
            }
        }
        StopCreate(isgameover = false) {
            this.isStop = true;
            if (!isgameover)
                DispatcherManager.event(EventType.Event.StopShot);
        }
        IsBulleting() {
            return !this.isStop;
        }
        ArriveFinal() {
            MouseEvent.Instance.OnClickUp();
            MainRoleManager.Instance.StopCreate();
            MouseEvent.Instance._Switch = false;
            GameManager.Instance.Arrive();
            if (!this.playerBehavior)
                return;
            this.playerBehavior.Arrive();
        }
        ArriveIsdead() {
            if (!this.playerBehavior)
                return true;
            return this.playerBehavior.isdead;
        }
        ToArrive(count, z) {
            if (!this.playerBehavior)
                return;
            if (count == 1) {
                this.playerBehavior.ToStand(new Vector3$5(0, 0, z));
            }
            else {
                this.playerBehavior.ToStand(new Vector3$5(-GlobalVariable.arriveStandWidth, 0, z));
            }
        }
        StartAtkEnemy() {
            if (!this.playerBehavior)
                return;
            this.isover = true;
            this.playerBehavior.StartAtkEnemy();
        }
        CheackGame(isplayer) {
            if (isplayer) {
                let count = MateManager.Instance.GetArrive();
                if (count == 0) {
                    this.playerBehavior.Arrive();
                    GameManager.Instance.GameOver();
                }
            }
            else {
                let count = MateManager.Instance.GetArrive();
                if (count == 0) {
                    let isplayerdead = this.playerBehavior.isdead;
                    if (isplayerdead) {
                        this.playerBehavior.Arrive();
                        GameManager.Instance.GameOver();
                    }
                }
            }
        }
        GoToDance() {
            if (!this.playerBehavior)
                return;
            let t = PlaneManager.Instance.GetDancePos();
            if (!t)
                return;
            this.playerBehavior.Dance(t);
        }
        Reset() {
            for (let index = 0; index < this.FriendArrPos.length; index++) {
                const element = this.FriendArrPos[index];
                element["ishave"] = false;
            }
            this.isover = false;
            if (!this.playerBehavior)
                return;
            this.playerBehavior.Reset();
        }
        SetActiveFalse() {
            if (this.player)
                this.player.active = false;
        }
    }

    var Vector3$6 = Laya.Vector3;
    var CameraState;
    (function (CameraState) {
        CameraState[CameraState["game"] = 1] = "game";
        CameraState[CameraState["jump"] = 2] = "jump";
    })(CameraState || (CameraState = {}));
    class Camera extends Laya.Script3D {
        constructor() {
            super();
            this.arg = 0.1;
            this.canmovegame = false;
            this.startShake = false;
            this.seconds = 0;
            this.started = false;
            this.quake = 0.3;
        }
        onAwake() {
            this.selfObj = this.owner;
            this._tran = this.selfObj.transform;
            this.nowP = Mathf.VecZero;
            this.nowR = Mathf.VecZero;
            this.dis = Mathf.VecZero;
            this.temp = Mathf.VecZero;
        }
        Init() {
            let t = CameraManager.Instance.startPosTra;
            this._tran.position = t.position.clone();
            this._tran.localRotationEuler = Mathf.SpToCam(t.localRotationEuler.clone());
            this.dis.x = MainRoleManager.Instance.playerStartTra.position.x - this._tran.position.x;
            this.dis.y = MainRoleManager.Instance.playerStartTra.position.y - this._tran.position.y;
            this.dis.z = MainRoleManager.Instance.playerStartTra.position.z - this._tran.position.z;
        }
        SetCameraByState(type, arg) {
            this.arg = arg;
            switch (type) {
                case CameraState.game:
                    this.tarTra = MainRoleManager.Instance.playerTra;
                    if (!this.tarTra)
                        return;
                    let t = CameraManager.Instance.startPosTra;
                    this._tran.position = t.position.clone();
                    this._tran.localRotationEuler = Mathf.SpToCam(t.localRotationEuler.clone());
                    this.canmovegame = true;
                    break;
                case CameraState.jump:
                    this.tarTra = PlaneManager.Instance.jumpCamTra;
                    if (!this.tarTra)
                        return;
                    this.canmovegame = false;
                    Laya.timer.frameLoop(1, this, this.JumpCameraMove);
                    Laya.timer.once(3000, this, this.StopMove);
                    break;
            }
        }
        StopMove() {
            Laya.timer.clear(this, this.JumpCameraMove);
        }
        MoveGame(z) {
            if (!this.canmovegame)
                return;
            this.temp.z = z - this.dis.z;
            this._tran.localPositionZ = this.temp.z;
        }
        JumpCameraMove() {
            let p, r;
            if (this.arg == 1) {
                p = this.tarTra.position;
                r = Mathf.SpToCam(this.tarTra.localRotationEuler.clone());
            }
            else {
                p = Mathf.MixVector3(this._tran.position.clone(), this.tarTra.position, this.arg, this.nowP);
                r = Mathf.MixVector3(this._tran.localRotationEuler, Mathf.SpToCam(this.tarTra.localRotationEuler.clone()), this.arg, this.nowR);
            }
            this._tran.position = p;
            this._tran.localRotationEuler = r;
        }
        onDisable() {
        }
        onDestroy() {
            Laya.timer.clearAll(this);
        }
        ShakeFor(a, b) {
            this.camPOS = this.selfObj.transform.position.clone();
            this.seconds = a;
            this.started = true;
            this.startShake = true;
            this.quake = b;
        }
        onLateUpdate() {
            if (this.startShake) {
                this.Quake();
            }
            if (this.started) {
                this.started = false;
                Laya.timer.once(this.seconds * 1000, this, () => {
                    this.startShake = false;
                    this.selfObj.transform.position = this.camPOS;
                });
            }
        }
        Quake() {
            var x = GameTool.random_1to1() * this.quake;
            var y = GameTool.random_1to1() * this.quake;
            var z = GameTool.random_1to1() * this.quake;
            var temp = new Vector3$6(this.camPOS.x + Math.random() * this.quake, this.camPOS.y + Math.random() * this.quake, this.camPOS.z + Math.random() * this.quake);
            this.selfObj.transform.position = temp;
        }
    }

    class Scene3DManager {
        static get Instance() {
            return Scene3DManager.instance || (Scene3DManager.instance = new Scene3DManager());
        }
        Init(_s) {
            if (_s) {
                this._mainscene = _s;
                Laya.stage.addChild(_s);
            }
            else {
                console.error("场景不存在");
                return;
            }
            let sceneNode;
            sceneNode = this._mainscene.getChildByName("scene");
            if (!sceneNode) {
                console.error("场景资源配置错误!");
                return;
            }
            this._camera = this._mainscene.getChildByName("Main Camera");
            this._camera.enableHDR = false;
            this.bulletCon = sceneNode.getChildByName("bulletContainer");
            this.effectCon = sceneNode.getChildByName("effectPos");
            this.InitSceneArg();
            let build = sceneNode.getChildByName("buildings");
            ConstructManager.Instance.Init(build);
            let playerStartPos = sceneNode.getChildByName("playerstartPoint");
            let playerCon = sceneNode.getChildByName("playerContainer");
            MainRoleManager.Instance.Init(playerStartPos, playerCon);
            let moveBlockContainer = sceneNode.getChildByName("BlockContainer");
            StreetManager.Instance.Init(moveBlockContainer);
            let towerContainer = sceneNode.getChildByName("towerContainer");
            MoundManager.Instance.Init(towerContainer);
            let startCampos1 = sceneNode.getChildByName("startCamPos");
            let startCamposX = sceneNode.getChildByName("startXCamPos");
            let ps;
            if (GameSetting.isX)
                ps = startCamposX;
            else
                ps = startCampos1;
            CameraManager.Instance.Init(this._camera, ps);
            let finalPos = sceneNode.getChildByName("finalPos");
            PlaneManager.Instance.Init(finalPos);
            this.INITGAME();
        }
        INITGAME() {
            Laya.timer.frameOnce(10, this, () => {
                MainRoleManager.Instance.CreatePlayer();
                this.InItScene();
            });
        }
        ;
        InitSceneArg() {
            this._camera.clearFlag = Laya.BaseCamera.CLEARFLAG_SKY;
            let skyRenderer = this._mainscene.skyRenderer;
            skyRenderer.mesh = Laya.SkyDome.instance;
            let mat = new Laya.SkyProceduralMaterial();
            skyRenderer.material = mat;
            mat.sunDisk = Laya.SkyProceduralMaterial.SUN_NODE;
            mat.skyTint = new Laya.Vector4(1, 0.74, 0.74, 1);
        }
        SkyRotate() {
            Laya.timer.frameLoop(2, this, this.St);
        }
        St() {
            if (this.mat)
                this.mat.rotation += 0.1;
        }
        InItScene() {
            LevelController.Instance.SetLevel();
            PlaneManager.Instance.SetAir();
            ConstructManager.Instance.SetBuild();
            CameraManager.Instance.SetCamState(CameraState.game, 1);
            MainRoleManager.Instance.InitPlayerPos();
        }
    }

    class AssetController {
        constructor() {
            this.cloth = [];
        }
        static get Instance() {
            return this.instance || (this.instance = new AssetController());
        }
        LoadAsset(callback) {
            var arr = [
                AssetPath.main_path,
                AssetPath.enemy_path,
                AssetPath.playerBullet_path,
                AssetPath.tower_path,
            ];
            let arr1 = arr.concat(AssetPath.player_path);
            let arr2 = arr1.concat(AssetPath.barrier_paths);
            let arr3 = arr2.concat(AssetPath.effect_path);
            let arr4 = arr3.concat(AssetPath.enemytexture);
            AssetController.LoadResource(arr4, () => {
                this.InitAsset();
                if (callback)
                    callback();
            });
        }
        InitAsset() {
            AssetPath.player_path.forEach(element => {
                let _player = Laya.loader.getRes(element);
                Laya.loader.clearRes(element);
                this.LoadPoolRes(_player.name, _player);
            });
            AssetPath.enemytexture.forEach(element => {
                let _tex = Laya.loader.getRes(element);
                Laya.loader.clearRes(element);
                this.cloth.push(_tex);
            });
            AssetPath.effect_path.forEach(element => {
                let _effect = Laya.loader.getRes(element);
                Laya.loader.clearRes(element);
                this.LoadPoolRes(_effect.name, _effect);
            });
            let _enemy = Laya.loader.getRes(AssetPath.enemy_path);
            Laya.loader.clearRes(AssetPath.enemy_path);
            this.LoadPoolRes(_enemy.name, _enemy);
            let _playerbullet = Laya.loader.getRes(AssetPath.playerBullet_path);
            Laya.loader.clearRes(AssetPath.playerBullet_path);
            this.LoadPoolRes(_playerbullet.name, _playerbullet);
            let _tower = Laya.loader.getRes(AssetPath.tower_path);
            Laya.loader.clearRes(AssetPath.tower_path);
            this.LoadPoolRes(_tower.name, _tower);
            let _scene = Laya.loader.getRes(AssetPath.main_path);
            Laya.loader.clearRes(AssetPath.main_path);
            AssetPath.barrier_paths.forEach(element => {
                let _barrier = Laya.loader.getRes(element);
                Laya.loader.clearRes(element);
                this.LoadPoolRes(_barrier.name, _barrier);
            });
            Scene3DManager.Instance.Init(_scene);
        }
        LoadPoolRes(name, prefab) {
            GamePool.Instance.InitData(name, prefab);
        }
        static LoadResource(path, complet) {
            Laya.loader.retryNum = 2;
            Laya.loader.maxLoader = 3;
            Laya.loader.retryDelay = 100;
            Laya.loader.create(path, new Laya.Handler(this, complet));
            Laya.loader.on(Laya.Event.ERROR, this, (data) => {
                console.log(data + " 资源加载失败");
            });
        }
    }

    var Tween = Laya.Tween;
    class LoadView extends ui.LoadViewUI {
        constructor() {
            super();
            this.proCom = false;
            this.a = new Laya.Vector3();
            this.loadResCom = false;
            this.loginCom = false;
            this.errorTime = 0;
            this.timers = 0;
            this.subLoadCom = false;
            LoadView.instance = this;
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        static get Instance() {
            return LoadView.instance;
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
        OnShow(data) {
            this.proTex.text = "0%";
            this.pro1.width = 0;
            this.InitUi();
            this.LoginGame();
            this.LoadSubpackage();
            Laya.timer.frameOnce(5, this, () => {
                this.resizeHander();
            });
            WXSdk.AldEvent("进入加载加载界面!");
        }
        InitDate() {
            this.proLen = this.pro.width;
        }
        InitHandler() {
        }
        InitUi() {
            Tween.to(this.a, {
                x: 1, update: new Laya.Handler(this, () => {
                    var num = this.a.x;
                    this.pro1.width = this.proLen * num;
                    num = num * 100;
                    this.proTex.text = Math.ceil(num) + "%";
                })
            }, 1500, Laya.Ease.quadInOut, new Laya.Handler(this, () => {
                this.proTex.text = "100%";
                this.pro1.width = this.proLen;
                this.proCom = true;
                this.AllCom();
            }));
        }
        LoadRes() {
            if (this.subLoadCom && this.loginCom) {
                AssetController.Instance.LoadAsset(() => {
                    WXSdk.AldEvent("资源加载成功");
                    this.loadResCom = true;
                    this.AllCom();
                });
            }
        }
        LoginGame() {
            if (GameSetting.isWx) {
                WXSdk.Login((data) => {
                    this.onWxLoginHandler(data);
                });
            }
            else {
                this.LocalLogin();
            }
        }
        onWxLoginHandler(params) {
            console.log("微信回调成功!");
            console.log(params);
            if (params == "error" || params.code == null) {
                if (this.errorTime == 0) {
                    WXSdk.AldEvent("微信登录失败");
                }
                this.errorTime++;
                if (this.errorTime >= 3)
                    return;
                WXSdk.Login((data) => {
                    this.onWxLoginHandler(data);
                });
            }
            else {
                if (this.errorTime == 0) {
                    WXSdk.AldEvent("微信登录成功!");
                }
                let systemInfo = WXSdk.SystemInfo();
                let platformModel = "ipx";
                if (systemInfo != null) {
                    var model = systemInfo.model;
                    platformModel = `${systemInfo.brand}_${model}_${systemInfo.system}_wx${systemInfo.version}_SDKVer${systemInfo.SDKVersion}`;
                    console.log("platformModel:" + platformModel);
                }
                new UserModel(params.code, params.nickName, params.avatarUrl, params.gender, params.country, params.province, params.city, platformModel, WXSdk.ShareId, WXSdk.Chanel);
                this.LocalLogin();
            }
        }
        LocalLogin() {
            NetManager.Instance.login(null, (data) => {
                this.OnLoginComplete(data);
            }, (data) => {
                this.OnLoginError(data);
            });
        }
        OnLoginComplete(data) {
            if (data["code"] != "0") {
                console.log("登录异常错误！");
                WXSdk.AldEvent("本地登录成功!");
                this.timers++;
                if (this.timers >= 4)
                    return;
                if (GameSetting.isWx) {
                    WXSdk.Login((data) => {
                        this.onWxLoginHandler(data);
                    });
                }
                else {
                    this.LocalLogin();
                }
            }
            else {
                this.loginCom = true;
                this.LoadRes();
                this.AllCom();
            }
        }
        OnLoginError(data) {
            console.log("登录错误");
            WXSdk.AldEvent("本地登陆失败");
        }
        LoadSubpackage() {
            WXSdk.LoadSubPackage("subpackage", (com) => {
                if (com) {
                    console.log("subpackage com++++++++++++++++");
                    LoadView.instance.subLoadCom = true;
                    WXSdk.LoadSubPackage("subpackage1");
                    LoadView.instance.LoadRes();
                }
            });
        }
        AllCom() {
            if (this.proCom && this.loadResCom && this.loginCom) {
                BannerAndVideo1.InitVideo();
                Laya.timer.once(1000, this, () => {
                    WXSdk.AldEvent("进入主界面");
                    ViewManager.Instance.OpenView(ViewType.MainView);
                    MouseEvent.Instance.InitMouseEvent();
                    ShareModule.OnShowHandle();
                    SettingController.Instance.Init();
                    OnHideHandler.Reg();
                    SettingController.Instance._playMusic();
                });
            }
        }
        OnClose() {
            LoadView.instance = null;
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
        }
    }

    class MainView extends ui.MainViewUI {
        constructor() {
            super();
            this.isTryed = false;
            MainView.instance = this;
            this.resizeHander();
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        static get Instance() {
            return MainView.instance;
        }
        OnShow(data) {
            this.InitDate();
            this.InitHandler();
            this.InitUi();
            if (GuideController.Instance.IsGuide()) {
                this.mainBox.visible = false;
            }
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
        InitUi() {
            this.user_id.text = "user_id:" + UserModel.Instance.CurModel.m_userid;
            this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
            this.SetStage();
            this.SetStagePro(0);
            this.SetSettingBox(false);
        }
        InitDate() {
            this.GetImage();
            this.coinFollow = new FollowNumber(0.1, 0, 0, 0.1);
            this.proWidth = this.pro.width;
            this.isTryed = false;
        }
        AdaptiveUI() {
        }
        moreFunc(ist) {
            if (ist) ;
            else {
                console.log("mainui");
            }
        }
        InitHandler() {
            this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
            this.settingBtn.CZ = () => {
                this.SetSettingBox();
            };
            this.moreGameBtn.clickHandler = new Laya.Handler(this, () => {
            });
            this.coutiBtn.clickHandler = new Laya.Handler(this, () => {
            });
            this.skinBtn.CZ = () => {
                ViewManager.Instance.AddView(ViewType.SKinShopView);
            };
            this.updateBtn.CZ = () => {
                ViewManager.Instance.AddView(ViewType.IntensifyView);
            };
            DispatcherManager.on(EventType.Event.ShowMainUi, this, this.ShowMainBox);
            DispatcherManager.on(EventType.Event.SetMonery, this, this.SetPlayerGrade);
            DispatcherManager.on(EventType.Event.SetStage, this, this.SetStage);
            DispatcherManager.on(EventType.Event.SetStagePro, this, this.SetStagePro);
            this.sound_btn.clickHandler = new Laya.Handler(this, () => {
                this.SoundSetting();
            });
            this.shake_btn.clickHandler = new Laya.Handler(this, () => {
                this.ShakeSetting();
            });
        }
        SetStage() {
            this.stageValue.text = PlayerManager.Instance.stage.toString();
        }
        SetStagePro(value) {
            value = value >= 1 ? 1 : value;
            this.pro1.width = this.proWidth * value;
        }
        SetPlayerGrade(num) {
            this.tempTarGrade = num;
            this.coinFollow.target = num;
            Laya.timer.frameLoop(1, this, this.T2);
        }
        T2() {
            this.coinFollow.update();
            let v = Math.ceil(this.coinFollow.follow);
            this.countValue.text = v.toString();
            if (v >= this.tempTarGrade) {
                this.countValue.text = this.tempTarGrade.toString();
                Laya.timer.clear(this, this.T2);
            }
        }
        StartGame(e) {
            if (this.isTryed) {
                this.TryStartGame();
                return;
            }
            if (e.target instanceof Laya.UIComponent) {
                if (e.target.name != "mainBox")
                    return;
            }
            console.log("click");
            let param = [{ "t": UserModel.Instance.CurModel.ServerTime }];
            NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Start, param, (data) => {
                if (data["play_id"]) {
                    PlayerManager.Instance.Play_Id = data["play_id"];
                }
                WXSdk.Start(PlayerManager.Instance.stage.toString());
                if (PlayerManager.Instance.stage >= 3) {
                    ViewManager.Instance.AddView(ViewType.TrialView);
                }
                else {
                    this.MainStartGame();
                }
            }, (data) => {
            });
        }
        MainStartGame() {
            this.mainBox.visible = false;
            this.sliderBox.visible = false;
            this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
            this.gameStart.stop();
            GameManager.Instance.GameStart();
            MouseEvent.Instance.StartGameClick();
            MainRoleManager.Instance.StartGame();
            MateManager.Instance.TryOutFriendPlayAni();
            StreetManager.Instance.SetBlock();
            GuideController.Instance.StartGuide();
        }
        TryStartGame() {
            this.sliderBox.visible = false;
            this.gameStart.stop();
            this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
            GameManager.Instance.GameStart();
            MouseEvent.Instance.StartGameClick();
            MainRoleManager.Instance.StartGame();
            MateManager.Instance.TryOutFriendPlayAni();
            StreetManager.Instance.SetBlock();
        }
        TryClick() {
            this.isTryed = true;
            this.mainBox.visible = false;
        }
        ShowMainBox() {
            this.mainBox.visible = true;
            this.sliderBox.visible = true;
            this.gameStart.play(0, true);
            this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
            this.isTryed = false;
            this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
        }
        SetSettingBox(ist = true) {
            if (!ist) {
                this.settingBox.visible = false;
                return;
            }
            this.settingBox.visible = !this.settingBox.visible;
        }
        GetImage() {
            this.sound_open = this.sound_btn.getChildByName("kai");
            this.sound_guan = this.sound_btn.getChildByName("guan");
            this.shake_open = this.shake_btn.getChildByName("kai");
            this.shake_guan = this.shake_btn.getChildByName("guan");
            this.SoundShow(SettingController.Instance.sound);
            this.ShakeShow(SettingController.Instance.vibrate);
        }
        SoundSetting() {
            SettingController.Instance.sound = !SettingController.Instance.sound;
            this.SoundShow(SettingController.Instance.sound);
        }
        SoundShow(isshow) {
            if (!isshow) {
                this.sound_open.visible = false;
                this.sound_guan.visible = true;
                SettingController.Instance.SettingSound(0);
                Laya.LocalStorage.setItem("sound", "0");
                console.log("关闭声音");
            }
            else {
                this.sound_open.visible = true;
                this.sound_guan.visible = false;
                SettingController.Instance.SettingSound(1);
                Laya.LocalStorage.setItem("sound", "1");
                console.log("开启声音");
            }
        }
        ShakeSetting() {
            SettingController.Instance.vibrate = !SettingController.Instance.vibrate;
            this.ShakeShow(SettingController.Instance.vibrate);
        }
        ShakeShow(isshow) {
            if (!isshow) {
                this.shake_open.visible = false;
                this.shake_guan.visible = true;
                Laya.LocalStorage.setItem("vibrate", "0");
                console.log("关闭震动");
            }
            else {
                this.shake_open.visible = true;
                this.shake_guan.visible = false;
                Laya.LocalStorage.setItem("vibrate", "1");
                console.log("开启震动");
            }
        }
        OnClose() {
            this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
            DispatcherManager.off(EventType.Event.ShowMainUi, this, this.ShowMainBox);
            DispatcherManager.off(EventType.Event.SetMonery, this, this.SetPlayerGrade);
            DispatcherManager.off(EventType.Event.SetStage, this, this.SetStage);
            DispatcherManager.off(EventType.Event.SetStagePro, this, this.SetStagePro);
            MainView.instance = null;
            Laya.timer.clearAll(this);
        }
    }

    class ShadeView extends ui.ShadeViewUI {
        constructor() {
            super();
            this.resizeHander();
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        OnShow(data) {
            this.InitHandler();
        }
        InitUi() {
        }
        InitDate() {
        }
        InitHandler() {
            this.on(Laya.Event.CLICK, this, this.Test);
        }
        Test() {
        }
        OnClose() {
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
            this.off(Laya.Event.CLICK, this, this.Test);
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
    }

    class CompleteView extends ui.CompleteViewUI {
        constructor() {
            super();
            this.isWin = false;
            CompleteView.instance = this;
            this.resizeHander();
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        static get Instance() {
            return CompleteView.instance;
        }
        OnShow(data) {
            this.isWin = data;
            this.InitDate();
            this.InitHandler();
            this.InitUi();
            BannerAndVideo1.CheatBanner(this.winbtnBox);
        }
        BannerMove() {
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
        InitDate() {
            this.coinValue = this.isWin == true ? LevelController.Instance._level.gold : LevelController.Instance._level.fail_gold;
            this.tes1 = this.coinValue;
            this.coinValue += (PlayerManager.tower_reward * GameManager.Instance.towerCount + PlayerManager.enemy_reward * GameManager.Instance.roleCount + PlayerManager.block_reward * GameManager.Instance.blockCount);
            let iswin = this.isWin == true ? 1 : 0;
            let count = this.coinValue;
            let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "play_id": PlayerManager.Instance.Play_Id }, { "win": iswin }, { "money": count }];
            NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.GameResult, param, (data) => {
            }, (data) => {
                ViewManager.Instance.ShowTips("结算失败");
            });
            if (this.isWin) {
                SettingController.Instance.PlaySound(SoundType.win);
                WXSdk.Success(PlayerManager.Instance.stage.toString());
            }
            else {
                SettingController.Instance.PlaySound(SoundType.defeat);
                WXSdk.Fail(PlayerManager.Instance.stage.toString());
            }
        }
        InitHandler() {
            this.doublegetBtn.CZ = () => {
                this.DoubleGetHandler();
            };
            this.nextBtn.CZ = () => {
                if (this.isWin) {
                    this.NextHandler();
                }
                else {
                    this.ResetHandler();
                }
            };
        }
        InitUi() {
            this.winTop.visible = this.isWin;
            this.shibaiTop.visible = !this.isWin;
            this.valueText.text = "+" + this.coinValue;
            this.doubleText.text = (this.coinValue * 3).toString();
            this.towerCount.text = "X" + GameManager.Instance.towerCount.toString();
            this.towerValue.text = (PlayerManager.tower_reward * GameManager.Instance.towerCount).toString();
            this.roleCount.text = "X" + GameManager.Instance.roleCount.toString();
            this.roleValue.text = (PlayerManager.enemy_reward * GameManager.Instance.roleCount).toString();
            this.blockCount.text = "X" + GameManager.Instance.blockCount.toString();
            this.blockValue.text = (PlayerManager.block_reward * GameManager.Instance.blockCount).toString();
        }
        DoubleGetHandler() {
            BannerAndVideo1.ShowVideo((isok) => {
                if (isok) {
                    WXSdk.AldEvent("结束界面看视屏获得钱");
                    var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.coinValue * 2).toString() }];
                    NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
                        ViewManager.Instance.ShowTips("金币:X" + (this.coinValue * 3));
                        this.NextHandler();
                    }, (data) => {
                    });
                }
            });
        }
        NextHandler() {
            GameManager.Instance.NextLevel();
        }
        ResetHandler() {
            ViewManager.Instance.CloseView(ViewType.CompleteView);
            ViewManager.Instance.AddView(ViewType.AttributeUpView);
        }
        OnClose() {
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
            CompleteView.instance = null;
            Laya.timer.clearAll(this);
            BannerAndVideo1.Clear();
        }
    }

    class InGameView extends ui.InGameViewUI {
        static get Instance() {
            return InGameView.instance;
        }
        constructor() {
            super();
            InGameView.instance = this;
            this.resizeHander();
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        OnShow(data) {
            this.InitDate();
            this.InitHandler();
            this.InitUi();
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
        InitDate() {
        }
        InitHandler() {
        }
        InitUi() {
        }
        OnClose() {
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
            InGameView.instance = null;
            Laya.timer.clearAll(this);
        }
    }

    class IntensifyView extends ui.IntensifyViewUI {
        constructor() {
            super();
            this.iscoinShowfreecoinbtn = false;
            this.resizeHander();
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        OnShow(data) {
            this.InitDate();
            this.InitHandler();
            this.InitUi();
            BannerAndVideo1.CheatBanner(null);
        }
        InitUi() {
            this.SetUi();
            this.RefreshCoinShow();
            let t = this.cost1 < this.cost2 ? this.cost1 : this.cost2;
            this.freecoinValue = Math.floor(t * 1.2);
            this.coinValue.text = this.freecoinValue.toString();
        }
        SetUi() {
            this.atkLv.text = "LV" + this.tempPowerLevel;
            let al = CfgManager.Instance._atk.length;
            let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
            this.cost1 = CfgManager.Instance.GetAtk(t)["cost"];
            this.atkValue.text = this.cost1.toString();
            this.rateLv.text = "LV" + this.tempRateLevel;
            let al1 = CfgManager.Instance._rate.length;
            let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
            this.cost2 = CfgManager.Instance.GetRate(t1)["cost"];
            this.rateValue.text = this.cost2.toString();
            if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
                this.atkBtn.gray = true;
                this.atkBtn.mouseEnabled = false;
            }
            else {
                this.atkBtn.gray = false;
                this.atkBtn.mouseEnabled = true;
            }
            if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
                this.rateBtn.gray = true;
                this.rateBtn.mouseEnabled = false;
            }
            else {
                this.rateBtn.gray = false;
                this.rateBtn.mouseEnabled = true;
            }
        }
        InitDate() {
            this.tempPowerLevel = PlayerManager.Instance.powerLevel;
            this.tempRateLevel = PlayerManager.Instance.rateLevel;
            this.RefreshData();
        }
        RefreshData() {
            let detail = UserModel.Instance.CurModel.user_video.detail;
            if (!detail)
                this.iscoinShowfreecoinbtn = true;
            else {
                let freet = detail.freecoin;
                if (!freet) {
                    this.iscoinShowfreecoinbtn = true;
                    return;
                }
                if (freet < AppSetting.freeGetcoinTime) {
                    this.iscoinShowfreecoinbtn = true;
                    return;
                }
                this.iscoinShowfreecoinbtn = false;
            }
        }
        RefreshCoinShow() {
            if (this.iscoinShowfreecoinbtn) {
                this.coinBtn.gray = false;
                this.coinBtn.mouseEnabled = true;
            }
            else {
                this.coinBtn.gray = true;
                this.coinBtn.mouseEnabled = false;
            }
        }
        InitHandler() {
            this.backBtn.CZ = () => {
                ViewManager.Instance.CloseView(ViewType.IntensifyView);
            };
            this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
            this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
            this.coinBtn.clickHandler = new Laya.Handler(this, this.CoinBtnHandler);
        }
        AtkBtnHandler() {
            if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
                ViewManager.Instance.ShowTips("金币不足!", 1);
                return;
            }
            PlayerManager.Instance.GradePower(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
                if (iscom) {
                    WXSdk.AldEvent("升级界面花钱升级攻击力");
                    this.tempPowerLevel++;
                    this.SetUi();
                    DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
                }
            });
        }
        RateBtnHandler() {
            if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
                ViewManager.Instance.ShowTips("金币不足!", 1);
                return;
            }
            PlayerManager.Instance.GradeRate(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
                if (iscom) {
                    WXSdk.AldEvent("升级界面花钱升级速度");
                    this.tempRateLevel++;
                    this.SetUi();
                    DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
                }
            });
        }
        CoinBtnHandler() {
            BannerAndVideo1.ShowVideo((isok) => {
                if (isok) {
                    var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.freecoinValue).toString() }, { "channel": "video:freecoin" }];
                    NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
                        WXSdk.AldEvent("升级界面看视屏获得钱");
                        DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
                        this.RefreshData();
                        this.RefreshCoinShow();
                    }, (data) => {
                    });
                }
            });
        }
        OnClose() {
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
            if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
                PlayerManager.Instance.SetArr();
            }
            BannerAndVideo1.Clear();
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
    }

    class AttributeUpView extends ui.AttributeUpViewUI {
        constructor() {
            super();
            this.iscanShowVideoBtn = true;
            this.isatkvideo = false;
            this.isfirstatkvideo = true;
            this.isfirstratevideo = true;
            this.isratevideo = false;
            this.atkShow = false;
            this.resizeHander();
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        OnShow(data) {
            this.InitDate();
            this.InitHandler();
            this.InitUi();
            BannerAndVideo1.CheatBanner(null);
        }
        InitUi() {
            this.SetUi();
        }
        SetUi() {
            this.atkLv.text = "LV" + this.tempPowerLevel;
            let al = CfgManager.Instance._atk.length;
            let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
            this.cost1 = CfgManager.Instance.GetAtk(t)["cost"];
            this.atkValue.text = this.cost1.toString();
            this.rateLv.text = "LV" + this.tempRateLevel;
            let al1 = CfgManager.Instance._rate.length;
            let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
            this.cost2 = CfgManager.Instance.GetRate(t1)["cost"];
            this.rateValue.text = this.cost2.toString();
            if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
                if (this.iscanShowVideoBtn && this.isfirstatkvideo) {
                    this.isatkvideo = true;
                    this._atk.visible = false;
                    this._atkVideo.visible = true;
                    this.atkBtn.mouseEnabled = true;
                    this.atkBtn.gray = false;
                    this.click1.visible = true;
                    this.atkShow = true;
                }
                else {
                    this.atkBtn.mouseEnabled = false;
                    this.atkBtn.gray = true;
                    this.isatkvideo = false;
                    this.click1.visible = false;
                    this.atkShow = false;
                }
            }
            else {
                this._atk.visible = true;
                this._atkVideo.visible = false;
                this.atkBtn.gray = false;
                this.atkBtn.mouseEnabled = true;
                this.isatkvideo = false;
                this.click1.visible = true;
                this.atkShow = true;
            }
            if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
                if (this.iscanShowVideoBtn && this.isfirstratevideo) {
                    this.isratevideo = true;
                    this._rate.visible = false;
                    this._rateVideo.visible = true;
                    this.rateBtn.mouseEnabled = true;
                    this.rateBtn.gray = false;
                    if (this.atkShow)
                        this.click2.visible = false;
                    else
                        this.click2.visible = true;
                }
                else {
                    this.rateBtn.mouseEnabled = false;
                    this.rateBtn.gray = true;
                    this.isratevideo = false;
                    this.click2.visible = false;
                }
            }
            else {
                this._rate.visible = true;
                this._rateVideo.visible = false;
                this.rateBtn.gray = false;
                this.rateBtn.mouseEnabled = true;
                this.isratevideo = false;
                if (this.atkShow)
                    this.click2.visible = false;
                else
                    this.click2.visible = true;
            }
        }
        InitDate() {
            this.tempPowerLevel = PlayerManager.Instance.powerLevel;
            this.tempRateLevel = PlayerManager.Instance.rateLevel;
            let detail = UserModel.Instance.CurModel.user_video.detail;
            if (!detail)
                this.iscanShowVideoBtn = true;
            else {
                let freet = detail.free;
                if (!freet) {
                    this.iscanShowVideoBtn = true;
                    return;
                }
                if (freet < AppSetting.freeUpdateVideotime) {
                    this.iscanShowVideoBtn = true;
                    return;
                }
                {
                    this.iscanShowVideoBtn = false;
                }
            }
        }
        InitHandler() {
            this.backBtn.CZ = () => {
                this.BackClickHandler();
            };
            this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
            this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
        }
        AtkBtnHandler() {
            if (this.isatkvideo) {
                BannerAndVideo1.ShowVideo((iscom) => {
                    if (iscom) {
                        PlayerManager.Instance.GradePower(this.tempPowerLevel + 1, "video:free", this.cost1, (iscom) => {
                            if (iscom) {
                                WXSdk.AldEvent("失败界面看视屏升级攻击力");
                                this.tempPowerLevel++;
                                this.isfirstatkvideo = false;
                                this.SetUi();
                                DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
                            }
                        });
                    }
                });
            }
            else {
                PlayerManager.Instance.GradePower(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
                    if (iscom) {
                        WXSdk.AldEvent("失败界面花钱升级攻击力");
                        this.tempPowerLevel++;
                        this.SetUi();
                        DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
                    }
                });
            }
        }
        RateBtnHandler() {
            if (this.isratevideo) {
                BannerAndVideo1.ShowVideo((iscom) => {
                    if (iscom) {
                        PlayerManager.Instance.GradeRate(this.tempRateLevel + 1, "video:free", this.cost2, (iscom) => {
                            if (iscom) {
                                WXSdk.AldEvent("失败界面看视屏升级速度");
                                this.tempRateLevel++;
                                this.isfirstratevideo = false;
                                this.SetUi();
                            }
                        });
                    }
                });
            }
            else {
                PlayerManager.Instance.GradeRate(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
                    if (iscom) {
                        WXSdk.AldEvent("失败界面花钱升级速度");
                        this.tempRateLevel++;
                        this.SetUi();
                    }
                });
            }
        }
        BackClickHandler() {
            ViewManager.Instance.CloseView(ViewType.AttributeUpView);
            GameManager.Instance.ReStart();
        }
        OnClose() {
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
            if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
                PlayerManager.Instance.SetArr();
                DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
            }
            BannerAndVideo1.Clear();
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
    }

    var Vector3$7 = Laya.Vector3;
    class DisplayerCarController {
        static get Instance() {
            return DisplayerCarController.instance || (DisplayerCarController.instance = new DisplayerCarController());
        }
        InitDis(par) {
            if (!this._scene) {
                this._scene = new Laya.Scene3D();
                this._camera = new Laya.Camera();
                this._camera.enableHDR = false;
                this._scene.addChild(this._camera);
                this._light = new Laya.DirectionLight();
                this._light.transform.rotation = new Laya.Quaternion(-0.24776, 0, 0, 0.9688215);
                this._light.intensity = 0.45;
                this._light.color = new Vector3$7(1, 1, 1);
                this._scene.addChild(this._light);
                let or = 1;
                this._camera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
                this._camera.orthographic = false;
                this._camera.enableHDR = false;
                this._camera.clearFlag = 2;
                this._camera.fieldOfView = 60;
                this._camera.transform.position = new Vector3$7(0, 1.52, 3.12);
                this._camera.transform.rotation = new Laya.Quaternion(0, 0, 0, 1);
            }
            let or = 1;
            this._camera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
            par.addChild(this._scene);
            this.CreatePlayer();
        }
        CreatePlayer(id) {
            if (!id)
                id = PlayerManager.Instance.equipId;
            if (!this.player) {
                let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + id);
                if (p)
                    this.player = p;
                this._scene.addChild(this.player);
                this.player.transform.localPosition = Mathf.VecZero;
                this.player.transform.localRotationEuler = Mathf.VecZero;
            }
            else {
                GamePool.Instance.SetDisableObject(this.player);
                let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + id);
                if (p)
                    this.player = p;
                this._scene.addChild(this.player);
                this.player.transform.localPosition = Mathf.VecZero;
                this.player.transform.localRotationEuler = Mathf.VecZero;
            }
            let anima = this.player.getChildAt(0).getComponent(Laya.Animator);
            anima.play(MusicType.Dance);
            anima.speed = 1;
        }
        Reset() {
            if (this._scene) {
                this._scene.removeSelf();
            }
            if (this.player) {
                GamePool.Instance.SetDisableObject(this.player);
                this.player = null;
            }
        }
    }

    class SKinShopView extends ui.SkinShopViewUI {
        static get Instance() {
            return SKinShopView.instance;
        }
        constructor() {
            super();
            SKinShopView.instance = this;
            this.resizeHander();
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
        OnShow(data) {
            this.InitDate();
            this.InitHandler();
            this.InitUi();
            WXSdk.AldEvent("打开皮肤界面");
        }
        InitDate() {
            this.oignPlayerid = PlayerManager.Instance.equipId;
            this.operateIndex = this.oignPlayerid;
        }
        InitUi(data) {
            this.SetShowbtn(this.operateIndex);
            this.SetUseBtn(this.operateIndex);
            DisplayerCarController.Instance.InitDis(this.viewPort);
        }
        InitHandler() {
            this.backBtn.CZ = () => {
                this.BackHandler();
            };
            this.leftBtn.clickHandler = Laya.Handler.create(this, () => {
                if (this.operateIndex == 1)
                    return;
                this.operateIndex--;
                this.SetShowbtn(this.operateIndex);
                this.SetUseBtn(this.operateIndex);
                DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
            }, null, false);
            this.rightBtn.clickHandler = Laya.Handler.create(this, () => {
                if (this.operateIndex == 7)
                    return;
                this.operateIndex++;
                this.SetShowbtn(this.operateIndex);
                this.SetUseBtn(this.operateIndex);
                DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
            }, null, false);
            this.use.CZ = () => {
                this.NetEquip();
            };
            this.coin.CZ = () => {
                if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.coinValue)
                    ViewManager.Instance.ShowTips("金币不足!", 2);
                else
                    this.NetBuy();
            };
            this.video.CZ = () => {
                this.VideoBtnHandler();
            };
        }
        SetShowbtn(index) {
            if (index == 1) {
                this.leftBtn.getChildByName("leftFalse").visible = true;
                this.leftBtn.getChildByName("leftTrue").visible = false;
                this.rightBtn.getChildByName("rightFalse").visible = false;
                this.rightBtn.getChildByName("rightTrue").visible = true;
                return;
            }
            if (index == 7) {
                this.leftBtn.getChildByName("leftFalse").visible = false;
                this.leftBtn.getChildByName("leftTrue").visible = true;
                this.rightBtn.getChildByName("rightFalse").visible = true;
                this.rightBtn.getChildByName("rightTrue").visible = false;
                return;
            }
            this.leftBtn.getChildByName("leftFalse").visible = false;
            this.leftBtn.getChildByName("leftTrue").visible = true;
            this.rightBtn.getChildByName("rightFalse").visible = false;
            this.rightBtn.getChildByName("rightTrue").visible = true;
        }
        SetUseBtn(index) {
            if (PlayerManager.Instance.equipId == index) {
                this.using.visible = true;
                this.use.visible = false;
                this.coin.visible = false;
                this.video.visible = false;
                return;
            }
            if (UserModel.Instance.CurModel.HasTheme(index)) {
                this.using.visible = false;
                this.use.visible = true;
                this.coin.visible = false;
                this.video.visible = false;
                return;
            }
            let data = CfgManager.Instance.GetTheme(index);
            if (data.require_type == 2) {
                this.using.visible = false;
                this.use.visible = false;
                this.coin.visible = true;
                this.video.visible = false;
                this.coinValue = Number(data.require_num);
                this.coin.getChildAt(0).getChildAt(0).text = this.coinValue.toString();
                return;
            }
            if (data.require_type == 3) {
                this.using.visible = false;
                this.use.visible = false;
                this.coin.visible = false;
                this.video.visible = true;
                this.video.getChildAt(0).getChildAt(0).text = UserModel.Instance.CurModel.GetThemeProgress(data.id) + "/" + data.require_num;
                return;
            }
        }
        VideoBtnHandler() {
            BannerAndVideo1.ShowVideo((done) => {
                if (done) {
                    WXSdk.AldEvent("商店中看视屏获得皮肤");
                    this.NetVideo();
                }
            });
        }
        ;
        NetVideo() {
            var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "id": this.operateIndex }, { "channel": "video" }];
            NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.themefission, param, (data) => {
                var usermodel = UserModel.Instance.CurModel;
                PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
                this.SetUseBtn(this.operateIndex);
            }, (data) => {
            });
        }
        NetBuy() {
            var param = [{ "id": this.operateIndex }];
            NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Buy, param, (data) => {
                var usermodel = UserModel.Instance.CurModel;
                PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
                DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
                this.SetUseBtn(this.operateIndex);
            }, (data) => {
            });
        }
        NetEquip() {
            var param = [{ "id": this.operateIndex }];
            NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Equip, param, (data) => {
                var usermodel = UserModel.Instance.CurModel;
                PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
                this.SetUseBtn(this.operateIndex);
            }, (data) => {
            });
        }
        BackHandler() {
            DisplayerCarController.Instance.Reset();
            if (this.oignPlayerid != PlayerManager.Instance.equipId) {
                MainRoleManager.Instance.ChangePlayer();
            }
            ViewManager.Instance.CloseView(ViewType.SKinShopView);
        }
        OnClose() {
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
            SKinShopView.instance = null;
            WXSdk.AldEvent("关闭皮肤界面");
        }
    }

    class TrialView extends ui.TrialViewUI {
        constructor() {
            super();
            this.resizeHander();
            DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
        }
        OnShow(data) {
            this.InitHandler();
            this.InitDate();
            this.InitHandler();
            this.InitUi();
            BannerAndVideo1.CheatBanner(this.btnBox);
        }
        InitUi() {
            DisplayerCarController.Instance.InitDis(this.viewPort);
        }
        InitDate() {
        }
        InitHandler() {
            this.videoBtn.CZ = () => {
                this.VideoHandler();
            };
            this.backBtn.CZ = () => {
                DisplayerCarController.Instance.Reset();
                this.BackUi();
            };
        }
        VideoHandler() {
            BannerAndVideo1.ShowVideo((isok) => {
                if (isok) {
                    WXSdk.AldEvent("看视屏试用");
                    this.VideoCom();
                }
            });
        }
        VideoCom() {
            DisplayerCarController.Instance.Reset();
            this.BackUi();
            MateManager.Instance.CreateTryOut();
        }
        BackUi() {
            ViewManager.Instance.CloseView(ViewType.TrialView);
            if (MainView.Instance)
                MainView.Instance.TryClick();
        }
        OnClose() {
            DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
            BannerAndVideo1.Clear();
        }
        resizeHander() {
            this.height = Laya.stage.height;
        }
    }

    var ViewType;
    (function (ViewType) {
        ViewType[ViewType["InGameView"] = 0] = "InGameView";
        ViewType[ViewType["ShadeView"] = 1] = "ShadeView";
        ViewType[ViewType["CompleteView"] = 2] = "CompleteView";
        ViewType[ViewType["LoadView"] = 3] = "LoadView";
        ViewType[ViewType["MainView"] = 4] = "MainView";
        ViewType[ViewType["SettingUi"] = 5] = "SettingUi";
        ViewType[ViewType["SKinShopView"] = 6] = "SKinShopView";
        ViewType[ViewType["TrialView"] = 7] = "TrialView";
        ViewType[ViewType["IntensifyView"] = 8] = "IntensifyView";
        ViewType[ViewType["AttributeUpView"] = 9] = "AttributeUpView";
    })(ViewType || (ViewType = {}));
    class ViewManager {
        constructor() {
            this.viewDic = [];
            this.addViewDic = new Dictionary();
            this._maskCnt = 0;
            this.init();
        }
        static get Instance() {
            return this.instance || (this.instance = new ViewManager());
        }
        init() {
            this._maskCnt = 0;
            this.viewDic[ViewType.InGameView] = InGameView;
            this.viewDic[ViewType.LoadView] = LoadView;
            this.viewDic[ViewType.MainView] = MainView;
            this.viewDic[ViewType.ShadeView] = ShadeView;
            this.viewDic[ViewType.IntensifyView] = IntensifyView;
            this.viewDic[ViewType.CompleteView] = CompleteView;
            this.viewDic[ViewType.SKinShopView] = SKinShopView;
            this.viewDic[ViewType.TrialView] = TrialView;
            this.viewDic[ViewType.AttributeUpView] = AttributeUpView;
            this.uiNode = new Laya.Sprite();
            this.popNode = new Laya.Sprite();
            Laya.stage.addChild(this.uiNode);
            Laya.stage.addChild(this.popNode);
            this.uiNode.zOrder = 3;
            this.popNode.zOrder = 4;
        }
        OpenView(view, data) {
            if (this.curView != null) {
                this.curView.OnClose();
                this.uiNode.removeChild(this.curView);
                this.curView.destroy(true);
                this.curView = null;
            }
            this.curView = new this.viewDic[view];
            this.uiNode.addChild(this.curView);
            this.curView.OnShow(data);
        }
        get getCurView() {
            return this.curView;
        }
        AddView(view, data) {
            if (this.addViewDic.has(view))
                return;
            let t_view = new this.viewDic[view];
            this.addViewDic.set(view, t_view);
            this.uiNode.addChild(t_view);
            t_view.OnShow(data);
            MouseEvent.Instance.CloseInput();
        }
        RemoveView() {
            if (this.curView != null) {
                this.curView.OnClose();
                this.uiNode.removeChild(this.curView);
                this.curView.destroy(true);
                this.curView = null;
            }
        }
        HaveView(view) {
            return this.addViewDic.has(view);
        }
        CloseView(view) {
            if (!this.addViewDic.has(view))
                return;
            let t_view = this.addViewDic.get(view);
            t_view.OnClose();
            this.uiNode.removeChild(t_view);
            t_view.destroy(true);
            this.addViewDic.delete(view);
            MouseEvent.Instance.OpenInput();
        }
        OpenMask() {
            this._maskCnt++;
            if (this._maskCnt > 1)
                return;
            if (this.curMask != null) {
                this.curMask.OnClose();
                this.popNode.removeChild(this.curView);
                this.curMask.destroy();
                this.curMask = null;
                return;
            }
            this.curMask = new this.viewDic[ViewType.ShadeView];
            if (!this.curMask)
                return;
            console.log("打开遮罩");
            this.popNode.addChild(this.curMask);
            this.curMask.OnShow();
        }
        CloseMask() {
            this._maskCnt--;
            if (this._maskCnt > 0)
                return;
            if (this.curMask != null) {
                this.curMask.OnClose();
                this.popNode.removeChild(this.curMask);
                this.curMask.destroy(true);
                console.log("关闭遮罩");
                this.curMask = null;
            }
        }
        ShowTips(value, type = 1) {
            var warn = GamePool.Instance.SetActiveForUi(PoolType.WarnTips);
            if (!warn)
                return;
            if (type == 1) {
                warn.y = 0;
                warn.text = value;
                warn.x = Laya.stage.width >> 1;
                this.popNode.addChild(warn);
                let _end = (Laya.stage.height >> 1) - 300;
                var tw = Laya.Tween.to(warn, { y: _end }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
                    tw.clear();
                    GamePool.Instance.SetDisableForUi(PoolType.WarnTips, warn);
                }));
            }
            else if (type == 2) {
                warn.y = Laya.stage.height - 400;
                warn.text = value;
                warn.x = Laya.stage.width >> 1;
                this.popNode.addChild(warn);
                var tw = Laya.Tween.to(warn, { alpha: 0 }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
                    tw.clear();
                    GamePool.Instance.SetDisableForUi(PoolType.WarnTips, warn);
                    warn.alpha = 1;
                }));
            }
        }
        ShowGuideView() {
            if (!this.GuideView) {
                this.GuideView = new GuideView();
                this.popNode.addChild(this.GuideView);
            }
            this.GuideView.OnShow();
        }
        CloseGuideView() {
            if (this.GuideView) {
                this.GuideView.OnClose();
                this.GuideView.removeSelf();
                this.GuideView.destroy();
            }
        }
    }

    class ShareModule {
        static GoShare(callBack) {
            ShareModule.ShareTime = new Date().getTime();
            console.log("分享点击时间=" + ShareModule.ShareTime);
            ShareModule.IsSharing = true;
            ShareModule.callback = callBack;
        }
        static OnShowHandle() {
            if (Laya.Browser.window.wx) {
                Laya.Browser.window.wx.onShow(function (option) {
                    SettingController.Instance.SetSoundV(1);
                    console.log("onshow share start");
                    console.log("进入微信");
                    if (ShareModule.IsSharing) {
                        ShareModule.IsSharing = false;
                        let time = new Date().getTime();
                        console.log("分享回到游戏时间" + time);
                        let wait = (time - ShareModule.ShareTime) / 1000;
                        console.log("分享停留时间为：" + wait);
                        if (wait >= 2) {
                            if (Math.random() <= 1) {
                                if (!ShareModule.callback)
                                    return;
                                ShareModule.callback(true, 1);
                            }
                            else {
                                if (!ShareModule.callback)
                                    return;
                                if (Math.random() <= 0.5) {
                                    ViewManager.Instance.ShowTips("分享失败!");
                                }
                                else {
                                    ViewManager.Instance.ShowTips("请分享到不同的群!");
                                }
                                ShareModule.callback(false, 1);
                            }
                        }
                        else {
                            if (!ShareModule.callback)
                                return;
                            if (Math.random() <= 0.5) {
                                ViewManager.Instance.ShowTips("分享失败!");
                            }
                            else {
                                ViewManager.Instance.ShowTips("请分享到不同的群!");
                            }
                            ShareModule.callback(false, 1);
                        }
                    }
                });
            }
        }
    }
    ShareModule.IsSharing = false;
    class OnHideHandler {
        static Reg() {
        }
    }

    var ALDType;
    (function (ALDType) {
        ALDType[ALDType["\u767B\u5F55\u52A0\u8F7D"] = 0] = "\u767B\u5F55\u52A0\u8F7D";
        ALDType[ALDType["\u754C\u9762\u5F00\u542F"] = 1] = "\u754C\u9762\u5F00\u542F";
    })(ALDType || (ALDType = {}));
    class WXSdk {
        static get ShareId() {
            return this.shareId;
        }
        static get Chanel() {
            return this._chanel;
        }
        static init(cb) {
            this.EventStatistics();
            Laya.Browser.window.wx.showShareMenu({
                withShareTicket: true
            });
            Laya.Browser.window.wx.onShow(this.InitWx);
        }
        static InitWx(option) {
            var shareid = option.query.share_id;
            this.shareId = shareid ? shareid : "";
            GameSetting.wxValue = option.scene;
            var scene = Laya.LocalStorage.getItem("scene");
            if (scene) {
                GameSetting.wxValue = scene;
                console.log("读取配置场景值:" + scene);
            }
            else {
                console.log("第一次拉取场景值:" + GameSetting.wxValue);
                Laya.LocalStorage.setItem("scene", GameSetting.wxValue);
            }
            var channel = option.query.channel;
            this._chanel = channel ? channel : "";
            Laya.Browser.window.wx.offShow(WXSdk.InitWx);
        }
        static ShareMessage() {
            if (!GameSetting.isWx)
                return;
            var t = UserModel.Instance.CurModel.ServerTime;
            var _title;
            var _url;
            _title = AppSetting.sharetitle;
            _url = AppSetting.shareimage;
            if (_title == null) {
                _title = "枪王之王...";
                _url = "res/share.png";
            }
            else {
                let a = GameTool.SpliteString(_title);
                let b = GameTool.SpliteString(_url);
                _title = a[GameTool.randomInt(0, a.length - 1)];
                _url = b[GameTool.randomInt(0, b.length - 1)];
            }
            console.log("_title:", _title);
            console.log("_url:", _url);
            Laya.Browser.window.wx.onShareAppMessage(() => ({
                title: _title,
                imageUrl: _url,
                query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_other_" + t + "_" + Math.floor(9999 * Math.random()).toString()
            }));
        }
        static Login(cb) {
            if (WXSdk.Lodining) {
                return;
            }
            WXSdk.Lodining = true;
            Laya.Browser.window.wx.login({
                success: function (res) {
                    console.log("wx.login: success! res.code=" + res.code);
                    if (res.code) {
                        WXSdk.Lodining = false;
                        console.log("将要传递的参数:" + res);
                        cb(res);
                    }
                    else {
                        console.log('获取用户登录态失败！' + res.errMsg);
                        cb("error");
                    }
                },
                fail: function (res) { console.log("wx.login: failed, res=" + res); WXSdk.Lodining = false; cb("error"); }
            });
        }
        static ShowLoading(title = "加载中...", isShowWx = true) {
            console.log(title);
            if (Laya.Browser.window && Laya.Browser.window.wx) {
                if (isShowWx) {
                    Laya.Browser.window.wx.showLoading({ title: title, mask: true });
                }
                ViewManager.Instance.OpenMask();
            }
            else {
                ViewManager.Instance.OpenMask();
            }
        }
        static HideLoading(isShowWx = true) {
            if (Laya.Browser.window && Laya.Browser.window.wx) {
                if (isShowWx) {
                    Laya.Browser.window.wx.hideLoading();
                }
                ViewManager.Instance.CloseMask();
            }
            else {
                ViewManager.Instance.CloseMask();
            }
        }
        static SystemInfo() {
            if (Laya.Browser.window.wx) {
                if (!WXSdk.sysdata)
                    WXSdk.sysdata = Laya.Browser.window.wx.getSystemInfoSync();
                return WXSdk.sysdata;
            }
        }
        static ShowToast(text, icon = true) {
            if (Laya.Browser.window.wx) {
                var t_icon = icon ? "success" : "none";
                text = text ? text : "暂未开放...";
                Laya.Browser.window.wx.showToast({ title: text, icon: t_icon });
            }
            else {
                console.log(text);
            }
        }
        static ShortVibrate() {
            if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
                if (WXSdk.vibrating)
                    return;
                WXSdk.vibrating = true;
                Laya.Browser.window.wx.vibrateShort({
                    complete: function (res) {
                        WXSdk.vibrating = false;
                    }
                });
            }
        }
        static LongVibrate() {
            if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
                if (WXSdk.vibrating)
                    return;
                WXSdk.vibrating = true;
                Laya.Browser.window.wx.vibrateLong({
                    complete: function (res) {
                        WXSdk.vibrating = false;
                    }
                });
            }
        }
        static Success(stageId) {
            if (!GameSetting.isWx)
                return;
            Laya.Browser.window.wx.aldStage.onEnd({
                stageId: stageId,
                stageName: "第" + stageId + "关",
                event: "complete",
                params: {
                    desc: "关卡完成"
                }
            });
        }
        static AldEvent(eventName, a) {
            if (Laya.Browser.window && Laya.Browser.window.wx) {
                Laya.Browser.window.wx.aldSendEvent(eventName, { key: "" });
            }
        }
        static EventStatistics() {
            let uuid = Laya.LocalStorage.getItem("uuidTimes");
            if (uuid) {
                let lastSignTime = new Date(Number(uuid));
                let todayZero = new Date(Laya.timer.currTimer);
                todayZero.setHours(0, 0, 0, 0);
                if (lastSignTime.valueOf() < todayZero.valueOf()) {
                    this.IsNew = 0;
                }
                else {
                    this.IsNew = 1;
                }
            }
            else {
                this.IsNew = 1;
                Laya.LocalStorage.setItem("uuidTimes", Laya.timer.currTimer.toString());
            }
        }
        static Fail(stageId) {
            if (!GameSetting.isWx)
                return;
            Laya.Browser.window.wx.aldStage.onEnd({
                stageId: stageId,
                stageName: "第" + stageId + "关",
                event: "fail",
                params: {
                    desc: "关卡失败",
                }
            });
        }
        static Start(stageId) {
            if (!GameSetting.isWx)
                return;
            Laya.Browser.window.wx.aldStage.onStart({
                stageId: stageId,
                stageName: "第" + stageId + "关",
            });
        }
        static Game_Share(callback = null, channel = "") {
            if (!GameSetting.isWx) {
                return;
            }
            var _title;
            var _url;
            _title = AppSetting.sharetitle;
            _url = AppSetting.shareimage;
            if (_title == null) {
                _title = "枪王之王...";
                _url = "res/share.png";
            }
            else {
                let a = GameTool.SpliteString(_title);
                let b = GameTool.SpliteString(_url);
                _title = a[GameTool.randomInt(0, a.length - 1)];
                _url = b[GameTool.randomInt(0, b.length - 1)];
            }
            console.log("_title:", _title);
            console.log("_url:", _url);
            var t = UserModel.Instance.CurModel.ServerTime;
            Laya.Browser.window.wx.shareAppMessage({
                title: _title,
                imageUrl: _url,
                query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_" + "other" + "_" + t + "_" + Math.floor(9999 * Math.random()).toString(),
            });
            ShareModule.GoShare(callback);
        }
        static LoadSubPackage(name, callback) {
            if (GameSetting.isWx) {
                const loadTask = Laya.Browser.window.wx.loadSubpackage({
                    name: name,
                    success(res) {
                        console.log("分包下载成功:", res);
                        if (callback)
                            callback(true);
                    },
                    fail(res) {
                        console.log("分包下载失败:" + JSON.stringify(res));
                        if (callback)
                            callback(false);
                    }
                });
            }
            else {
                if (callback)
                    callback(true);
            }
        }
        static IsNeedUpdate() {
            if (!GameSetting.isWx)
                return false;
            const updateManager = Laya.Browser.window.wx.getUpdateManager();
            updateManager.onCheckForUpdate(function (res) {
                console.log("最新版本:" + res.hasUpdate);
            });
            updateManager.onUpdateReady(function () {
                Laya.Browser.window.wx.showModal({
                    showCancel: false,
                    title: '更新提示',
                    content: '新版本已经准备好，是否重启应用？',
                    success(res) {
                        updateManager.applyUpdate();
                    },
                    fail(res) {
                        updateManager.applyUpdate();
                    }
                });
            });
        }
        static IsAuth() {
            if (Laya.Browser.window && Laya.Browser.window.wx) {
                Laya.Browser.window.wx.getSetting({
                    success: (res) => {
                        console.log("授权结果..");
                        console.log(res);
                        if (res.authSetting['scope.userInfo'] == true) {
                            WXSdk.isAuth = true;
                            Laya.Browser.window.wx.getUserInfo({
                                lang: 'zh_CN',
                                success: (res) => {
                                    UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
                                    UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
                                    console.log("已经受过权");
                                },
                                fail: () => {
                                    console.log('调用getUserInfo fail');
                                }
                            });
                        }
                    }
                });
            }
        }
        static RequestAuth(callback) {
            if (WXSdk.isAuth) {
                if (callback != null) {
                    callback(true);
                }
                return;
            }
            if (GameSetting.isWx) {
                console.log("-----授权");
                let openAuthView = () => {
                    let w = Laya.stage.width;
                    let h = Laya.stage.height;
                    console.log("准备授权");
                    let button = Laya.Browser.window.wx.createUserInfoButton({
                        type: 'text',
                        text: '',
                        style: {
                            left: 0,
                            top: 0,
                            width: w,
                            height: h,
                            lineHeight: 40,
                            backgroundColor: '#00000000',
                            textAlign: 'center',
                            fontSize: 16,
                            borderRadius: 4
                        }
                    });
                    let opTapHandler = (res) => {
                        console.log("res:" + JSON.stringify(res));
                        if (res.userInfo) {
                            button.hide();
                            button.offTap(opTapHandler);
                            button.destroy();
                            console.log("userinfo", res);
                            UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
                            UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
                            let param = [{ "nickname": res.userInfo.nickName }, { "avatar": res.userInfo.avatarUrl }, { "gender": res.userInfo.gender }, { "city": res.userInfo.city },
                                { "country": res.userInfo.country }, { "province": res.userInfo.province }];
                            NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Userauth, param, () => {
                                WXSdk.isAuth = true;
                                if (callback != null) {
                                    callback(true);
                                }
                            }, null);
                        }
                        else {
                            button.hide();
                            button.offTap(opTapHandler);
                            button.destroy();
                            if (callback != null) {
                                callback(false);
                            }
                        }
                    };
                    button.show();
                    button.onTap(opTapHandler);
                };
                openAuthView();
            }
            else {
                WXSdk.isAuth = true;
                if (callback != null) {
                    callback(true);
                }
            }
        }
        static showbjWxGameQuan(flag) {
            if (!GameSetting.isWx) {
                return;
            }
            if (flag) {
                if (this.button == null) {
                    let info = Laya.Browser.window.wx.getSystemInfoSync();
                    if (!info)
                        return;
                    var top = 0.5 * info.windowHeight;
                    var height = 109 * info.windowHeight / Laya.stage.height;
                    var width = height * 80 / 109;
                    Laya.stage.width;
                    this.button = Laya.Browser.window.wx.createGameClubButton({
                        type: "image",
                        image: 'res/talk.png',
                        style: {
                            left: info.windowWidth * 0.5 + 150 * info.windowWidth / Laya.stage.width,
                            top: top - 240 * info.windowHeight / Laya.stage.height,
                            width: width,
                            height: height
                        }
                    });
                }
                this.button.show();
            }
            else {
                if (this.button) {
                    this.button.hide();
                }
            }
        }
    }
    WXSdk.Lodining = false;
    WXSdk.shareId = "";
    WXSdk._chanel = "";
    WXSdk.isAuth = false;
    WXSdk.vibrating = false;
    WXSdk.IsNew = 0;

    class Main {
        constructor() {
            window['Config3D'] && (window['Config3D']["_config"]["_defaultPhysicsMemory"] = 128);
            window['Config3D'] && (window['Config3D']["_config"]["isAntialias"] = true);
            if (window["Laya3D"])
                Laya3D.init(GameConfig.width, GameConfig.height);
            else
                Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
            Laya["Physics"] && Laya["Physics"].enable();
            Laya["DebugPanel"] && Laya["DebugPanel"].enable();
            Laya.stage.scaleMode = GameConfig.scaleMode;
            Laya.stage.screenMode = GameConfig.screenMode;
            Laya.stage.alignV = GameConfig.alignV;
            Laya.stage.alignH = GameConfig.alignH;
            Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;
            if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true")
                Laya.enableDebugPanel();
            if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"])
                Laya["PhysicsDebugDraw"].enable();
            if (GameConfig.stat)
                Laya.Stat.show();
            Laya.alertGlobalError = true;
            GameSetting.isWx = Laya.Browser.onWeiXin;
            if (GameSetting.isWx) {
                WXSdk.init();
            }
            Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
            WXSdk.IsNeedUpdate();
        }
        onVersionLoaded() {
            Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
            Laya.MouseManager.multiTouchEnabled = false;
        }
        onConfigLoaded() {
            ViewManager.Instance.OpenView(ViewType.LoadView);
            GameSetting.isX = Laya.Browser.clientHeight / Laya.Browser.clientWidth > 2;
        }
    }
    new Main();

}());
//# sourceMappingURL=bundle.js.map
