//------------------------------------------------------------------------------ // // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ export namespace TB {export namespace Battle {export namespace Role { export class GRole { constructor(_json_: any) { if (_json_.id === undefined) { throw new Error() } this.id = _json_.id if (_json_.name === undefined) { throw new Error() } this.name = _json_.name if (_json_.price === undefined) { throw new Error() } this.price = _json_.price if(_json_.expire_time != undefined) { this.expireTime = _json_.expire_time } else { this.expireTime = undefined } } /** * 这是id */ readonly id: number /** * 名字 */ readonly name: string /** * 价格 */ readonly price: number /** * 过期时间 */ readonly expireTime: number|undefined resolve(tables:Tables) { } } }}} export class TbGRole{ private _dataMap: Map private _dataList: TB.Battle.Role.GRole[] constructor(_json_: any) { this._dataMap = new Map() this._dataList = [] for(var _json2_ of _json_) { let _v: TB.Battle.Role.GRole _v = new TB.Battle.Role.GRole(_json2_) this._dataList.push(_v) this._dataMap.set(_v.id, _v) } } getDataMap(): Map { return this._dataMap; } getDataList(): TB.Battle.Role.GRole[] { return this._dataList; } get(key: number): TB.Battle.Role.GRole | undefined { return this._dataMap.get(key); } resolve(tables:Tables) { for(let data of this._dataList) { data.resolve(tables) } } } type JsonLoader = (file: string) => any export class Tables { private _TbGRole: TbGRole get TbGRole(): TbGRole { return this._TbGRole;} constructor(loader: JsonLoader) { this._TbGRole = new TbGRole(loader('tbgrole')) this._TbGRole.resolve(this) } }