Beispiel #1
0
    // Reader
    public static object JsonDeserializer(Jboy.JsonReader reader)
    {
        reader.ReadArrayStart();

        var tree = new ArtifactTree();
        for(int i = 0; i < tree.slots.Length; i++) {
            int numSlots = Artifact.maxLevel - i;
            var slotLevel = tree.slots[i];
            reader.ReadArrayStart();

            for(int slotIndex = 0; slotIndex < numSlots; slotIndex++) {
                var artifactSlot = new ArtifactSlot((byte)i);
                artifactSlot.artifact = Jboy.Json.ReadObject<Artifact>(reader);

                slotLevel[slotIndex] = artifactSlot;
            }

            reader.ReadArrayEnd();
        }

        reader.ReadArrayEnd();
        return tree;
    }