28 lines
679 B
TypeScript
Raw Normal View History

2025-07-28 14:26:19 +08:00
/**
* @Author: Gongxh
* @Date: 2025-02-17
* @Description:
*/
import { GlobalEvent } from "kunpocc-event";
import { Level } from "../Data/global/Level";
2025-07-28 14:26:19 +08:00
export class DataHelper {
public static level: Level = new Level();
2025-07-28 14:26:19 +08:00
private static _data: Map<string, any> = new Map();
public static getValue<T>(key: string, defaultValue: T): T {
if (this._data.has(key)) {
return this._data.get(key) as T;
}
return defaultValue;
}
public static setValue(key: string, value: any): void {
this._data.set(key, value);
/** 数据改变后发送事件 */
GlobalEvent.send(key);
}
}