using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerPrefManager { public const string INTERACT_CONFIG = "Interact_Config"; public const string PLAYER_CONFIG = "Player_Config"; public static bool GetBool(string label, bool defaultValue) { int i = PlayerPrefs.GetInt(label, -1); if (i == -1) { return defaultValue; } if (i == 0) { return false; } else { return true; } } public static void SaveBool(string label, bool value) { if (value) { PlayerPrefs.SetInt(label, 1); } else { PlayerPrefs.SetInt(label, 0); } PlayerPrefs.Save(); } public static string GetStr(string label, string defaultValue) { string str = PlayerPrefs.GetString(label, "null"); if (str == "null") { return defaultValue; } return str; } public static void SaveStr(string label, string value) { PlayerPrefs.SetString(label, value); PlayerPrefs.Save(); } }