//
// automatically generated by the FlatBuffers compiler, do not modify
//
[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() where T : class { return this.Value as T; }
public AttackerT AsMuLan() { return this.As(); }
public static CharacterUnion FromMuLan(AttackerT _mulan) { return new CharacterUnion{ Type = Character.MuLan, Value = _mulan }; }
public RapunzelT AsRapunzel() { return this.As(); }
public static CharacterUnion FromRapunzel(RapunzelT _rapunzel) { return new CharacterUnion{ Type = Character.Rapunzel, Value = _rapunzel }; }
public BookReaderT AsBelle() { return this.As(); }
public static CharacterUnion FromBelle(BookReaderT _belle) { return new CharacterUnion{ Type = Character.Belle, Value = _belle }; }
public BookReaderT AsBookFan() { return this.As(); }
public static CharacterUnion FromBookFan(BookReaderT _bookfan) { return new CharacterUnion{ Type = Character.BookFan, Value = _bookfan }; }
public string AsOther() { return this.As(); }
public static CharacterUnion FromOther(string _other) { return new CharacterUnion{ Type = Character.Other, Value = _other }; }
public string AsUnused() { return this.As(); }
public static CharacterUnion FromUnused(string _unused) { return new CharacterUnion{ Type = Character.Unused, Value = _unused }; }
public static int Pack(Google.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;
}
}
}
static public class CharacterVerify
{
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
{
bool result = true;
switch((Character)typeId)
{
case Character.MuLan:
result = AttackerVerify.Verify(verifier, tablePos);
break;
case Character.Rapunzel:
result = verifier.VerifyUnionData(tablePos, 4, 4);
break;
case Character.Belle:
result = verifier.VerifyUnionData(tablePos, 4, 4);
break;
case Character.BookFan:
result = verifier.VerifyUnionData(tablePos, 4, 4);
break;
case Character.Other:
result = verifier.VerifyUnionString(tablePos);
break;
case Character.Unused:
result = verifier.VerifyUnionString(tablePos);
break;
default: result = true;
break;
}
return result;
}
}
public class CharacterUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
public override bool CanConvert(System.Type objectType) {
return objectType == typeof(CharacterUnion) || objectType == typeof(System.Collections.Generic.List);
}
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
var _olist = value as System.Collections.Generic.List;
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;
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(reader); break;
case Character.Rapunzel: _o.Value = serializer.Deserialize(reader); break;
case Character.Belle: _o.Value = serializer.Deserialize(reader); break;
case Character.BookFan: _o.Value = serializer.Deserialize(reader); break;
case Character.Other: _o.Value = serializer.Deserialize(reader); break;
case Character.Unused: _o.Value = serializer.Deserialize(reader); break;
}
return _o;
}
}