var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameDefined_1 = require("./script/GameLogic/GameDefined");
var SceneController_1 = require("./script/GameLogic/SceneController");
var OimoHelper_1 = require("./script/Oimo/OimoHelper");
var ViewManager_1 = require("./script/GameLogic/ViewManager");
var AssetController = /** @class */ (function () {
    function AssetController() {
    }
    Object.defineProperty(AssetController, "Instance", {
        get: function () {
            return this.instance || (this.instance = new AssetController());
        },
        enumerable: true,
        configurable: true
    });
    AssetController.prototype.GameStart = function () {
        Laya.loader.create(GameDefined_1.default.main_path, new Laya.Handler(this, function (res) {
            var _scene = res;
            OimoHelper_1.default.Inst.createWolrd();
            SceneController_1.SceneController.Instance.Init(_scene);
            ViewManager_1.default.Instance.OpenView(ViewManager_1.ViewType.game_ui);
        }));
    };
    // private CreateBody() {
    //     var panel = this.panel.addComponent(StandBehaviour) as StandBehaviour;
    //     var data = new OimoBodyData();
    //     data.move = false;
    //     data.type = "box";
    //     panel.init(data);
    //     for (let index = 0; index < this.move._children.length; index++) {
    //         const element = this.move._children[index];
    //         var shell = element.addComponent(ShellBehaviour) as ShellBehaviour;
    //         var data1 = new OimoBodyData();
    //         data1.move = true;
    //         data1.type = "box";
    //         data1.friction=3;
    //         shell.init(data1);
    //     }
    //     var player = this.cube1.addComponent(PlayerBehaviour) as PlayerBehaviour;
    //     var data2 = new OimoBodyData();
    //     data2.move = true;
    //     data2.type = "box";
    //     data2.kinematic = true;
    //     data2.name = 1000;
    //     player.init(data2);
    // }
    AssetController.prototype.MouseContr = function () {
        Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.OnClickDown);
        Laya.stage.on(Laya.Event.MOUSE_UP, this, this.OnClickUp);
        Laya.stage.on(Laya.Event.MOUSE_OUT, this, this.OnClickUp);
    };
    AssetController.prototype.OnClickDown = function (e) {
        Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.OnSlider);
        this.curMousePos = new Laya.Vector3(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY);
        console.log(this.curMousePos);
    };
    AssetController.prototype.OnClickUp = function () {
        Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.OnSlider);
        var MousePos = new Laya.Vector3(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY);
        console.log(MousePos);
    };
    AssetController.prototype.OnSlider = function () {
        var MousePos = new Laya.Vector3(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY);
        var offestX = MousePos.x - this.curMousePos.x;
        var offestZ = MousePos.y - this.curMousePos.y;
        if (offestX > 0)
            offestX = offestX < 0.1 ? offestX : 0.1;
        if (offestX < 0)
            offestX = offestX > -0.1 ? offestX : -0.1;
        if (offestZ > 0)
            offestZ = offestZ < 0.1 ? offestZ : 0.1;
        if (offestZ < 0)
            offestZ = offestZ > -0.1 ? offestZ : -0.1;
        console.log(offestX);
        // this.cube1.transform.localPositionX += offestX;
        // this.cube1.transform.localPositionZ += offestZ;
        this.curMousePos = new Laya.Vector3(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY);
        ;
    };
    return AssetController;
}());
exports.default = AssetController;
},{"./script/GameLogic/GameDefined":11,"./script/GameLogic/SceneController":14,"./script/GameLogic/ViewManager":15,"./script/Oimo/OimoHelper":19}],2:[function(require,module,exports){
"use strict";
/**This class is automatically generated by LayaAirIDE, please do not make any modifications. */
Object.defineProperty(exports, "__esModule", { value: true });
/*
* 游戏初始化配置;
*/
var GameConfig = /** @class */ (function () {
    function GameConfig() {
    }
    GameConfig.init = function () {
        var reg = Laya.ClassUtils.regClass;
    };
    GameConfig.width = 720;
    GameConfig.height = 1280;
    GameConfig.scaleMode = "fixedwidth";
    GameConfig.screenMode = "none";
    GameConfig.alignV = "middle";
    GameConfig.alignH = "center";
    GameConfig.startScene = "game_ui.scene";
    GameConfig.sceneRoot = "";
    GameConfig.debug = false;
    GameConfig.stat = false;
    GameConfig.physicsDebug = false;
    GameConfig.exportSceneToJson = true;
    return GameConfig;
}());
exports.default = GameConfig;
GameConfig.init();
},{}],3:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameConfig_1 = require("./GameConfig");
var AssetController_1 = require("./AssetController");
var Main = /** @class */ (function () {
    function Main() {
        //根据IDE设置初始化引擎		
        if (window["Laya3D"])
            Laya3D.init(GameConfig_1.default.width, GameConfig_1.default.height);
        else
            Laya.init(GameConfig_1.default.width, GameConfig_1.default.height, Laya["WebGL"]);
        Laya["Physics"] && Laya["Physics"].enable();
        Laya["DebugPanel"] && Laya["DebugPanel"].enable();
        Laya.stage.scaleMode = GameConfig_1.default.scaleMode;
        Laya.stage.screenMode = GameConfig_1.default.screenMode;
        //兼容微信不支持加载scene后缀场景
        Laya.URL.exportSceneToJson = GameConfig_1.default.exportSceneToJson;
        //打开调试面板（通过IDE设置调试模式，或者url地址增加debug=true参数，均可打开调试面板）
        if (GameConfig_1.default.debug || Laya.Utils.getQueryString("debug") == "true")
            Laya.enableDebugPanel();
        if (GameConfig_1.default.physicsDebug && Laya["PhysicsDebugDraw"])
            Laya["PhysicsDebugDraw"].enable();
        if (GameConfig_1.default.stat)
            Laya.Stat.show();
        Laya.alertGlobalError = true;
        Main.isWx = Laya.Browser.onWeiXin;
        Main.nowratio = Laya.stage.width / Laya.stage.height;
        //激活资源版本控制，version.json由IDE发布功能自动生成，如果没有也不影响后续流程
        Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
    }
    Main.prototype.onVersionLoaded = function () {
        //激活大小图映射，加载小图的时候，如果发现小图在大图合集里面，则优先加载大图合集，而不是小图
        Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
    };
    Main.prototype.onConfigLoaded = function () {
        AssetController_1.default.Instance.GameStart();
    };
    return Main;
}());
exports.Main = Main;
//激活启动类
new Main();
},{"./AssetController":1,"./GameConfig":2}],4:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var OimoRigibody_1 = require("../Oimo/OimoRigibody");
var OimoBodyData_1 = require("../Oimo/OimoBodyData");
var PassivityBehaviour = /** @class */ (function (_super) {
    __extends(PassivityBehaviour, _super);
    function PassivityBehaviour() {
        return _super.call(this) || this;
    }
    // private disZ: number = 35;
    // private disY: number = -2;
    // private speed: number = 500;
    // private tempvev: Laya.Vector3 = new Laya.Vector3();
    // private velocity: Laya.Vector3;
    // private tragetZ: number = 0;
    // private force: Laya.Vector3 = new Laya.Vector3();
    PassivityBehaviour.prototype.init = function (data) {
        if (!data)
            data = new OimoBodyData_1.default();
        data.move = true;
        //  data.density=0;
        //data.friction=0;
        //data.restitution=2;
        _super.prototype.init.call(this, data);
    };
    // public setData(vec: Laya.Vector3) {
    //     this.velocity = vec;
    //     this.tragetZ = this.transform.position.z + this.disZ;
    //     let pos = this.transform.position;
    //     let forceVec3 = new OIMO.Vec3(vec.x, vec.y, vec.z * 300);
    //     let posVec3 = new OIMO.Vec3(pos.x, pos.y, pos.z);
    //     this.body.applyImpulse(posVec3, forceVec3);
    // }
    PassivityBehaviour.prototype.onAwake = function () {
    };
    PassivityBehaviour.prototype.onStart = function () {
    };
    PassivityBehaviour.prototype.onUpdate = function () {
        _super.prototype.onUpdate.call(this);
        _super.prototype.checkContact.call(this, 1111);
    };
    PassivityBehaviour.prototype.onDisable = function () {
        if (this.body && this.body.parent)
            this.body.dispose();
        this.body = null;
    };
    return PassivityBehaviour;
}(OimoRigibody_1.default));
exports.default = PassivityBehaviour;
},{"../Oimo/OimoBodyData":18,"../Oimo/OimoRigibody":20}],5:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var OimoRigibody_1 = require("../Oimo/OimoRigibody");
var OimoBodyData_1 = require("../Oimo/OimoBodyData");
var GameDefined_1 = require("../GameLogic/GameDefined");
var PlayerBehaviour = /** @class */ (function (_super) {
    __extends(PlayerBehaviour, _super);
    function PlayerBehaviour() {
        var _this = _super.call(this) || this;
        _this.bodyVc3 = new OIMO.Vec3(0, 0, 0);
        _this.bodyQut = new OIMO.Quat(0, 0, 0, 1);
        return _this;
    }
    PlayerBehaviour.prototype.init = function (data) {
        if (!data)
            data = new OimoBodyData_1.default();
        data.move = true;
        data.kinematic = true;
        data.name = GameDefined_1.default.playerbodyname;
        _super.prototype.init.call(this, data);
    };
    PlayerBehaviour.prototype.onAwake = function () {
    };
    PlayerBehaviour.prototype.onStart = function () {
    };
    PlayerBehaviour.prototype.onUpdate = function () {
        var transPos = this.transform.position;
        var transQut = this.transform.rotation;
        this.bodyVc3.set(transPos.x, transPos.y, transPos.z);
        this.bodyQut.set(transQut.x, transQut.y, transQut.z, transQut.w);
        this.body.setPosition(this.bodyVc3);
        this.body.setQuaternion(this.bodyQut);
    };
    PlayerBehaviour.prototype.checkContact = function (name) {
        return false;
    };
    PlayerBehaviour.prototype.onDisable = function () {
        if (this.body && this.body.parent)
            this.body.dispose();
        this.body = null;
    };
    Object.defineProperty(PlayerBehaviour.prototype, "name", {
        get: function () {
            if (this.body)
                return this.body.name;
            return -1;
        },
        enumerable: true,
        configurable: true
    });
    return PlayerBehaviour;
}(OimoRigibody_1.default));
exports.default = PlayerBehaviour;
},{"../GameLogic/GameDefined":11,"../Oimo/OimoBodyData":18,"../Oimo/OimoRigibody":20}],6:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var OimoRigibody_1 = require("../Oimo/OimoRigibody");
var OimoBodyData_1 = require("../Oimo/OimoBodyData");
var StandBehaviour = /** @class */ (function (_super) {
    __extends(StandBehaviour, _super);
    function StandBehaviour() {
        return _super.call(this) || this;
    }
    StandBehaviour.prototype.init = function (data) {
        if (!data)
            data = new OimoBodyData_1.default();
        data.move = false;
        _super.prototype.init.call(this, data);
    };
    StandBehaviour.prototype.onAwake = function () {
    };
    StandBehaviour.prototype.onUpdate = function () {
    };
    StandBehaviour.prototype.onStart = function () {
    };
    StandBehaviour.prototype.onDisable = function () {
        if (this.body && this.body.parent) {
            this.body.dispose();
            this.body.id = -1;
            this.body.name = -1;
        }
        this.body = null;
    };
    return StandBehaviour;
}(OimoRigibody_1.default));
exports.default = StandBehaviour;
},{"../Oimo/OimoBodyData":18,"../Oimo/OimoRigibody":20}],7:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Vector3 = Laya.Vector3;
var Game_Tool_1 = require("../Util/Game_Tool");
var Main_1 = require("../../Main");
var GameController_1 = require("./GameController");
var GameDefined_1 = require("./GameDefined");
var PlayerController_1 = require("./PlayerController");
var CameraBehavior = /** @class */ (function (_super) {
    __extends(CameraBehavior, _super);
    //  private p_c_dis: number = 0;
    function CameraBehavior() {
        var _this = _super.call(this) || this;
        _this.origPos = new Vector3(0, 12.88, -3.48);
        _this.speed = 0;
        _this.startShake = false; //camera是否开始震动
        _this.seconds = 0; //震动持续秒数
        _this.started = false; //是否已经开始震动
        _this.quake = 0.2; //震动系数
        return _this;
    }
    CameraBehavior.prototype.onAwake = function () {
        this.selfObj = this.owner;
        this._tran = this.selfObj.transform;
        var origSize = this.selfObj.fieldOfView;
        var origratio = 0.5; //    原始屏幕的宽高比 720/1280
        var nowratio = Main_1.Main.nowratio;
        var nowSize = Main_1.Main.nowratio * origSize / origratio;
        this.selfObj.fieldOfView = nowSize;
        this.speed = GameDefined_1.default.moveSpeed;
        // GameDefined.minDis= Main.nowratio * GameDefined.minDis * origratio;
        // console.log(GameDefined.minDis);
        var dis = Vector3.distance(PlayerController_1.PlayerController.Instance.player.transform.position, this._tran.position);
    };
    CameraBehavior.prototype.onUpdate = function () {
        if (GameController_1.GameController.Instance.gamestart)
            this._tran.localPositionZ += this.speed;
    };
    CameraBehavior.prototype.onDestroy = function () {
    };
    CameraBehavior.prototype.ShakeFor = function (a, b) {
        this.camPOS = this.selfObj.transform.position.clone();
        this.seconds = a;
        this.started = true;
        this.startShake = true;
        this.quake = b;
    };
    CameraBehavior.prototype.onLateUpdate = function () {
        var _this = this;
        if (this.startShake) {
            this.Quake();
        }
        if (this.started) {
            this.started = false;
            Laya.timer.once(this.seconds * 1000, this, function () {
                _this.startShake = false;
                _this.selfObj.transform.position = _this.camPOS;
            });
        }
    };
    CameraBehavior.prototype.Quake = function () {
        var x = Game_Tool_1.default.random_1to1() * this.quake;
        var y = Game_Tool_1.default.random_1to1() * this.quake;
        var z = Game_Tool_1.default.random_1to1() * this.quake;
        var temp = new Vector3(this.camPOS.x + Math.random() * this.quake, this.camPOS.y + Math.random() * this.quake, this.camPOS.z + Math.random() * this.quake);
        this.selfObj.transform.position = temp;
    };
    return CameraBehavior;
}(Laya.Script3D));
exports.default = CameraBehavior;
},{"../../Main":3,"../Util/Game_Tool":22,"./GameController":10,"./GameDefined":11,"./PlayerController":13}],8:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameDefined_1 = require("./GameDefined");
var DealPackaging = /** @class */ (function () {
    function DealPackaging() {
    }
    DealPackaging.DealLayer = function (_layaer) {
        if (_layaer == GameDefined_1.BodyType.box) {
            return "box";
        }
        else if (_layaer == GameDefined_1.BodyType.sphere) {
            return "sphere";
        }
        else if (_layaer == GameDefined_1.BodyType.cylinder) {
            return "cylinder";
        }
        else if (_layaer == GameDefined_1.BodyType.plane) {
            return "plane";
        }
        else {
            return "box";
        }
    };
    return DealPackaging;
}());
exports.DealPackaging = DealPackaging;
},{"./GameDefined":11}],9:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var EventManager = /** @class */ (function () {
    function EventManager() {
    }
    Object.defineProperty(EventManager, "Disispatcher", {
        get: function () {
            return EventManager.disispatcher || (EventManager.disispatcher = new Laya.EventDispatcher());
        },
        enumerable: true,
        configurable: true
    });
    EventManager.on = function (type, call, data) {
        this.Disispatcher.on(type, call, data);
    };
    EventManager.off = function (type, call, data) {
        this.Disispatcher.off(type, call, data);
    };
    EventManager.event = function (type, data) {
        if (data === void 0) { data = null; }
        this.Disispatcher.event(type, data);
    };
    return EventManager;
}());
exports.EventManager = EventManager;
},{}],10:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameController = /** @class */ (function () {
    function GameController() {
        this.gamestart = false;
    }
    Object.defineProperty(GameController, "Instance", {
        get: function () {
            return GameController.instance || (GameController.instance = new GameController());
        },
        enumerable: true,
        configurable: true
    });
    return GameController;
}());
exports.GameController = GameController;
},{}],11:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameDefined = /** @class */ (function () {
    function GameDefined() {
    }
    GameDefined.main_path = "res/LayaScene_main/Conventional/main.ls";
    GameDefined.playerbodyname = 1111;
    GameDefined.maxDis = 26.53; //玩家和相机的最大距离
    GameDefined.minDis = 13;
    GameDefined.x_player = 5; // 玩家可以在左右的距离
    GameDefined.moveSpeed = 0.04;
    return GameDefined;
}());
exports.default = GameDefined;
var BodyType;
(function (BodyType) {
    BodyType[BodyType["sphere"] = 8] = "sphere";
    BodyType[BodyType["cylinder"] = 9] = "cylinder";
    BodyType[BodyType["box"] = 10] = "box";
    BodyType[BodyType["plane"] = 11] = "plane";
})(BodyType = exports.BodyType || (exports.BodyType = {}));
var ColorType;
(function (ColorType) {
    ColorType[ColorType["white"] = 1] = "white";
    ColorType[ColorType["red"] = 2] = "red";
    ColorType[ColorType["yellow"] = 3] = "yellow";
    ColorType[ColorType["purple"] = 4] = "purple";
    ColorType[ColorType["black"] = 5] = "black";
})(ColorType = exports.ColorType || (exports.ColorType = {}));
},{}],12:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PassivityBehaviour_1 = require("../Behaviour/PassivityBehaviour");
var ObsController = /** @class */ (function () {
    function ObsController() {
    }
    Object.defineProperty(ObsController, "Instance", {
        get: function () {
            return ObsController.instance || (ObsController.instance = new ObsController());
        },
        enumerable: true,
        configurable: true
    });
    ObsController.prototype.Init = function (obs) {
        if (obs && obs.length > 0) {
            for (var index = 0; index < obs.length; index++) {
                for (var j = 0; j < obs[index]._children.length; j++) {
                    var element = obs[index].getChildAt(j);
                    var _o = element.getChildAt(0);
                    var _pb = _o.addComponent(PassivityBehaviour_1.default);
                    _pb.init();
                }
            }
        }
    };
    return ObsController;
}());
exports.ObsController = ObsController;
},{"../Behaviour/PassivityBehaviour":4}],13:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PlayerBehaviour_1 = require("../Behaviour/PlayerBehaviour");
var player_1 = require("./player");
var SceneController_1 = require("./SceneController");
var Vector3 = Laya.Vector3;
var GameDefined_1 = require("./GameDefined");
var PlayerController = /** @class */ (function () {
    function PlayerController() {
        this.tempPos = new Vector3(0, 0.5, 0);
    }
    Object.defineProperty(PlayerController, "Instance", {
        get: function () {
            return PlayerController.instance || (PlayerController.instance = new PlayerController());
        },
        enumerable: true,
        configurable: true
    });
    PlayerController.prototype.Init = function (_p) {
        if (_p) {
            this.player = _p;
            var _pb = this.player.getChildAt(0).getComponent(PlayerBehaviour_1.default);
            if (!_pb)
                _pb = this.player.addComponent(PlayerBehaviour_1.default);
            _pb.init();
            this.playerBehave = this.player.getComponent(player_1.Player);
            if (!this.playerBehave)
                this.playerBehave = this.player.addComponent(player_1.Player);
        }
    };
    PlayerController.prototype.StartSliderPlayer = function (_y, _x) {
        this.playerBehave.SetSpeed(_y * 0.01, _x * 0.01);
        this.JundgePByCDis();
    };
    PlayerController.prototype.JundgePByCDis = function () {
        var camera = SceneController_1.SceneController.Instance._camera;
        this.tempPos.z = this.player.transform.position.z;
        var dis = Vector3.distance(this.tempPos, camera.transform.position);
        if (dis <= GameDefined_1.default.minDis || dis >= GameDefined_1.default.maxDis) {
            this.StopSliderPlayer();
        }
    };
    PlayerController.prototype.StopSliderPlayer = function () {
        this.playerBehave.SetSpeed();
    };
    return PlayerController;
}());
exports.PlayerController = PlayerController;
},{"../Behaviour/PlayerBehaviour":5,"./GameDefined":11,"./SceneController":14,"./player":16}],14:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PlayerController_1 = require("./PlayerController");
var ObsController_1 = require("./ObsController");
var StandBehaviour_1 = require("../Behaviour/StandBehaviour");
var CameraBehavior_1 = require("./CameraBehavior");
var SceneController = /** @class */ (function () {
    function SceneController() {
    }
    Object.defineProperty(SceneController, "Instance", {
        get: function () {
            return SceneController.instance || (SceneController.instance = new SceneController());
        },
        enumerable: true,
        configurable: true
    });
    SceneController.prototype.Init = function (_s) {
        if (_s) {
            Laya.stage.addChild(_s);
        }
        else {
            console.error("场景不存在");
            return;
        }
        var road = _s.getChildByName("road");
        var obs = road.getChildByName("road")._children;
        this.floor = road.getChildByName("floor").getChildAt(0);
        var player = _s.getChildByName("player");
        this._camera = _s.getChildByName("Main Camera");
        PlayerController_1.PlayerController.Instance.Init(player);
        ObsController_1.ObsController.Instance.Init(obs);
        this.InitScene();
        this._camera.addComponent(CameraBehavior_1.default);
    };
    SceneController.prototype.InitScene = function () {
        if (this.floor) {
            var floor = this.floor.getComponent(StandBehaviour_1.default);
            if (!floor)
                floor = this.floor.addComponent(StandBehaviour_1.default);
            floor.init();
        }
    };
    return SceneController;
}());
exports.SceneController = SceneController;
},{"../Behaviour/StandBehaviour":6,"./CameraBehavior":7,"./ObsController":12,"./PlayerController":13}],15:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Dictionary_1 = require("../Util/Dictionary");
var game_ui_1 = require("../Gameui/game_ui");
var ViewType;
(function (ViewType) {
    ViewType[ViewType["game_ui"] = 0] = "game_ui";
})(ViewType = exports.ViewType || (exports.ViewType = {}));
var ViewManager = /** @class */ (function () {
    function ViewManager() {
        this.viewDic = [];
        this.addViewDic = new Dictionary_1.default();
        this.init();
    }
    Object.defineProperty(ViewManager, "Instance", {
        get: function () {
            return this.instance || (this.instance = new ViewManager());
        },
        enumerable: true,
        configurable: true
    });
    ViewManager.prototype.init = function () {
        this.viewDic[ViewType.game_ui] = game_ui_1.game_ui;
    };
    ViewManager.prototype.OpenView = function (view, data) {
        if (this.curView != null) {
            this.curView.OnClose();
            Laya.stage.removeChild(this.curView);
            //    var  a:Laya.Scene;
            //    a.destroy()
            this.curView.destroy(true);
            this.curView = null;
        }
        this.curView = new this.viewDic[view];
        Laya.stage.addChild(this.curView);
        // this.curView.resizeHander();
        this.curView.OnShow(data);
    };
    Object.defineProperty(ViewManager.prototype, "getCurView", {
        get: function () {
            return this.curView;
        },
        enumerable: true,
        configurable: true
    });
    ViewManager.prototype.AddView = function (view, data) {
        if (this.addViewDic.has(view))
            return;
        var t_view = new this.viewDic[view];
        this.addViewDic.set(view, t_view);
        Laya.stage.addChild(t_view);
        t_view.OnShow(data);
    };
    ViewManager.prototype.RemoveView = function () {
        if (this.curView != null) {
            this.curView.OnClose();
            Laya.stage.removeChild(this.curView);
            this.curView.destroy(true);
            this.curView = null;
        }
    };
    ViewManager.prototype.CloseView = function (view) {
        if (!this.addViewDic.has(view))
            return;
        var t_view = this.addViewDic.get(view);
        t_view.OnClose();
        Laya.stage.removeChild(t_view);
        t_view.destroy(true);
        this.addViewDic.delete(view);
    };
    ViewManager.prototype.OpenMask = function () {
        if (this.curMask != null) {
            return;
        }
        //  this.curMask = new Mask_ui();
        if (!this.curMask)
            return;
        Laya.stage.addChild(this.curMask);
    };
    ViewManager.prototype.CloseMask = function () {
        if (this.curMask != null) {
            this.curMask.OnClose();
            Laya.stage.removeChild(this.curMask);
            this.curMask.destroy(true);
            this.curMask = null;
        }
    };
    return ViewManager;
}());
exports.default = ViewManager;
},{"../Gameui/game_ui":17,"../Util/Dictionary":21}],16:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GameDefined_1 = require("./GameDefined");
var GameController_1 = require("./GameController");
var Vector3 = Laya.Vector3;
var Player = /** @class */ (function (_super) {
    __extends(Player, _super);
    function Player() {
        var _this = _super.call(this) || this;
        _this._speed = Vector3._ZERO.clone();
        return _this;
    }
    Player.prototype.onAwake = function () {
        this.self = this.owner;
        this._tran = this.self.transform;
        this.SetSpeed();
    };
    Player.prototype.onUpdate = function () {
        if (GameController_1.GameController.Instance.gamestart) {
            this._tran.localPositionZ += this._speed.y;
            this._tran.localPositionX += this._speed.x;
            if (this._tran.localPositionX >= 5)
                this._tran.localPositionX = 5;
            if (this._tran.localPositionX <= -5)
                this._tran.localPositionX = -5;
        }
    };
    Player.prototype.SetSpeed = function (_Y, _X) {
        if (!_Y) {
            this._speed.y = GameDefined_1.default.moveSpeed;
        }
        else {
            this._speed.y = GameDefined_1.default.moveSpeed + _Y;
        }
        ;
        if (!_X) {
            this._speed.x = 0;
        }
        else {
            this._speed.x = _X;
        }
    };
    return Player;
}(Laya.Script3D));
exports.Player = Player;
},{"./GameController":10,"./GameDefined":11}],17:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var layaMaxUI_1 = require("../../ui/layaMaxUI");
var EventManager_1 = require("../GameLogic/EventManager");
var PlayerController_1 = require("../GameLogic/PlayerController");
var Vector3 = Laya.Vector3;
var GameController_1 = require("../GameLogic/GameController");
var game_ui = /** @class */ (function (_super) {
    __extends(game_ui, _super);
    function game_ui() {
        var _this = _super.call(this) || this;
        _this._mousePos = Vector3._ZERO.clone();
        _this.tempMouse = Vector3._ZERO.clone();
        _this.tar = Vector3._ZERO.clone();
        _this.lerpPos = Vector3._ZERO.clone();
        _this.clickD = false;
        _this.resizeHander();
        EventManager_1.EventManager.on(Laya.Event.RESIZE, _this, _this.resizeHander);
        return _this;
    }
    game_ui.prototype.resizeHander = function () {
        this.height = Laya.stage.height;
    };
    game_ui.prototype.OnShow = function (data) {
        this.initEvent();
        this.initData();
    };
    game_ui.prototype.initEvent = function () {
        var _this = this;
        this.on(Laya.Event.MOUSE_DOWN, this, this.OnClickDown);
        this.on(Laya.Event.MOUSE_UP, this, this.OnClickUp);
        this.on(Laya.Event.MOUSE_OUT, this, this.OnClickUp);
        this.startBtn.clickHandler = new Laya.Handler(this, function () {
            GameController_1.GameController.Instance.gamestart = true;
            _this.startBtn.visible = false;
        });
    };
    game_ui.prototype.offEvent = function () {
        EventManager_1.EventManager.off(Laya.Event.RESIZE, this, this.resizeHander);
        this.off(Laya.Event.MOUSE_DOWN, this, this.OnClickDown);
        this.off(Laya.Event.MOUSE_UP, this, this.OnClickUp);
        this.off(Laya.Event.MOUSE_OUT, this, this.OnClickUp);
    };
    game_ui.prototype.initData = function () {
        var p = PlayerController_1.PlayerController.Instance.player;
        if (p)
            this.pTrans = p.transform;
    };
    game_ui.prototype.OnClickDown = function (e) {
        if (!GameController_1.GameController.Instance.gamestart)
            return;
        this.clickD = true;
        ;
        this.on(Laya.Event.MOUSE_MOVE, this, this.OnSlider);
        this._mousePos.x = Laya.MouseManager.instance.mouseX;
        this._mousePos.z = Laya.MouseManager.instance.mouseY;
    };
    game_ui.prototype.OnClickUp = function (e) {
        if (!this.clickD)
            return;
        if (!GameController_1.GameController.Instance.gamestart)
            return;
        this.clickD = false;
        this.off(Laya.Event.MOUSE_MOVE, this, this.OnSlider);
        PlayerController_1.PlayerController.Instance.StopSliderPlayer();
    };
    game_ui.prototype.OnSlider = function (e) {
        this.tempMouse.x = Laya.MouseManager.instance.mouseX;
        this.tempMouse.z = Laya.MouseManager.instance.mouseY;
        var offestX = this.tempMouse.x - this._mousePos.x;
        var offestZ = this.tempMouse.z - this._mousePos.z;
        if (offestX >= 0)
            offestX = offestX < 10 ? offestX : 10;
        if (offestX < 0)
            offestX = offestX > -10 ? offestX : -10;
        if (offestZ >= 0)
            offestZ = offestZ < 10 ? offestZ : 10;
        if (offestZ < 0)
            offestZ = offestZ > -10 ? offestZ : -10;
        // if (this.pTrans) {
        //     this.tar.x = this.pTrans.localPositionX -= offestX;
        //     this.tar.y = this.pTrans.localPositionY;
        //     this.tar.z = this.pTrans.localPositionZ -= offestY;
        // }
        // Vector3.lerp(this.pTrans.localPosition, this.tar, 0.1, this.lerpPos);
        // this.pTrans.localPositionX = this.lerpPos.x;
        // this.pTrans.localPositionZ = this.lerpPos.z;
        PlayerController_1.PlayerController.Instance.StartSliderPlayer(-offestZ, -offestX);
        this._mousePos.x = Laya.MouseManager.instance.mouseX;
        this._mousePos.z = Laya.MouseManager.instance.mouseY;
    };
    game_ui.prototype.OnClose = function () {
        this.offEvent();
    };
    return game_ui;
}(layaMaxUI_1.ui.game_uiUI));
exports.game_ui = game_ui;
},{"../../ui/layaMaxUI":23,"../GameLogic/EventManager":9,"../GameLogic/GameController":10,"../GameLogic/PlayerController":13}],18:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var OimoBodyData = /** @class */ (function () {
    function OimoBodyData() {
    }
    return OimoBodyData;
}());
exports.default = OimoBodyData;
},{}],19:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var OimoHelper = /** @class */ (function () {
    function OimoHelper() {
    }
    Object.defineProperty(OimoHelper, "Inst", {
        get: function () {
            if (this.instance == null) {
                this.instance = new OimoHelper();
            }
            return this.instance;
        },
        enumerable: true,
        configurable: true
    });
    OimoHelper.prototype.createWolrd = function () {
        this.world = new OIMO.World({
            timestep: 1 / 60,
            iterations: 8,
            broadphase: 2,
            worldscale: 1,
            random: true,
            info: false,
            gravity: [0, -100, 0]
        });
        this.world.play();
    };
    OimoHelper.prototype.createBody = function (data) {
        return this.world.add(data);
    };
    OimoHelper.prototype.clearWorld = function () {
        if (this.world) {
            this.world.clear();
        }
    };
    OimoHelper.prototype.playWorld = function () {
        if (this.world) {
            this.world.play();
        }
    };
    return OimoHelper;
}());
exports.default = OimoHelper;
},{}],20:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var OimoHelper_1 = require("./OimoHelper");
var DealPackaging_1 = require("../GameLogic/DealPackaging");
var OimoRigidBody = /** @class */ (function (_super) {
    __extends(OimoRigidBody, _super);
    function OimoRigidBody() {
        return _super.call(this) || this;
    }
    OimoRigidBody.prototype.init = function (data) {
        this.bodyData = data;
        this.sprite = this.owner;
        this.transform = this.sprite.transform;
        data.type = DealPackaging_1.DealPackaging.DealLayer(this.sprite.layer);
        this.initBodyData(data);
        if (this.body && this.body.parent)
            this.body.dispose();
        this.body = OimoHelper_1.default.Inst.createBody(data);
    };
    OimoRigidBody.prototype.onAwake = function () {
    };
    OimoRigidBody.prototype.onStart = function () {
    };
    OimoRigidBody.prototype.onUpdate = function () {
        var bodyPos = this.body.getPosition();
        var bodyQut = this.body.getQuaternion();
        var transPos = this.transform.position;
        var transQut = this.transform.rotation;
        transPos.x = bodyPos.x;
        transPos.y = bodyPos.y;
        transPos.z = bodyPos.z;
        this.transform.position = transPos;
        transQut.x = bodyQut.x;
        transQut.y = bodyQut.y;
        transQut.z = bodyQut.z;
        transQut.w = bodyQut.w;
        this.transform.rotation = transQut;
    };
    OimoRigidBody.prototype.checkContact = function (name) {
        if (this.body && this.body.contactLink) {
            var otherBody = this.body.contactLink.body;
            if (otherBody.name == name)
                return true;
        }
        return false;
    };
    OimoRigidBody.prototype.initBodyData = function (data) {
        data.type = data.type === undefined ? this.sprite.name : data.type;
        data.pos = this.getPos();
        data.rot = this.getRot();
        data.size = data.size === undefined ? this.getSize() : data.size;
        // if (data.type == "cube" || data.type == "barrier") data.type = "box";
        // else if (data.type == "capsule") data.type = "cylinder";
        // else if (data.type == "shell") data.type = "sphere";
        // else data.type = "box";
    };
    OimoRigidBody.prototype.getPos = function () {
        var position = this.transform.position;
        var pos = [position.x, position.y, position.z];
        return pos;
    };
    OimoRigidBody.prototype.getSize = function () {
        var w, h, d, size;
        var _scale = this.transform.scale;
        if (this.bodyData.type == "capsule" || this.bodyData.type == "cylinder") {
            var _scale = this.transform.scale;
            // w = this.transform.localScale.x;
            // h = this.transform.localScale.y * 2;
            // d = this.transform.localScale.z;
            w = _scale.x * 0.5;
            h = _scale.y * 2;
            d = _scale.z * 0.5;
            size = [w, h, d];
        }
        else if (this.bodyData.type == "sphere") {
            // w = this.transform.localScale.x;
            w = _scale.x * 0.5;
            size = [w];
        }
        else if (this.bodyData.type == "cube" || this.bodyData.type == "box") {
            // w = this.transform.localScale.x;
            // h = this.transform.localScale.y;//* 2;
            // d = this.transform.localScale.z;
            w = _scale.x;
            h = _scale.y;
            d = _scale.z;
            size = [w, h, d];
        }
        //  console.log(size);
        return size;
    };
    OimoRigidBody.prototype.getRot = function () {
        var euler = this.transform.rotationEuler;
        var rot = [euler.x, euler.y, euler.z];
        return rot;
    };
    OimoRigidBody.prototype.bodyName = function () {
        if (this.body)
            return this.body.name;
        return -1;
    };
    return OimoRigidBody;
}(Laya.Script3D));
exports.default = OimoRigidBody;
},{"../GameLogic/DealPackaging":8,"./OimoHelper":19}],21:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Dictionary = /** @class */ (function () {
    function Dictionary() {
        this._container = {};
        this._length = 0;
    }
    Object.defineProperty(Dictionary.prototype, "container", {
        get: function () {
            return this._container;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Dictionary.prototype, "size", {
        //获取字典长度    
        get: function () {
            return this._length;
        },
        enumerable: true,
        configurable: true
    });
    //添加
    Dictionary.prototype.set = function (key, value) {
        if (!this._container.hasOwnProperty(key)) {
            this._length++;
        }
        this._container[key] = value;
    };
    //删除     
    Dictionary.prototype.delete = function (key) {
        if (this._container.hasOwnProperty(key)) {
            delete this._container[key];
            this._length--;
        }
    };
    //查找   
    Dictionary.prototype.has = function (key) {
        return this._container.hasOwnProperty(key) ? true : false;
    };
    //获取 
    Dictionary.prototype.get = function (key) {
        if (this._container.hasOwnProperty(key)) {
            return this._container[key];
        }
        else {
            return undefined;
        }
    };
    //清空    
    Dictionary.prototype.clear = function () {
        this._container = {};
        this._length = 0;
    };
    return Dictionary;
}());
exports.default = Dictionary;
},{}],22:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Game_Tool = /** @class */ (function () {
    function Game_Tool() {
    }
    Game_Tool.GetObjKey = function (obj) {
        if (obj == null)
            return null;
        for (var key in obj) {
            if (obj.hasOwnProperty(key)) {
                return key;
            }
        }
    };
    //返回一个随机整数[min,max]
    Game_Tool.randomInt = function (min, max) {
        return parseInt(Math.random() * (max - min + 1) + min);
    };
    //p1 左向量 p2
    Game_Tool.getAng = function (xx, yy, obl) {
        return 180 / Math.PI * this.getRad(xx, yy, obl);
    };
    //返回角度
    Game_Tool.getRad = function (xx, yy, obl) {
        // 方法一：asin()
        // var rad:Number = xx > 0 ? ((Math.PI * 3)/2  + Math.asin(-yy/obl)) : (Math.PI / 2 -  Math.asin(-yy/obl));
        // 方法二：acos()
        var rad = yy < 0 ? Math.acos(xx / obl) : (Math.PI * 2 - Math.acos(xx / obl));
        // 方法三：atan2()
        // var rad:Number = yy < 0 ? Math.atan2(-yy, xx) : Math.PI * 2 + Math.atan2(-yy, xx);
        return rad;
    };
    Game_Tool.getM_Vector = function (v1, v2) {
        var temp = new Laya.Vector3();
        Laya.Vector3.add(v1, v2, temp);
        return new Laya.Vector3(temp.x * 0.5, temp.y * 0.5, temp.z * 0.5);
    };
    Game_Tool.random_1to1 = function () {
        var iszheng = Math.random() > 0.5 ? -1 : 1;
        return Math.random() * iszheng;
    };
    Game_Tool.get64Encode = function (str) {
        var c1, c2, c3;
        var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
        var i = 0, len = str.length, string = '';
        while (i < len) {
            c1 = str.charCodeAt(i++) & 0xff;
            if (i == len) {
                string += base64EncodeChars.charAt(c1 >> 2);
                string += base64EncodeChars.charAt((c1 & 0x3) << 4);
                string += "==";
                break;
            }
            c2 = str.charCodeAt(i++);
            if (i == len) {
                string += base64EncodeChars.charAt(c1 >> 2);
                string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
                string += base64EncodeChars.charAt((c2 & 0xF) << 2);
                string += "=";
                break;
            }
            c3 = str.charCodeAt(i++);
            string += base64EncodeChars.charAt(c1 >> 2);
            string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
            string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
            string += base64EncodeChars.charAt(c3 & 0x3F);
        }
        return string;
    };
    // public static SetHuTuiList(list:Laya.List,data?,scrol:number=1,type:number=0){ //scrol 1:竖的  2横的
    //     var arr=data?data:FYHD_Sdk.pushData;
    //     list.selectEnable = false;
    //     scrol==1?list.vScrollBarSkin = "":list.hScrollBarSkin = "";
    //     list.renderHandler = Laya.Handler.create(this, this.updateItem, [type], false);
    //     list.array = arr;
    //     list.refresh();
    //  }
    //  private static updateItem(type,cell: Laya.Box, index: number){
    //      var aditem=cell.getComponent(HuiTuiItem)as HuiTuiItem;
    //      aditem.Refresh(type);
    //  }
    Game_Tool.makeRandomArr = function (arrList, num) {
        if (num > arrList.length) {
            return;
        }
        var tempArr = arrList.slice(0);
        var newArrList = [];
        for (var i = 0; i < num; i++) {
            var random = Math.floor(Math.random() * (tempArr.length - 1));
            var arr = tempArr[random];
            tempArr.splice(random, 1);
            newArrList.push(arr);
        }
        return newArrList;
    };
    Game_Tool.CopyArr = function (o) {
        var arr = [];
        for (var index = 0; index < o.length; index++) {
            var element = o[index];
            arr.push(element);
        }
        return arr;
    };
    // public static ShowQianDao(): boolean {
    //     let todayZero = new Date(UserModel.Instance.CurModel.ServerTime * 1000);
    //     todayZero.setHours(0, 0, 0, 0);
    //     if(!PlayerManager.Instance.sign)return true;
    //     var lastTime = Number(PlayerManager.Instance.sign["sign_time"]) * 1000;
    //     let lastSignTime = new Date(lastTime);
    //     if (lastTime == 0) {
    //         return true;
    //     }
    //     if (lastSignTime.valueOf() < todayZero.valueOf()) {
    //         return true;
    //     }
    //     return false;
    // }
    Game_Tool.TweenGoldAward = function (_num, _pos, _completeHandle) {
        if (_pos === void 0) { _pos = null; }
        if (_completeHandle === void 0) { _completeHandle = null; }
        if (_num == 0)
            return;
        var parent = new Laya.Box;
        parent.width = 400;
        parent.height = 100;
        parent.pivotX = parent.width / 2;
        parent.pivotY = parent.height / 2;
        if (_pos == null) {
            _pos = new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height / 2);
        }
        parent.pos(_pos.x, _pos.y);
        var _Image = new Laya.Image;
        _Image.skin = "main_res/sign_icon.png";
        _Image.width = 60;
        _Image.height = 60;
        _Image.left = 50;
        _Image.y = 10;
        parent.addChild(_Image);
        var curText = new Laya.Text;
        curText.width = 300;
        curText.height = 50;
        curText.align = "center";
        curText.valign = "middle";
        curText.font = "Microsoft YaHei";
        curText.fontSize = 35;
        curText.color = "#ff8e00";
        curText.bold = true;
        curText.font = "Microsoft YaHei";
        curText.text = "金币 +" + _num;
        curText.x = 60;
        curText.y = 10;
        parent.addChild(curText);
        parent.zOrder = 2;
        Laya.stage.addChild(parent);
        var tween = Laya.Tween.to(parent, { y: parent.y - 200 }, 1000, Laya.Ease.expoInOut, Laya.Handler.create(this, function () {
            tween.clear();
            parent.destroy();
            if (_completeHandle) {
                _completeHandle.run();
            }
        }), 100);
    };
    return Game_Tool;
}());
exports.default = Game_Tool;
},{}],23:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Scene = Laya.Scene;
var REG = Laya.ClassUtils.regClass;
var ui;
(function (ui) {
    var game_uiUI = /** @class */ (function (_super) {
        __extends(game_uiUI, _super);
        function game_uiUI() {
            return _super.call(this) || this;
        }
        game_uiUI.prototype.createChildren = function () {
            _super.prototype.createChildren.call(this);
            this.createView(game_uiUI.uiView);
        };
        game_uiUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Button", "props": { "y": 615, "x": 225, "width": 269, "var": "startBtn", "labelSize": 50, "label": "开始游戏", "height": 50 }, "compId": 4 }], "loadList": [], "loadList3D": [] };
        return game_uiUI;
    }(Scene));
    ui.game_uiUI = game_uiUI;
    REG("ui.game_uiUI", game_uiUI);
})(ui = exports.ui || (exports.ui = {}));
},{}]},{},[3])
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 104496 characters]
