public void Load() { QuickSaveReader reader = QuickSaveReader.Create("GuardianIdleSave"); Equipment item; string key; for (int i = 0; i < slots.Count; i++) { key = "equipSlot" + i; if (reader.Exists(key)) { string JsonString = reader.Read <string>(key); item = JsonUtility.FromJson <Equipment>(JsonString); string icon = reader.Read <string>(key + "_icon"); item.SetIcon(icon); slots[i].AddItem(item); } else { // Saved slot is empty, clear the slot to prevent duplication slots[i].Clear(); } } }
public void Load() { QuickSaveReader reader = QuickSaveReader.Create("GuardianIdleSave"); if (reader.Exists("itemIdCounter")) { idCounter = reader.Read <int>("itemIdCounter"); } else { idCounter = 0; } }
public static Dictionary <string, float> LoadPriceMultipliers(QuickSaveReader reader = null) { reader ??= QSReader.Create("Market"); var priceMultipliers = new Dictionary <string, float>(); if (reader.Exists("Multipliers")) { priceMultipliers = reader.Read <Dictionary <string, float> >("Multipliers"); } else { foreach (var seedName in SeedTypesInInventory) { if (!priceMultipliers.ContainsKey(seedName)) { priceMultipliers[seedName] = 1.0f; } } } return(priceMultipliers); }
public void Load() { QuickSaveReader reader = QuickSaveReader.Create("GuardianIdleSave"); Item item; string key; for (int i = 0; i < slots.Count; i++) { key = "invslot" + i; if (reader.Exists(key)) { string JsonString = reader.Read <string>(key); string type = reader.Read <string>(key + "_type"); if (type == "equipment") { item = JsonUtility.FromJson <Equipment>(JsonString); } else { item = JsonUtility.FromJson <Item>(JsonString); } string icon = reader.Read <string>(key + "_icon"); item.SetIcon(icon); Debug.Log("adding item to slot: " + i); slots[i].AddItem(item); } else { // Saved slot is empty, clear the slot to prevent duplication Debug.Log("clearing slot: " + i); slots[i].Clear(); } } }