123456789101112131415161718192021222324252627 |
- using UnityEngine;
- namespace GFGGame
- {
- public class LocalCache
- {
- public static void SetBool(string key, bool isOn)
- {
- int value = isOn?1:0;
- PlayerPrefs.SetInt(key, value);
- PlayerPrefs.Save();
- }
- public static bool GetBool(string key, bool defaultValue)
- {
- int defaultInt = defaultValue?1:0;
- int value = PlayerPrefs.GetInt(key, defaultInt);
- return value > 0;
- }
- public static void InitLocalData()
- {
- SoundManager.Instance.isOn = GetBool(LauncherConfig.SOUND_KEY, true);
- MusicManager.Instance.isOn = GetBool(LauncherConfig.MUSIC_KEY, true);
- }
- }
- }
|