示例#1
0
    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();
            }
        }
    }
示例#2
0
    public void Load()
    {
        QuickSaveReader reader = QuickSaveReader.Create("GuardianIdleSave");

        if (reader.Exists("itemIdCounter"))
        {
            idCounter = reader.Read <int>("itemIdCounter");
        }
        else
        {
            idCounter = 0;
        }
    }
示例#3
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);
    }
示例#4
0
    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();
            }
        }
    }