mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
使用Luban
This commit is contained in:
98
JisolGameCocos/assets/resources/config/data/schema.ts
Normal file
98
JisolGameCocos/assets/resources/config/data/schema.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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<number, TB.Battle.Role.GRole>
|
||||
private _dataList: TB.Battle.Role.GRole[]
|
||||
constructor(_json_: any) {
|
||||
this._dataMap = new Map<number, TB.Battle.Role.GRole>()
|
||||
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<number, TB.Battle.Role.GRole> { 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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user