(function () { 'use strict'; class GameConfig { constructor() { } static init() { var reg = Laya.ClassUtils.regClass; } } GameConfig.width = 640; GameConfig.height = 1136; GameConfig.scaleMode = "fixedwidth"; GameConfig.screenMode = "none"; GameConfig.alignV = "top"; GameConfig.alignH = "left"; GameConfig.startScene = "MainScene.scene"; GameConfig.sceneRoot = ""; GameConfig.debug = false; GameConfig.stat = false; GameConfig.physicsDebug = false; GameConfig.exportSceneToJson = true; GameConfig.init(); class ResDic { constructor() { this._container = {}; this._length = 0; } get container() { return this._container; } get size() { return this._length; } set(key, value) { if (!this._container.hasOwnProperty(key)) { this._length++; } this._container[key] = value; } has(key) { return this._container.hasOwnProperty(key) ? true : false; } get(key) { if (this._container.hasOwnProperty(key)) { return this._container[key]; } else { return undefined; } } delete(key) { if (this._container.hasOwnProperty(key)) { delete this._container[key]; this._length--; } } clear() { this._container = {}; this._length = 0; } } var DispatcherState; (function (DispatcherState) { DispatcherState[DispatcherState["LoadComplete"] = 0] = "LoadComplete"; DispatcherState[DispatcherState["SceneInit"] = 1] = "SceneInit"; DispatcherState[DispatcherState["StageInit"] = 2] = "StageInit"; DispatcherState[DispatcherState["StageCreateComplete"] = 3] = "StageCreateComplete"; DispatcherState[DispatcherState["GoldGet"] = 4] = "GoldGet"; DispatcherState[DispatcherState["PlayerRunning"] = 5] = "PlayerRunning"; DispatcherState[DispatcherState["PlayerStand"] = 6] = "PlayerStand"; DispatcherState[DispatcherState["ShowModel"] = 7] = "ShowModel"; DispatcherState[DispatcherState["RefreshCityName"] = 8] = "RefreshCityName"; })(DispatcherState || (DispatcherState = {})); var StageState; (function (StageState) { StageState[StageState["Start"] = 0] = "Start"; StageState[StageState["Lose"] = 1] = "Lose"; StageState[StageState["Win"] = 2] = "Win"; StageState[StageState["TimeOver"] = 3] = "TimeOver"; })(StageState || (StageState = {})); class DispatcherControl { static DispatcherOn(_mode, caller, fun, args = []) { DispatcherControl.instance.on(DispatcherState[_mode], caller, fun, args); } static DispatcherOff(_mode, caller, fun, args = []) { DispatcherControl.instance.off(DispatcherState[_mode], caller, fun); } static DispatcherTrigger(_mode, args = []) { DispatcherControl.instance.event(DispatcherState[_mode], args); } static StageOn(_state, caller, fun, args = []) { DispatcherControl.instance.on(StageState[_state], caller, fun, args); } static StageOff(_state, caller, fun, args = []) { DispatcherControl.instance.off(StageState[_state], caller, fun); } static StageTrigger(_state, args = []) { DispatcherControl.instance.event(StageState[_state], args); } } DispatcherControl.instance = new Laya.EventDispatcher(); 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; } 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); } 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; } } } 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 = 1000) { 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); } } class AssetManager { constructor() { this.Zombie = new ResDic(); this.Character = new ResDic(); AssetManager.ins = this; DispatcherControl.DispatcherOn(DispatcherState.LoadComplete, this, this.Init); } static get Instance() { if (AssetManager.ins) { return AssetManager.ins; } else { return new AssetManager(); } } Init() { this.maincamera = this.mainscene.getChildByName("Main Camera"); this.Wall = this.mainscene.getChildByName("Wall"); this.Build = this.mainscene.getChildByName("Build"); GameTools.Instance.SetCollider(this.Wall, 100); GameTools.Instance.SetCollider(this.Build, 100); DispatcherControl.DispatcherTrigger(DispatcherState.SceneInit); } } class ResourcesPath { constructor() { ResourcesPath.ins = this; } static get Instance() { if (ResourcesPath.ins) { return ResourcesPath.ins; } else { return new ResourcesPath(); } } } ResourcesPath.MainScene = "Game/res/MainScene/LayaScene_mainscene/Conventional/mainscene.ls"; ResourcesPath.Character = [ "Game/res/Role/LayaScene_role/Conventional/Character.lh" ]; ResourcesPath.Zombie = [ "Game/res/Role/LayaScene_role/Conventional/Zombie.lh" ]; var Sprite3D = Laya.Sprite3D; var Vector3 = Laya.Vector3; class modelConfig { constructor(model) { this.modelcur = model; this.modelPos = model.transform.position.clone(); this.modelRot = model.transform.rotation.clone(); this.modelSca = model.transform.scale.clone(); } } class GamePool { constructor() { this.modelpool = {}; this.maxAcount = 100; GamePool.ins = this; } static get Instance() { if (GamePool.ins) { return GamePool.ins; } else { return new GamePool(); } } GetModel(_model, title) { var poolname = title + _model.name; if (this.modelpool[poolname] != null && this.modelpool[poolname] != undefined) { if (this.modelpool[poolname].length > 0) { var model1 = this.modelpool[poolname][0]; this.modelpool[poolname].splice(0, 1); if (model1.modelcur.destroyed) { model1.modelcur = Sprite3D.instantiate(_model); if (!model1.modelcur.active) { model1.modelcur.active = true; } } model1.modelcur.active = true; model1.modelcur.transform.position = _model.transform.position.clone(); model1.modelcur.transform.rotation = _model.transform.rotation.clone(); model1.modelcur.transform.scale = _model.transform.scale.clone(); return model1.modelcur; } else { var model = Sprite3D.instantiate(_model); model.active = true; return model; } } else { var model = Sprite3D.instantiate(_model); model.active = true; return model; } } RecoveryModel(model, title = "", modelstate = false) { if (model.destroyed) { return; } if (!modelstate && model.active == false) { return; } var poolname = title + model.name; if (this.modelpool[poolname] != null && this.modelpool[poolname] != undefined) { var modelnum = this.modelpool[poolname]; if (modelnum.length > this.maxAcount) { model.destroy(); return; } else { modelnum.push(new modelConfig(model)); } } else { modelnum = []; modelnum.push(new modelConfig(model)); this.modelpool[poolname] = modelnum; } model.transform.position = new Vector3(0, 0, -10000); model.removeSelf(); model.active = false; } } class CharacterData { constructor() { } } var Vector3$1 = Laya.Vector3; class NpcControl { constructor() { this.NpcCharacter = true; this.FowardHit = new Laya.HitResult(); this.move = true; this.ChargeSpeed = 0; this.rundir = new Laya.Vector3(); this.rolepos = new Laya.Vector3(); this.curspeed = 0; NpcControl.ins = this; DispatcherControl.StageOn(StageState.Start, this, this.Start); DispatcherControl.StageOn(StageState.Lose, this, this.GameOver); DispatcherControl.StageOn(StageState.Win, this, this.GameOver); DispatcherControl.StageOn(StageState.TimeOver, this, this.GameOver); } static get Instance() { if (NpcControl.ins) { return NpcControl.ins; } else { return new NpcControl(); } } Init(_model, _characterdata) { var Npc = new NpcControl(); Npc.CurCharacterData = _characterdata; Npc.CurCharacterData.Model = _model; Npc.CurCharacterData.Animator = _model.getComponent(Laya.Animator); return Npc; } Start() { Laya.timer.frameLoop(1, this, this.LateUpdate); } GameOver() { Laya.timer.clear(this, this.LateUpdate); } LateUpdate() { this.RayCheck(); this.Move(); } Move() { if (this.move) { if (this.NpcCharacter) { var speed = this.CurCharacterData.Speed; this.ChargeSpeed = GameTools.Instance.lerp(this.ChargeSpeed, 0, 0.1); speed = this.CurCharacterData.Speed + this.ChargeSpeed; this.curspeed = GameTools.Instance.lerp(this.curspeed, speed, 0.04); Vector3$1.scale(new Vector3$1(0, 0, 1), this.curspeed, this.rundir); Vector3$1.add(this.CurCharacterData.Model.transform.position, this.rundir, this.rolepos); Vector3$1.lerp(this.CurCharacterData.Model.transform.position, this.rolepos, 0.15, this.rolepos); this.CurCharacterData.Model.transform.position = this.rolepos; } } } RayCheck() { if (this.FowardRayCheck) { let dir = Math.random(); if (dir < 0.25) { this.CurCharacterData.Model.transform.rotationEuler = new Vector3$1(this.CurCharacterData.Model.transform.rotationEuler.x, 90, this.CurCharacterData.Model.transform.rotationEuler.z); } else if (dir >= 0.25 && dir < 0.5) { this.CurCharacterData.Model.transform.rotationEuler = new Vector3$1(this.CurCharacterData.Model.transform.rotationEuler.x, -90, this.CurCharacterData.Model.transform.rotationEuler.z); } else if (dir >= 0.5 && dir < 0.75) { this.CurCharacterData.Model.transform.rotationEuler = new Vector3$1(this.CurCharacterData.Model.transform.rotationEuler.x, 180, this.CurCharacterData.Model.transform.localRotationEuler.z); } else if (dir >= 0.75 && dir < 1) { this.CurCharacterData.Model.transform.rotationEuler = new Vector3$1(this.CurCharacterData.Model.transform.rotationEuler.x, -180, this.CurCharacterData.Model.transform.rotationEuler.z); } } } get FowardRayCheck() { var isFowardHit = false; var startPos = new Vector3$1(this.CurCharacterData.Model.transform.position.x, this.CurCharacterData.Model.transform.position.y + 0.5, this.CurCharacterData.Model.transform.position.z); var direction = new Vector3$1(0, 0, 1); var FowardRay = new Laya.Ray(startPos, direction); if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this.FowardHit, 0.5)) { if (this.FowardHit.collider.collisionGroup == 200 && this.FowardHit.collider != this.ForwardTarget || this.FowardHit.collider.owner.name == "Wall" || this.FowardHit.collider.owner.name == "build") { this.ForwardTarget = this.FowardHit.collider; isFowardHit = true; } } return isFowardHit; } } var Vector3$2 = Laya.Vector3; class PlayerControl { constructor() { this.curtouchsmoothness = 0.02; this.offx = 0; this.offz = 0; this.poschazhi = new Vector3$2(); this.gengsuipos = new Vector3$2(); this.lllpos = new Vector3$2(); this.hights = 0; this.wights = 0; PlayerControl.ins = this; } static get Instance() { if (PlayerControl.ins) { return PlayerControl.ins; } else { return new PlayerControl(); } } Init(_npccontrol) { this.NPC = _npccontrol; this.Player = _npccontrol.CurCharacterData.Model; this.maincamera = AssetManager.Instance.maincamera; console.log(this.maincamera.transform.rotationEuler); this.maincamera.transform.position = new Laya.Vector3(19.5, 40, 16.7); Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.TouchEnter); Laya.stage.on(Laya.Event.MOUSE_UP, this, this.OnTouchOut); Laya.stage.on(Laya.Event.MOUSE_OUT, this, this.OnTouchOut); this.CameraFollow(); } TouchEnter() { this.mousepos = new Laya.Vector2(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY); Laya.timer.clear(this, this.OnTouchMove); Laya.timer.frameLoop(1, this, this.OnTouchMove); } OnTouchOut() { Laya.timer.clear(this, this.OnTouchMove); } OnTouchMove() { var MousePos = new Laya.Vector2(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY); var offestX = MousePos.x - this.mousepos.x; var offestZ = MousePos.y - this.mousepos.y; offestX = offestX > 200 ? 200 : offestX; offestX = offestX < -200 ? -200 : offestX; offestZ = offestZ > 200 ? 200 : offestZ; offestZ = offestZ < -200 ? -200 : offestZ; this.offx = GameTools.Instance.lerp(this.offx, offestX, this.curtouchsmoothness); this.offz = GameTools.Instance.lerp(this.offz, offestZ, this.curtouchsmoothness); var movespeedx = this.offx * 0.04; var movespeedz = this.offz * 0.04; this.ChangeDirection(); this.Player.transform.translate(new Vector3$2(movespeedz, 0, -movespeedx)); var dir = new Laya.Vector3(-offestX * 0.001, 0, 0); this.mousepos = MousePos; } ChangeDirection() { let point = new Laya.Vector2(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY); let Ray = new Laya.Ray(new Vector3$2(0, 0, 0), new Vector3$2(0, 0, 0)); let enemyhit = new Laya.HitResult(); AssetManager.Instance.maincamera.viewportPointToRay(point, Ray); if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(Ray, enemyhit, 10000)) { let target = enemyhit.collider.owner; if (target.name == "build" || target.name == "ground") { var position = enemyhit.point; position.y = this.Player.transform.position.y; } } } CameraFollow() { this.hights = 0; this.wights = 0; Vector3$2.subtract(this.Player.transform.position, this.maincamera.transform.position, this.poschazhi); Laya.timer.frameLoop(1, this, this.Follow); } Follow() { Vector3$2.subtract(this.Player.transform.position, this.poschazhi, this.gengsuipos); this.hights = GameTools.Instance.lerp(this.hights, 1.0, 0.03); this.wights = GameTools.Instance.lerp(this.wights, 0.8, 0.02); this.gengsuipos = new Vector3$2(this.gengsuipos.x + this.hights, this.gengsuipos.y, this.gengsuipos.z + this.wights); Vector3$2.lerp(this.maincamera.transform.position, this.gengsuipos, 0.25, this.lllpos); this.lllpos = new Vector3$2(this.gengsuipos.x + 20, this.lllpos.y, this.lllpos.z); this.maincamera.transform.position = this.lllpos; var qqqwe = new Laya.Quaternion(); var eyePos = new Vector3$2(this.gengsuipos.x, this.gengsuipos.y, this.gengsuipos.z); Laya.Quaternion.lookAt(eyePos, this.Player.transform.position, new Vector3$2(0, 1, 0), qqqwe); qqqwe.invert(qqqwe); Laya.Quaternion.slerp(this.maincamera.transform.rotation, qqqwe, 0.1, qqqwe); this.maincamera.transform.rotationEuler = new Laya.Vector3(-45, 90, 0); } } class MainGame { constructor() { this.TransformUp = new Laya.Vector3(0, 0.5, 0); this.CharacterArray = []; DispatcherControl.DispatcherOn(DispatcherState.SceneInit, this, this.Init); MainGame.ins = this; } static get Instance() { if (MainGame.ins) { return MainGame.ins; } else { return new MainGame(); } } Init() { this.mainscene = AssetManager.Instance.mainscene; this.CreatCharacter(); Laya.stage.addChildAt(this.mainscene, 0); } CreatCharacter() { this.CreatPlayer(); this.CreatNpc(); DispatcherControl.StageTrigger(StageState.Start); } CreatPlayer() { let playermodel = GamePool.Instance.GetModel(AssetManager.Instance.Character.get(1), ""); playermodel.transform.position = new Laya.Vector3(19.5, 25, 16.7); playermodel.transform.localScale = new Laya.Vector3(1, 1, 1); AssetManager.Instance.mainscene.addChild(playermodel); this.AddBooldUI(playermodel); let _characterdata = new CharacterData(); var npc = NpcControl.Instance.Init(playermodel, _characterdata); npc.NpcCharacter = false; PlayerControl.Instance.Init(npc); this.CharacterArray.push(npc); } CreatNpc() { for (let i = 0; i < 10; i++) { let npcmodel = GamePool.Instance.GetModel(AssetManager.Instance.Zombie.get(1), ""); let X = GameTools.RandomANumber(-50, 50); let Z = GameTools.RandomANumber(-50, 50); npcmodel.transform.position = new Laya.Vector3(X, 25, Z); npcmodel.transform.localScale = new Laya.Vector3(1, 1, 1); npcmodel.transform.localRotationEuler = new Laya.Vector3(0, 0, 0); AssetManager.Instance.mainscene.addChild(npcmodel); this.AddBooldUI(npcmodel); let _characterdata = new CharacterData(); var npc = NpcControl.Instance.Init(npcmodel, _characterdata); this.CharacterArray.push(npc); } } AddBooldUI(_sprite3D) { let bloodprogress = new Laya.ProgressBar(); let screenposition = new Laya.Vector3(); bloodprogress.skin = "Game/res/Resources/jiazai.png"; bloodprogress.value = 0.9; let role_position = _sprite3D.transform.position; AssetManager.Instance.maincamera.worldToViewportPoint(role_position, screenposition); bloodprogress.pos(screenposition.x, screenposition.y); console.log("X--", bloodprogress.x); console.log("Y--", bloodprogress.y); AssetManager.Instance.mainscene.addChild(bloodprogress); Laya.stage.addChild(bloodprogress); } } class LoadView { constructor() { LoadView.ins = this; new MainGame(); this.Init(); } static get Instance() { if (LoadView.ins) { return LoadView.ins; } else { return new LoadView(); } } Init() { this.LoadScene(); } LoadScene() { Laya.Scene3D.load(ResourcesPath.MainScene, Laya.Handler.create(this, (scene) => { this.mainscene = scene; AssetManager.Instance.mainscene = this.mainscene; console.log("场景加载完毕--"); this.LoadZombie(); })); } LoadZombie() { var path = []; for (let i = 0; i < ResourcesPath.Zombie.length; i++) { path.push(ResourcesPath.Zombie[i]); } Laya.loader.create(path, Laya.Handler.create(this, () => { for (var i = 0; i < ResourcesPath.Zombie.length; i++) { var people = Laya.loader.getRes(ResourcesPath.Zombie[i]); AssetManager.Instance.Zombie.set(i + 1, people); Laya.loader.clearRes(ResourcesPath.Zombie[i]); } })); console.log("僵尸模型加载完毕--"); this.LoadCharacter(); } LoadCharacter() { var path = []; for (let i = 0; i < ResourcesPath.Character.length; i++) { path.push(ResourcesPath.Character[i]); } Laya.loader.create(path, Laya.Handler.create(this, () => { for (var i = 0; i < ResourcesPath.Character.length; i++) { var people = Laya.loader.getRes(ResourcesPath.Character[i]); AssetManager.Instance.Character.set(i + 1, people); Laya.loader.clearRes(ResourcesPath.Character[i]); } DispatcherControl.DispatcherTrigger(DispatcherState.LoadComplete); })); console.log("人物模型加载完毕--"); } } class CheckMain { } CheckMain.Create = false; class Main { constructor() { if (CheckMain.Create) return; CheckMain.Create = true; if (window["Laya3D"]) Laya3D.init(GameConfig.width, GameConfig.height); else Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]); Laya["Physics"] && Laya["Physics"].enable(); Laya["DebugPanel"] && Laya["DebugPanel"].enable(); Laya.stage.scaleMode = GameConfig.scaleMode; Laya.stage.screenMode = GameConfig.screenMode; Laya.stage.alignV = GameConfig.alignV; Laya.stage.alignH = GameConfig.alignH; Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson; if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true") Laya.enableDebugPanel(); if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"]) Laya["PhysicsDebugDraw"].enable(); if (GameConfig.stat) Laya.Stat.show(); Laya.alertGlobalError = true; 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(); } } new Main(); }()); //# sourceMappingURL=bundle.js.map