// Writer public static void JsonSerializer(Jboy.JsonWriter writer, object instance) { Color col = (Color)instance; writer.WriteObjectStart(); writer.WritePropertyName("r"); writer.WriteNumber(col.r); writer.WritePropertyName("g"); writer.WriteNumber(col.g); writer.WritePropertyName("b"); writer.WriteNumber(col.b); writer.WritePropertyName("a"); writer.WriteNumber(col.a); writer.WriteObjectEnd(); }
// Writer public static void JsonSerializer(Jboy.JsonWriter writer, object instance) { var slot = (ArtifactSlot)instance; writer.WriteObjectStart(); writer.WritePropertyName("requiredLevel"); writer.WriteNumber(slot.requiredLevel); writer.WritePropertyName("artifactId"); if(slot.artifact != null) writer.WriteNumber(slot.artifact.id); else writer.WriteNumber(-1); writer.WriteObjectEnd(); }
// 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(); }