blob: 07deadc28af1278a2252471c3d4c972ec5ae31f4 [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// <auto-generated>
2// automatically generated by the FlatBuffers compiler, do not modify
3// </auto-generated>
4
5namespace MyGame.Example
6{
7
Austin Schuh272c6132020-11-14 16:37:52 -08008[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07009public enum AnyAmbiguousAliases : byte
10{
11 NONE = 0,
12 M1 = 1,
13 M2 = 2,
14 M3 = 3,
15};
16
Austin Schuh272c6132020-11-14 16:37:52 -080017public class AnyAmbiguousAliasesUnion {
18 public AnyAmbiguousAliases Type { get; set; }
19 public object Value { get; set; }
20
21 public AnyAmbiguousAliasesUnion() {
22 this.Type = AnyAmbiguousAliases.NONE;
23 this.Value = null;
24 }
25
26 public T As<T>() where T : class { return this.Value as T; }
27 public MyGame.Example.MonsterT AsM1() { return this.As<MyGame.Example.MonsterT>(); }
28 public MyGame.Example.MonsterT AsM2() { return this.As<MyGame.Example.MonsterT>(); }
29 public MyGame.Example.MonsterT AsM3() { return this.As<MyGame.Example.MonsterT>(); }
30
31 public static int Pack(FlatBuffers.FlatBufferBuilder builder, AnyAmbiguousAliasesUnion _o) {
32 switch (_o.Type) {
33 default: return 0;
34 case AnyAmbiguousAliases.M1: return MyGame.Example.Monster.Pack(builder, _o.AsM1()).Value;
35 case AnyAmbiguousAliases.M2: return MyGame.Example.Monster.Pack(builder, _o.AsM2()).Value;
36 case AnyAmbiguousAliases.M3: return MyGame.Example.Monster.Pack(builder, _o.AsM3()).Value;
37 }
38 }
39}
40
41public class AnyAmbiguousAliasesUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
42 public override bool CanConvert(System.Type objectType) {
43 return objectType == typeof(AnyAmbiguousAliasesUnion) || objectType == typeof(System.Collections.Generic.List<AnyAmbiguousAliasesUnion>);
44 }
45 public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
46 var _olist = value as System.Collections.Generic.List<AnyAmbiguousAliasesUnion>;
47 if (_olist != null) {
48 writer.WriteStartArray();
49 foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
50 writer.WriteEndArray();
51 } else {
52 this.WriteJson(writer, value as AnyAmbiguousAliasesUnion, serializer);
53 }
54 }
55 public void WriteJson(Newtonsoft.Json.JsonWriter writer, AnyAmbiguousAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
56 if (_o == null) return;
57 serializer.Serialize(writer, _o.Value);
58 }
59 public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
60 var _olist = existingValue as System.Collections.Generic.List<AnyAmbiguousAliasesUnion>;
61 if (_olist != null) {
62 for (var _j = 0; _j < _olist.Count; ++_j) {
63 reader.Read();
64 _olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
65 }
66 reader.Read();
67 return _olist;
68 } else {
69 return this.ReadJson(reader, existingValue as AnyAmbiguousAliasesUnion, serializer);
70 }
71 }
72 public AnyAmbiguousAliasesUnion ReadJson(Newtonsoft.Json.JsonReader reader, AnyAmbiguousAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
73 if (_o == null) return null;
74 switch (_o.Type) {
75 default: break;
76 case AnyAmbiguousAliases.M1: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
77 case AnyAmbiguousAliases.M2: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
78 case AnyAmbiguousAliases.M3: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
79 }
80 return _o;
81 }
82}
83
Austin Schuhe89fa2d2019-08-14 20:24:23 -070084
85}