Beispiel #1
0
 public void SetLevel(string name, int level)
 {
     if (CustomerLevel.ContainsKey(name))
     {
         CustomerLevel[name] = level;
     }
     else
     {
         CustomerLevel.Add(name, level);
     }
 }
Beispiel #2
0
 public void SetExp(string name, int exp)
 {
     if (CustomerLevel.ContainsKey(name))
     {
         CustomerLevel[name] = exp;
     }
     else
     {
         CustomerLevel.Add(name, exp);
     }
 }
Beispiel #3
0
    void LoadLevel()
    {
        int count = PlayerPrefs.GetInt(nameof(CustomerCount));

        CustomerLevel.Clear();
        for (int i = 0; i < count; i++)
        {
            string key = PlayerPrefs.GetString($"Customer{i}Level");
            if (string.IsNullOrEmpty(key))
            {
                continue;
            }

            int value = PlayerPrefs.GetInt(key);
            CustomerLevel.Add(key, value);
        }
    }