Ejemplo n.º 1
0
 public void LoadData(string data)
 {
     string[] i = data.Split('/');
     if (i.Length == 0)
     {
         return;
     }
     IsLoadingSave = true;
     foreach (string line in i)
     {
         string[] s = line.Split('_');
         if (s.Length < 2)
         {
             continue;
         }
         string   id = s[0];
         GameItem it = ItemManager.Instance.LoadItemByUniqueID(id);
         if (s.Length >= 3)
         {
             List <string> tabs = JsonConvert.DeserializeObject <List <string> >(s[2]);
             foreach (string tag in tabs)
             {
                 it.AddTag(tag);
             }
         }
         if (s.Length >= 4)
         {
             if (bool.TryParse(s[3], out bool res))
             {
                 it.IsLocked = res;
             }
         }
         if (int.TryParse(s[1], out int amt))
         {
             AddMultipleOfItem(it, amt);
         }
         else
         {
             Console.WriteLine("Error loading item in line:" + line);
         }
         if (it != null)
         {
             it.IsLocked = false;
         }
     }
     //FixItems = true;
     IsLoadingSave = false;
     UpdateItemCount();
 }