schema.ts 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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 Item3 {
  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 Item {
  224. constructor(_buf_: ByteBuf) {
  225. this.id = _buf_.ReadInt()
  226. this.name = _buf_.ReadString()
  227. this.maxPileNum = _buf_.ReadInt()
  228. this.icon = _buf_.ReadString()
  229. this.iconBackgroud = _buf_.ReadString()
  230. this.desc = _buf_.ReadString()
  231. }
  232. /**
  233. * 道具编号
  234. */
  235. readonly id: number
  236. /**
  237. * 道具名称
  238. */
  239. readonly name: string
  240. /**
  241. * 最大叠加数量
  242. */
  243. readonly maxPileNum: number
  244. /**
  245. * 道具图标
  246. */
  247. readonly icon: string
  248. /**
  249. * 道具图标底衬
  250. */
  251. readonly iconBackgroud: string
  252. /**
  253. * 道具说明
  254. */
  255. readonly desc: string
  256. resolve(tables:Tables) {
  257. }
  258. }
  259. export class TbItem {
  260. private _dataMap: Map<number, Item>
  261. private _dataList: Item[]
  262. constructor(_buf_: ByteBuf) {
  263. this._dataMap = new Map<number, Item>()
  264. this._dataList = []
  265. for(let n = _buf_.ReadInt(); n > 0; n--) {
  266. let _v: Item
  267. _v = new Item(_buf_)
  268. this._dataList.push(_v)
  269. this._dataMap.set(_v.id, _v)
  270. }
  271. }
  272. getDataMap(): Map<number, Item> { return this._dataMap; }
  273. getDataList(): Item[] { return this._dataList; }
  274. get(key: number): Item | undefined {
  275. return this._dataMap.get(key);
  276. }
  277. resolve(tables:Tables) {
  278. for(let data of this._dataList)
  279. {
  280. data.resolve(tables)
  281. }
  282. }
  283. }
  284. export class TbItem3 {
  285. private _dataMap: Map<number, Item3>
  286. private _dataList: Item3[]
  287. constructor(_buf_: ByteBuf) {
  288. this._dataMap = new Map<number, Item3>()
  289. this._dataList = []
  290. for(let n = _buf_.ReadInt(); n > 0; n--) {
  291. let _v: Item3
  292. _v = new Item3(_buf_)
  293. this._dataList.push(_v)
  294. this._dataMap.set(_v.id, _v)
  295. }
  296. }
  297. getDataMap(): Map<number, Item3> { return this._dataMap; }
  298. getDataList(): Item3[] { return this._dataList; }
  299. get(key: number): Item3 | undefined {
  300. return this._dataMap.get(key);
  301. }
  302. resolve(tables:Tables) {
  303. for(let data of this._dataList)
  304. {
  305. data.resolve(tables)
  306. }
  307. }
  308. }
  309. export class TbItem4 {
  310. private _dataMap: Map<number, Item4>
  311. private _dataList: Item4[]
  312. constructor(_buf_: ByteBuf) {
  313. this._dataMap = new Map<number, Item4>()
  314. this._dataList = []
  315. for(let n = _buf_.ReadInt(); n > 0; n--) {
  316. let _v: Item4
  317. _v = new Item4(_buf_)
  318. this._dataList.push(_v)
  319. this._dataMap.set(_v.id, _v)
  320. }
  321. }
  322. getDataMap(): Map<number, Item4> { return this._dataMap; }
  323. getDataList(): Item4[] { return this._dataList; }
  324. get(key: number): Item4 | undefined {
  325. return this._dataMap.get(key);
  326. }
  327. resolve(tables:Tables) {
  328. for(let data of this._dataList)
  329. {
  330. data.resolve(tables)
  331. }
  332. }
  333. }
  334. type ByteBufLoader = (file: string) => ByteBuf
  335. export class Tables {
  336. private _TbItem: TbItem
  337. get TbItem(): TbItem { return this._TbItem;}
  338. private _TbItem3: TbItem3
  339. get TbItem3(): TbItem3 { return this._TbItem3;}
  340. private _TbItem4: TbItem4
  341. get TbItem4(): TbItem4 { return this._TbItem4;}
  342. static getTableNames(): string[] {
  343. let names: string[] = [];
  344. names.push('tbitem');
  345. names.push('tbitem3');
  346. names.push('tbitem4');
  347. return names;
  348. }
  349. constructor(loader: ByteBufLoader) {
  350. this._TbItem = new TbItem(loader('tbitem'))
  351. this._TbItem3 = new TbItem3(loader('tbitem3'))
  352. this._TbItem4 = new TbItem4(loader('tbitem4'))
  353. this._TbItem.resolve(this)
  354. this._TbItem3.resolve(this)
  355. this._TbItem4.resolve(this)
  356. }
  357. }