예제 #1
0
    public void Save()
    {
        QuickSaveWriter writer = QuickSaveWriter.Create("GuardianIdleSave");
        Equipment       item;
        string          key;

        for (int i = 0; i < slots.Count; i++)
        {
            key = "equipSlot" + i;

            if (!(slots[i].IsEmpty()))
            {
                item = (Equipment)slots[i].GetItem();
                string data = JsonUtility.ToJson(item, false);

                writer.Write(key, data);
                writer.Write(key + "_icon", item.imagePath);
            }
            else
            {
                writer.Delete(key);
            }
        }

        writer.Commit();
    }
예제 #2
0
    public void Save()
    {
        QuickSaveWriter writer = QuickSaveWriter.Create("GuardianIdleSave");
        Item            item;
        string          key;

        for (int i = 0; i < slots.Count; i++)
        {
            key = "invslot" + i;

            if (!(slots[i].IsEmpty()))
            {
                item = slots[i].GetItem();
                string data = JsonUtility.ToJson(item, false);
                Debug.Log(key);
                writer.Write(key, data);
                writer.Write(key + "_icon", item.imagePath);

                if (item is Equipment)
                {
                    writer.Write(key + "_type", "equipment");
                }
                else
                {
                    writer.Write(key + "_type", "item");
                }


                Debug.Log("Wrote item in slot" + i + ": " + item);
                Debug.Log("JSON Utility: " + JsonUtility.ToJson(item, false));
            }
            else
            {
                writer.Delete(key);
            }
        }

        writer.Commit();
    }