コード例 #1
0
    // Writer
    public static void JsonSerializer(Jboy.JsonWriter writer, object instance)
    {
        writer.WriteNull();
        /*var tex = (Texture2D)instance;
        writer.WriteObjectStart();

        writer.WritePropertyName("width");
        writer.WriteNumber(tex.width);

        writer.WritePropertyName("height");
        writer.WriteNumber(tex.height);

        writer.WritePropertyName("data");
        Jboy.Json.WriteObject(tex.EncodeToPNG(), writer);

        writer.WriteObjectEnd();*/
    }
コード例 #2
0
ファイル: ItemSlot.cs プロジェクト: judah4/battle-of-mages
    // Writer
    public static void JsonSerializer(Jboy.JsonWriter writer, object instance)
    {
        if(instance == null) {
            writer.WriteNull();
            return;
        }

        var slot = (ItemSlot)instance;

        writer.WriteObjectStart();

        // ID
        writer.WritePropertyName("item");
        Jboy.Json.WriteObject(slot.item, writer);

        // Count
        writer.WritePropertyName("count");
        writer.WriteNumber(slot.count);

        writer.WriteObjectEnd();
    }