Ejemplo n.º 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);
    }
Ejemplo n.º 2
0
    // Constructor
    public ArtifactTree()
    {
        slots = new ArtifactSlot[5][];

        for(byte i = 0; i < Artifact.maxLevel; i++) {
            int numSlots = Artifact.maxLevel - i;
            slots[i] = new ArtifactSlot[numSlots];

            for(int slotIndex = 0; slotIndex < numSlots; slotIndex++) {
                slots[i][slotIndex] = new ArtifactSlot(i);
            }
        }
    }
Ejemplo n.º 3
0
    // Constructor
    public ArtifactTree()
    {
        slots = new ArtifactSlot[5][];

        for (byte i = 0; i < Artifact.maxLevel; i++)
        {
            int numSlots = Artifact.maxLevel - i;
            slots[i] = new ArtifactSlot[numSlots];

            for (int slotIndex = 0; slotIndex < numSlots; slotIndex++)
            {
                slots[i][slotIndex] = new ArtifactSlot(i);
            }
        }
    }
Ejemplo n.º 4
0
    // Reader
    public static object JsonDeserializer(Jboy.JsonReader reader)
    {
        var slot = new ArtifactSlot();

        reader.ReadObjectStart();

        reader.ReadPropertyName("requiredLevel");
        slot.requiredLevel = (byte)reader.ReadNumber();

        reader.ReadPropertyName("artifactId");
        int itemId = (int)reader.ReadNumber();

        if(itemId != -1) {
            slot.artifact = new Artifact(itemId);
        }

        reader.ReadObjectEnd();

        return slot;
    }
Ejemplo n.º 5
0
    // Reader
    public static object JsonDeserializer(Jboy.JsonReader reader)
    {
        var slot = new ArtifactSlot();

        reader.ReadObjectStart();

        reader.ReadPropertyName("requiredLevel");
        slot.requiredLevel = (byte)reader.ReadNumber();

        reader.ReadPropertyName("artifactId");
        int itemId = (int)reader.ReadNumber();

        if (itemId != -1)
        {
            slot.artifact = new Artifact(itemId);
        }

        reader.ReadObjectEnd();

        return(slot);
    }
Ejemplo n.º 6
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;
    }