(function () {
    'use strict';

    class GameConfig {
        constructor() { }
        static init() {
            var reg = Laya.ClassUtils.regClass;
        }
    }
    GameConfig.width = 720;
    GameConfig.height = 1280;
    GameConfig.scaleMode = "fixedwidth";
    GameConfig.screenMode = "none";
    GameConfig.alignV = "top";
    GameConfig.alignH = "left";
    GameConfig.startScene = "LoadView.scene";
    GameConfig.sceneRoot = "";
    GameConfig.debug = false;
    GameConfig.stat = false;
    GameConfig.physicsDebug = false;
    GameConfig.exportSceneToJson = false;
    GameConfig.init();

    var Vector3 = Laya.Vector3;
    class faafssfafsa {
        constructor(_message, _pos, _size, _fontSize, _color = null) {
            this.fontSize = 30;
            this.message = "";
            this.size = new Laya.Vector2(_size.x, _size.y);
            this.fontSize = _fontSize;
            this.color = _color;
            this.message = _message;
            this.pos = _pos;
        }
    }
    class Transform3DHelper {
        static getForward(transform) {
            let forward = new Vector3();
            transform.getForward(forward);
            Laya.Vector3.scale(forward, -1, forward);
            Laya.Vector3.normalize(forward, forward);
            return forward;
        }
    }
    class GameTools {
        constructor() {
            GameTools.ins = this;
        }
        static get Instance() {
            if (GameTools.ins) {
                return GameTools.ins;
            }
            else {
                return new GameTools();
            }
        }
        lerp(form, to, t) {
            if (t <= 0) {
                return form;
            }
            else if (t >= 1) {
                return to;
            }
            var a = t * to + (1 - t) * form;
            return a;
        }
        SetCollider(setNode, CollisionGroup) {
            var numchild = setNode.numChildren;
            for (var i = 0; i < setNode.numChildren; i++) {
                var numchild2 = setNode.getChildAt(i).numChildren;
                if (numchild2 > 1) {
                    this.SetCollider(setNode.getChildAt(i), CollisionGroup);
                }
                var physicsCollider = setNode.getChildAt(i).getComponent(Laya.PhysicsCollider);
                if (physicsCollider) {
                    physicsCollider.collisionGroup = CollisionGroup;
                }
            }
        }
        EnemySetCollider(setNode, collisionGroup) {
            var collider = setNode.getChildByName("npcfrontcollider");
            var collider2 = setNode.getChildByName("npcrearcollider");
            var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
            var physicsCollider2 = collider2.getComponent(Laya.PhysicsCollider);
            if (physicsCollider) {
                physicsCollider.collisionGroup = collisionGroup;
            }
            if (physicsCollider2) {
                physicsCollider2.collisionGroup = collisionGroup;
            }
        }
        PlayerSetCollider(setNode, collisionGroup) {
            var collider = setNode.getChildByName("playercollider");
            var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
            if (physicsCollider) {
                physicsCollider.collisionGroup = collisionGroup;
            }
        }
        HostageSetCollider(setNode, collisionGroup) {
            var collider = setNode.getChildByName("hostagecollider");
            var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
            if (physicsCollider) {
                physicsCollider.collisionGroup = collisionGroup;
            }
        }
        static RandomNumber(from, to) {
            if (from >= to) {
                return 0;
            }
            var size = to - from;
            var curNumber = Math.random() * size + from;
            return curNumber;
        }
        static RandomANumber(from, to) {
            if (from >= to) {
                return 0;
            }
            var size = to - from;
            var curNumber = Math.random() * size + from;
            return Math.floor(curNumber);
        }
        static GetMoney(_num, _pos = null, _completeHandle = null) {
            if (_num == 0)
                return;
            var fafaafsfa = new Laya.Box;
            fafaafsfa.width = 400;
            fafaafsfa.height = 100;
            fafaafsfa.pivotX = fafaafsfa.width / 2;
            fafaafsfa.pivotY = fafaafsfa.height / 2;
            if (_pos == null) {
                _pos = new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height / 2);
            }
            fafaafsfa.pos(_pos.x, _pos.y);
            var aafafaffa = new Laya.Image;
            aafafaffa.skin = "game/qiandao_1_7.png";
            aafafaffa.width = 60;
            aafafaffa.height = 60;
            aafafaffa.left = 50;
            aafafaffa.y = 10;
            fafaafsfa.addChild(aafafaffa);
            var faasfafsafs = new Laya.Text;
            faasfafsafs.width = 300;
            faasfafsafs.height = 50;
            faasfafsafs.align = "center";
            faasfafsafs.valign = "middle";
            faasfafsafs.font = "Microsoft YaHei";
            faasfafsafs.fontSize = 40;
            faasfafsafs.color = "#FFFFFF";
            faasfafsafs.bold = true;
            faasfafsafs.font = "Microsoft YaHei";
            faasfafsafs.text = "金币 +" + _num;
            faasfafsafs.x = 60;
            faasfafsafs.y = 10;
            fafaafsfa.addChild(faasfafsafs);
            Laya.stage.addChild(fafaafsfa);
            var faasfsaf = Laya.Tween.to(fafaafsfa, { y: fafaafsfa.y - 200 }, 1500, Laya.Ease.expoInOut, Laya.Handler.create(this, () => {
                faasfsaf.clear();
                fafaafsfa.destroy();
                if (_completeHandle) {
                    _completeHandle.run();
                }
            }), 100);
        }
        static TweenText(faafssfafsa, _hight, _completeHandle = null, hide = true, _duration = 500) {
            var afasafsafsfa = new Laya.Text();
            afasafsafsfa.width = faafssfafsa.size.x;
            afasafsafsfa.height = faafssfafsa.size.y;
            afasafsafsfa.align = "center";
            afasafsafsfa.valign = "middle";
            afasafsafsfa.font = "Microsoft YaHei";
            afasafsafsfa.fontSize = faafssfafsa.fontSize;
            afasafsafsfa.pivotX = afasafsafsfa.width / 2;
            afasafsafsfa.pivotY = afasafsafsfa.height / 2;
            afasafsafsfa.color = "#5ad122";
            afasafsafsfa.bold = true;
            afasafsafsfa.stroke = 5;
            afasafsafsfa.strokeColor = "#ffffff";
            if (faafssfafsa.color) {
                faafssfafsa.color = faafssfafsa.color;
            }
            afasafsafsfa.text = faafssfafsa.message;
            afasafsafsfa.zOrder = 1;
            Laya.stage.addChildAt(afasafsafsfa, Laya.stage.numChildren - 1);
            afasafsafsfa.pos(faafssfafsa.pos.x, faafssfafsa.pos.y);
            var tween = Laya.Tween.to(afasafsafsfa, { y: afasafsafsfa.y - _hight, update: new Laya.Handler(this, function () {
                }) }, _duration, Laya.Ease.expoInOut, Laya.Handler.create(this, function () {
                tween.clear();
                if (hide) {
                    afasafsafsfa.destroy();
                }
                if (_completeHandle) {
                    _completeHandle.run();
                }
            }));
            if (hide) {
                Laya.Tween.to(afasafsafsfa, { alpha: 0.4 }, 500);
            }
            return afasafsafsfa;
        }
        static StationTweenText(faafssfafsa, _hight, _completeHandle = null, hide = true, _duration = 500) {
            var afasafsafsfa = new Laya.Text();
            afasafsafsfa.width = faafssfafsa.size.x;
            afasafsafsfa.height = faafssfafsa.size.y;
            afasafsafsfa.align = "center";
            afasafsafsfa.valign = "middle";
            afasafsafsfa.font = "Microsoft YaHei";
            afasafsafsfa.fontSize = 50;
            afasafsafsfa.pivotX = afasafsafsfa.width / 2;
            afasafsafsfa.pivotY = afasafsafsfa.height / 2;
            afasafsafsfa.color = "#5ad122";
            afasafsafsfa.bold = true;
            afasafsafsfa.stroke = 5;
            afasafsafsfa.strokeColor = "#ffffff";
            if (faafssfafsa.color) {
                faafssfafsa.color = faafssfafsa.color;
            }
            afasafsafsfa.text = faafssfafsa.message;
            afasafsafsfa.zOrder = 1;
            Laya.stage.addChildAt(afasafsafsfa, Laya.stage.numChildren - 1);
            afasafsafsfa.pos(faafssfafsa.pos.x, faafssfafsa.pos.y);
            var tween = Laya.Tween.to(afasafsafsfa, { y: afasafsafsfa.y - _hight, update: new Laya.Handler(this, function () {
                }) }, _duration, Laya.Ease.expoInOut, Laya.Handler.create(this, function () {
                tween.clear();
                if (hide) {
                    afasafsafsfa.destroy();
                }
                if (_completeHandle) {
                    _completeHandle.run();
                }
            }));
            if (hide) {
                Laya.Tween.to(afasafsafsfa, { alpha: 0.4 }, 10000);
            }
            return afasafsafsfa;
        }
        static tweenMove(transform, targPos, delay, ease, complete) {
            let curPos = transform.position.clone();
            return Laya.Tween.to(curPos, {
                x: targPos.x,
                y: targPos.y,
                z: targPos.z,
                update: new Laya.Handler(this, () => {
                    transform.position = curPos.clone();
                })
            }, delay, ease, complete);
        }
        static tweenRotate(transform, targEuler, delay, ease, complete) {
            let curEuler = transform.rotationEuler.clone();
            return Laya.Tween.to(curEuler, {
                x: targEuler.x,
                y: targEuler.y,
                z: targEuler.z,
                update: new Laya.Handler(this, () => {
                    transform.rotationEuler = curEuler.clone();
                })
            }, delay, ease, complete);
        }
    }

    var EventState;
    (function (EventState) {
        EventState[EventState["LoadComplete"] = 0] = "LoadComplete";
        EventState[EventState["SceneInit"] = 1] = "SceneInit";
        EventState[EventState["StageInit"] = 2] = "StageInit";
        EventState[EventState["ShowModel"] = 3] = "ShowModel";
    })(EventState || (EventState = {}));
    ;
    var StageState;
    (function (StageState) {
        StageState[StageState["Win"] = 0] = "Win";
        StageState[StageState["Lose"] = 1] = "Lose";
        StageState[StageState["Start"] = 2] = "Start";
        StageState[StageState["BackMain"] = 3] = "BackMain";
        StageState[StageState["StageCreateComPlete"] = 4] = "StageCreateComPlete";
        StageState[StageState["Over"] = 5] = "Over";
        StageState[StageState["Pause"] = 6] = "Pause";
        StageState[StageState["Resume"] = 7] = "Resume";
        StageState[StageState["RefreshPro"] = 8] = "RefreshPro";
        StageState[StageState["ShowGuide1"] = 9] = "ShowGuide1";
        StageState[StageState["HideGuide1"] = 10] = "HideGuide1";
        StageState[StageState["ShowGuide2"] = 11] = "ShowGuide2";
        StageState[StageState["HideGuide2"] = 12] = "HideGuide2";
        StageState[StageState["ArriverAttack"] = 13] = "ArriverAttack";
    })(StageState || (StageState = {}));
    ;
    var RoleState;
    (function (RoleState) {
        RoleState[RoleState["Die"] = 0] = "Die";
        RoleState[RoleState["Sky"] = 1] = "Sky";
        RoleState[RoleState["OnLand"] = 2] = "OnLand";
        RoleState[RoleState["Land"] = 3] = "Land";
        RoleState[RoleState["Arriver"] = 4] = "Arriver";
    })(RoleState || (RoleState = {}));
    ;
    class DispatcherManager {
        static EventOn(_mode, caller, fun, args = []) {
            DispatcherManager.instance.on(EventState[_mode], caller, fun, args);
        }
        static EventOff(_mode, caller, fun, args = []) {
            DispatcherManager.instance.off(EventState[_mode], caller, fun);
        }
        static EventTrigger(_mode, args = []) {
            DispatcherManager.instance.event(EventState[_mode], args);
        }
        static StageOn(_mode, caller, fun, args = []) {
            DispatcherManager.instance.on(StageState[_mode], caller, fun, args);
        }
        static StageOff(_mode, caller, fun, args = []) {
            DispatcherManager.instance.off(StageState[_mode], caller, fun);
        }
        static StageTrigger(_mode, args = []) {
            DispatcherManager.instance.event(StageState[_mode], args);
        }
    }
    DispatcherManager.instance = new Laya.EventDispatcher();

    class Dictionary {
        constructor() {
            this._items = {};
            this.length = 0;
        }
        get container() {
            return this._items;
        }
        has(key) {
            return this._items.hasOwnProperty(key);
        }
        set(key, val) {
            if (!this.has(key)) {
                this.length++;
            }
            this._items[key] = val;
        }
        delete(key) {
            let val = null;
            if (this.has(key)) {
                val = this._items[key];
                delete this._items[key];
                this.length--;
            }
            return val;
        }
        get(key) {
            return this.has(key) ? this._items[key] : null;
        }
        values() {
            let values = [];
            for (let k in this._items) {
                if (this.has(k)) {
                    values.push(this._items[k]);
                }
            }
            return values;
        }
        keys() {
            let keys = [];
            for (let k in this._items) {
                if (this.has(k)) {
                    keys.push(k);
                }
            }
            return keys;
        }
        clear() {
            this._items = {};
            this.length = 0;
        }
    }

    class NodeUtil {
        static GetChild(node, cond) {
            let queue = [];
            for (let i = 0; i < node.numChildren; i++) {
                queue.push(node.getChildAt(i));
            }
            while (queue.length > 0) {
                let first = queue.shift();
                if (cond(first)) {
                    return first;
                }
                else {
                    for (let i = 0; i < first.numChildren; i++) {
                        queue.push(first.getChildAt(i));
                    }
                }
            }
            return null;
        }
        static GetChildByName(node, name) {
            return NodeUtil.GetChild(node, s => s.name == name);
        }
        static getChildren(node, cond) {
            let finded = [];
            let queue = [];
            for (let i = 0; i < node.numChildren; i++) {
                queue.push(node.getChildAt(i));
            }
            while (queue.length > 0) {
                let first = queue.shift();
                if (cond(first)) {
                    finded.push(first);
                }
                for (let i = 0; i < first.numChildren; i++) {
                    queue.push(first.getChildAt(i));
                }
            }
            return finded;
        }
        static SetColliderInactive(sp) {
            let colliders = NodeUtil.getChildren(sp, s => s.getComponent(Laya.PhysicsCollider));
            colliders.forEach(s => {
                let collider = s.getComponent(Laya.PhysicsCollider);
                if (collider) {
                    collider.enabled = false;
                }
            }, this);
        }
        static SetColliderGroup(sp, _group) {
            let colliders = NodeUtil.getChildren(sp, s => s.getComponent(Laya.PhysicsCollider));
            colliders.forEach(s => {
                let collisionGroup = _group;
                let collider = s.getComponent(Laya.PhysicsCollider);
                collider.collisionGroup = collisionGroup;
            }, this);
        }
    }
    NodeUtil.All = Laya.Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER;
    NodeUtil.Body = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER1;
    NodeUtil.Head = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER2;
    NodeUtil.Citizen = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER3;
    class Transform3DHelper$1 {
        static getForward(transform) {
            let forward = new Laya.Vector3();
            transform.getForward(forward);
            Laya.Vector3.scale(forward, -1, forward);
            Laya.Vector3.normalize(forward, forward);
            return forward;
        }
    }

    class ResourcesPath {
    }
    ResourcesPath.Yan = "yan";
    ResourcesPath.YanHua = "yanhua";
    ResourcesPath.Nail1 = "Nail1";
    ResourcesPath.Nail2 = "Nail2";
    ResourcesPath.Nail3 = "Nail3";
    ResourcesPath.Nail4 = "Nail4";
    ResourcesPath.Nail5 = "Nail5";
    ResourcesPath.Nail6 = "Nail6";
    ResourcesPath.Nail7 = "Nail7";
    ResourcesPath.Coin = "Coin";
    ResourcesPath.FinishCircle = "FinishCircle";
    ResourcesPath.Speed = "speed";
    ResourcesPath.Ramp = "Ramp";
    ResourcesPath.Boss = "Boss";
    ResourcesPath.EndGround = "endground2";
    ResourcesPath.mainscene = "subpackage/res/mainscene/LayaScene_mainscene2/Conventional/mainscene2.ls";
    ResourcesPath.Character = [
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character1.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character2.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character3.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character4.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character5.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character6.lh"
    ];
    ResourcesPath.Prop = [
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/FinishCircle.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/FinishCircle2.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail1.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail2.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail3.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail4.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail5.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail6.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail7.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/yan.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/yanhua.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/flag.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Coin.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Ramp.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/speed.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Boss.lh",
        "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/endground2.lh"
    ];

    var Vector3$1 = Laya.Vector3;
    class WallBehav extends Laya.Script3D {
        constructor() {
            super();
            this._hitres = new Laya.HitResult();
            this.crash = false;
            this._hitres2 = new Laya.HitResult();
        }
        onAwake() {
            this._gameobject = this.owner;
        }
        onStart() {
            var isFowardHit = false;
            var startPos = new Vector3$1(this._gameobject.transform.position.x, this._gameobject.transform.position.y, this._gameobject.transform.position.z);
            let _up = new Laya.Vector3(0, 1, 0);
            var FowardRay = new Laya.Ray(startPos, _up);
            if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this._hitres, 1)) {
                if (this._hitres.collider.collisionGroup == 2) {
                    let _wall = this._hitres.collider.owner.parent;
                    if (this.crash) {
                        NodeUtil.SetColliderInactive(this._gameobject);
                        let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
                        let yan = Laya.Sprite3D.instantiate(_pre);
                        LevelManager.Instance.spritepool.addChild(yan);
                        yan.transform.position = this._gameobject.transform.position.clone();
                        yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
                        this.destroy();
                        this._gameobject.destroy();
                    }
                    else {
                        this.FallDown();
                    }
                    let _behav = _wall.addComponent(WallBehav);
                }
            }
            else {
                if (this.crash) {
                    NodeUtil.SetColliderInactive(this._gameobject);
                    let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
                    let yan = Laya.Sprite3D.instantiate(_pre);
                    LevelManager.Instance.spritepool.addChild(yan);
                    yan.transform.position = this._gameobject.transform.position.clone();
                    yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
                    this.destroy();
                    this._gameobject.destroy();
                }
            }
        }
        onUpdate() {
            if (this.crash) {
                NodeUtil.SetColliderInactive(this._gameobject);
                let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
                let yan = Laya.Sprite3D.instantiate(_pre);
                LevelManager.Instance.spritepool.addChild(yan);
                yan.transform.position = this._gameobject.transform.position.clone();
                yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
                this.destroy();
                this._gameobject.destroy();
                return;
            }
            this.Down();
        }
        Crash() {
            NodeUtil.SetColliderInactive(this._gameobject);
            let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
            let yan = Laya.Sprite3D.instantiate(_pre);
            LevelManager.Instance.spritepool.addChild(yan);
            yan.transform.position = this._gameobject.transform.position.clone();
            yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
            this.destroy();
            this._gameobject.destroy();
        }
        FallDown() {
            Laya.timer.loop(1, this, this.Down);
        }
        Down() {
            var isFowardHit = false;
            var startPos = new Vector3$1(this._gameobject.transform.position.x, this._gameobject.transform.position.y + 0.1, this._gameobject.transform.position.z);
            let _down = new Laya.Vector3(0, -0.1, 0);
            var FowardRay = new Laya.Ray(startPos, _down);
            if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this._hitres2, 0.2)) {
                if (this._hitres2 != null && (this._hitres2.collider.collisionGroup == 1 || this._hitres2.collider.collisionGroup == 2)) {
                    Laya.timer.clear(this, this.Down);
                }
                else {
                    let _posy = this._gameobject.transform.position.y -= 0.03;
                    this._gameobject.transform.position = new Laya.Vector3(this._gameobject.transform.position.x, _posy, this._gameobject.transform.position.z);
                }
            }
            else {
                let _posy = this._gameobject.transform.position.y -= 0.03;
                this._gameobject.transform.position = new Laya.Vector3(this._gameobject.transform.position.x, _posy, this._gameobject.transform.position.z);
            }
        }
    }

    var VoiceType;
    (function (VoiceType) {
        VoiceType[VoiceType["crashrole"] = 0] = "crashrole";
        VoiceType[VoiceType["crashwall"] = 1] = "crashwall";
        VoiceType[VoiceType["win"] = 2] = "win";
        VoiceType[VoiceType["lose"] = 3] = "lose";
        VoiceType[VoiceType["fly"] = 4] = "fly";
        VoiceType[VoiceType["speedup"] = 5] = "speedup";
        VoiceType[VoiceType["coin"] = 6] = "coin";
    })(VoiceType || (VoiceType = {}));
    var BGMType;
    (function (BGMType) {
        BGMType[BGMType["bgm"] = 0] = "bgm";
    })(BGMType || (BGMType = {}));
    ;
    class AudioManager {
        static voiceres(_type) {
            return "subpackage2/res/music/" + VoiceType[_type] + ".mp3";
        }
        static bgmres(_type) {
            return "subpackage2/res/music/" + BGMType[_type] + ".mp3";
        }
        static ClearAudio() {
            Laya.SoundManager.stopAllSound();
        }
        static StopMusic() {
            Laya.SoundManager.stopMusic();
        }
        static PlayBGM(_type) {
        }
        static PlayVoice(_type, _loop = false) {
            if (!this.play)
                return;
            var loop = _loop ? 0 : 1;
            Laya.SoundManager.soundVolume = 1;
            if (_type == VoiceType.coin) {
                Laya.SoundManager.soundVolume = 0.3;
            }
            Laya.SoundManager.playSound(this.voiceres(_type), loop);
        }
    }
    AudioManager.play = true;

    class CoinBehav extends Laya.Script3D {
        constructor() {
            super();
        }
        onAwake() {
            this._gameobject = this.owner;
            Laya.timer.loop(1, this, this.Rotate);
        }
        OnTouch() {
            GameManager.GoldNum++;
            AudioManager.PlayVoice(VoiceType.coin);
            Laya.timer.clear(this, this.Rotate);
            this.destroy();
        }
        Rotate() {
            this._gameobject.transform.rotate(new Laya.Vector3(0, 0.05, 0));
        }
    }

    class MathHelper {
        static Clamp(n, min, max) {
            return n > max ? max : (n < min ? min : n);
        }
        static ClampRange(n, a, b, min, max) {
            return (MathHelper.Clamp(n, a, b) - a) / (b - a) * (max - min) + min;
        }
        static ToPercentage(n, min, max) {
            return (n - min) / (max - min);
        }
        static ToRad() {
            return Math.PI / 180;
        }
        static ToDeg() {
            return 180 / Math.PI;
        }
        static Rand(min, max) {
            return Math.random() * (max - min) + min;
        }
        static RandInt(min, max) {
            return Math.floor(Math.random() * (max - min + 1) + min);
        }
        static Lerp(a, b, t) {
            return a * (1 - t) + b * t;
        }
        static PrefixNum(num, len, prefix = "0") {
            return (Array(len).join(prefix) + num).slice(-len);
        }
        static ClampEuler(angle) {
            while (angle > 180) {
                angle -= 360;
            }
            while (angle < -180) {
                angle += 360;
            }
            return angle;
        }
    }

    class Vector3Helper {
        static get Zero() {
            return new Laya.Vector3(0, 0, 0);
        }
        static get Up() {
            return new Laya.Vector3(0, 1, 0);
        }
        static Add(a, b) {
            return new Laya.Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
        }
        static Substract(a, b) {
            return new Laya.Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
        }
        static Scale(a, b) {
            let res = Vector3Helper.Zero;
            Laya.Vector3.scale(a, b, res);
            return res;
        }
        static Lerp(a, b, t) {
            let res = Vector3Helper.Zero;
            Laya.Vector3.lerp(a, b, t, res);
            return res;
        }
        static ClampEuler(euler) {
            return new Laya.Vector3(MathHelper.ClampEuler(euler.x), MathHelper.ClampEuler(euler.y), MathHelper.ClampEuler(euler.z));
        }
        static RotateY(a, deg) {
            let matrix = new Laya.Matrix4x4();
            Laya.Matrix4x4.createRotationY(deg * MathHelper.ToRad(), matrix);
            let res = Vector3Helper.Zero;
            Laya.Vector3.transformCoordinate(a, matrix, res);
            return res;
        }
        static CancelBrackets(str) {
            let a = str.split("(");
            let b = a[1];
            let c = b.split(")");
            let d = c[0];
            let e = d.split(",");
            return e;
        }
    }
    class Transform3DHelper$2 {
        static getForward(transform) {
            let forward = new Laya.Vector3();
            transform.getForward(forward);
            Laya.Vector3.scale(forward, -1, forward);
            Laya.Vector3.normalize(forward, forward);
            return forward;
        }
    }

    class HpBarBehav extends Laya.Script3D {
        constructor() {
            super();
        }
        onAwake() {
            this._gameobject = this.owner;
            this._headPos = NodeUtil.GetChildByName(this._gameobject, "UiPos");
            this._bossbehav = this._gameobject.getComponent(BossBehav);
            this._hpBar = new Laya.ProgressBar("Main/youxi-1-5.png");
            this._hpBar.anchorX = this._hpBar.anchorY = 0.5;
            Laya.stage.addChild(this._hpBar);
        }
        onUpdate() {
            let sp = new Laya.Sprite3D();
            sp.transform.position = this._headPos.transform.position.clone();
            sp.transform.rotationEuler = this._headPos.transform.rotationEuler.clone();
            sp.transform.translate(new Laya.Vector3(0, 0.4, 0), false);
            let pt = Vector3Helper.Zero;
            AssetManager.Instance.maincamera.worldToViewportPoint(sp.transform.position, pt);
            this._hpBar.pos(pt.x, pt.y);
            this._hpBar.value = this._bossbehav.health / this._bossbehav.maxhealth;
        }
        onDestroy() {
            this._hpBar.destroy();
            this._hpBar = null;
        }
    }

    class AnimatorManager {
        static Play(isboss = false, animator, anim, islooping = null, complete = null, speed = null) {
            if (animator == null || animator.getControllerLayer() == null) {
                complete && complete.run();
                return;
            }
            let animatorState = animator.getControllerLayer().getAnimatorState(anim);
            if (animatorState == null) {
                complete && complete.run();
                return;
            }
            if (islooping != null)
                animatorState.clip.islooping = islooping;
            if (speed != null)
                animatorState.speed = speed;
            animator.play(anim);
            if (complete) {
                let cb = () => {
                    if (animator.getCurrentAnimatorPlayState().normalizedTime >= 1) {
                        if (isboss) {
                            animator.play("idle");
                        }
                        Laya.timer.clear(this, cb);
                        complete.run();
                    }
                };
                Laya.timer.frameLoop(1, this, cb);
            }
        }
    }

    class BossBehav extends Laya.Script3D {
        constructor() {
            super();
            this.dead = false;
            this.canmove = true;
            this.start = false;
            this.play = false;
            this._up = new Laya.Vector3(0, 1, 0);
            this.quaternion1 = new Laya.Quaternion();
        }
        onAwake() {
            this._gameobject = this.owner;
            this._animator = this._gameobject.getComponent(Laya.Animator);
            this.health = 100;
            this.maxhealth = 100;
            this.atk = 10;
            DispatcherManager.StageOn(StageState.ArriverAttack, this, this.Start);
            DispatcherManager.StageOn(StageState.Win, this, this.Destroy);
            DispatcherManager.StageOn(StageState.Lose, this, this.Destroy);
        }
        onUpdate() {
            if (!this.start)
                return;
            if (this.dead) {
                this.BossDie();
                return;
            }
            if (this.canmove) {
                this.Attack();
            }
        }
        Attack() {
            if (!this.play) {
                this.play = true;
                AnimatorManager.Play(true, this._animator, "atk", false, Laya.Handler.create(this, () => {
                    this.play = false;
                    this._Attack();
                }));
            }
        }
        _Attack() {
            if (this.target) {
                let _matemove = this.target.getComponent(MateMove);
                if (_matemove) {
                    _matemove.Injured(this.atk);
                }
            }
        }
        Injured(_damega) {
            if (this.health == 0)
                return;
            this.health -= _damega;
            if (this.health <= 0) {
                this.health = 0;
                this.dead = true;
            }
        }
        BossDie() {
            this._animator.play("die2");
            this.canmove = false;
            Laya.timer.clearAll(this);
            GameManager.Instance.GameWin();
            this.destroy();
        }
        Start() {
            this.start = true;
            let _hp = this._gameobject.addComponent(HpBarBehav);
        }
        HideHpBar() {
            let _hp = this._gameobject.getComponent(HpBarBehav);
            if (_hp) {
                _hp.destroy();
            }
        }
        SetTarRotate(_trans) {
            this.target = _trans;
            this.targetpos = _trans.transform.position;
            Laya.Quaternion.lookAt(this.targetpos, this._gameobject.transform.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this._gameobject.transform.rotation = this.quaternion1.clone();
        }
        Destroy() {
            let _hp = this._gameobject.getComponent(HpBarBehav);
            if (_hp) {
                _hp.destroy();
            }
        }
    }

    class MateHpBarBehav extends Laya.Script3D {
        constructor() {
            super();
        }
        onAwake() {
            this._gameobject = this.owner;
            this._headPos = NodeUtil.GetChildByName(this._gameobject, "UiPos");
            this._matebehav = this._gameobject.getComponent(MateMove);
            this._hpBar = new Laya.ProgressBar("Main/youxi-1-5.png");
            this._hpBar.anchorX = this._hpBar.anchorY = 0.5;
            Laya.stage.addChild(this._hpBar);
        }
        onUpdate() {
            let sp = new Laya.Sprite3D();
            sp.transform.position = this._headPos.transform.position.clone();
            sp.transform.rotationEuler = this._headPos.transform.rotationEuler.clone();
            sp.transform.translate(new Laya.Vector3(0, 0.4, 0), false);
            let pt = Vector3Helper.Zero;
            AssetManager.Instance.maincamera.worldToViewportPoint(sp.transform.position, pt);
            this._hpBar.pos(pt.x, pt.y);
            this._hpBar.value = this._matebehav.health / this._matebehav.maxhealth;
        }
        onDestroy() {
            this._hpBar.destroy();
            this._hpBar = null;
        }
    }

    var Vector3$2 = Laya.Vector3;
    var Quaternion = Laya.Quaternion;
    class MateMove extends Laya.Script3D {
        constructor() {
            super();
            this._speed = 0.2;
            this.testspeed = 0.5;
            this.Tag_Head = false;
            this.start = false;
            this.isdead = false;
            this.geted = false;
            this._arriver = false;
            this._destination = false;
            this.GravityTime = 0;
            this.ChargeSpeed = 0;
            this.ChargeTime = 0;
            this.Downhit = new Laya.HitResult();
            this.FowardHit = new Laya.HitResult();
            this._forward = new Vector3$2(0, 0, 0);
            this._up = new Vector3$2(0, 1, 0);
            this._up2 = new Vector3$2(0, -1, 0);
            this.CanJump = false;
            this.JumpTime = 0;
            this.JumpSpeed = 0.3;
            this.JumpSpeedUp = 1;
            this.targetPos = new Vector3$2(0, 0, 0);
            this.forW = new Vector3$2(0, 0, 0);
            this.RoleList = [];
            this.MovePointList = [];
            this.MoveRotateList = [];
            this._foward = new Laya.Vector3(0, 0, 0);
            this._MovetarPos = new Laya.Vector3(0, 0, 0);
            this.curpos2 = new Vector3$2();
            this.offest2 = new Vector3$2();
            this.curspeed2 = 0;
            this.curpos = new Vector3$2();
            this.offest = new Vector3$2();
            this.curspeed = 0;
            this.isarrive = false;
            this.showguide1 = false;
            this.showguide2 = false;
            this.pause = false;
            this.play = false;
            this.v3 = new Vector3$2(0, 0, 0);
            this.ts = new Vector3$2(0, 0, 0.01);
            this.quaternion1 = new Laya.Quaternion();
            this.quaternion2 = new Laya.Quaternion();
            this.quaternion3 = new Laya.Quaternion();
            this.showpro = false;
            DispatcherManager.StageOn(StageState.Start, this, this.GameStart);
        }
        onAwake() {
            this._gameobject = this.owner;
            this._transform = this._gameobject.transform;
            this._quaternion = new Quaternion();
            this._animator = this._gameobject.getComponent(Laya.Animator);
            this.health = 50;
            this.maxhealth = 50;
        }
        onUpdate() {
            if (!this.start)
                return;
            if (this.isdead) {
                this.RoleDie();
                this.ChangeState(RoleState.Die);
                return;
            }
            if (this._destination)
                return;
            if (this.isarrive)
                return;
            if (this.Tag_Head) {
                this.RefreshUI();
                if (this.DownRayCheck) {
                    if (this.curstate == RoleState.OnLand) {
                        this._gameobject.transform.position = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
                        if (this.Downhit.collider.owner.parent.name == "speed") {
                            AudioManager.PlayVoice(VoiceType.speedup);
                            this.SpeedUp(0.6, 0.1);
                        }
                        else if (this.Downhit.collider.owner.parent.name == "Ramp") {
                            AudioManager.PlayVoice(VoiceType.fly);
                            this.SpeedUp(0.3, 0.2);
                            this.Jump();
                        }
                    }
                    else if (this.curstate == RoleState.Sky) {
                        var distance = this._gameobject.transform.position.y - this.Downhit.point.y;
                        if (distance < 0.5) {
                            var leropos = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
                            Vector3$2.lerp(this._gameobject.transform.position, leropos, 0.3, leropos);
                            this._gameobject.transform.position = leropos;
                            this.ChangeState(RoleState.OnLand);
                        }
                    }
                }
                else {
                    this.ChangeState(RoleState.Sky);
                }
                if (this.FowardRayCheck) {
                }
                let foward = Transform3DHelper$1.getForward(this._gameobject.transform);
                this.Move(foward);
                this.Gravity();
            }
            else {
                if (!this.geted)
                    return;
                if (this._arriver) {
                    if (this.DownRayCheck) {
                        if (this.curstate == RoleState.OnLand) {
                            this._gameobject.transform.position = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
                        }
                        else if (this.curstate == RoleState.Sky) {
                            var distance = this._gameobject.transform.position.y - this.Downhit.point.y;
                            if (distance < 0.5) {
                                var leropos = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
                                Vector3$2.lerp(this._gameobject.transform.position, leropos, 0.3, leropos);
                                this._gameobject.transform.position = leropos;
                                this.ChangeState(RoleState.OnLand);
                            }
                        }
                    }
                    else {
                        this.ChangeState(RoleState.Sky);
                    }
                    this.RoleMoveFun();
                    this.Gravity();
                }
                else {
                    this.MoveToGroup();
                }
            }
            if (this._gameobject.transform.position.y < -15) {
                this.FallDown();
            }
        }
        RefreshUI() {
            let pre = PlayerManager.Instance.RefreshPro();
            let count = this.RoleList.length;
            let data = {};
            data["pre"] = pre;
            data["count"] = count;
            DispatcherManager.StageTrigger(StageState.RefreshPro, [data]);
        }
        GameStart() {
            this.start = true;
            if (this.Tag_Head)
                this.ChangeState(RoleState.OnLand);
            Laya.timer.loop(2, this, this.SetNewMovePoint, [this._transform]);
        }
        Start(model) {
            if (this.geted)
                return;
            this.targetmodel = model.getChildByName("followpos");
            this.geted = true;
            this.ChangeState(RoleState.OnLand);
        }
        ChangeState(state) {
            if (this.curstate == state)
                return;
            this.curstate = state;
            switch (this.curstate) {
                case RoleState.Die:
                    this.DIE();
                    break;
                case RoleState.Sky:
                    this.SKY();
                    break;
                case RoleState.OnLand:
                    this.ONLAND();
                    break;
                case RoleState.Arriver:
                    this.ARRIVER();
                    break;
            }
        }
        ONLAND() {
            if (this.Tag_Head) {
                this._animator.play("run");
                this._animator.speed = 2;
            }
            else {
                if (this.geted) {
                    this._animator.play("run");
                    this._animator.speed = 2;
                }
                else {
                    this._animator.play("idle");
                }
            }
        }
        SKY() {
            WXSDK.Shake();
            this._animator.play("sky");
        }
        ARRIVER() {
            this._destination = true;
            Laya.timer.clear(this, this.SetNewMovePoint);
            this._animator.play("win");
            if (this.Tag_Head) {
                GameManager.Instance.GameWin();
                for (let i = 0; i < this.RoleList.length; i++) {
                    let item = this.RoleList[i].getComponent(MateMove);
                    if (item) {
                        item.ARRIVER();
                    }
                }
            }
        }
        DIE() {
            Laya.timer.clearAll(this);
            this._gameobject.active = false;
            if (this.Tag_Head && this.RoleList.length == 0) {
                GameManager.Instance.GameLose();
            }
            this.destroy();
        }
        FallDown() {
            if (this.Tag_Head) {
                Laya.timer.clearAll(this);
                GameManager.Instance.GameLose();
                AudioManager.PlayVoice(VoiceType.lose);
                WXSDK.Shake(false);
                this.DestroyProBar();
                this.destroy();
            }
        }
        SetMoveTarger(_point, _rotate) {
            if (this.pause)
                return;
            if (_point) {
                this._MovetarPos = _point;
                this._gameobject.transform.position = this._MovetarPos.clone();
                this._gameobject.transform.rotationEuler = _rotate.clone();
                this.MovePointList.push(_point);
                if (this.MovePointList.length > 100) {
                    this.MovePointList.shift();
                }
                this.MoveRotateList.push(_rotate);
                if (this.MoveRotateList.length > 100) {
                    this.MoveRotateList.shift();
                }
            }
        }
        RoleMoveFun() {
            if (this.pause)
                return;
            Quaternion.lookAt(this._MovetarPos, this._transform.position, this._up, this._quaternion);
            this._quaternion.invert(this._quaternion);
            Quaternion.slerp(this._transform.rotation, this._quaternion, 0.1, this._quaternion);
            this._transform.rotation = this._quaternion.clone();
            let _rotationEuler = this._transform.rotationEuler.clone();
            _rotationEuler.x = 0;
            _rotationEuler.z = 0;
            this._transform.rotationEuler = _rotationEuler;
        }
        SetNewMovePoint(_transform) {
            if (this.Tag_Head) {
                var _movePos = _transform.position.clone();
                var _point = new Laya.Vector3(_movePos.x, _movePos.y, _movePos.z);
                var _rotate = _transform.rotationEuler.clone();
                this.MovePointList.push(_point);
                if (this.MovePointList.length > 200) {
                    this.MovePointList.shift();
                }
                this.MoveRotateList.push(_rotate);
                if (this.MoveRotateList.length > 200) {
                    this.MoveRotateList.shift();
                }
                for (let i = 0; i < this.RoleList.length; i++) {
                    var _script = this.RoleList[i].getComponent(MateMove);
                    if (_script) {
                        var _id = this.MovePointList.length - 1 - (i + 1) * 10;
                        _script.SetMoveTarger(this.MovePointList[_id], this.MoveRotateList[_id]);
                    }
                }
            }
        }
        RoleDie() {
            if (this.RoleList.length == 0) {
                return;
            }
            var _newHand = this.RoleList[0];
            var _script = _newHand.getComponent(MateMove);
            if (_script) {
                _script._gameobject.transform.rotationEuler = this._gameobject.transform.rotationEuler.clone();
                _script.Tag_Head = true;
                PlayerManager.Instance.player = _script._gameobject;
                _script.RoleList = [];
                for (let i = 1; i < this.RoleList.length; i++) {
                    _script.RoleList.push(this.RoleList[i]);
                }
            }
        }
        MoveToGroup() {
            this.targetPos = this.targetmodel.transform.position;
            let tarPos = this.targetPos;
            let speed = 0.05;
            Vector3$2.subtract(tarPos, this._transform.position, this._forward);
            Vector3$2.normalize(this._forward, this._forward);
            this._forward = new Vector3$2(this._forward.x * speed, this._forward.y * speed, this._forward.z * speed);
            this._transform.translate(this._forward, false);
            if (Vector3$2.distance(this._transform.position, tarPos) < 0.1) {
                this.ArriverTargetPos();
                return;
            }
            Quaternion.lookAt(tarPos, this._transform.position, this._up, this._quaternion);
            this._quaternion.invert(this._quaternion);
            Quaternion.slerp(this._transform.rotation, this._quaternion, 0.1, this._quaternion);
            this._transform.rotation = this._quaternion.clone();
        }
        Move(_dir) {
            if (this.pause)
                return;
            let speed = this.testspeed;
            if (this.ChargeTime > 0) {
                this.ChargeTime -= 0.01;
                speed = speed + this.ChargeSpeed;
            }
            else {
                this.ChargeSpeed = GameTools.Instance.lerp(this.ChargeSpeed, 0, 0.1);
                speed = speed + this.ChargeSpeed;
                this.ChargeTime = 0;
            }
            this.curspeed = GameTools.Instance.lerp(this.curspeed, speed, 0.1);
            Vector3$2.scale(_dir, this.curspeed, this.offest);
            Vector3$2.add(this._gameobject.transform.position, this.offest, this.curpos);
            Vector3$2.lerp(this._gameobject.transform.position, this.curpos, 0.15, this.curpos);
            if (this.CanJump) {
                this.JumpTime += 0.8;
                var Height = this.JumpSpeed * this.JumpTime * 1.9 - (this.JumpTime * this.JumpTime * this.JumpSpeedUp);
                if (Height > 0) {
                    this.curpos = new Vector3$2(this.curpos.x, this.curpos.y + Height, this.curpos.z);
                }
                else {
                    this.CanJump = false;
                }
                this.curpos = new Vector3$2(this.curpos.x, this.curpos.y + 0.8, this.curpos.z);
                this._gameobject.transform.position = this.curpos;
            }
            else {
                this.curpos = new Vector3$2(this.curpos.x, this.curpos.y, this.curpos.z);
                this._gameobject.transform.position = this.curpos;
            }
        }
        ArriverTargetPos() {
            this._gameobject.transform.position = this.targetmodel.transform.position.clone();
            this._gameobject.transform.rotationEuler = this.targetmodel.transform.rotationEuler.clone();
            this._arriver = true;
        }
        get DownRayCheck() {
            var startPos = new Vector3$2(this._gameobject.transform.position.x, this._gameobject.transform.position.y + 0.1, this._gameobject.transform.position.z);
            let foward = new Laya.Vector3(0, -1, 0);
            var FowardRay = new Laya.Ray(startPos, foward);
            var isDownHit = false;
            if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this.Downhit, 1)) {
                if (this.Downhit != null) {
                    if (this.Downhit.collider.collisionGroup == 1) {
                        isDownHit = true;
                    }
                }
            }
            return isDownHit;
        }
        get FowardRayCheck() {
            var isFowardHit = false;
            var startPos = new Vector3$2(this._gameobject.transform.position.x, this._gameobject.transform.position.y + 0.1, this._gameobject.transform.position.z);
            let foward = Transform3DHelper$1.getForward(this._gameobject.transform);
            var FowardRay = new Laya.Ray(startPos, foward);
            if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this.FowardHit, 0.1)) {
                if (this.FowardHit) {
                }
                if (this.FowardHit.collider.collisionGroup == 100) {
                    this.ForwardTarget = this.FowardHit.collider;
                    isFowardHit = true;
                    let _mate = this.FowardHit.collider.owner.parent.getComponent(MateMove);
                    if (_mate) {
                        let _model;
                        if (this.RoleList.length > 0) {
                            _model = this.RoleList[this.RoleList.length - 1];
                        }
                        else {
                            _model = this._gameobject;
                        }
                        _mate.Start(_model);
                        let target = this.FowardHit.collider.owner.parent;
                        if (!this.JudgeEqual(target)) {
                            this.RoleList.push(target);
                        }
                    }
                    AudioManager.PlayVoice(VoiceType.crashrole);
                    WXSDK.Shake();
                }
                else if (this.FowardHit.collider.collisionGroup == 2) {
                    this.isdead = true;
                    let _wall = this.FowardHit.collider.owner.parent;
                    let _behav = _wall.getComponent(WallBehav);
                    if (_behav) {
                        _behav.Crash();
                    }
                    else {
                        _behav = _wall.addComponent(WallBehav);
                        _behav.crash = true;
                    }
                    AudioManager.PlayVoice(VoiceType.crashwall);
                    WXSDK.Shake();
                }
                else if (this.FowardHit.collider.collisionGroup == 3) {
                    this.Crash();
                }
                else if (this.FowardHit.collider.collisionGroup == 4) {
                    let stage = Number(AccountManager.Instance.curplayerData.GainAccount("stage")) + 1;
                    if (stage == 1) {
                        if (this.FowardHit.collider.owner.parent.name == "roleguide") {
                            if (!this.showguide1) {
                                this.showguide1 = true;
                                DispatcherManager.StageTrigger(StageState.ShowGuide1);
                            }
                        }
                        else if (this.FowardHit.collider.owner.parent.name == "rotateguide") {
                            if (!this.showguide2) {
                                this.showguide2 = true;
                                DispatcherManager.StageTrigger(StageState.ShowGuide2);
                            }
                        }
                    }
                }
                else if (this.FowardHit.collider.collisionGroup == 200) {
                }
                else if (this.FowardHit.collider.collisionGroup == 400) {
                    let atkpos_z = this.FowardHit.collider.owner.parent.transform.position.clone();
                    if (!this.isarrive) {
                        this.isarrive = true;
                        this.NearAtkPos(this.RoleList.length + 1, atkpos_z.z);
                    }
                }
            }
            return isFowardHit;
        }
        Crash() {
            let target = this.FowardHit.collider.owner.parent;
            switch (target.name) {
                case "Ramp":
                    AudioManager.PlayVoice(VoiceType.fly);
                    this.SpeedUp(0.8, 0.3);
                    this.Jump();
                    break;
                case "Coin":
                    let _behav = target.getComponent(CoinBehav);
                    if (_behav) {
                        _behav.OnTouch();
                    }
                    target.destroy();
                    break;
            }
        }
        Gravity() {
            if (this.curstate == RoleState.Sky) {
                if (this.ChargeSpeed > 0.001) {
                    this.GravityTime += 0.008;
                }
                else {
                    this.GravityTime += 0.010;
                }
                var hight = this.GravityTime * this.GravityTime;
                this._gameobject.transform.position = new Vector3$2(this._gameobject.transform.position.x, this._gameobject.transform.position.y - hight, this._gameobject.transform.position.z + hight / 2);
            }
        }
        Jump() {
            this.CanJump = true;
            this.JumpTime = 0;
        }
        SpeedUp(_speed, _time) {
            if (this.ChargeTime < _time) {
                this.ChargeTime += 0.1;
            }
            if (this.ChargeSpeed < _speed) {
                this.ChargeSpeed += 0.2;
            }
        }
        Pause() {
            this._animator.play("idle");
            this.testspeed = 0;
            this.pause = true;
            for (let i = 0; i < this.RoleList.length; i++) {
                let _role = this.RoleList[i].getComponent(MateMove);
                if (_role) {
                    _role.Pause();
                }
            }
        }
        Resume() {
            this.pause = false;
            this._animator.play("run");
            this.testspeed = 0.5;
            for (let i = 0; i < this.RoleList.length; i++) {
                let _role = this.RoleList[i].getComponent(MateMove);
                if (_role) {
                    _role.Resume();
                }
            }
        }
        JudgeEqual(_model) {
            for (let i = 0; i < this.RoleList.length; i++) {
                let item = this.RoleList[i];
                if (item == _model) {
                    return true;
                }
            }
            return false;
        }
        SetRoleAtk() {
            for (let i = 0; i < this.RoleList.length; i++) {
                let item = this.RoleList[i].getComponent(MateMove);
                item.isarrive = true;
                item.pause = true;
            }
        }
        MoveToAttackPoint() {
            Vector3$2.subtract(this.tp, this._gameobject.transform.position, this.forW);
            Vector3$2.normalize(this.forW, this.forW);
            this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
            this._gameobject.transform.translate(this.forW, false);
            let _dis = Vector3$2.distance(this._gameobject.transform.position, this.tp);
            if (Vector3$2.distance(this._gameobject.transform.position, this.tp) < 1) {
                Laya.timer.clear(this, this.MoveToAttackPoint);
                this._animator.play("atk");
                return;
            }
            Quaternion.lookAt(this.tp, this._gameobject.transform.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this._gameobject.transform.rotation = this.quaternion1.clone();
            let _rotationEuler = this._transform.rotationEuler.clone();
            _rotationEuler.x = 0;
            _rotationEuler.z = 0;
            this._transform.rotationEuler = _rotationEuler;
        }
        SetBossRotate() {
            Laya.timer.frameLoop(1, this, this._SetBossRotate);
        }
        _SetBossRotate() {
            if (this.Tag_Head) {
                let _boss = AssetManager.Instance.Boss.getComponent(BossBehav);
                if (_boss) {
                    _boss.SetTarRotate(this._gameobject);
                }
            }
        }
        NearAtkPos(_count, _zpos) {
            this.tp = AssetManager.Instance.Boss.transform.position.clone();
            Laya.timer.clear(this, this.SetNewMovePoint);
            Laya.timer.frameLoop(1, this, this.MoveToAttackPoint);
            this.SetRoleAtk();
            this.SetBossRotate();
            this.pause = true;
            if (_count == 1)
                return;
            this.v3.z = _zpos;
            var _dis = Math.abs(Number(AssetManager.Instance.leftpos.x) - Number(AssetManager.Instance.rightpos.x));
            var _interval = Math.floor(_dis / (_count - 1));
            var mubiaodian = AssetManager.Instance.endground.transform.position.clone();
            var jiange = false;
            var index = 1;
            var num = 0;
            this.v3.x = mubiaodian.x;
            this.Defense(this.v3.clone());
            for (let i = 0; i < this.RoleList.length; i++) {
                num++;
                const element = this.RoleList[i].getComponent(MateMove);
                const element2 = this.RoleList[i].getComponent(MateMove);
                if (num > 2) {
                    index++;
                    num = 1;
                }
                jiange = !jiange;
                if (jiange) {
                    this.v3.x = mubiaodian.x - 1 * index;
                }
                else {
                    this.v3.x = mubiaodian.x + 1 * index;
                }
                element.Defense(this.v3.clone());
                element.SetBossRotate();
            }
            DispatcherManager.StageTrigger(StageState.ArriverAttack);
        }
        ArriverAtkPos() {
            Laya.timer.clear(this, this._Attack);
            let BossTran = AssetManager.Instance.curstage.getChildByName("Boss");
            let BossPos = BossTran.transform.position.clone();
            Quaternion.lookAt(BossPos, this._gameobject.transform.position, this._up, this.quaternion2);
            this.quaternion2.invert(this.quaternion2);
            this._gameobject.transform.rotation = this.quaternion2.clone();
            let _rotationEuler = this._transform.rotationEuler.clone();
            _rotationEuler.x = 0;
            _rotationEuler.z = 0;
            this._transform.rotationEuler = _rotationEuler;
            Laya.timer.loop(1, this, this.PlayAtkAni);
            let tween = Laya.Tween.to(this._gameobject.transform, { RotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
                tween.clear();
            }, null, false));
            return;
        }
        PlayAtkAni() {
            if (!this.play) {
                this.play = true;
                AnimatorManager.Play(true, this._animator, "atk", false, Laya.Handler.create(this, () => {
                    let BossTran = AssetManager.Instance.curstage.getChildByName("Boss");
                    let _behav = BossTran.getComponent(BossBehav);
                    if (_behav) {
                        _behav.Injured(10);
                    }
                    this.play = false;
                }));
            }
        }
        _Defense() {
            Vector3$2.subtract(this.tp, this._gameobject.transform.position, this.forW);
            Vector3$2.normalize(this.forW, this.forW);
            this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
            this._gameobject.transform.translate(this.forW, false);
            let _dis = Vector3$2.distance(this._gameobject.transform.position, this.tp);
            if (Vector3$2.distance(this._gameobject.transform.position, this.tp) < 0.5) {
                Laya.timer.clear(this, this._Defense);
                this.Attack(AssetManager.Instance.Boss.transform.position.clone());
                return;
            }
            Quaternion.lookAt(this.tp, this._gameobject.transform.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this._gameobject.transform.rotation = this.quaternion1.clone();
            let _rotationEuler = this._transform.rotationEuler.clone();
            _rotationEuler.x = 0;
            _rotationEuler.z = 0;
            this._transform.rotationEuler = _rotationEuler;
        }
        Defense(pos) {
            this.tp = pos;
            Quaternion.lookAt(pos, this._gameobject.transform.position, this._up, this.quaternion1);
            this.quaternion1.invert(this.quaternion1);
            this._gameobject.transform.rotation = this.quaternion1.clone();
            Laya.timer.frameLoop(1, this, this._Defense);
        }
        Attack(pos) {
            this.tp = pos;
            Quaternion.lookAt(pos, this._gameobject.transform.position, this._up2, this.quaternion3);
            this.quaternion3.invert(this.quaternion3);
            this._gameobject.transform.rotation = this.quaternion3.clone();
            Laya.timer.frameLoop(1, this, this._Attack);
        }
        _Attack() {
            Vector3$2.subtract(this.tp, this._gameobject.transform.position, this.forW);
            Vector3$2.normalize(this.forW, this.forW);
            this.forW = new Vector3$2(this.forW.x * 0.05, this.forW.y * 0.05, this.forW.z * 0.05);
            this._gameobject.transform.translate(this.forW, false);
            let _dis = Vector3$2.distance(this._gameobject.transform.position, this.tp);
            if (Vector3$2.distance(this._gameobject.transform.position, this.tp) < 0.5) {
                this.ArriverAtkPos();
                return;
            }
            Quaternion.lookAt(this.tp, this._gameobject.transform.position, this._up2, this.quaternion3);
            this.quaternion3.invert(this.quaternion3);
            this._gameobject.transform.rotation = this.quaternion3.clone();
            let _rotationEuler = this._transform.rotationEuler.clone();
            _rotationEuler.x = 0;
            _rotationEuler.z = 0;
            this._transform.rotationEuler = _rotationEuler;
        }
        Killed() {
            if (this.isdead)
                return;
            AnimatorManager.Play(false, this._animator, "die2", false, Laya.Handler.create(this, () => {
                this.isdead = true;
            }));
        }
        Injured(_demage) {
            if (this.health == 0)
                return;
            if (!this.showpro) {
                this.showpro = true;
                this.AddProBar();
            }
            this.health -= _demage;
            if (this.health <= 0) {
                this.health = 0;
                this.Killed();
            }
        }
        AddProBar() {
            let probar = this._gameobject.addComponent(MateHpBarBehav);
        }
        DestroyProBar() {
            let probar = this._gameobject.getComponent(MateHpBarBehav);
            if (probar) {
                probar.destroy();
            }
        }
    }

    class PlayerManager {
        constructor() {
            this.canmove = false;
            this.guide2stop = false;
            this.trun = true;
            PlayerManager.ins = this;
        }
        static get Instance() {
            if (PlayerManager.ins == null) {
                return new PlayerManager();
            }
            return PlayerManager.ins;
        }
        Init() {
            this.Direction = AccountManager.Instance.curplayerData.LevelDirection;
            let playerpref = AssetManager.Instance.Character.get(1);
            this.player = Laya.Sprite3D.instantiate(playerpref);
            LevelManager.Instance.spritepool.addChild(this.player);
            this.player.transform.position = AssetManager.Instance.playerpos.transform.position.clone();
            this.player.transform.rotation = AssetManager.Instance.playerpos.transform.rotation.clone();
            this.trun = true;
            DispatcherManager.StageOn(StageState.ShowGuide1, this, this.Guide1);
            DispatcherManager.StageOn(StageState.ShowGuide2, this, this.Guide2);
        }
        RefreshPro() {
            let startpoint = AssetManager.Instance.playerpos.transform.position.clone();
            let Z = startpoint.z;
            let finishpoint = AssetManager.Instance.finishpoint.z;
            let distance = finishpoint - Z;
            let pro = this.player.transform.position.z / distance;
            return pro;
        }
        EnablePlayer() {
            let _move = this.player.addComponent(MateMove);
            _move.Tag_Head = true;
            this.ListenOn();
        }
        ListenOn() {
            Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.OnMouseDown);
        }
        ListenOff() {
            Laya.stage.off(Laya.Event.MOUSE_DOWN, this, this.OnMouseDown);
        }
        DisablePlayer() {
            let _move = this.player.getComponent(MateMove);
            if (_move) {
                _move.destroy();
            }
        }
        Guide1() {
            this.ListenOff();
            let _matemove = this.player.getComponent(MateMove);
            if (_matemove) {
                _matemove.Pause();
            }
        }
        Guide2() {
            let _matemove = this.player.getComponent(MateMove);
            if (_matemove) {
                _matemove.Pause();
            }
            this.guide2stop = true;
        }
        Resume() {
            let _matemove = this.player.getComponent(MateMove);
            if (_matemove) {
                _matemove.Resume();
            }
        }
        OnMouseDown() {
            if (this.Direction == 1) {
                if (this.trun) {
                    this.player.transform.rotationEuler = new Laya.Vector3(0, -90, 0);
                    this.trun = !this.trun;
                }
                else {
                    this.player.transform.rotationEuler = new Laya.Vector3(0, 0, 0);
                    this.trun = !this.trun;
                }
            }
            else if (this.Direction == 2) {
                if (this.trun) {
                    this.player.transform.rotationEuler = new Laya.Vector3(0, 90, 0);
                    this.trun = !this.trun;
                }
                else {
                    this.player.transform.rotationEuler = new Laya.Vector3(0, 0, 0);
                    this.trun = !this.trun;
                }
            }
            if (this.guide2stop) {
                this.guide2stop = false;
                this.Resume();
                DispatcherManager.StageTrigger(StageState.HideGuide2);
            }
        }
    }

    var REG = Laya.ClassUtils.regClass;
    var ui;
    (function (ui) {
        class GameResultViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(GameResultViewUI.uiView);
            }
        }
        GameResultViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "12,13,14,10", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 29 }, { "type": "Image", "props": { "y": 210, "x": 90.5, "var": "WinBox", "skin": "Main/lanshandi.png", "alpha": 1 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": -140, "x": 24, "skin": "Main/shenglilo.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 151, "x": 52.5, "skin": "Main/shangkuan.png" }, "compId": 6, "child": [{ "type": "Image", "props": { "y": 150, "x": 90.5, "skin": "Main/jinbidi.png" }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 27, "x": 86, "skin": "Main/jinbihud.png" }, "compId": 8 }, { "type": "Image", "props": { "y": 20, "x": 30, "skin": "Main/jinbi.png" }, "compId": 9 }, { "type": "Text", "props": { "y": -101, "x": 6, "width": 241, "var": "Win_GoldNum", "valign": "middle", "text": "888", "height": 69, "fontSize": 92, "font": "Microsoft YaHei", "color": "#92501d", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 10 }] }] }, { "type": "Button", "props": { "y": 470, "x": 82, "var": "Win_VideoBtn", "stateNum": 1, "skin": "Main/dihong.png" }, "compId": 12, "child": [{ "type": "Image", "props": { "y": 39, "x": 45, "skin": "Main/shipin.png" }, "compId": 13 }, { "type": "Image", "props": { "y": 40.5, "x": 158, "skin": "Main/sanbeilingqu.png" }, "compId": 14 }] }, { "type": "Button", "props": { "y": 627, "x": 204.5, "var": "Win_BackBtn", "stateNum": 1, "skin": "Main/shenglibtn-1.png" }, "compId": 15 }, { "type": "Button", "props": { "y": 434, "x": 125, "visible": false, "var": "Win_kuangbtn", "stateNum": 1, "skin": "Main/shenglibtn-4.png" }, "compId": 30, "child": [{ "type": "Image", "props": { "y": 5, "x": 6, "var": "win_dian", "skin": "Main/shenglibtn-3.png" }, "compId": 31 }, { "type": "Image", "props": { "y": -1, "x": 36, "skin": "Main/shenglibtn-2.png" }, "compId": 32 }] }] }, { "type": "Image", "props": { "y": 210, "x": 90.5, "var": "FailBox", "skin": "Main/beijing.png", "alpha": 1 }, "compId": 17, "child": [{ "type": "Image", "props": { "y": -140, "x": 24, "skin": "Main/tongguanshi-lo.png" }, "compId": 18 }, { "type": "Image", "props": { "y": 151, "x": 52.5, "skin": "Main/shangshudi.png" }, "compId": 19, "child": [{ "type": "Image", "props": { "y": 150, "x": 90.5, "skin": "Main/qinandi.png" }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 27, "x": 86, "skin": "Main/jinbihud.png" }, "compId": 21 }, { "type": "Image", "props": { "y": 20, "x": 30, "skin": "Main/jinbi.png" }, "compId": 22 }, { "type": "Text", "props": { "y": -101, "x": 6, "width": 241, "var": "Fail_GoldNum", "valign": "middle", "text": "888", "height": 69, "fontSize": 92, "font": "Microsoft YaHei", "color": "#3660ab", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }] }, { "type": "Button", "props": { "y": 470, "x": 82, "var": "Fail_VideoBtn", "stateNum": 1, "skin": "Main/ludi.png" }, "compId": 24, "child": [{ "type": "Image", "props": { "y": 39, "x": 45, "skin": "Main/shipin.png" }, "compId": 25 }, { "type": "Image", "props": { "y": 39, "x": 157, "skin": "Main/sanbeilingqu.png" }, "compId": 26 }] }, { "type": "Button", "props": { "y": 627, "x": 204.5, "var": "Fail_BackBtn", "stateNum": 1, "skin": "Main/shibaibtn-1.png" }, "compId": 27 }, { "type": "Button", "props": { "y": 434, "x": 125, "visible": false, "var": "Fail_kuangbtn", "stateNum": 1, "skin": "Main/shibaibtn-3.png" }, "compId": 33, "child": [{ "type": "Image", "props": { "y": 5, "x": 6, "var": "fail_dian", "skin": "Main/shibaibtn-4.png" }, "compId": 34 }, { "type": "Image", "props": { "y": -1, "x": 36, "skin": "Main/shibaibtn-2.png" }, "compId": 35 }] }] }], "loadList": ["Main/chunhei.png", "Main/lanshandi.png", "Main/shenglilo.png", "Main/shangkuan.png", "Main/jinbidi.png", "Main/jinbihud.png", "Main/jinbi.png", "Main/dihong.png", "Main/shipin.png", "Main/sanbeilingqu.png", "Main/shenglibtn-1.png", "Main/shenglibtn-4.png", "Main/shenglibtn-3.png", "Main/shenglibtn-2.png", "Main/beijing.png", "Main/tongguanshi-lo.png", "Main/shangshudi.png", "Main/qinandi.png", "Main/ludi.png", "Main/shibaibtn-1.png", "Main/shibaibtn-3.png", "Main/shibaibtn-4.png", "Main/shibaibtn-2.png"], "loadList3D": [] };
        ui.GameResultViewUI = GameResultViewUI;
        REG("ui.GameResultViewUI", GameResultViewUI);
        class HomeViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(HomeViewUI.uiView);
            }
        }
        HomeViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Button", "props": { "y": 718, "x": 204, "var": "StartBtn", "stateNum": 1, "skin": "Main/dianjikaishi.png" }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 72, "x": 209, "width": 86, "var": "shou", "skin": "Main/shou.png", "scaleY": 1, "scaleX": 1, "pivotY": 46, "pivotX": 43, "height": 92 }, "compId": 19 }] }, { "type": "Button", "props": { "y": 630, "x": 0, "stateNum": 1, "skin": "Main/gengduo.png", "name": "MoreFunBtn" }, "compId": 9 }, { "type": "Button", "props": { "y": 754, "x": 606, "var": "SkinBtn", "stateNum": 1, "skin": "Main/shangdain.png" }, "compId": 10 }, { "type": "Button", "props": { "y": 630, "x": 605, "var": "SignBtn", "stateNum": 1, "skin": "Main/qiandao.png" }, "compId": 11 }, { "type": "Image", "props": { "y": 95, "x": 557, "width": 164, "skin": "Main/qiandi.png", "height": 55 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/qian.png" }, "compId": 15 }, { "type": "Text", "props": { "y": 0, "x": 54, "width": 110, "var": "GoldNum", "valign": "middle", "text": "99999", "height": 55, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 18 }] }, { "type": "Box", "props": { "y": 160.5, "x": 127.5, "width": 487, "var": "ProBox", "height": 81 }, "compId": 21, "child": [{ "type": "ProgressBar", "props": { "y": 30, "x": 68, "width": 352, "value": 0, "skin": "Main/guandi-3.png", "height": 22 }, "compId": 20 }, { "type": "Image", "props": { "y": 11.5, "x": 20, "skin": "Main/guandi.png" }, "compId": 22, "child": [{ "type": "Text", "props": { "y": 9, "x": 1, "width": 56, "var": "NowLevelNum", "valign": "middle", "text": "10", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }, { "type": "Image", "props": { "y": 12, "x": 414, "skin": "Main/zhongdian.png" }, "compId": 24 }] }, { "type": "Button", "props": { "y": 36, "x": 32, "var": "SetBtn", "stateNum": 1, "skin": "Main/shezhi.png" }, "compId": 26 }, { "type": "Image", "props": { "visible": false, "var": "SetPanel", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "13,15,15,15", "right": 0, "left": 0, "bottom": 0 }, "compId": 48, "child": [{ "type": "Image", "props": { "y": 466, "x": 118.5, "skin": "Main/Background Pop up ads.png" }, "compId": 29, "child": [{ "type": "Image", "props": { "y": 40, "x": 73, "skin": "Main/Bouton policy privacy.png", "name": "shake" }, "compId": 30, "child": [{ "type": "Image", "props": { "y": 15, "x": 43, "skin": "Main/zhenfu.png" }, "compId": 33 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/kaigdi.png" }, "compId": 35, "child": [{ "type": "Image", "props": { "y": 9, "x": 94, "skin": "Main/OFF.png" }, "compId": 38 }, { "type": "Image", "props": { "y": 9, "x": 23, "skin": "Main/ON.png" }, "compId": 39 }] }, { "type": "Image", "props": { "y": 25, "x": 206, "skin": "Main/bodong.png", "name": "on" }, "compId": 41 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/boodong-2.png", "name": "off" }, "compId": 40 }, { "type": "Button", "props": { "y": 26, "x": 121, "width": 171, "var": "shakebtn", "height": 41 }, "compId": 49 }] }, { "type": "Image", "props": { "y": 151.5, "x": 73, "skin": "Main/Bouton policy privacy.png", "name": "sound" }, "compId": 31, "child": [{ "type": "Image", "props": { "y": 20, "x": 47, "skin": "Main/yinfu.png" }, "compId": 34 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/kaigdi.png" }, "compId": 42, "child": [{ "type": "Image", "props": { "y": 9, "x": 94, "skin": "Main/OFF.png" }, "compId": 43 }, { "type": "Image", "props": { "y": 9, "x": 23, "skin": "Main/ON.png" }, "compId": 44 }] }, { "type": "Image", "props": { "y": 25, "x": 206, "skin": "Main/bodong.png", "name": "on" }, "compId": 45 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/boodong-2.png", "name": "off" }, "compId": 46 }, { "type": "Button", "props": { "y": 26, "x": 121, "width": 171, "var": "soundbtn", "height": 41 }, "compId": 50 }] }, { "type": "Button", "props": { "y": -46, "x": -35, "var": "CloseSetBtn", "stateNum": 1, "skin": "Main/guanbi.png" }, "compId": 47 }] }] }, { "type": "Button", "props": { "y": 504, "x": 606, "var": "LotteryBtn", "stateNum": 1, "skin": "Main/qiandao-2.png" }, "compId": 52 }, { "type": "Button", "props": { "y": 754, "x": 0, "visible": false, "var": "RewardBtn", "stateNum": 1, "skin": "Main/gengduo -2.png" }, "compId": 53 }, { "type": "Box", "props": { "y": 890, "x": 23.5, "width": 673, "visible": false, "var": "UpgradeBox", "height": 227 }, "compId": 54, "child": [{ "type": "Image", "props": { "y": 2.5, "x": 5, "skin": "Main/wuazhudi.png" }, "compId": 55, "child": [{ "type": "Image", "props": { "y": -27.5, "x": 0, "skin": "Main/xiaodi.png", "name": "Info" }, "compId": 56, "child": [{ "type": "Image", "props": { "y": 42, "x": 16, "skin": "Main/wenzid.png" }, "compId": 74 }, { "type": "Image", "props": { "y": 85, "x": 47.5, "name": "icon" }, "compId": 77 }, { "type": "Text", "props": { "y": 45, "x": 23, "width": 185, "valign": "middle", "text": "刀兵", "name": "name", "height": 40, "fontSize": 24, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 75 }, { "type": "Text", "props": { "y": 204, "x": 149, "width": 66, "valign": "middle", "text": "lv2", "name": "lv", "height": 32, "fontSize": 30, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 76 }] }, { "type": "Image", "props": { "y": 21, "x": 243, "skin": "Main/cahgdi.png", "name": "Atk" }, "compId": 58, "child": [{ "type": "Image", "props": { "skin": "Main/gaoncb.png" }, "compId": 59 }, { "type": "Text", "props": { "y": 1, "x": 54, "width": 66, "valign": "middle", "text": "攻击", "height": 47, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 60 }, { "type": "Text", "props": { "y": 6, "x": 135, "width": 66, "valign": "middle", "text": "400", "name": "nowatk", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#fee934", "align": "center", "runtime": "laya.display.Text" }, "compId": 61 }, { "type": "Text", "props": { "y": 6, "x": 299, "width": 66, "valign": "middle", "text": "+20", "name": "addatk", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#87fd37", "align": "center", "runtime": "laya.display.Text" }, "compId": 62 }] }, { "type": "Image", "props": { "y": 78, "x": 243, "skin": "Main/cahgdi.png", "name": "AtkSpeed" }, "compId": 63, "child": [{ "type": "Image", "props": { "skin": "Main/sudi-b.png" }, "compId": 64 }, { "type": "Text", "props": { "y": 1, "x": 54, "width": 66, "valign": "middle", "text": "攻速", "height": 47, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 65 }, { "type": "Text", "props": { "y": 6, "x": 135, "width": 66, "valign": "middle", "text": "400", "name": "nowatkspeed", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#fee934", "align": "center", "runtime": "laya.display.Text" }, "compId": 66 }, { "type": "Text", "props": { "y": 6, "x": 299, "width": 66, "valign": "middle", "text": "+20", "name": "addatkspeed", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#87fd37", "align": "center", "runtime": "laya.display.Text" }, "compId": 67 }] }] }, { "type": "Button", "props": { "y": 136, "x": 312, "stateNum": 1, "skin": "Main/dalan.png" }, "compId": 68, "child": [{ "type": "Text", "props": { "y": 0, "x": 0, "width": 284, "valign": "middle", "text": "升级", "height": 75, "fontSize": 30, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 70 }] }] }], "animations": [{ "nodes": [{ "target": 19, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 20 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 20 }] } }], "name": "handclick", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/dianjikaishi.png", "Main/shou.png", "Main/gengduo.png", "Main/shangdain.png", "Main/qiandao.png", "Main/qiandi.png", "Main/qian.png", "Main/guandi-3.png", "Main/guandi.png", "Main/zhongdian.png", "Main/shezhi.png", "Main/chunhei.png", "Main/Background Pop up ads.png", "Main/Bouton policy privacy.png", "Main/zhenfu.png", "Main/kaigdi.png", "Main/OFF.png", "Main/ON.png", "Main/bodong.png", "Main/boodong-2.png", "Main/yinfu.png", "Main/guanbi.png", "Main/qiandao-2.png", "Main/gengduo -2.png", "Main/wuazhudi.png", "Main/xiaodi.png", "Main/wenzid.png", "Main/cahgdi.png", "Main/gaoncb.png", "Main/sudi-b.png", "Main/dalan.png"], "loadList3D": [] };
        ui.HomeViewUI = HomeViewUI;
        REG("ui.HomeViewUI", HomeViewUI);
        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, "child": [{ "type": "Box", "props": { "y": 123, "x": 116.5, "width": 487, "visible": true, "var": "ProBox", "height": 81 }, "compId": 8, "child": [{ "type": "ProgressBar", "props": { "y": 30, "x": 68, "width": 352, "var": "jindupro", "value": 0, "skin": "Main/guandi-3.png", "height": 22 }, "compId": 9 }, { "type": "Image", "props": { "y": 11.5, "x": 20, "skin": "Main/guandi.png" }, "compId": 10, "child": [{ "type": "Text", "props": { "y": 9, "x": 1, "width": 56, "var": "NowLevelNum", "valign": "middle", "text": "10", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 11 }] }, { "type": "Image", "props": { "y": 12, "x": 414, "skin": "Main/zhongdian.png" }, "compId": 12 }] }, { "type": "Image", "props": { "y": 181.5, "x": 251.5, "visible": true, "skin": "Main/shuliandi.png" }, "compId": 13, "child": [{ "type": "Text", "props": { "y": 0, "x": 28, "width": 161, "var": "CountTxt", "valign": "middle", "text": "小人数量:22", "height": 45, "fontSize": 24, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 14 }] }, { "type": "Box", "props": { "y": 998, "x": 166, "width": 388, "visible": false, "var": "GuideBox1", "height": 80 }, "compId": 16, "child": [{ "type": "Text", "props": { "y": 0, "x": 132, "wordWrap": true, "width": 148, "var": "Txt2", "valign": "top", "text": "收集同伴一起行动", "leading": 15, "height": 88, "fontSize": 35, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "laya.display.Text" }, "compId": 20 }] }, { "type": "Box", "props": { "y": 883, "x": 166, "width": 388, "visible": false, "var": "GuideBox2", "height": 186 }, "compId": 15, "child": [{ "type": "Image", "props": { "y": 69, "x": 194, "width": 87, "var": "shou1", "skin": "Main/shou-yindao3.png", "scaleY": 1, "scaleX": 1, "pivotY": 59, "pivotX": 44, "height": 117 }, "compId": 17 }, { "type": "Text", "props": { "y": 136, "x": 123.5, "width": 141, "var": "Txt1", "valign": "middle", "text": "点击转向", "height": 48, "fontSize": 35, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "laya.display.Text" }, "compId": 18 }] }], "animations": [{ "nodes": [{ "target": 17, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 20 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 20 }] } }], "name": "guideclick1", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/guandi-3.png", "Main/guandi.png", "Main/zhongdian.png", "Main/shuliandi.png", "Main/shou-yindao3.png"], "loadList3D": [] };
        ui.InGameViewUI = InGameViewUI;
        REG("ui.InGameViewUI", InGameViewUI);
        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": { "top": 0, "skin": "Load/beijing.png", "sizeGrid": "10,14,12,10", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 4 }, { "type": "ProgressBar", "props": { "y": 1018, "x": 165, "var": "jindupro", "skin": "Load/ss.png" }, "compId": 3 }, { "type": "Image", "props": { "y": 160, "x": 105, "skin": "Load/title.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 1062, "x": 292.5, "skin": "Load/jiazaizhon.png" }, "compId": 7 }], "loadList": ["Load/beijing.png", "Load/ss.png", "Load/title.png", "Load/jiazaizhon.png"], "loadList3D": [] };
        ui.LoadViewUI = LoadViewUI;
        REG("ui.LoadViewUI", LoadViewUI);
        class LotteryViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(LotteryViewUI.uiView);
            }
        }
        LotteryViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "11,13,15,12", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 36 }, { "type": "Box", "props": { "y": 253, "x": 10, "width": 700, "height": 581 }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 7.5, "x": 71.5, "skin": "Main/zhuanpandi.png" }, "compId": 6 }, { "type": "Image", "props": { "y": 288, "x": 350, "var": "dial", "skin": "Main/p__zhuan-wu1.png", "anchorY": 0.5, "anchorX": 0.5, "alpha": 1 }, "compId": 3, "child": [{ "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "pivotY": 225, "pivotX": 50, "name": "reward1", "height": 100 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 0, "x": 23, "name": "skin" }, "compId": 12 }, { "type": "Text", "props": { "y": 72, "x": 1.5, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 13 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 45, "pivotY": 225, "pivotX": 50, "name": "reward2", "height": 100 }, "compId": 14, "child": [{ "type": "Image", "props": { "y": 2, "x": 27, "name": "skin" }, "compId": 15 }, { "type": "Text", "props": { "y": 72, "x": 3, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 90, "pivotY": 225, "pivotX": 50, "name": "reward3", "height": 100 }, "compId": 17, "child": [{ "type": "Image", "props": { "y": 2, "x": 25.5, "name": "skin" }, "compId": 18 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 19 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 135, "pivotY": 225, "pivotX": 50, "name": "reward4", "height": 100 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 0, "x": -16.5, "name": "skin" }, "compId": 21 }, { "type": "Text", "props": { "y": 72, "x": 3, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 22 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 180, "pivotY": 225, "pivotX": 50, "name": "reward5", "height": 100 }, "compId": 23, "child": [{ "type": "Image", "props": { "y": 0, "x": 27, "name": "skin" }, "compId": 24 }, { "type": "Text", "props": { "y": 72, "x": 3, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 25 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 225, "pivotY": 225, "pivotX": 50, "name": "reward6", "height": 100 }, "compId": 26, "child": [{ "type": "Image", "props": { "y": 2, "x": 27, "name": "skin" }, "compId": 27 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 28 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 270, "pivotY": 225, "pivotX": 50, "name": "reward7", "height": 100 }, "compId": 29, "child": [{ "type": "Image", "props": { "y": 0, "x": 25.5, "name": "skin" }, "compId": 30 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 31 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 315, "pivotY": 225, "pivotX": 50, "name": "reward8", "height": 100 }, "compId": 32, "child": [{ "type": "Image", "props": { "y": 0, "x": 25.5, "name": "skin" }, "compId": 33 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 34 }] }] }, { "type": "Image", "props": { "y": -159, "x": 111, "skin": "Main/choujian.png" }, "compId": 8 }, { "type": "Image", "props": { "y": 196, "x": 277, "skin": "Main/p__zhizhen.png", "name": "pont" }, "compId": 37 }] }, { "type": "Button", "props": { "y": 218, "x": 29, "var": "CloseBtn", "stateNum": 1, "skin": "Main/guabi.png" }, "compId": 9 }, { "type": "Button", "props": { "y": 903, "x": 160, "var": "VideoGetBtn", "stateNum": 1, "skin": "Main/anniu.png" }, "compId": 35 }], "loadList": ["Main/chunhei.png", "Main/zhuanpandi.png", "Main/p__zhuan-wu1.png", "Main/choujian.png", "Main/p__zhizhen.png", "Main/guabi.png", "Main/anniu.png"], "loadList3D": [] };
        ui.LotteryViewUI = LotteryViewUI;
        REG("ui.LotteryViewUI", LotteryViewUI);
        class ReviveViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(ReviveViewUI.uiView);
            }
        }
        ReviveViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "12,13,14,10", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 15 }, { "type": "Button", "props": { "y": 711, "x": 172.5, "var": "ReviveBtn", "stateNum": 1, "skin": "Main/dihong.png" }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 39, "x": 41, "skin": "Main/shipin.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 39, "x": 162, "skin": "Main/fuhuowenzi.png" }, "compId": 6 }] }, { "type": "Button", "props": { "y": 888, "x": 294, "var": "BackBtn", "stateNum": 1, "skin": "Main/fanhuiwenzi.png" }, "compId": 7 }, { "type": "Box", "props": { "y": 315, "x": 116.5, "width": 487, "var": "ProBox", "height": 81 }, "compId": 8, "child": [{ "type": "ProgressBar", "props": { "y": 30, "x": 68, "width": 352, "skin": "Main/guandi-3.png", "height": 22 }, "compId": 9 }, { "type": "Image", "props": { "y": 11.5, "x": 20, "skin": "Main/guandi.png" }, "compId": 10, "child": [{ "type": "Text", "props": { "y": 9, "x": 1, "width": 56, "var": "NowLevelNum", "valign": "middle", "text": "10", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 11 }] }, { "type": "Image", "props": { "y": 12, "x": 414, "skin": "Main/zhongdian.png" }, "compId": 12 }] }, { "type": "Image", "props": { "y": 192, "x": 80.5, "skin": "Main/wenzi.png" }, "compId": 13 }], "loadList": ["Main/chunhei.png", "Main/dihong.png", "Main/shipin.png", "Main/fuhuowenzi.png", "Main/fanhuiwenzi.png", "Main/guandi-3.png", "Main/guandi.png", "Main/zhongdian.png", "Main/wenzi.png"], "loadList3D": [] };
        ui.ReviveViewUI = ReviveViewUI;
        REG("ui.ReviveViewUI", ReviveViewUI);
        class SignViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(SignViewUI.uiView);
            }
        }
        SignViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "13,14,14,12", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 72 }, { "type": "Image", "props": { "y": 170, "x": 60.5, "skin": "Main/qinad-d.png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 12, "x": 188, "skin": "Main/qiriqiandao.png" }, "compId": 6 }, { "type": "Box", "props": { "y": 101, "x": 0, "width": 600, "var": "signList", "height": 632 }, "compId": 73, "child": [{ "type": "Box", "props": { "y": 2, "x": 24, "width": 180, "name": "day1", "height": 200 }, "compId": 74, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 75, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 76 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第1天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 77 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 78 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 79, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 80 }] }] }] }, { "type": "Box", "props": { "y": 2, "x": 210, "width": 180, "name": "day2", "height": 200 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 8, "child": [{ "type": "Image", "props": { "y": 118, "x": 85.5, "name": "item", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 12 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第2天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 9 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 14 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 11, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 10 }] }] }] }, { "type": "Box", "props": { "y": 2, "x": 396, "width": 180, "name": "day3", "height": 200 }, "compId": 81, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 82, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 83 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第3天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 84 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 85 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 86, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 87 }] }] }] }, { "type": "Box", "props": { "y": 216, "x": 24, "width": 180, "name": "day4", "height": 200 }, "compId": 88, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 91, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 92 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第4天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 93 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 94 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 95, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 96 }] }] }] }, { "type": "Box", "props": { "y": 216, "x": 210, "width": 180, "name": "day5", "height": 200 }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 98 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第5天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 99 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 100 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 101, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 102 }] }] }] }, { "type": "Box", "props": { "y": 216, "x": 396, "width": 180, "name": "day6", "height": 200 }, "compId": 90, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 103, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 104 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第6天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 105 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 108 }] }] }] }, { "type": "Box", "props": { "y": 436, "x": 12, "width": 553, "name": "day7", "height": 196 }, "compId": 57, "child": [{ "type": "Image", "props": { "y": -2, "x": 71, "skin": "Main/qitiankuang.png" }, "compId": 58, "child": [{ "type": "Text", "props": { "y": 42, "x": 42, "width": 78, "valign": "middle", "text": "第7天", "rotation": -45, "pivotY": 17, "pivotX": 39, "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 59 }, { "type": "Image", "props": { "y": 58.5, "x": 180, "scaleY": 0.5, "scaleX": 0.5, "name": "item" }, "compId": 60 }, { "type": "Text", "props": { "y": 136, "x": 182, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 61 }, { "type": "Image", "props": { "y": 0, "x": -1, "width": 433, "skin": "Main/heizha.png", "sizeGrid": "63,54,82,55", "name": "isGet", "height": 198 }, "compId": 62, "child": [{ "type": "Image", "props": { "y": 42.5, "x": 160, "skin": "Main/yihuode.png" }, "compId": 63 }] }] }] }] }] }, { "type": "Image", "props": { "y": 70, "x": 556, "width": 164, "skin": "Main/qiandi.png", "height": 55 }, "compId": 65, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/qian.png" }, "compId": 66 }, { "type": "Text", "props": { "y": 0, "x": 54, "width": 110, "var": "GoldNum", "valign": "middle", "text": "99999", "height": 55, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 67 }] }, { "type": "Button", "props": { "y": 948, "x": 172, "var": "receiveBtn", "stateNum": 1, "skin": "Main/bd-d.png" }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 39, "x": 42, "skin": "Main/ship.png" }, "compId": 69 }, { "type": "Image", "props": { "y": 39, "x": 156, "skin": "Main/minf.png" }, "compId": 70 }] }, { "type": "Button", "props": { "y": 1101, "x": 274, "var": "closeBtn", "stateNum": 1, "skin": "Main/buyong.png" }, "compId": 71 }], "loadList": ["Main/chunhei.png", "Main/qinad-d.png", "Main/qiriqiandao.png", "Main/pitongkuan.png", "Main/jinbi.png", "Main/heizha.png", "Main/yihuode.png", "Main/qitiankuang.png", "Main/qiandi.png", "Main/qian.png", "Main/bd-d.png", "Main/ship.png", "Main/minf.png", "Main/buyong.png"], "loadList3D": [] };
        ui.SignViewUI = SignViewUI;
        REG("ui.SignViewUI", SignViewUI);
        class SkinViewUI extends Laya.Scene {
            constructor() { super(); }
            createChildren() {
                super.createChildren();
                this.createView(SkinViewUI.uiView);
            }
        }
        SkinViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "loadList": [], "loadList3D": [] };
        ui.SkinViewUI = SkinViewUI;
        REG("ui.SkinViewUI", SkinViewUI);
    })(ui || (ui = {}));

    class InGameView extends ui.InGameViewUI {
        constructor() {
            super();
            InGameView.ins = this;
        }
        static get Instance() {
            if (InGameView.ins == null) {
                return new InGameView();
            }
            return InGameView.ins;
        }
        OnShow() {
            console.log("游戏界面");
            this.on(Laya.Event.MOUSE_DOWN, this, this.ClickStart);
            this.RefreshUI();
            this.height = Laya.stage.height;
            Laya.stage.on(Laya.Event.RESIZE, this, () => {
                this.height = Laya.stage.height;
            });
            DispatcherManager.StageOn(StageState.RefreshPro, this, this.SetProValue);
            DispatcherManager.StageOn(StageState.ShowGuide1, this, this.ShowGuide1);
            DispatcherManager.StageOn(StageState.HideGuide1, this, this.HideGuide1);
            DispatcherManager.StageOn(StageState.ShowGuide2, this, this.ShowGuide2);
            DispatcherManager.StageOn(StageState.HideGuide2, this, this.HideGuide2);
        }
        ClickStart() {
            this.off(Laya.Event.MOUSE_DOWN, this, this.ClickStart);
        }
        RefreshUI() {
            let stage = Number(AccountManager.Instance.curplayerData.GainAccount("stage")) + 1;
            this.NowLevelNum.text = stage + "";
        }
        SetProValue(data) {
            this.jindupro.value = data["pre"];
            this.CountTxt.text = "小人数量：" + (Number(data["count"]) + 1);
        }
        ShowGuide1() {
            this.GuideBox1.visible = true;
            Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.HideGuide1);
        }
        HideGuide1() {
            this.GuideBox1.visible = false;
            Laya.stage.off(Laya.Event.MOUSE_DOWN, this, this.HideGuide1);
            PlayerManager.Instance.Resume();
            PlayerManager.Instance.ListenOn();
        }
        ShowGuide2() {
            this.GuideBox2.visible = true;
            this.guideclick1.play(null, true);
        }
        HideGuide2() {
            this.GuideBox2.visible = false;
            this.guideclick1.stop();
        }
        OnHide() {
            DispatcherManager.StageOff(StageState.RefreshPro, this, this.SetProValue);
            DispatcherManager.StageOff(StageState.ShowGuide1, this, this.ShowGuide1);
            DispatcherManager.StageOff(StageState.HideGuide1, this, this.HideGuide1);
            DispatcherManager.StageOff(StageState.ShowGuide2, this, this.ShowGuide2);
            DispatcherManager.StageOff(StageState.HideGuide2, this, this.HideGuide2);
        }
    }

    class Global {
    }
    Global.VERSION = "1.0.3";
    Global.CFG = "123";

    var HttpRequest = Laya.HttpRequest;
    var Event = Laya.Event;
    const JtSniperApiUrl = "https://waveapi.xwxgame.com/";
    class TeamWave {
    }
    TeamWave.DengLu = "user/login";
    TeamWave.KaiShi = "game/start";
    TeamWave.JieShu = "game/play";
    TeamWave.QianDao = "sign/sign";
    TeamWave.Chengjiu = "achievement/getRewards";
    TeamWave.Config = "config/table";
    TeamWave.FenXiang = "fission/share";
    TeamWave.LiXian = "fission/offline";
    TeamWave.vd = "fission/vd";
    TeamWave.FuHuo = "game/revival";
    TeamWave.gadagdag = "treasure/click";
    TeamWave.Invite = "invite/getRewards";
    TeamWave.Lottery = "lottery/lottery";
    TeamWave.ShareGetSkin = "theme/fission";
    TeamWave.WearEquip = "theme/equip";
    TeamWave.BuyEquip = "theme/buy";
    TeamWave.ShouQuan = "user/auth";
    TeamWave.JinBi = "user/sync";
    ;
    class ServerManager {
        constructor() { }
        static get Instance() {
            if (ServerManager.ins) {
                return ServerManager.ins;
            }
            else {
                return new ServerManager();
            }
        }
        Login(progresscb, completecb, errorcb) {
            var Account = AccountManager.Instance;
            var ver = Global.VERSION;
            let Data = `code=${Account.code}&nickname=${Account.nickName}&avatar=${Account.avatarUrl}&gender=${Account.gender}&country=${Account.country}&province=${Account.province}&city=${Account.city}& device=${Account.device}$&share_id=${Account.share_id}&scene=${Account.scene}&v=${ver}`;
            let httpRequest = new HttpRequest();
            httpRequest.once(Event.PROGRESS, this, this.Progress, [progresscb, httpRequest]);
            httpRequest.once(Event.COMPLETE, this, this.Complete, [completecb, httpRequest]);
            httpRequest.once(Event.ERROR, this, this.Errorcb, [errorcb, httpRequest]);
            httpRequest.send(JtSniperApiUrl + TeamWave.DengLu, Data, "post", "text");
        }
        Progress(_progresscb, _httpreq) {
            if (_progresscb) {
                _progresscb.run();
            }
        }
        Complete(_completecb, _httpreq) {
            let data = JSON.parse(_httpreq.data);
            console.log(data);
            if (data["code"] != "0") {
                console.log("登录异常错误！错误信息sssssssss：", _httpreq.data["code"]);
                return;
            }
            console.log("-----------sss", data["t"]);
            AccountManager.Instance.SFSFSF = data["t"];
            this.RessetConfig(data, _completecb);
        }
        RessetConfig(data, completecb) {
            AccountManager.Instance.ReSetting(data, (flag) => {
                if (flag) {
                    completecb.runWith(data);
                }
                else {
                    this.RessetConfig(data, completecb);
                }
            });
        }
        Errorcb(_errorcb, _httpreq) {
            if (_errorcb != null) {
                _errorcb.runWith(_httpreq);
            }
        }
        SendHttp(protocol, param, completecb, errorcb, hasToken = true) {
            let sfaasfsfa = "";
            let daadsads = JtSniperApiUrl + protocol;
            if (hasToken == true) {
                sfaasfsfa = `token=${AccountManager.Instance.curplayerData.zhengshu}&`;
            }
            if (protocol == TeamWave.KaiShi || protocol == TeamWave.JieShu || protocol == TeamWave.vd || protocol == TeamWave.Lottery || protocol == TeamWave.ShareGetSkin) {
                let asddsa = "abcdefghijkimnopqrstuvwxyz0123456789";
                let adsassda = "{";
                let saafsafs = "";
                for (let i = 0; i < 4; i++) {
                    saafsafs += asddsa[Math.floor(Math.random() * 100) % asddsa.length];
                }
                for (let i = 0; i < param.length; i++) {
                    for (let key in param[i]) {
                        adsassda += `\"${key}\":\"${param[i][key]}\"`;
                    }
                    if (i < param.length - 1) {
                        adsassda += ",";
                    }
                    else {
                        adsassda += "}";
                    }
                }
                sfaasfsfa += "_r=" + saafsafs + this.SFGSGSG(adsassda);
            }
            else {
                if (param != null) {
                    for (let i = 0; i < param.length; i++) {
                        for (let key in param[i]) {
                            let val = param[i][key];
                            sfaasfsfa += `${key}=${val}`;
                            if (i < param.length - 1) {
                                sfaasfsfa += "&";
                            }
                        }
                    }
                }
            }
            let httpRequest = new HttpRequest();
            httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest]);
            httpRequest.once(Event.ERROR, this, this.Errorcb, [errorcb, httpRequest]);
            httpRequest.send(daadsads, sfaasfsfa, "post", "text");
        }
        onHttpRequestComplete(succeedcb, failurecb, httpRequest) {
            let data = JSON.parse(httpRequest.data);
            if (data["code"] == 0) {
                AccountManager.Instance.ReSetting(data);
                if (succeedcb != null) {
                    succeedcb.runWith(data);
                }
            }
            else {
                if (failurecb != null) {
                    failurecb.runWith(data);
                }
                console.log("Error! Http request complete error, code: " + data["code"] + " message: " + data["message"]);
            }
        }
        SFGSGSG(str) {
            var c1, c2, c3;
            var SFSFFSFSFSFS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
            var i = 0, len = str.length, SFFSSFFS = '';
            while (i < len) {
                c1 = str.charCodeAt(i++) & 0xff;
                if (i == len) {
                    SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
                    SFFSSFFS += SFSFFSFSFSFS.charAt((c1 & 0x3) << 4);
                    SFFSSFFS += "==";
                    break;
                }
                c2 = str.charCodeAt(i++);
                if (i == len) {
                    SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
                    SFFSSFFS += SFSFFSFSFSFS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
                    SFFSSFFS += SFSFFSFSFSFS.charAt((c2 & 0xF) << 2);
                    SFFSSFFS += "=";
                    break;
                }
                c3 = str.charCodeAt(i++);
                SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
                SFFSSFFS += SFSFFSFSFSFS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
                SFFSSFFS += SFSFFSFSFSFS.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
                SFFSSFFS += SFSFFSFSFSFS.charAt(c3 & 0x3F);
            }
            return SFFSSFFS;
        }
    }

    class HomeView extends ui.HomeViewUI {
        constructor() {
            super();
            HomeView.ins = this;
        }
        static get Instance() {
            if (HomeView.ins == null) {
                return new HomeView();
            }
            return HomeView.ins;
        }
        OnShow() {
            console.log("主界面");
            this.RefreshUI();
            this.RegButton();
            this.handclick.play(null, true);
        }
        RegButton() {
            this.StartBtn.clickHandler = new Laya.Handler(this, this.Start);
            this.SignBtn.clickHandler = new Laya.Handler(this, this.ClickSign);
            this.LotteryBtn.clickHandler = new Laya.Handler(this, this.ClickLottery);
            this.SkinBtn.clickHandler = new Laya.Handler(this, this.ClickSKin);
            this.SetBtn.clickHandler = new Laya.Handler(this, this.ShowSetPanel);
            this.CloseSetBtn.clickHandler = new Laya.Handler(this, this.HideSetPanel);
            this.shakebtn.clickHandler = new Laya.Handler(this, this.ClickShake);
            this.soundbtn.clickHandler = new Laya.Handler(this, this.ClickSound);
            this.height = Laya.stage.height;
            Laya.stage.on(Laya.Event.RESIZE, this, () => {
                this.height = Laya.stage.height;
            });
        }
        RefreshUI() {
            let stage = Number(AccountManager.Instance.curplayerData.GainAccount("stage")) + 1;
            this.NowLevelNum.text = stage + "";
            this.GoldNum.text = AccountManager.Instance.curplayerData.GainAccount("money");
        }
        Start() {
            var agrs = [{ "t": AccountManager.Instance.ServerTime.toString() }];
            ServerManager.Instance.SendHttp(TeamWave.KaiShi, agrs, Laya.Handler.create(this, (data) => {
                GameManager.play_id = data.play_id;
                PlayerManager.Instance.EnablePlayer();
                this.handclick.stop();
                this.shou.visible = false;
                ViewManager.Instance.ShowView(ViewType.InGameView);
                DispatcherManager.StageTrigger(StageState.Start);
            }), null);
        }
        ShowSetPanel() {
            this.SetPanel.visible = true;
            let shakeon = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("on");
            let shakeoff = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("off");
            let soundon = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("on");
            let soundoff = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("off");
            soundon.visible = AudioManager.play;
            soundoff.visible = !soundon.visible;
            shakeon.visible = WXSDK.shake;
            shakeoff.visible = !shakeon.visible;
        }
        HideSetPanel() {
            this.SetPanel.visible = false;
        }
        ClickSound() {
            let soundon = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("on");
            let soundoff = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("off");
            AudioManager.play = !AudioManager.play;
            soundon.visible = AudioManager.play;
            soundoff.visible = !soundon.visible;
            if (AudioManager.play) {
                AudioManager.PlayBGM(BGMType.bgm);
            }
            else {
                AudioManager.StopMusic();
            }
        }
        ClickShake() {
            let shakeon = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("on");
            let shakeoff = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("off");
            WXSDK.shake = !WXSDK.shake;
            shakeon.visible = WXSDK.shake;
            shakeoff.visible = !shakeon.visible;
        }
        ClickSign() {
            WXSDK.ShowTxt("暂未开放");
        }
        ClickLottery() {
            WXSDK.ShowTxt("暂未开放");
        }
        ClickSKin() {
            WXSDK.ShowTxt("暂未开放");
        }
        OnHide() {
        }
    }

    class ReviveView extends ui.ReviveViewUI {
        constructor() {
            super();
            ReviveView.ins = this;
        }
        static get Instance() {
            if (ReviveView.ins == null) {
                return new ReviveView();
            }
            return ReviveView.ins;
        }
        OnShow() {
            this.height = Laya.stage.height;
            Laya.stage.on(Laya.Event.RESIZE, this, () => {
                this.height = Laya.stage.height;
            });
        }
        OnHide() {
        }
    }

    class WxGameItem {
        constructor() {
            this.appNameHidden = false;
            this.color = "C93B3BFF";
            this.size = 100;
            this.borderWidth = 50;
            this.borderColor = "A1A0A0FF";
        }
    }
    class GuangGao {
        constructor() {
            GuangGao.ins = this;
        }
        static get Instance() {
            if (GuangGao.ins) {
                return GuangGao.ins;
            }
            else {
                return new GuangGao();
            }
        }
        static InitVideo() {
            if (!Laya.Browser.onWeiXin)
                return;
            console.log(this.bannerAdUnitId);
            this.fsaasfafssfa = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: this.videlAdUnitId });
            this.fsaasfafssfa.onLoad(() => {
                console.log('激励视频 广告加载成功');
                this.asfasfsaffsa = true;
            });
            this.fsaasfafssfa.onError(err => {
                console.log("激励视屏加载失败:" + err);
                this.asfasfsaffsa = false;
            });
            this.afsfsaafsfsa = true;
        }
        static ShowVideo(callback) {
            if (this.asfasfsaffsa) {
                console.log("showVideoAd:" + this.asfasfsaffsa);
                this.SetVideoCallBack(callback);
                this.fsaasfafssfa.show().catch(err => {
                    this.fsaasfafssfa.load().then(() => {
                        this.SetVideoCallBack(callback);
                        this.fsaasfafssfa.show();
                    });
                });
            }
        }
        static SetVideoCallBack(callback) {
            this.fsaasfafssfa.offClose();
            this.fsaasfafssfa.onClose(res => {
                console.log("激励视频关闭:" + res.isEnded);
                if (res && res.isEnded || res === undefined) {
                    callback && callback(true);
                }
                else {
                    callback && callback(false);
                }
                this.fsaasfafssfa.offClose();
            });
        }
        static OpenBanner(gap = 0, callVack = null, iswait = false) {
            if (!Laya.Browser.onWeiXin) {
                if (callVack) {
                    callVack(null);
                }
                return;
            }
            this.canshowbanner = true;
            var idd = this.bannerAdUnitId;
            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("广告错误onerror--");
                console.log(err);
                callVack(null);
            });
            newBanner.onLoad(() => {
                if (this.curbanner)
                    this.curbanner.destroy();
                this.curbanner = newBanner;
                var hight = this.GetRealHight(gap);
                if (callVack != null) {
                    callVack(hight);
                }
                if (this.canshowbanner && !iswait) {
                    this.curbanner.show();
                }
                else {
                    this.curbanner.hide();
                }
            });
        }
        static GetRealHight(gap) {
            if (this.curbanner) {
                let info = Laya.Browser.window.wx.getSystemInfoSync();
                this.curbanner.style.width = info.windowWidth;
                this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - gap;
                return Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
            }
        }
        static Clear() {
            Laya.timer.clearAll(this);
            Laya.Tween.clearAll(this);
            this.canshowbanner = false;
            if (this.curbanner)
                this.curbanner.hide();
        }
        static hidebanner() {
            if (!Laya.Browser.onWeiXin)
                return;
            if (this.curbanner)
                this.curbanner.hide();
        }
        static showbanner() {
            if (!Laya.Browser.onWeiXin)
                return;
            if (this.curbanner)
                this.curbanner.show();
        }
        static get cancheat() {
            return false;
        }
        static SetPosBanner(btn, complete) {
            if (Laya.Browser.onPC) {
                complete(false);
                return;
            }
            let info = Laya.Browser.window.wx.getSystemInfoSync();
            var reshight = btn.y * info.windowHeight / Laya.stage.height;
            var idd = this.bannerAdUnitId;
            console.log("adUnitId:" + idd);
            if (this.curbanner)
                this.curbanner.destroy();
            let newBanner = Laya.Browser.window.wx.createBannerAd({
                adUnitId: idd,
                style: {
                    left: 0,
                    top: 0,
                    width: 720
                }
            });
            newBanner.onError(err => {
                console.log(err);
                complete(false);
            });
            newBanner.onLoad(() => {
                this.curbanner = newBanner;
                this.curbanner.style.top = reshight;
                if (this.curbanner) {
                    console.log("banner show");
                    this.curbanner.show();
                    Laya.timer.once(2300, this, () => {
                        this.curbanner.style.top = info.windowHeight - GuangGao.bannerhigt;
                        complete(true);
                    });
                }
            });
            newBanner.onResize((res) => {
                GuangGao.bannerhigt = res.height;
                this.curbanner.style.width = info.windowWidth;
                this.curbanner.style.top = reshight;
            });
        }
        static CheatBanner(btn, complete = null, gap = 0) {
            if (!AccountManager.Instance.curplayerData.Cheat) {
                console.log("ignorecheat");
                GuangGao.OpenBanner(0, (height) => {
                    if (height == null) {
                        console.log("banner高度为null---");
                    }
                });
            }
            else {
                btn.y = Laya.stage.height - btn.height - 100;
                GuangGao.OpenBanner(gap, (height) => {
                    if (height == null) {
                    }
                    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(1000, this, () => {
                            btn.mouseEnabled = true;
                            this.showbanner();
                            Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
                                if (complete != null) {
                                    complete();
                                }
                            }));
                        });
                    }
                }, true);
            }
        }
        showBanner(success = null, fail = null) {
            if (!Laya.Browser.onWeiXin)
                return;
            var ran = GameTools.RandomANumber(0, 3);
            let ad = GuangGao.bannerAdUnitId;
            let bannerAd = Laya.Browser.window.wx.createBannerAd({
                adUnitId: ad,
                style: {
                    left: 0,
                    top: 0,
                    width: 460
                }
            });
            bannerAd.onLoad(() => {
                console.log("[LOG] Banner广告加载成功");
                this.hideBanner();
                this._bannerAd = bannerAd;
                let info = Laya.Browser.window.wx.getSystemInfoSync();
                this._bannerAd.style.width = info.windowWidth;
                this._bannerAd.style.top = info.windowHeight - this._bannerAd.style.realHeight - 20;
                this._bannerAd.show();
                success && success(this._bannerAd);
            });
            bannerAd.onError(err => {
                console.log("[LOG] Banner广告加载失败");
                console.log(err);
                fail && fail();
            });
        }
        hideBanner() {
            if (!Laya.Browser.onWeiXin)
                return;
            if (this._bannerAd) {
                this._bannerAd.hide();
                this._bannerAd.destroy();
                this._bannerAd = null;
            }
        }
    }
    GuangGao.videlAdUnitId = "adunit-8feb4e40536601ff";
    GuangGao.bannerAdUnitId = "adunit-426c9d6299d18f7e";
    GuangGao.afsfsaafsfsa = false;
    GuangGao.asfasfsaffsa = false;
    GuangGao.canshowbanner = true;
    GuangGao.bannerhigt = 0;

    class GameResultView extends ui.GameResultViewUI {
        constructor() {
            super();
            GameResultView.ins = this;
        }
        static get Instance() {
            if (GameResultView.ins == null) {
                return new GameResultView();
            }
            return GameResultView.ins;
        }
        OnShow(data) {
            this._result = data;
            if (data) {
                this.WinBox.visible = true;
                this.FailBox.visible = false;
            }
            else {
                this.WinBox.visible = false;
                this.FailBox.visible = true;
            }
            LevelManager.Instance.BackMain();
            this.RefreshUI();
            this.RegButton();
            this.height = Laya.stage.height;
            Laya.stage.on(Laya.Event.RESIZE, this, () => {
                this.height = Laya.stage.height;
            });
        }
        RegButton() {
            this.Win_BackBtn.clickHandler = new Laya.Handler(this, this.BackHome);
            this.Win_VideoBtn.clickHandler = new Laya.Handler(this, this.WinVideoGet);
            this.Win_kuangbtn.clickHandler = new Laya.Handler(this, this.ClickWinKuang);
            this.Fail_BackBtn.clickHandler = new Laya.Handler(this, this.BackHome);
            this.Fail_VideoBtn.clickHandler = new Laya.Handler(this, this.LoseVideoGet);
            this.Fail_kuangbtn.clickHandler = new Laya.Handler(this, this.ClickLoseKuang);
        }
        RefreshUI() {
            this.Win_GoldNum.text = (AccountManager.Instance.curplayerData.LevelReward(this._result) + GameManager.GoldNum) + "";
            this.Fail_GoldNum.text = (AccountManager.Instance.curplayerData.LevelReward(this._result) + GameManager.GoldNum) + "";
        }
        ClickWinKuang() {
            this.win_dian.visible = !this.win_dian.visible;
        }
        ClickLoseKuang() {
            this.fail_dian.visible = !this.fail_dian.visible;
        }
        WinVideoGet() {
            GuangGao.ShowVideo((isLoad) => {
                if (isLoad) {
                }
            });
        }
        LoseVideoGet() {
            GuangGao.ShowVideo((isLoad) => {
                if (isLoad) {
                }
            });
        }
        BackHome() {
            let stage = AccountManager.Instance.curplayerData.STAGE;
            var iswin = this._result ? "1" : "0";
            var coinnum = (AccountManager.Instance.curplayerData.LevelReward(this._result) + GameManager.GoldNum) + "";
            var args = [{ "t": AccountManager.Instance.ServerTime.toString() }, { "play_id": GameManager.play_id }, { "win": iswin }, { "money": coinnum }];
            ServerManager.Instance.SendHttp(TeamWave.JieShu, args, Laya.Handler.create(this, this.Success), null);
        }
        Success() {
            GameManager.GoldNum = 0;
            GameManager.Instance.GameOver();
        }
        OnHide() {
        }
    }

    class SignView extends ui.SignViewUI {
        constructor() {
            super();
            SignView.ins = this;
        }
        static get Instance() {
            if (SignView.ins == null) {
                return new SignView();
            }
            return SignView.ins;
        }
        OnShow() {
            this.signReward = AccountManager.Instance.curplayerData.GainCollocation("sign");
            this.RegButton();
            this.RefreshUI();
            this.InitData();
            if (!SignView.canSgin) {
                this.receiveBtn.visible = false;
            }
            else {
                this.receiveBtn.visible = true;
            }
            this.height = Laya.stage.height;
            Laya.stage.on(Laya.Event.RESIZE, this, () => {
                this.height = Laya.stage.height;
            });
        }
        RefreshUI() {
            this.GoldNum.text = AccountManager.Instance.curplayerData.GainAccount("money");
        }
        RegButton() {
            this.receiveBtn.clickHandler = new Laya.Handler(this, this.ClickReceive);
            this.closeBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
        }
        ClickReceive() {
            if (Laya.Browser.onWeiXin) {
                GuangGao.ShowVideo((isLoad) => {
                    if (isLoad) {
                        var agrs = [{ "video": "0" }];
                        ServerManager.Instance.SendHttp(TeamWave.QianDao, agrs, Laya.Handler.create(this, (e) => {
                            this.InitData();
                            this.RefreshUI();
                            this.showReward(e.rewards, () => {
                                this.ClickClose();
                            });
                        }), Laya.Handler.create(this, this.OnSignError), true);
                    }
                });
            }
            else {
                this.ClickClose();
            }
        }
        OnSignError(e) {
            console.log(e);
        }
        ClickClose() {
            ViewManager.Instance.ShowView(ViewType.HomeView);
        }
        InitData() {
            let day = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_days));
            let signtime = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_time));
            let curIndex = day % 7 + 1;
            let first = day < 7;
            let index = first ? 0 : 7;
            let rewards = [];
            for (var i = index; i < index + 7; i++) {
                rewards[this.signReward[i].id] = this.signReward[i].rewards;
            }
            for (let i = 1 + index; i <= 7 + index; i++) {
                let t = i % 8;
                var rewardid = rewards[i];
                var reward = AccountManager.Instance.curplayerData.GetRewardConfig(rewardid);
                let dayBox = this.signList.getChildByName('day' + t).getChildAt(0);
                let item = dayBox.getChildByName('item');
                let itemnum = dayBox.getChildByName('itemnum');
                let isGet = dayBox.getChildByName('isGet');
                isGet.visible = false;
                let type = reward.reward_item;
                if (type == 1000) {
                    itemnum.text = reward.reward_num;
                }
                else {
                    item.skin = 'subpackage2/res/skin/' + reward.icon + '.png';
                    itemnum.visible = false;
                }
                if (t < curIndex) {
                    isGet.visible = true;
                }
            }
        }
        static get canSgin() {
            let todayZero = new Date(AccountManager.Instance.ServerTime * 1000);
            todayZero.setHours(0, 0, 0, 0);
            var zeroTime = todayZero.valueOf();
            var signtime = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_time));
            var signTime = signtime * 1000;
            var can = signTime < zeroTime ? true : false;
            return can;
        }
        static get CanVideoSign() {
            let todayZero = new Date(AccountManager.Instance.ServerTime * 1000);
            todayZero.setHours(0, 0, 0, 0);
            let lasttime = new Date(AccountManager.Instance.ServerTime * 1000);
            lasttime.setHours(24, 0, 0, 0);
            var mtime = lasttime.valueOf();
            var zeroTime = todayZero.valueOf();
            var signtime = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_time));
            var signTime = signtime * 1000;
            var can = (signTime > zeroTime && signTime < mtime) ? true : false;
            return can;
        }
        showReward(rewards, callback) {
            for (let key in rewards) {
                let itemId = Number(key);
                let itemnum = Number(rewards[key]);
                if (itemId == 1000) {
                    GameTools.GetMoney(itemnum, null, Laya.Handler.create(this, () => {
                        callback && callback();
                    }));
                }
                else {
                    Laya.timer.once(1000, this, () => {
                        callback && callback();
                    });
                }
            }
        }
        OnHide() {
        }
    }

    const REWARDNAME = "reward";
    const MAINPATH = "Main/";
    const SKINPATH = "subpackage2/res/skin/";
    const CIRCLES = 5;
    const ROTATIME = 5000;
    class LotteryView extends ui.LotteryViewUI {
        constructor() {
            super();
            LotteryView.ins = this;
        }
        static get Instance() {
            if (LotteryView.ins == null) {
                return new LotteryView();
            }
            return LotteryView.ins;
        }
        OnShow() {
            this.RegButton();
            this.RefreshUI();
            this.height = Laya.stage.height;
            Laya.stage.on(Laya.Event.RESIZE, this, () => {
                this.height = Laya.stage.height;
            });
        }
        RefreshUI() {
            let lottery = AccountManager.Instance.curplayerData.GainCollocation("lottery");
            let idx = 1;
            this._itemDic = new Dictionary();
            lottery && lottery.forEach(item => {
                this._itemDic.set(idx, item);
                let type = Math.floor(Number(item.reward_item) * 0.001);
                let reward = this.dial.getChildByName(`${REWARDNAME}${idx++}`);
                if (!reward)
                    return;
                let skin = reward.getChildByName("skin");
                let name = reward.getChildByName("name");
                if (type == 1) {
                    skin.skin = MAINPATH + item.icon + ".png";
                    name.text = "X" + item.reward_num.toString();
                }
                else if (type == 6) {
                    skin.skin = SKINPATH + item.icon + ".png";
                    name.text = item.name.toString();
                    name.visible = false;
                }
            }, this);
        }
        _rotateDial(data) {
            let targRota = 360 * CIRCLES - 45 * (data.lottery_id - 1);
            let tween = Laya.Tween.to(this.dial, { rotation: targRota }, ROTATIME, Laya.Ease.quadInOut, Laya.Handler.create(this, () => {
                let item = this._itemDic.get(data.lottery_id);
                let type = Math.floor(Number(item.reward_item) * 0.001);
                var reward = data["rewards"];
                if (reward["1000"]) {
                    var gg = Number(reward["1000"]);
                    GameTools.GetMoney(gg, null, Laya.Handler.create(this, () => {
                        ViewManager.Instance.ShowView(ViewType.LotteryView);
                    }));
                }
                else {
                    GameTools.TweenText(new faafssfafsa("皮肤 + 1", new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height * 0.35), new Laya.Vector2(250, 80), 30), 150, Laya.Handler.create(this, () => {
                        ViewManager.Instance.ShowView(ViewType.LotteryView);
                    }));
                }
            }));
        }
        RegButton() {
            this.VideoGetBtn.clickHandler = new Laya.Handler(this, this.ClickVideoGet);
            this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
        }
        ClickClose() {
            ViewManager.Instance.ShowView(ViewType.HomeView);
        }
        ClickVideoGet() {
            this.VideoGetBtn.visible = false;
            let param = [{ "channel": "video" }, { "t": AccountManager.Instance.ServerTime.toString() }];
            ServerManager.Instance.SendHttp(TeamWave.Lottery, param, Laya.Handler.create(this, function (e) {
                this._rotateDial(e);
            }), Laya.Handler.create(this, () => {
                WXSDK.ShowTxt("抽奖次数已经用完!");
            }), true);
        }
        OnHide() {
        }
    }

    class SkinView extends ui.SkinViewUI {
        constructor() {
            super();
            SkinView.ins = this;
        }
        static get Instance() {
            if (SkinView.ins == null) {
                return new SkinView();
            }
            return SkinView.ins;
        }
        OnShow() {
            this.height = Laya.stage.height;
            Laya.stage.on(Laya.Event.RESIZE, this, () => {
                this.height = Laya.stage.height;
            });
        }
        OnHide() {
        }
    }

    var ViewType;
    (function (ViewType) {
        ViewType[ViewType["InGameView"] = 0] = "InGameView";
        ViewType[ViewType["HomeView"] = 1] = "HomeView";
        ViewType[ViewType["GameResultView"] = 2] = "GameResultView";
        ViewType[ViewType["SkinView"] = 3] = "SkinView";
        ViewType[ViewType["TrialView"] = 4] = "TrialView";
        ViewType[ViewType["ReviveView"] = 5] = "ReviveView";
        ViewType[ViewType["SignView"] = 6] = "SignView";
        ViewType[ViewType["LotteryView"] = 7] = "LotteryView";
    })(ViewType || (ViewType = {}));
    ;
    class ViewManager {
        constructor() {
            this.showexportview = 0;
            this.popViewDic = [];
            this.ViewSprite = new Laya.Sprite();
            this.OtherViewSprite = new Laya.Sprite();
            ViewManager.ins = this;
            Laya.stage.addChild(this.ViewSprite);
            Laya.stage.addChild(this.OtherViewSprite);
        }
        static get Instance() {
            if (ViewManager.ins) {
                return ViewManager.ins;
            }
            else {
                return new ViewManager();
            }
        }
        ShowView(_viewtype, data = null) {
            if (this.curView != null) {
                this.curView.OnHide();
                this.curView.destroy();
                this.curView.removeSelf();
            }
            this.curView = this.CreateView(_viewtype);
            this.curView.name = ViewType[_viewtype];
            this.ViewSprite.addChild(this.curView);
            this.curView.OnShow(data);
        }
        CloseView() {
            if (this.curView != null) {
                this.curView.OnHide();
                this.curView.destroy();
                this.curView.removeSelf();
            }
        }
        OpenPopView(viewType, data = null) {
            var popView;
            if (this.popViewDic[viewType]) {
                popView = this.popViewDic[viewType];
                this.OtherViewSprite.setChildIndex(popView, this.OtherViewSprite.numChildren - 1);
                popView.visible = true;
            }
            else {
                popView = this.CreateView(viewType);
                this.OtherViewSprite.addChild(popView);
                this.popViewDic[viewType] = popView;
            }
            popView.OnOpen(data);
        }
        ClosePopView(viewType) {
            var popView = this.popViewDic[viewType];
            if (popView == null) {
                return;
            }
            popView.OnHide();
            popView.visible = false;
        }
        ClearPopViews() {
        }
        CreateView(_viewtype) {
            switch (_viewtype) {
                case ViewType.InGameView:
                    return new InGameView();
                case ViewType.HomeView:
                    return new HomeView();
                case ViewType.ReviveView:
                    return new ReviveView();
                case ViewType.GameResultView:
                    return new GameResultView();
                case ViewType.SignView:
                    return new SignView();
                case ViewType.LotteryView:
                    return new LotteryView();
                case ViewType.SkinView:
                    return new SkinView();
            }
            return null;
        }
    }

    class CameraManager {
        constructor() {
            this.LeftPosition = new Laya.Vector3(3.65, 5.72, -4.52);
            this.LeftRotate = new Laya.Vector3(-24, 145, 0);
            this.RightPosition = new Laya.Vector3(-3.78, 4.87, -4.46);
            this.RightRotate = new Laya.Vector3(-24, -145, 0);
            this.poschazhi = new Laya.Vector3();
            this.gengsuipos = new Laya.Vector3();
            this.lllpos = new Laya.Vector3();
            this.hights = 0;
            this.wights = 0;
            CameraManager.ins = this;
            DispatcherManager.StageOn(StageState.Start, this, this.CameraFollow);
            DispatcherManager.StageOn(StageState.Win, this, this.CameraCancelFollow);
            DispatcherManager.StageOn(StageState.Lose, this, this.CameraCancelFollow);
        }
        static get Instance() {
            if (CameraManager.ins == null) {
                return new CameraManager();
            }
            return CameraManager.ins;
        }
        Init() {
            let Direction = AccountManager.Instance.curplayerData.LevelDirection;
            if (Direction == 1) {
                this.camera.transform.position = this.LeftPosition;
                this.camera.transform.rotationEuler = this.LeftRotate;
            }
            else {
                this.camera.transform.position = this.RightPosition;
                this.camera.transform.rotationEuler = this.RightRotate;
            }
            this.CameraFollow();
        }
        CameraFollow() {
            this.hights = 0;
            this.wights = 0;
            Laya.Vector3.subtract(PlayerManager.Instance.player.transform.position, this.camera.transform.position, this.poschazhi);
            Laya.timer.frameLoop(1, this, this.GenSui);
        }
        GenSui() {
            Laya.Vector3.subtract(PlayerManager.Instance.player.transform.position, this.poschazhi, this.gengsuipos);
            this.hights = GameTools.Instance.lerp(this.hights, 1, 0.03);
            this.wights = GameTools.Instance.lerp(this.wights, 1, 0.05);
            this.gengsuipos = new Laya.Vector3(this.gengsuipos.x, this.gengsuipos.y, this.gengsuipos.z);
            Laya.Vector3.lerp(this.camera.transform.position, this.gengsuipos, 0.25, this.lllpos);
            this.lllpos = new Laya.Vector3(this.gengsuipos.x, this.lllpos.y, this.lllpos.z);
            this.camera.transform.position = this.lllpos;
        }
        CameraCancelFollow() {
            Laya.timer.clear(this, this.GenSui);
        }
        CameraRotate() {
            let tween = Laya.Tween.to(this.camera.transform, { RotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
                tween.clear();
            }, null, false));
        }
    }

    class LevelManager {
        constructor() {
            LevelManager.ins = this;
        }
        static get Instance() {
            if (LevelManager.ins == null) {
                return new LevelManager();
            }
            return LevelManager.ins;
        }
        RegEvent() {
            DispatcherManager.StageOn(StageState.Lose, this, this.GameLose);
            DispatcherManager.StageOn(StageState.Win, this, this.GameWin);
            DispatcherManager.StageOn(StageState.Pause, this, this.GamePause);
            DispatcherManager.StageOn(StageState.Resume, this, this.GameResume);
            DispatcherManager.StageOn(StageState.Over, this, this.GameStart);
        }
        GameStart() {
            PlayerManager.Instance.Init();
            CameraManager.Instance.Init();
            ViewManager.Instance.ShowView(ViewType.HomeView);
            AudioManager.PlayBGM(BGMType.bgm);
        }
        GameLose() {
            PlayerManager.Instance.ListenOff();
            Laya.timer.once(1000, this, () => {
                ViewManager.Instance.ShowView(ViewType.GameResultView, false);
            });
            AudioManager.StopMusic();
        }
        GameWin() {
            PlayerManager.Instance.ListenOff();
            Laya.timer.once(1000, this, () => {
                ViewManager.Instance.ShowView(ViewType.GameResultView, true);
            });
            AudioManager.StopMusic();
        }
        GamePause() {
        }
        GameResume() {
        }
        BackMain() {
            for (let i = this.spritepool.numChildren - 1; i >= 0; i--) {
                let child = this.spritepool.getChildAt(i);
                let _well = child.getComponent(WallBehav);
                if (_well) {
                    _well.destroy();
                }
                let _matemove = child.getComponent(MateMove);
                if (_matemove) {
                    _matemove.destroy();
                }
                let _hppro = child.getComponent(HpBarBehav);
                if (_hppro) {
                    _hppro.destroy();
                }
                child.removeSelf();
                child.destroy();
                child = null;
            }
        }
    }

    class AssetManager {
        constructor() {
            this.Prop = new Dictionary();
            this.Character = new Dictionary();
            AssetManager.ins = this;
            DispatcherManager.EventOn(EventState.LoadComplete, this, this.Init);
        }
        static get Instance() {
            if (AssetManager.ins == null) {
                return new AssetManager();
            }
            return AssetManager.ins;
        }
        Init() {
            this.mainscene.enableFog = true;
            this.mainscene.fogStart = 25;
            this.mainscene.fogRange = 40;
            this.mainscene.fogColor = new Laya.Vector3(138 / 255, 78 / 255, 188 / 255);
            Laya.stage.addChild(this.mainscene);
            this.maincamera = this.mainscene.getChildByName("Main Camera");
            this.maincamera.clearColor = new Laya.Vector4(138 / 255, 78 / 255, 188 / 255, 1);
            this.maincamera.enableHDR = false;
            CameraManager.Instance.camera = this.maincamera;
            this.camerapos = this.maincamera.transform.position.clone();
            this.camerarotate = this.maincamera.transform.rotationEuler.clone();
            let _sprite = new Laya.Sprite3D();
            this.mainscene.addChild(_sprite);
            LevelManager.Instance.spritepool = _sprite;
            this.SetCharacterPos();
            LevelManager.Instance.RegEvent();
            LevelManager.Instance.GameStart();
        }
        getPref(name) {
            return this.Prop.get(name);
        }
        getRolePref(index) {
            return this.Character.get(index);
        }
        SetCharacterPos() {
            GameManager.STAGE = -1;
            let _level = this.mainscene.getChildByName("level456");
            let stage = AccountManager.Instance.curplayerData.STAGE;
            let levelname = "level" + stage;
            let decorate = this.mainscene.getChildByName("decorate");
            let decorate2 = this.mainscene.getChildByName("decorate2");
            let decorateid = AccountManager.Instance.curplayerData.SceneDecorate;
            if (decorateid == 3) {
                decorate.active = true;
                decorate2.active = false;
            }
            else {
                decorate.active = false;
                decorate2.active = true;
            }
            for (let i = 0; i < _level.numChildren; i++) {
                let item = _level.getChildAt(i);
                if (item.name != levelname) {
                    item.active = false;
                }
                else {
                    item.active = true;
                    this.curstage = item;
                }
            }
            for (let i = 0; i < this.curstage.numChildren; i++) {
                let item = this.curstage.getChildAt(i);
                if (item.name == "player") {
                    this.playerpos = Laya.Sprite3D.instantiate(item);
                }
                else if (item.name == "barrier") {
                    let _pref = this.getPref(ResourcesPath.Nail2);
                    let _cube = Laya.Sprite3D.instantiate(_pref);
                    LevelManager.Instance.spritepool.addChild(_cube);
                    _cube.transform.position = item.transform.position.clone();
                    _cube.transform.rotation = item.transform.rotation.clone();
                    _cube.transform.scale = item.transform.scale.clone();
                    _cube.name = ResourcesPath.Nail2;
                    NodeUtil.SetColliderGroup(_cube, 2);
                }
                else if (item.name == "role") {
                    let _pref = this.getRolePref(1);
                    let _player = Laya.Sprite3D.instantiate(_pref);
                    LevelManager.Instance.spritepool.addChild(_player);
                    _player.transform.position = item.transform.position.clone();
                    _player.transform.rotation = item.transform.rotation.clone();
                    let _mate = _player.addComponent(MateMove);
                    NodeUtil.SetColliderGroup(_player, 100);
                }
                else if (item.name == "speed") {
                    let _pref = this.getPref(ResourcesPath.Speed);
                    let _cube = Laya.Sprite3D.instantiate(_pref);
                    LevelManager.Instance.spritepool.addChild(_cube);
                    _cube.transform.position = item.transform.position.clone();
                    _cube.transform.rotation = item.transform.rotation.clone();
                    _cube.transform.scale = item.transform.scale.clone();
                    _cube.name = ResourcesPath.Speed;
                    NodeUtil.SetColliderGroup(item, 1);
                }
                else if (item.name == "Ramp") {
                    let _pref = this.getPref(ResourcesPath.Ramp);
                    let _cube = Laya.Sprite3D.instantiate(_pref);
                    LevelManager.Instance.spritepool.addChild(_cube);
                    _cube.transform.position = item.transform.position.clone();
                    _cube.transform.rotation = item.transform.rotation.clone();
                    _cube.transform.scale = item.transform.scale.clone();
                    _cube.name = ResourcesPath.Ramp;
                    NodeUtil.SetColliderGroup(item, 1);
                }
                else if (item.name == "bridge") {
                    NodeUtil.SetColliderGroup(item, 1);
                }
                else if (item.name == "Coin") {
                    let _pref = this.getPref(ResourcesPath.Coin);
                    let _cube = Laya.Sprite3D.instantiate(_pref);
                    LevelManager.Instance.spritepool.addChild(_cube);
                    _cube.transform.position = item.transform.position.clone();
                    _cube.transform.rotation = item.transform.rotation.clone();
                    _cube.transform.scale = item.transform.scale.clone();
                    _cube.name = ResourcesPath.Coin;
                    let coinbehav = _cube.addComponent(CoinBehav);
                    NodeUtil.SetColliderGroup(_cube, 3);
                }
                else if (item.name == "FinishCircle") {
                    let _pref = this.getPref(ResourcesPath.FinishCircle);
                    let _cube = Laya.Sprite3D.instantiate(_pref);
                    LevelManager.Instance.spritepool.addChild(_cube);
                    _cube.transform.position = item.transform.position.clone();
                    _cube.transform.rotation = item.transform.rotation.clone();
                    _cube.transform.scale = item.transform.scale.clone();
                    _cube.name = ResourcesPath.FinishCircle;
                    this.finishpoint = item.transform.position.clone();
                    NodeUtil.SetColliderGroup(_cube, 200);
                }
                else if (item.name == "Boss") {
                    let _behav = item.addComponent(BossBehav);
                    this.Boss = item;
                }
                else if (item.name == "roleguide" || item.name == "rotateguide" || item.name == "roleguideend" || item.name == "rotateguideend") {
                    NodeUtil.SetColliderGroup(item, 4);
                }
                else if (item.name == "AttackPoint") {
                    let left = item.getChildByName("leftpos");
                    let right = item.getChildByName("rightpos");
                    this.leftpos = left.transform.position.clone();
                    this.rightpos = right.transform.position.clone();
                    NodeUtil.SetColliderGroup(item, 400);
                }
                else if (item.name == "endground2") {
                    let _pref = this.getPref(ResourcesPath.EndGround);
                    let _cube = Laya.Sprite3D.instantiate(_pref);
                    LevelManager.Instance.spritepool.addChild(_cube);
                    _cube.transform.position = item.transform.position.clone();
                    _cube.transform.rotationEuler = item.transform.rotationEuler.clone();
                    _cube.transform.scale = item.transform.scale.clone();
                    _cube.name = ResourcesPath.EndGround;
                    let attackpoint = _cube.getChildByName("AttackPoint");
                    let left = attackpoint.getChildByName("leftpos");
                    let right = attackpoint.getChildByName("rightpos");
                    this.leftpos = left.transform.position.clone();
                    this.rightpos = right.transform.position.clone();
                    let bosspoint = _cube.getChildByName("BossPoint");
                    let _bosspref = this.getPref(ResourcesPath.Boss);
                    let _boss = Laya.Sprite3D.instantiate(_pref);
                    LevelManager.Instance.spritepool.addChild(_boss);
                    _boss.transform.position = bosspoint.transform.position.clone();
                    _boss.transform.rotationEuler = bosspoint.transform.rotationEuler.clone();
                    _boss.transform.scale = item.transform.scale.clone();
                    _boss.name = ResourcesPath.Boss;
                    console.log(_cube.transform.rotationEuler);
                    console.log(_cube.transform.position);
                    console.log(_cube.transform.scale);
                    this.endground = item;
                }
            }
        }
    }

    class GameManager {
        constructor() {
            GameManager.ins = this;
        }
        static get Instance() {
            if (GameManager.ins == null) {
                return new GameManager();
            }
            return GameManager.ins;
        }
        GameLose() {
            DispatcherManager.StageTrigger(StageState.Lose);
        }
        GameWin() {
            DispatcherManager.StageTrigger(StageState.Win);
        }
        GameOver() {
            AssetManager.Instance.SetCharacterPos();
            DispatcherManager.StageTrigger(StageState.Over);
        }
    }
    GameManager.STAGE = -1;
    GameManager.GoldNum = 0;

    var signdata;
    (function (signdata) {
        signdata[signdata["sign_days"] = 0] = "sign_days";
        signdata[signdata["sign_time"] = 1] = "sign_time";
    })(signdata || (signdata = {}));
    var AccountUser;
    (function (AccountUser) {
        AccountUser[AccountUser["buyed_kun"] = 0] = "buyed_kun";
        AccountUser[AccountUser["diamond"] = 1] = "diamond";
        AccountUser[AccountUser["equip_themes"] = 2] = "equip_themes";
        AccountUser[AccountUser["favorite_times"] = 3] = "favorite_times";
        AccountUser[AccountUser["game_times"] = 4] = "game_times";
        AccountUser[AccountUser["get_themes"] = 5] = "get_themes";
        AccountUser[AccountUser["list_kun"] = 6] = "list_kun";
        AccountUser[AccountUser["moeny"] = 7] = "moeny";
        AccountUser[AccountUser["progress_themes"] = 8] = "progress_themes";
        AccountUser[AccountUser["revival"] = 9] = "revival";
        AccountUser[AccountUser["stage"] = 10] = "stage";
    })(AccountUser || (AccountUser = {}));
    class PlayerData {
        constructor(_token, _config, _appSetting, _user, _userbase, _useInvite, _user_stage = null, _user_sign, _user_achievement, lottery) {
            this.openid = "";
            this.userId = "";
            this.m_RewardDic = {};
            this.zhengshu = _token;
            this.netzheshe = _appSetting;
            this.account = _user;
            this.accountssss = _userbase;
            this.qiandao = _user_sign;
            this.renwu = _user_achievement;
            this.userId = this.account["user_id"];
            this.openid = this.accountssss["openid"];
            this.m_invite = _useInvite;
            this.lottery = lottery;
            console.log("user_id:" + this.userId);
        }
        GetSign(_datatype) {
            var type = signdata[_datatype];
            return this.qiandao[type];
        }
        GainCollocation(_type) {
            return this.peizhis[_type];
        }
        GainAccount(_type) {
            return this.account[_type];
        }
        GetRewardDic() {
            var config = this.GainCollocation("rewards");
            for (var key in config) {
                this.m_RewardDic[config[key].id] = config[key];
            }
        }
        GetRewardConfig(_rewardid) {
            var reward = this.m_RewardDic[_rewardid];
            return reward;
        }
        get fenxiang() {
            return this.netzheshe["share"] == "1";
        }
        get CheckScene() {
            return this.netzheshe["checkscene"] == "1";
        }
        get Cheat() {
            return this.netzheshe["cheat"] == "1";
        }
        get Banner() {
            return this.netzheshe["Banner"] == "1";
        }
        get wudaoshijian() {
            return Number(this.netzheshe["wudaoshijian"]);
        }
        get SceneDecorate() {
            let stage = this.STAGE;
            let _mission = this.GainCollocation("mission");
            for (var key in _mission) {
                let item = _mission[key];
                if (item.ID == stage) {
                    return Number(item.scene);
                }
            }
            return null;
        }
        LevelReward(win) {
            let stage = this.STAGE;
            let levelinfo = this.GainCollocation("mission");
            for (var key in levelinfo) {
                let item = levelinfo[key];
                if (item.ID == stage) {
                    if (win) {
                        return Number(item.win);
                    }
                    else {
                        return Number(item.lose);
                    }
                }
            }
            return null;
        }
        get LevelDirection() {
            let stage = this.STAGE;
            let levelinfo = this.GainCollocation("mission");
            for (var key in levelinfo) {
                let item = levelinfo[key];
                if (item.ID == stage) {
                    return Number(item.direction);
                }
            }
            return null;
        }
        get STAGE() {
            if (GameManager.STAGE == -1) {
                GameManager.STAGE = Number(this.GainAccount("stage")) + 1;
                if (GameManager.STAGE > 30) {
                    GameManager.STAGE = GameTools.RandomANumber(1, 30);
                }
            }
            return GameManager.STAGE;
        }
        GetUser(_type) {
            var type = AccountUser[_type];
            return this.account[type];
        }
        HasGun(_id) {
            var data = this.GainAccount("get_themes");
            for (var i = 0; i < data.length; i++) {
                var hd = data[i];
                if (_id == hd) {
                    return true;
                }
            }
            return false;
        }
        GetProgress(_id) {
            var config = this.account["progress_themes"];
            var progress = config[_id] ? config[_id] : 0;
            return progress;
        }
        get ShareTxt() {
            return this.netzheshe["sharecontent"];
        }
    }

    class AccountManager {
        constructor(_code, _userinfo, _nickname, _avatarurl, _gender, _province, _city, _country, _device, _shareid, _scene, _v) {
            this.createTime = Laya.timer.currTimer;
            AccountManager.ins = this;
            this.code = _code;
            this.userInfo = _userinfo;
            this.nickName = _nickname;
            this.avatarUrl = _avatarurl;
            this.gender = _gender;
            this.province = _province;
            this.city = _city;
            this.country = _country;
            this.device = _device;
            this.share_id = _shareid;
            this.scene = _scene;
            this.v = _v;
        }
        static get Instance() {
            if (AccountManager.ins == null) {
                new AccountManager("222222", "你找谁？", "1233", "123", 1, "中国", "上海", "上海", "iphone6s", "123", "123", "123");
            }
            return AccountManager.ins;
        }
        ReSetting(data, cb = null) {
            var zhengshu = data["token"];
            var netset = data["app_setting"];
            var user = data["user"];
            var jichu = data["user_base"];
            var qiandao = data["user_sign"];
            var chengjiu = data["user_achievement"];
            var invite = data["user_invite"];
            var lottery = data["user_lottery"];
            if (this.curplayerData == null) {
                this.curplayerData = new PlayerData(zhengshu, null, netset, user, jichu, invite, null, qiandao, chengjiu, lottery);
                this.JundgCfg(data.table_version, cb);
            }
            else {
                if (netset) {
                    this.curplayerData.netzheshe = netset;
                }
                if (user) {
                    this.curplayerData.account = user;
                }
                if (jichu) {
                    this.curplayerData.accountssss = jichu;
                }
                if (qiandao) {
                    this.curplayerData.qiandao = qiandao;
                }
                if (chengjiu) {
                    this.curplayerData.renwu = chengjiu;
                }
            }
        }
        JundgCfg(ver, callball) {
            var cfg = Laya.LocalStorage.getJSON(Global.CFG);
            if (cfg) {
                if (cfg.VER == ver) {
                    console.log("已经拥有,不用更新");
                    this.SetCfg(cfg);
                    if (callball)
                        callball(true);
                }
                else {
                    console.log("cfg存在但是过期了");
                    Laya.LocalStorage.removeItem(Global.CFG);
                    ServerManager.Instance.SendHttp(TeamWave.Config, null, Laya.Handler.create(this, (data) => {
                        data.configs.VER = ver;
                        Laya.LocalStorage.setJSON(Global.CFG, data.configs);
                        this.SetCfg(data.configs);
                        if (callball)
                            callball(true);
                    }), Laya.Handler.create(this, (data) => {
                        console.log("配置获取失败" + data);
                        if (callball)
                            callball(false);
                        return;
                    }));
                }
            }
            else {
                console.log("本地没有cfg");
                ServerManager.Instance.SendHttp(TeamWave.Config, null, Laya.Handler.create(this, (data) => {
                    data.configs.VER = ver;
                    Laya.LocalStorage.setJSON(Global.CFG, data.configs);
                    this.SetCfg(data.configs);
                    if (callball)
                        callball(true);
                }), Laya.Handler.create(this, (data) => {
                    console.log("配置获取失败" + data);
                }));
            }
        }
        SetCfg(data) {
            this.curplayerData.peizhis = data;
            this.curplayerData.GetRewardDic();
        }
        RessetConfig() {
            ServerManager.Instance.SendHttp(TeamWave.Config, null, Laya.Handler.create(this, (data) => {
                this.curplayerData.peizhis = data["configs"];
            }), null);
        }
        get ServerTime() {
            let time = Laya.timer.currTimer;
            let stime = this.SFSFSF + Math.ceil((time - this.createTime) / 1000);
            return stime;
        }
    }

    class ShareUtil {
        beginShare(callBack) {
            ShareUtil.beginShareTime = new Date().getTime();
            console.log("分享点击时间=" + ShareUtil.beginShareTime);
            ShareUtil.isSharing = true;
            ShareUtil.callback = callBack;
        }
        onRegister() {
            if (Laya.Browser.window.wx == null) {
                return;
            }
            Laya.Browser.window.wx.onShow(function (option) {
                console.log("onshow share start");
                if (ShareUtil.isSharing) {
                    ShareUtil.isSharing = false;
                    let time = new Date().getTime();
                    console.log("分享回到游戏时间" + time);
                    let wait = (time - ShareUtil.beginShareTime) / 1000;
                    console.log("分享停留时间为：" + wait);
                    let shareSuccess = false;
                    let realSuccess = false;
                    if (wait < 3) {
                        Laya.Browser.window.wx.showToast({ title: "请重试一次" });
                        ShareUtil.callback(false);
                    }
                    else {
                        var random = Math.random();
                        if (random <= 0.3) {
                            var message = ["你已分享过该群", "请重新换个群分享！", "请分享到30人大群中！"];
                            var curmes = message[GameTools.RandomANumber(0, 2)];
                            Laya.Browser.window.wx.showToast({ title: curmes });
                            ShareUtil.callback(false);
                        }
                        else {
                            Laya.Browser.window.wx.showToast({ title: "分享成功!" });
                            ShareUtil.callback(true);
                        }
                    }
                }
            });
        }
        static ShareMessage() {
            if (!Laya.Browser.onWeiXin)
                return;
            var t = AccountManager.Instance.ServerTime;
            var _title = AccountManager.Instance.curplayerData.ShareTxt;
            _title = (_title == "" || !_title) ? "组团一起浪" : _title;
            var _image = "subpackage2/res/share/shareimage.png";
            Laya.Browser.window.wx.onShareAppMessage(() => ({
                title: _title,
                imageUrl: _image,
                query: "shareid=" + AccountManager.Instance.curplayerData.userId + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
            }));
        }
        static shareImage(channel, callback = null, shareType) {
            if (Laya.Browser.window.wx == null) {
                return;
            }
            var t = AccountManager.Instance.ServerTime;
            var _title = AccountManager.Instance.curplayerData.ShareTxt;
            _title = (_title == "" || !_title) ? "组团一起浪" : _title;
            var _image = "subpackage2/res/share/shareimage.png";
            Laya.Browser.window.wx.aldShareAppMessage({
                title: _title,
                imageUrl: _image,
                query: "userId=" + AccountManager.Instance.curplayerData.userId + "_" + shareType + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
            });
            if (callback) {
                ShareUtil.Instance.beginShare(callback);
            }
        }
    }
    ShareUtil.Instance = new ShareUtil();
    ShareUtil.shareSuccessTime = 0;
    ShareUtil.isSharing = false;

    class WXSDK {
        constructor() {
            WXSDK.ins = this;
        }
        static get Instance() {
            if (WXSDK.ins) {
                return WXSDK.ins;
            }
            else {
                return new WXSDK();
            }
        }
        static Init() {
        }
        static DengLu(_complete) {
            var that = this;
            Laya.Browser.window.wx.login({
                success: function (res) {
                    if (res.code) {
                        ShareUtil.Instance.onRegister();
                        console.log("微信登陆成功----");
                        that.codeValue = res.code;
                        console.log("shareid:" + WXSDK.shareOpenId);
                        new AccountManager(res.code, "", "", "", 0, "", "", "", "", WXSDK.shareOpenId, WXSDK.shareOpenId, Global.VERSION);
                        _complete(res);
                    }
                    else {
                        WXSDK.DengLu(WXSDK.DengLu);
                        console.log('wx no code' + res.errMsg);
                    }
                },
                fail: function (res) { console.log("wx.login: failed, res=" + res); }
            });
        }
        static ShowTxt(text) {
            if (Laya.Browser.onWeiXin) {
                Laya.Browser.window.wx.showToast({ title: text });
            }
            else {
                console.log(text);
            }
        }
        static OnShow(cb) {
            if (!Laya.Browser.onWeiXin)
                return;
            Laya.Browser.window.wx.onShow(cb);
        }
        static OffShow(cb) {
            if (!Laya.Browser.onWeiXin)
                return;
            Laya.Browser.window.wx.offShow(cb);
        }
        static OnHide(cb) {
            if (!Laya.Browser.onWeiXin)
                return;
            Laya.Browser.window.wx.onHide(cb);
        }
        static OffHide(cb) {
            if (!Laya.Browser.onWeiXin)
                return;
            Laya.Browser.window.wx.offHide(cb);
        }
        static ShortShake() {
            Laya.Browser.window.wx.vibrateShort({});
        }
        static LongShake() {
            Laya.Browser.window.wx.vibrateLong({});
        }
        static Shake(_short = true) {
            if (Laya.Browser.onWeiXin && WXSDK.shake) {
                if (_short) {
                    this.ShortShake();
                }
                else {
                    this.LongShake();
                }
            }
        }
        static LoadSubPackage(name, _complete) {
            if (Laya.Browser.onWeiXin) {
                const loadTask = Laya.Browser.window.wx.loadSubpackage({
                    name: 'subpackage',
                    success: function (res) {
                        _complete && _complete(true);
                        console.log("分包加载成功");
                    },
                    fail: function (res) {
                        _complete && _complete(false);
                        console.log("分包加载失败");
                    }
                });
            }
            else {
                console.log("未进行分包加载");
                _complete && _complete(true);
            }
        }
        static stageShake(callBack = null, speed = 32) {
            if (this.isShake || !this.canshakestage)
                return;
            this.isShake = true;
            var point = new Laya.Vector2(Laya.stage.x, Laya.stage.y);
            Laya.stage.timerLoop(speed, this, this.shakeObject, [point, callBack]);
        }
        static shakeObject(_point, _callBack) {
            var count = (this.num++) % 4;
            this.offsetArr[this.num % 2] = count < 2 ? 0 : this.offset;
            Laya.stage.x = this.offsetArr[0] + _point.x;
            Laya.stage.y = this.offsetArr[1] + _point.y;
            if (this.num > (this.times * 4 + 1)) {
                Laya.stage.clearTimer(this, this.shakeObject);
                Laya.stage.pos(0, 0);
                this.num = 0;
                this.isShake = false;
                if (_callBack != null) {
                    _callBack();
                }
            }
        }
        static UpdateGuide(ShowGuide = 0) {
            var kvDataList = new Array();
            let date = new Date().getTime();
            var myValue = JSON.stringify({
                "guide": {
                    "ShowGuide": ShowGuide,
                    "update_time": date.toString()
                }
            });
            kvDataList.push({ key: "ShowGuide", value: myValue });
            if (Laya.Browser.window.wx) {
                Laya.Browser.window.wx.setUserCloudStorage({
                    KVDataList: kvDataList,
                    success: r => {
                        console.log("KVDATALIST---", kvDataList);
                        console.log("上传新手指引成功:" + ShowGuide);
                    }
                });
            }
        }
        static UpdateScore(max_score) {
            var kvDataList = new Array();
            let date = new Date().getTime();
            var myValue = JSON.stringify({
                "wxgame": {
                    "max_score": max_score,
                    "update_time": date.toString(),
                }
            });
            kvDataList.push({ key: "max_score", value: myValue });
            if (Laya.Browser.window.wx) {
                Laya.Browser.window.wx.setUserCloudStorage({
                    KVDataList: kvDataList,
                    success: r => {
                        console.log("KVDATALIST---", kvDataList);
                        console.log("上传分数成功:" + max_score);
                    }
                });
            }
        }
        static fengxiangtupian(callback) {
            if (Laya.Browser.window.wx == null) {
                return;
            }
            var _title = "组团一起浪";
            var t = AccountManager.Instance.ServerTime;
            Laya.Browser.window.wx.aldShareAppMessage({
                title: _title,
                imageUrl: "subpackage2/res/share/shareimage.png",
                query: "userId=" + AccountManager.Instance.curplayerData.userId + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
            });
            if (callback) {
            }
        }
        static AldEvent(eventName, key = "用户id", value = "") {
        }
        static AldStart(stageId) {
        }
        static AldEnd(stageId, isComplete) {
        }
    }
    WXSDK.codeValue = "";
    WXSDK.shareOpenId = "";
    WXSDK.openId = 0;
    WXSDK.shareScene = "";
    WXSDK.uid = "123";
    WXSDK.querychannel = "";
    WXSDK.referrerInfoappId = "";
    WXSDK.shake = true;
    WXSDK.times = 1.3;
    WXSDK.num = 0;
    WXSDK.offsetArr = [0, 0];
    WXSDK.offset = 14;
    WXSDK.canshakestage = false;

    class LoadView extends ui.LoadViewUI {
        constructor() {
            super();
            this.progressnum = 0;
            this.fast = 0.07;
            this.slow = 0.005;
            this.End = false;
            this.EndProgress = false;
            LoadView.ins = this;
            Laya.stage.addChild(this);
            this.Init();
        }
        static get Instance() {
            if (LoadView.ins == null) {
                return new LoadView();
            }
            return LoadView.ins;
        }
        Init() {
            this.Login();
            Laya.timer.loop(1, this, this.UpdateProgress);
            this.height = Laya.stage.height;
            Laya.stage.on(Laya.Event.RESIZE, this, () => {
                this.height = Laya.stage.height;
            });
        }
        UpdateProgress() {
            if (this.progressnum <= 0.7) {
                this.progressnum += this.fast;
            }
            else if (this.progressnum > 0.7 && this.progressnum < 0.99) {
                this.progressnum += this.slow;
            }
            else {
                if (this.End) {
                    this.progressnum += this.slow;
                }
            }
            if (!this.EndProgress && this.progressnum >= 1) {
                this.EndProgress = true;
                this.progressnum = 1;
                Laya.timer.clear(this, this.UpdateProgress);
                this.LoadComplete();
            }
            this.jindupro.value = this.progressnum;
        }
        Login() {
            WXSDK.AldEvent("开始登陆");
            if (Laya.Browser.onWeiXin) {
                this.LoginWx();
            }
            else {
                this.LoginLocal();
            }
        }
        LoginWx() {
            if (Laya.Browser.onWeiXin) {
                WXSDK.DengLu((res) => {
                    if (res != "error") {
                        WXSDK.AldEvent("微信登陆成功");
                        console.log("1微信登录成功:" + res);
                        this.LoginLocal();
                    }
                    else {
                        this.LoginWx();
                    }
                });
            }
            else {
                this.LoginLocal();
            }
        }
        LoginLocal() {
            ServerManager.Instance.Login(null, Laya.Handler.create(this, this.LoginComplete), Laya.Handler.create(this, this.LoginFail));
        }
        LoginComplete() {
            WXSDK.AldEvent("本地服务器登陆成功");
            console.log("本地服务器登陆成功");
            GuangGao.InitVideo();
            if (Laya.Browser.onWeiXin) {
                this.LoadSubPackage();
            }
            else {
                this.LoadScene();
            }
        }
        LoginFail() {
            console.log("本地服务器登陆失败");
        }
        LoadSubPackage() {
            Laya.Browser.window.wx.loadSubpackage({
                name: 'subpackage',
                success: (res) => {
                    WXSDK.AldEvent("分包1加载成功");
                    this.LoadSubPackage2();
                },
                fail: (res) => {
                    this.LoadSubPackage();
                }
            });
        }
        LoadSubPackage2() {
            Laya.Browser.window.wx.loadSubpackage({
                name: 'subpackage2',
                success: (res) => {
                    WXSDK.AldEvent("分包2加载成功");
                    this.LoadScene();
                },
                fail: (res) => {
                    this.LoadSubPackage2();
                }
            });
        }
        LoadScene() {
            Laya.Scene3D.load(ResourcesPath.mainscene, Laya.Handler.create(this, (sprite) => {
                this.mainscene = sprite;
                AssetManager.Instance.mainscene = this.mainscene;
                WXSDK.AldEvent("场景资源加载完毕");
                this.LoadRole();
            }));
            console.log("场景资源加载成功");
        }
        LoadRole() {
            var arr = [];
            for (let i = 0; i < ResourcesPath.Character.length; i++) {
                let item = ResourcesPath.Character[i];
                arr.push(item);
            }
            Laya.loader.create(arr, Laya.Handler.create(this, () => {
                for (let i = 0; i < ResourcesPath.Character.length; i++) {
                    let model = Laya.loader.getRes(ResourcesPath.Character[i]);
                    AssetManager.Instance.Character.set(i + 1, model);
                    Laya.loader.clearRes(ResourcesPath.Character[i]);
                }
                console.log("玩家模型加载成功");
                WXSDK.AldEvent("玩家模型加载完毕");
                this.LoadResources();
            }));
        }
        LoadResources() {
            var arr = [];
            for (let i = 0; i < ResourcesPath.Prop.length; i++) {
                let item = ResourcesPath.Prop[i];
                arr.push(item);
            }
            Laya.loader.create(arr, Laya.Handler.create(this, () => {
                arr.forEach(s => {
                    if (s.progress == 1) {
                        let sp = Laya.loader.getRes(s.url);
                        AssetManager.Instance.Prop.set(sp.name, sp);
                    }
                    else {
                        console.log(`[LOG]${s.url}加载失败`);
                    }
                }, this);
                console.log("道具模型加载成功");
                WXSDK.AldEvent("道具模型加载完毕");
                this.complete();
            }));
        }
        complete() {
            this.End = true;
            this.slow = this.fast;
            DispatcherManager.EventTrigger(EventState.LoadComplete);
        }
        LoadComplete() {
            this.destroy();
        }
    }

    class Main {
        constructor() {
            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;
            if (Laya.Browser.onWeiXin) {
                Laya.Browser.window.wx.showShareMenu({
                    withShareTicket: true
                });
                Laya.Browser.window.wx.onShareAppMessage(function () {
                    return {
                        title: "组团一起浪",
                        imageUrl: "subpackage2/res/share/shareimage.png",
                    };
                });
                Laya.Browser.window.wx.onShow((option) => {
                    var shareTicket = option.shareTicket;
                    var userId = option.query.userId;
                    var shareTitle = option.query.shareTitle;
                    Main.SceneNum = option.scene;
                    WXSDK.querychannel = option.query.channel;
                    WXSDK.shareOpenId = option.query.userId;
                    console.log("scene:", option.scene);
                    if (WXSDK.querychannel != null) {
                        console.log("onShow channel is:", WXSDK.querychannel);
                    }
                    if (option.referrerInfo) {
                        WXSDK.referrerInfoappId = option.referrerInfo.appId;
                        console.log("onShow appId is:", option.referrerInfo.appId);
                    }
                });
                if (!Laya.Browser.onWeiXin)
                    return;
                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();
                        }
                    });
                });
            }
            Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
        }
        onVersionLoaded() {
            Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
        }
        onConfigLoaded() {
            new LoadView();
        }
    }
    Main.SceneNum = "123";
    new Main();

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