[add] first
This commit is contained in:
27
assets/scripts/core/data/data-base.ts
Normal file
27
assets/scripts/core/data/data-base.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { ResCache } from "../res/res-cache";
|
||||
import { KeyAnyType } from "../../logic/data/game-type";
|
||||
|
||||
export class DataBase {
|
||||
|
||||
_data:KeyAnyType = {};
|
||||
_name:string = '';
|
||||
|
||||
constructor() {}
|
||||
|
||||
public init(name:string) {
|
||||
this._name = name;
|
||||
this._data = ResCache.Instance.getJson(name).json;
|
||||
this.bind();
|
||||
}
|
||||
|
||||
public bind() {}
|
||||
|
||||
public get(name:string) {
|
||||
const item = this._data[name];
|
||||
if (item === undefined) {
|
||||
throw new Error(`${this._name} database not find ${name}.`);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
9
assets/scripts/core/data/data-base.ts.meta
Normal file
9
assets/scripts/core/data/data-base.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "cec94d7e-0d38-4158-80c8-67f7f2bde1cd",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user