12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import { PREVIEW } from "cc/env"
- import { StorageUtil } from "./util/StorageUtil"
- export class Setting {
- private static vibrateEnabled: boolean = true
- public static get VibrateEnabled(): boolean {
- return this.vibrateEnabled
- }
- public static set VibrateEnabled(v: boolean) {
- this.vibrateEnabled = v
- StorageUtil.setItem('vibrateEnabled', v)
- }
- private static sfxEnabled: boolean = true
- public static get SfxEnabled(): boolean {
- return this.sfxEnabled
- }
- public static set SfxEnabled(v: boolean) {
- this.sfxEnabled = v
- StorageUtil.setItem('sfxEnabled', v)
- }
- private static bgmEnabled: boolean = true
- public static get BgmEnabled(): boolean {
- return this.bgmEnabled
- }
- public static set BgmEnabled(v: boolean) {
- this.bgmEnabled = v
- StorageUtil.setItem('bgmEnabled', v)
- }
- public static init(): void {
- this.sfxEnabled = StorageUtil.getItem('sfxEnabled', true)
- this.bgmEnabled = StorageUtil.getItem('bgmEnabled', true)
- this.vibrateEnabled = StorageUtil.getItem('vibrateEnabled', true)
- }
- }
- if (PREVIEW) {
- globalThis.Setting = Setting
- }
|