mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
资源刷新 以及 出售
This commit is contained in:
@@ -309,6 +309,39 @@ export class TbGOnHookGlobal {
|
||||
}
|
||||
|
||||
|
||||
export namespace TB {
|
||||
export class TbGResource {
|
||||
|
||||
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_.tig === undefined) { throw new Error() }
|
||||
this.tig = _json_.tig
|
||||
}
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
readonly id: number
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
readonly name: string
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
readonly tig: string
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export class TbGGlobal{
|
||||
@@ -535,6 +568,38 @@ export class TbGOnHookGlobal{
|
||||
|
||||
|
||||
|
||||
export class TbGResource{
|
||||
private _dataMap: Map<number, TB.TbGResource>
|
||||
private _dataList: TB.TbGResource[]
|
||||
constructor(_json_: any) {
|
||||
this._dataMap = new Map<number, TB.TbGResource>()
|
||||
this._dataList = []
|
||||
for(var _json2_ of _json_) {
|
||||
let _v: TB.TbGResource
|
||||
_v = new TB.TbGResource(_json2_)
|
||||
this._dataList.push(_v)
|
||||
this._dataMap.set(_v.id, _v)
|
||||
}
|
||||
}
|
||||
|
||||
getDataMap(): Map<number, TB.TbGResource> { return this._dataMap; }
|
||||
getDataList(): TB.TbGResource[] { return this._dataList; }
|
||||
|
||||
get(key: number): TB.TbGResource | 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 {
|
||||
@@ -552,6 +617,8 @@ export class Tables {
|
||||
get TbGMap(): TbGMap { return this._TbGMap;}
|
||||
private _TbGOnHookGlobal: TbGOnHookGlobal
|
||||
get TbGOnHookGlobal(): TbGOnHookGlobal { return this._TbGOnHookGlobal;}
|
||||
private _TbGResource: TbGResource
|
||||
get TbGResource(): TbGResource { return this._TbGResource;}
|
||||
|
||||
constructor(loader: JsonLoader) {
|
||||
this._TbGGlobal = new TbGGlobal(loader('tbgglobal'))
|
||||
@@ -561,6 +628,7 @@ export class Tables {
|
||||
this._TbGRoleSkill = new TbGRoleSkill(loader('tbgroleskill'))
|
||||
this._TbGMap = new TbGMap(loader('tbgmap'))
|
||||
this._TbGOnHookGlobal = new TbGOnHookGlobal(loader('tbgonhookglobal'))
|
||||
this._TbGResource = new TbGResource(loader('tbgresource'))
|
||||
|
||||
this._TbGGlobal.resolve(this)
|
||||
this._TbGRole.resolve(this)
|
||||
@@ -569,5 +637,6 @@ export class Tables {
|
||||
this._TbGRoleSkill.resolve(this)
|
||||
this._TbGMap.resolve(this)
|
||||
this._TbGOnHookGlobal.resolve(this)
|
||||
this._TbGResource.resolve(this)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user