Пример #1
0
    public static string GetPlayerPrefString(Save_Keys type, string extra = "")
    {
        if (!PlayerPrefs.HasKey(type.ToString() + extra))
        {
            return null;
            //throw new UnityException("Key '" + type + "' does not exist!");
        }

        return PlayerPrefs.GetString(type.ToString() + extra);
    }
Пример #2
0
    public static float? GetPlayerPrefFloat(Save_Keys type)
    {
        if (!PlayerPrefs.HasKey(type.ToString()))
        {
            return null;
            //throw new UnityException("Key '" + type + "' does not exist!");
        }

        return PlayerPrefs.GetFloat(type.ToString());
    }
Пример #3
0
    public static int GetPlayerPrefInt(Save_Keys type)
    {
        if (!PlayerPrefs.HasKey(type.ToString()))
        {
            switch (type)
            {
                case Save_Keys.Key_Coins:
                    {
                        return 10;
                    }
                    break;
                default:
                    {
                        return 0;
                    }
            }
            //throw new UnityException("Key '" + type + "' does not exist!");
        }

        return PlayerPrefs.GetInt(type.ToString());
    }
Пример #4
0
 public static string GetKey(Save_Keys type)
 {
     return Keys[(int)type];
 }