使用Luban

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-11-05 04:40:09 +08:00
parent 0014eff5e0
commit e8f8cb3ce9
44 changed files with 909 additions and 8 deletions

View 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)
}
}

View File

@@ -0,0 +1,54 @@
[
{
"id": 10000,
"name": "发型",
"price": 100
},
{
"id": 10001,
"name": "外套",
"price": 100
},
{
"id": 10002,
"name": "上衣",
"price": 100
},
{
"id": 10003,
"name": "裙子",
"price": 100
},
{
"id": 10004,
"name": "袜子",
"price": 100
},
{
"id": 10005,
"name": "鞋子",
"price": 100
},
{
"id": 10006,
"name": "发饰",
"price": 100
},
{
"id": 10007,
"name": "中秋节发饰",
"price": 200,
"expire_time": 1633881599
},
{
"id": 10008,
"name": "中秋节鞋子",
"price": 300,
"expire_time": 1633967999
},
{
"id": 10009,
"name": "礼包",
"price": 100
}
]