3340fbbc304bd641e710dffe107fd5533573c9f7 8.4 KB

12345678910111213141516171819202122232425
  1. {
  2. "code": "import Dictionary from \"../Util/Dictionary\";\r\nimport { PoolManager, PoolType } from \"./PoolManager\";\r\nimport LoadUi from \"../Window/LoadUi\";\r\nimport MainUi from \"../Window/MainUi\";\r\nimport MaskUi from \"../Window/MaskUi\";\r\nimport { HotExport } from \"../Window/Export/HotExport\";\r\nimport { LikeWxExport } from \"../Window/Export/LikeWxExport\";\r\nimport { MergeExport } from \"../Window/Export/MergeExport\";\r\nimport { SettingUi } from \"../Window/SettingUi\";\r\nimport InputController from \"./InputController\";\r\nimport EasterUi from \"../Window/EasterUi\";\r\nimport ResultUi from \"../Window/ResultUi\";\r\nimport GameUi from \"../Window/GameUi\";\r\nimport { SkinUi } from \"../Window/SkinUi\";\r\nimport TryOutUi from \"../Window/TryOutUi\";\r\nimport { FullScreenExport } from \"../Window/Export/FullScreenExport\";\r\nimport RewardBoxUi from \"../Window/RewardBoxUi\";\r\nimport FreeGetPifuUi from \"../Window/FreeGetPifuUi\";\r\nexport var ViewType;\r\n(function (ViewType) {\r\n ViewType[ViewType[\"GameUi\"] = 0] = \"GameUi\";\r\n ViewType[ViewType[\"MaskUi\"] = 1] = \"MaskUi\";\r\n ViewType[ViewType[\"ResultUi\"] = 2] = \"ResultUi\";\r\n ViewType[ViewType[\"Loadui\"] = 3] = \"Loadui\";\r\n ViewType[ViewType[\"MainUi\"] = 4] = \"MainUi\";\r\n ViewType[ViewType[\"EasterUi\"] = 5] = \"EasterUi\";\r\n ViewType[ViewType[\"SettingUi\"] = 6] = \"SettingUi\";\r\n ViewType[ViewType[\"SkinUi\"] = 7] = \"SkinUi\";\r\n ViewType[ViewType[\"TryOutUi\"] = 8] = \"TryOutUi\";\r\n ViewType[ViewType[\"RewardBoxUi\"] = 9] = \"RewardBoxUi\";\r\n ViewType[ViewType[\"FreeGetPifuUi\"] = 10] = \"FreeGetPifuUi\";\r\n ViewType[ViewType[\"FullScreenExport\"] = 11] = \"FullScreenExport\";\r\n ViewType[ViewType[\"HotExport\"] = 12] = \"HotExport\";\r\n ViewType[ViewType[\"LikeWxExport\"] = 13] = \"LikeWxExport\";\r\n ViewType[ViewType[\"MergeExport\"] = 14] = \"MergeExport\";\r\n})(ViewType || (ViewType = {}));\r\nexport default class ViewManager {\r\n constructor() {\r\n this.viewDic = [];\r\n this.addViewDic = new Dictionary();\r\n this._maskCnt = 0;\r\n this.init();\r\n }\r\n static get Instance() {\r\n return this.instance || (this.instance = new ViewManager());\r\n }\r\n init() {\r\n this._maskCnt = 0;\r\n this.viewDic[ViewType.GameUi] = GameUi;\r\n this.viewDic[ViewType.Loadui] = LoadUi;\r\n this.viewDic[ViewType.MainUi] = MainUi;\r\n this.viewDic[ViewType.MaskUi] = MaskUi;\r\n this.viewDic[ViewType.HotExport] = HotExport;\r\n this.viewDic[ViewType.LikeWxExport] = LikeWxExport;\r\n this.viewDic[ViewType.MergeExport] = MergeExport;\r\n this.viewDic[ViewType.SettingUi] = SettingUi;\r\n this.viewDic[ViewType.EasterUi] = EasterUi;\r\n this.viewDic[ViewType.ResultUi] = ResultUi;\r\n this.viewDic[ViewType.SkinUi] = SkinUi;\r\n this.viewDic[ViewType.TryOutUi] = TryOutUi;\r\n this.viewDic[ViewType.FullScreenExport] = FullScreenExport;\r\n this.viewDic[ViewType.RewardBoxUi] = RewardBoxUi;\r\n this.viewDic[ViewType.FreeGetPifuUi] = FreeGetPifuUi;\r\n this.uiNode = new Laya.Sprite();\r\n this.popNode = new Laya.Sprite();\r\n Laya.stage.addChild(this.uiNode);\r\n Laya.stage.addChild(this.popNode);\r\n this.uiNode.zOrder = 3;\r\n this.popNode.zOrder = 4;\r\n }\r\n OpenView(view, data) {\r\n if (this.curView != null) {\r\n this.curView.OnClose();\r\n this.uiNode.removeChild(this.curView);\r\n this.curView.destroy(true);\r\n this.curView = null;\r\n }\r\n this.curView = new this.viewDic[view];\r\n this.uiNode.addChild(this.curView);\r\n this.curView.OnShow(data);\r\n }\r\n get getCurView() {\r\n return this.curView;\r\n }\r\n AddView(view, data) {\r\n if (this.addViewDic.has(view))\r\n return;\r\n let t_view = new this.viewDic[view];\r\n this.addViewDic.set(view, t_view);\r\n this.uiNode.addChild(t_view);\r\n t_view.OnShow(data);\r\n InputController.Instance.CloseInput();\r\n }\r\n RemoveView() {\r\n if (this.curView != null) {\r\n this.curView.OnClose();\r\n this.uiNode.removeChild(this.curView);\r\n this.curView.destroy(true);\r\n this.curView = null;\r\n }\r\n }\r\n HaveView(view) {\r\n return this.addViewDic.has(view);\r\n }\r\n CloseView(view) {\r\n if (!this.addViewDic.has(view))\r\n return;\r\n let t_view = this.addViewDic.get(view);\r\n t_view.OnClose();\r\n this.uiNode.removeChild(t_view);\r\n t_view.destroy(true);\r\n this.addViewDic.delete(view);\r\n InputController.Instance.OpenInput();\r\n }\r\n OpenMask() {\r\n this._maskCnt++;\r\n if (this._maskCnt > 1)\r\n return;\r\n if (this.curMask != null) {\r\n this.curMask.OnClose();\r\n this.popNode.removeChild(this.curView);\r\n this.curMask.destroy();\r\n this.curMask = null;\r\n return;\r\n }\r\n this.curMask = new this.viewDic[ViewType.MaskUi];\r\n if (!this.curMask)\r\n return;\r\n console.log(\"打开遮罩\");\r\n this.popNode.addChild(this.curMask);\r\n this.curMask.OnShow();\r\n }\r\n CloseMask() {\r\n this._maskCnt--;\r\n if (this._maskCnt > 0)\r\n return;\r\n if (this.curMask != null) {\r\n this.curMask.OnClose();\r\n this.popNode.removeChild(this.curMask);\r\n this.curMask.destroy(true);\r\n console.log(\"关闭遮罩\");\r\n this.curMask = null;\r\n }\r\n }\r\n ShowTips(value, type = 1) {\r\n var warn = PoolManager.Instance.SetActiveForUi(PoolType.WarnTips);\r\n if (!warn)\r\n return;\r\n if (type == 1) {\r\n warn.y = 0;\r\n warn.text = value;\r\n warn.x = Laya.stage.width >> 1;\r\n this.popNode.addChild(warn);\r\n let _end = (Laya.stage.height >> 1) - 300;\r\n var tw = Laya.Tween.to(warn, { y: _end }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {\r\n tw.clear();\r\n PoolManager.Instance.SetDisableForUi(PoolType.WarnTips, warn);\r\n }));\r\n }\r\n else if (type == 2) {\r\n warn.y = Laya.stage.height - 400;\r\n warn.text = value;\r\n warn.x = Laya.stage.width >> 1;\r\n this.popNode.addChild(warn);\r\n var tw = Laya.Tween.to(warn, { alpha: 0 }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {\r\n tw.clear();\r\n PoolManager.Instance.SetDisableForUi(PoolType.WarnTips, warn);\r\n warn.alpha = 1;\r\n }));\r\n }\r\n }\r\n}\r\n",
  3. "references": [
  4. "D:/GitProject/GunGang/gungang_laya/gungang/src/Util/Dictionary.ts",
  5. "D:/GitProject/GunGang/gungang_laya/gungang/src/GameLogic/PoolManager.ts",
  6. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/LoadUi.ts",
  7. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/MainUi.ts",
  8. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/MaskUi.ts",
  9. "D:/GitProject/GunGang/gungang_laya/gungang/src/game_module/NetManager.ts",
  10. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/Export/HotExport.ts",
  11. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/Export/LikeWxExport.ts",
  12. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/Export/MergeExport.ts",
  13. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/SettingUi.ts",
  14. "D:/GitProject/GunGang/gungang_laya/gungang/src/GameLogic/InputController.ts",
  15. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/EasterUi.ts",
  16. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/ResultUi.ts",
  17. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/GameUi.ts",
  18. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/SkinUi.ts",
  19. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/TryOutUi.ts",
  20. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/Export/FullScreenExport.ts",
  21. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/RewardBoxUi.ts",
  22. "D:/GitProject/GunGang/gungang_laya/gungang/src/Window/FreeGetPifuUi.ts"
  23. ]
  24. }