schema.ts 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated by a tool.
  4. // Changes to this file may cause incorrect behavior and will be lost if
  5. // the code is regenerated.
  6. // </auto-generated>
  7. //------------------------------------------------------------------------------
  8. import ByteBuf from '../bright/serialization/ByteBuf'
  9. export namespace test {
  10. export enum ETestQuality {
  11. /**
  12. * 最高品质
  13. */
  14. A = 1,
  15. /**
  16. * 黑色的
  17. */
  18. B = 2,
  19. /**
  20. * 蓝色的
  21. */
  22. C = 3,
  23. /**
  24. * 最差品质
  25. */
  26. D = 4,
  27. }
  28. }
  29. export namespace test {
  30. export enum AccessFlag {
  31. WRITE = 1,
  32. READ = 2,
  33. TRUNCATE = 4,
  34. NEW = 8,
  35. READ_WRITE = WRITE|READ,
  36. }
  37. }
  38. export namespace test {
  39. /**
  40. * 这是个测试excel结构
  41. */
  42. export class TestExcelBean1 {
  43. constructor(_buf_: ByteBuf) {
  44. this.x1 = _buf_.ReadInt()
  45. this.x2 = _buf_.ReadString()
  46. this.x3 = _buf_.ReadInt()
  47. this.x4 = _buf_.ReadFloat()
  48. }
  49. /**
  50. * 最高品质
  51. */
  52. readonly x1: number
  53. /**
  54. * 黑色的
  55. */
  56. readonly x2: string
  57. /**
  58. * 蓝色的
  59. */
  60. readonly x3: number
  61. /**
  62. * 最差品质
  63. */
  64. readonly x4: number
  65. resolve(tables:Tables) {
  66. }
  67. }
  68. }
  69. export namespace test {
  70. /**
  71. * 这是个测试excel结构
  72. */
  73. export class TestExcelBean2 {
  74. constructor(_buf_: ByteBuf) {
  75. this.y1 = _buf_.ReadInt()
  76. this.y2 = _buf_.ReadString()
  77. this.y3 = _buf_.ReadFloat()
  78. }
  79. /**
  80. * 最高品质
  81. */
  82. readonly y1: number
  83. /**
  84. * 黑色的
  85. */
  86. readonly y2: string
  87. /**
  88. * 蓝色的
  89. */
  90. readonly y3: number
  91. resolve(tables:Tables) {
  92. }
  93. }
  94. }
  95. export namespace test {
  96. export abstract class Shape {
  97. static constructorFrom(_buf_: ByteBuf): Shape{
  98. switch (_buf_.ReadInt()) {
  99. case 2131829196: return new test.Circle(_buf_)
  100. case 694982337: return new test2.Rectangle(_buf_)
  101. default: throw new Error()
  102. }
  103. }
  104. constructor(_buf_: ByteBuf) {
  105. }
  106. resolve(tables:Tables) {
  107. }
  108. }
  109. }
  110. export namespace test {
  111. /**
  112. * 圆
  113. */
  114. export class Circle extends test.Shape {
  115. constructor(_buf_: ByteBuf) {
  116. super(_buf_)
  117. this.radius = _buf_.ReadFloat()
  118. }
  119. /**
  120. * 半径
  121. */
  122. readonly radius: number
  123. resolve(tables:Tables) {
  124. super.resolve(tables)
  125. }
  126. }
  127. }
  128. export namespace test2 {
  129. /**
  130. * 矩形
  131. */
  132. export class Rectangle extends test.Shape {
  133. constructor(_buf_: ByteBuf) {
  134. super(_buf_)
  135. this.width = _buf_.ReadFloat()
  136. this.height = _buf_.ReadFloat()
  137. }
  138. /**
  139. * 宽度
  140. */
  141. readonly width: number
  142. /**
  143. * 高度
  144. */
  145. readonly height: number
  146. resolve(tables:Tables) {
  147. super.resolve(tables)
  148. }
  149. }
  150. }
  151. export class Item4 {
  152. constructor(_buf_: ByteBuf) {
  153. this.id = _buf_.ReadInt()
  154. this.name = _buf_.ReadString()
  155. this.maxPileNum = _buf_.ReadInt()
  156. this.icon = _buf_.ReadString()
  157. this.iconBackgroud = _buf_.ReadString()
  158. this.desc = _buf_.ReadString()
  159. }
  160. /**
  161. * 道具编号
  162. */
  163. readonly id: number
  164. /**
  165. * 道具名称
  166. */
  167. readonly name: string
  168. /**
  169. * 最大叠加数量
  170. */
  171. readonly maxPileNum: number
  172. /**
  173. * 道具图标
  174. */
  175. readonly icon: string
  176. /**
  177. * 道具图标底衬
  178. */
  179. readonly iconBackgroud: string
  180. /**
  181. * 道具说明
  182. */
  183. readonly desc: string
  184. resolve(tables:Tables) {
  185. }
  186. }
  187. export class Item {
  188. constructor(_buf_: ByteBuf) {
  189. this.id = _buf_.ReadInt()
  190. this.name = _buf_.ReadString()
  191. this.maxPileNum = _buf_.ReadInt()
  192. this.icon = _buf_.ReadString()
  193. this.iconBackgroud = _buf_.ReadString()
  194. this.desc = _buf_.ReadString()
  195. }
  196. /**
  197. * 道具编号
  198. */
  199. readonly id: number
  200. /**
  201. * 道具名称
  202. */
  203. readonly name: string
  204. /**
  205. * 最大叠加数量
  206. */
  207. readonly maxPileNum: number
  208. /**
  209. * 道具图标
  210. */
  211. readonly icon: string
  212. /**
  213. * 道具图标底衬
  214. */
  215. readonly iconBackgroud: string
  216. /**
  217. * 道具说明
  218. */
  219. readonly desc: string
  220. resolve(tables:Tables) {
  221. }
  222. }
  223. export class TbItem {
  224. private _dataMap: Map<number, Item>
  225. private _dataList: Item[]
  226. constructor(_buf_: ByteBuf) {
  227. this._dataMap = new Map<number, Item>()
  228. this._dataList = []
  229. for(let n = _buf_.ReadInt(); n > 0; n--) {
  230. let _v: Item
  231. _v = new Item(_buf_)
  232. this._dataList.push(_v)
  233. this._dataMap.set(_v.id, _v)
  234. }
  235. }
  236. getDataMap(): Map<number, Item> { return this._dataMap; }
  237. getDataList(): Item[] { return this._dataList; }
  238. get(key: number): Item | undefined {
  239. return this._dataMap.get(key);
  240. }
  241. resolve(tables:Tables) {
  242. for(let data of this._dataList)
  243. {
  244. data.resolve(tables)
  245. }
  246. }
  247. }
  248. export class TbItem4 {
  249. private _dataMap: Map<number, Item4>
  250. private _dataList: Item4[]
  251. constructor(_buf_: ByteBuf) {
  252. this._dataMap = new Map<number, Item4>()
  253. this._dataList = []
  254. for(let n = _buf_.ReadInt(); n > 0; n--) {
  255. let _v: Item4
  256. _v = new Item4(_buf_)
  257. this._dataList.push(_v)
  258. this._dataMap.set(_v.id, _v)
  259. }
  260. }
  261. getDataMap(): Map<number, Item4> { return this._dataMap; }
  262. getDataList(): Item4[] { return this._dataList; }
  263. get(key: number): Item4 | undefined {
  264. return this._dataMap.get(key);
  265. }
  266. resolve(tables:Tables) {
  267. for(let data of this._dataList)
  268. {
  269. data.resolve(tables)
  270. }
  271. }
  272. }
  273. type ByteBufLoader = (file: string) => ByteBuf
  274. export class Tables {
  275. private _TbItem: TbItem
  276. get TbItem(): TbItem { return this._TbItem;}
  277. private _TbItem4: TbItem4
  278. get TbItem4(): TbItem4 { return this._TbItem4;}
  279. static getTableNames(): string[] {
  280. let names: string[] = [];
  281. names.push('tbitem');
  282. names.push('tbitem4');
  283. return names;
  284. }
  285. constructor(loader: ByteBufLoader) {
  286. this._TbItem = new TbItem(loader('tbitem'))
  287. this._TbItem4 = new TbItem4(loader('tbitem4'))
  288. this._TbItem.resolve(this)
  289. this._TbItem4.resolve(this)
  290. }
  291. }