• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// automatically generated by the FlatBuffers compiler, do not modify
2
3import { Monster as MyGameExample2Monster, MonsterT as MyGameExample2MonsterT } from '../../my-game/example2/monster';
4import { Monster, MonsterT } from '../../my-game/example/monster';
5import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum';
6
7
8export enum AnyUniqueAliases{
9  NONE = 0,
10  M = 1,
11  TS = 2,
12  M2 = 3
13}
14
15export function unionToAnyUniqueAliases(
16  type: AnyUniqueAliases,
17  accessor: (obj:Monster|MyGameExample2Monster|TestSimpleTableWithEnum) => Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null
18): Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null {
19  switch(AnyUniqueAliases[type]) {
20    case 'NONE': return null;
21    case 'M': return accessor(new Monster())! as Monster;
22    case 'TS': return accessor(new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
23    case 'M2': return accessor(new MyGameExample2Monster())! as MyGameExample2Monster;
24    default: return null;
25  }
26}
27
28export function unionListToAnyUniqueAliases(
29  type: AnyUniqueAliases,
30  accessor: (index: number, obj:Monster|MyGameExample2Monster|TestSimpleTableWithEnum) => Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null,
31  index: number
32): Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null {
33  switch(AnyUniqueAliases[type]) {
34    case 'NONE': return null;
35    case 'M': return accessor(index, new Monster())! as Monster;
36    case 'TS': return accessor(index, new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
37    case 'M2': return accessor(index, new MyGameExample2Monster())! as MyGameExample2Monster;
38    default: return null;
39  }
40}
41
42