You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.8 KiB

// <auto-generated>
// automatically generated by the FlatBuffers compiler, do not modify
// </auto-generated>
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public enum Character : byte
{
NONE = 0,
MuLan = 1,
Rapunzel = 2,
Belle = 3,
BookFan = 4,
Other = 5,
Unused = 6,
};
public class CharacterUnion {
public Character Type { get; set; }
public object Value { get; set; }
public CharacterUnion() {
this.Type = Character.NONE;
this.Value = null;
}
public T As<T>() where T : class { return this.Value as T; }
public AttackerT AsMuLan() { return this.As<AttackerT>(); }
public RapunzelT AsRapunzel() { return this.As<RapunzelT>(); }
public BookReaderT AsBelle() { return this.As<BookReaderT>(); }
public BookReaderT AsBookFan() { return this.As<BookReaderT>(); }
public string AsOther() { return this.As<string>(); }
public string AsUnused() { return this.As<string>(); }
public static int Pack(FlatBuffers.FlatBufferBuilder builder, CharacterUnion _o) {
switch (_o.Type) {
default: return 0;
case Character.MuLan: return Attacker.Pack(builder, _o.AsMuLan()).Value;
case Character.Rapunzel: return Rapunzel.Pack(builder, _o.AsRapunzel()).Value;
case Character.Belle: return BookReader.Pack(builder, _o.AsBelle()).Value;
case Character.BookFan: return BookReader.Pack(builder, _o.AsBookFan()).Value;
case Character.Other: return builder.CreateString(_o.AsOther()).Value;
case Character.Unused: return builder.CreateString(_o.AsUnused()).Value;
}
}
}
public class CharacterUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
public override bool CanConvert(System.Type objectType) {
return objectType == typeof(CharacterUnion) || objectType == typeof(System.Collections.Generic.List<CharacterUnion>);
}
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = value as System.Collections.Generic.List<CharacterUnion>;
if (_olist != null) {
writer.WriteStartArray();
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
writer.WriteEndArray();
} else {
this.WriteJson(writer, value as CharacterUnion, serializer);
}
}
public void WriteJson(Newtonsoft.Json.JsonWriter writer, CharacterUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return;
serializer.Serialize(writer, _o.Value);
}
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = existingValue as System.Collections.Generic.List<CharacterUnion>;
if (_olist != null) {
for (var _j = 0; _j < _olist.Count; ++_j) {
reader.Read();
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
}
reader.Read();
return _olist;
} else {
return this.ReadJson(reader, existingValue as CharacterUnion, serializer);
}
}
public CharacterUnion ReadJson(Newtonsoft.Json.JsonReader reader, CharacterUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
if (_o == null) return null;
switch (_o.Type) {
default: break;
case Character.MuLan: _o.Value = serializer.Deserialize<AttackerT>(reader); break;
case Character.Rapunzel: _o.Value = serializer.Deserialize<RapunzelT>(reader); break;
case Character.Belle: _o.Value = serializer.Deserialize<BookReaderT>(reader); break;
case Character.BookFan: _o.Value = serializer.Deserialize<BookReaderT>(reader); break;
case Character.Other: _o.Value = serializer.Deserialize<string>(reader); break;
case Character.Unused: _o.Value = serializer.Deserialize<string>(reader); break;
}
return _o;
}
}