123456789 |
- {
- "code": "import { ui } from \"../ui/layaMaxUI\";\r\nimport { EventManager } from \"../GameLogic/EventManager\";\r\nimport ViewManager, { ViewType } from \"../GameLogic/ViewManager\";\r\nimport { SettingController } from \"../GameLogic/SettingController\";\r\nexport class SettingUi extends ui.SettingUiUI {\r\n constructor() {\r\n super();\r\n this.resizeHander();\r\n EventManager.on(Laya.Event.RESIZE, this, this.resizeHander);\r\n }\r\n resizeHander() {\r\n this.height = Laya.stage.height;\r\n this.bg.height = Laya.stage.height;\r\n }\r\n OnShow(data) {\r\n this.InitDate();\r\n this.InitHandler();\r\n this.InitUi();\r\n }\r\n InitUi(data) {\r\n this.GetImage();\r\n this.SoundShow(SettingController.Instance.sound);\r\n this.ShakeShow(SettingController.Instance.vibrate);\r\n }\r\n InitHandler() {\r\n this.closeBtn.CZ = () => {\r\n ViewManager.Instance.CloseView(ViewType.SettingUi);\r\n };\r\n this.sound_btn.clickHandler = new Laya.Handler(this, () => {\r\n this.SoundSetting();\r\n });\r\n this.shake_btn.clickHandler = new Laya.Handler(this, () => {\r\n this.ShakeSetting();\r\n });\r\n }\r\n GetImage() {\r\n this.sound_open = this.sound_btn.getChildByName(\"kai\");\r\n this.sound_guan = this.sound_btn.getChildByName(\"guan\");\r\n this.shake_open = this.shake_btn.getChildByName(\"kai\");\r\n this.shake_guan = this.shake_btn.getChildByName(\"guan\");\r\n }\r\n InitDate() {\r\n }\r\n SoundSetting() {\r\n SettingController.Instance.sound = !SettingController.Instance.sound;\r\n this.SoundShow(SettingController.Instance.sound);\r\n }\r\n SoundShow(isshow) {\r\n if (!isshow) {\r\n this.sound_open.visible = false;\r\n this.sound_guan.visible = true;\r\n SettingController.Instance.SettingSound(0);\r\n console.log(\"关闭声音\");\r\n }\r\n else {\r\n this.sound_open.visible = true;\r\n this.sound_guan.visible = false;\r\n SettingController.Instance.SettingSound(1);\r\n console.log(\"开启声音\");\r\n }\r\n }\r\n ShakeSetting() {\r\n SettingController.Instance.vibrate = !SettingController.Instance.vibrate;\r\n this.ShakeShow(SettingController.Instance.vibrate);\r\n }\r\n ShakeShow(isshow) {\r\n if (!isshow) {\r\n this.shake_open.visible = false;\r\n this.shake_guan.visible = true;\r\n console.log(\"关闭震动\");\r\n }\r\n else {\r\n this.shake_open.visible = true;\r\n this.shake_guan.visible = false;\r\n console.log(\"开启震动\");\r\n }\r\n }\r\n OnClose() {\r\n EventManager.off(Laya.Event.RESIZE, this, this.resizeHander);\r\n Laya.LocalStorage.setItem(\"sound\", SettingController.Instance.sound ? \"1\" : \"0\");\r\n Laya.LocalStorage.setItem(\"vibrate\", SettingController.Instance.vibrate ? \"1\" : \"0\");\r\n }\r\n}\r\n",
- "references": [
- "D:/GitProject/GunGang/gungang_laya/gungang/src/GameLogic/EventManager.ts",
- "D:/GitProject/GunGang/gungang_laya/gungang/src/GameLogic/ViewManager.ts",
- "D:/GitProject/GunGang/gungang_laya/gungang/src/GameLogic/SettingController.ts"
- ]
- }
|