123456789 |
- {
- "code": "var Vector2 = Laya.Vector2;\r\nimport { EventManager } from \"./EventManager\";\r\nimport { GameState, TouchState } from \"./DataMaker\";\r\nexport class InputManager {\r\n constructor() {\r\n this.curtouthstate = TouchState.none;\r\n this.touchPos = new Vector2();\r\n this.curpos = [];\r\n this.enter = false;\r\n this.curMousePos = new Vector2(0, 0);\r\n this.sliderawakesize = 1;\r\n this.curtouchpos = new Vector2();\r\n InputManager.instance = this;\r\n this.Init();\r\n }\r\n static get Instance() {\r\n return InputManager.instance;\r\n }\r\n Init() {\r\n Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.TouchEnter);\r\n Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.OnTouchMove);\r\n Laya.stage.on(Laya.Event.MOUSE_UP, this, this.OnTouchOut);\r\n Laya.stage.on(Laya.Event.MOUSE_OUT, this, this.OnTouchOut);\r\n EventManager.GameOn(GameState.Ready, this, this.OnGameReady);\r\n EventManager.GameOn(GameState.Playing, this, this.OnGamePlaying);\r\n EventManager.GameOn(GameState.Lose, this, this.OnGameLose);\r\n EventManager.GameOn(GameState.Win, this, this.OnGameWin);\r\n }\r\n OnGameReady() {\r\n this.curtouthstate = TouchState.down;\r\n InputManager.caninput = false;\r\n }\r\n OnGamePlaying() {\r\n InputManager.caninput = true;\r\n }\r\n OnGameResurrection() {\r\n this.curtouthstate = TouchState.down;\r\n InputManager.caninput = false;\r\n }\r\n OnGameLose() {\r\n this.curtouthstate = TouchState.down;\r\n InputManager.caninput = false;\r\n }\r\n OnGameWin() {\r\n this.curtouthstate = TouchState.down;\r\n InputManager.caninput = false;\r\n }\r\n TouchEnter(e) {\r\n if (!InputManager.caninput)\r\n return;\r\n this.enter = true;\r\n this.curtouchpos = new Laya.Vector2(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY);\r\n this.curpos = [];\r\n EventManager.InputTrigger(TouchState.down, [this.curtouchpos]);\r\n }\r\n OnTouchOut() {\r\n if (!InputManager.caninput)\r\n return;\r\n this.enter = false;\r\n EventManager.InputTrigger(TouchState.up);\r\n }\r\n OnTouchMove() {\r\n if (!InputManager.caninput || !this.enter)\r\n return;\r\n this.curMousePos = new Laya.Vector2(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY);\r\n this.curpos.push(Laya.MouseManager.instance.mouseX, Laya.MouseManager.instance.mouseY);\r\n EventManager.InputTrigger(TouchState.slider, [this.curMousePos]);\r\n }\r\n}\r\nInputManager.caninput = false;\r\n//# sourceMappingURL=InputManager.js.map",
- "references": [
- "D:/Ver/samuraiflash/laya/samuraiflash/src/Main/EventManager.ts",
- "D:/Ver/samuraiflash/laya/samuraiflash/src/Main/DataMaker.ts"
- ],
- "map": "{\"version\":3,\"file\":\"InputManager.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/Main/InputManager.ts\"],\"names\":[],\"mappings\":\"AACA,IAAO,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAY,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,OAAO,YAAY;IAGrB;QAgDA,kBAAa,GAAc,UAAU,CAAC,IAAI,CAAC;QAC3C,aAAQ,GAAW,IAAI,OAAO,EAAE,CAAC;QACjC,WAAM,GAAG,EAAE,CAAC;QACZ,UAAK,GAAG,KAAK,CAAC;QAoBd,gBAAW,GAAG,IAAI,OAAO,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;QAC/B,oBAAe,GAAG,CAAC,CAAC;QACpB,gBAAW,GAAG,IAAI,OAAO,EAAE,CAAC;QAvExB,YAAY,CAAC,QAAQ,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IACD,MAAM,KAAK,QAAQ;QAEf,OAAO,YAAY,CAAC,QAAQ,CAAC;IACjC,CAAC;IAED,IAAI;QAEA,IAAI,CAAC,KAAK,CAAC,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