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;SACrB;IACL,CAAC;IACD,IAAI,WAAW,KAAK,OAAO,WAAW,CAAC,CAAC,CAAC;IACzC,IAAI,WAAW,CAAC,CAAS;QACrB,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,WAAW,EAAE;YAClB,WAAW,GAAG,CAAC,CAAC;YAChB,0BAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAClD,eAAe,EAAE,CAAC;SACrB;IACL,CAAC;IACD,IAAI,eAAe,KAAK,OAAO,eAAe,CAAC,CAAC,CAAC;IACjD,IAAI,eAAe,CAAC,CAAU;QAC1B,eAAe,GAAG,CAAC,CAAC;QACpB,mBAAmB,EAAE,CAAC;IAC1B,CAAC;CACJ,CAAA","file":"","sourceRoot":"/","sourcesContent":["import { LocalStorage } from \"simba-localstorage\";\r\nimport { debounce } from \"simba-utils\";\r\nimport { SettingEvents } from \"../../event/BaseEvents\";\r\n\r\nlet musicVolume = LocalStorage.getFloat(\"_musicVolume\", 1);\r\nlet soundVolume = LocalStorage.getFloat(\"_soundVolume\", 1);\r\nlet enableVibration = LocalStorage.getBoolean(\"_enableVibration\", true);\r\n\r\nconst saveMusicVolume = debounce(() => {\r\n LocalStorage.setFloat(\"_musicVolume\", musicVolume);\r\n}, 500);\r\n\r\nconst saveSoundVolume = debounce(() => {\r\n LocalStorage.setFloat(\"_soundVolume\", soundVolume);\r\n}, 500);\r\n\r\nconst saveEnableVibration = debounce(() => {\r\n LocalStorage.setBoolean(\"_enableVibration\", enableVibration);\r\n}, 500);\r\n\r\nexport const GameBasicSettings = {\r\n get musicVolume() { return musicVolume; },\r\n set musicVolume(v: number) {\r\n v = Math.min(1, Math.max(0, v));\r\n if (v != musicVolume) {\r\n musicVolume = v;\r\n SettingEvents.MusicVolumeChange.emit(musicVolume);\r\n saveMusicVolume();\r\n }\r\n },\r\n get soundVolume() { return soundVolume; },\r\n set soundVolume(v: number) {\r\n v = Math.min(1, Math.max(0, v));\r\n if (v != soundVolume) {\r\n soundVolume = v;\r\n SettingEvents.SoundVolumeChange.emit(soundVolume);\r\n saveSoundVolume();\r\n }\r\n },\r\n get enableVibration() { return enableVibration; },\r\n set enableVibration(v: boolean) {\r\n enableVibration = v;\r\n saveEnableVibration();\r\n }\r\n}"]}