mirror of
https://github.com/motajs/template.git
synced 2026-11-01 06:04:30 +08:00
style: LF -> CRLF
This commit is contained in:
1 parent
f6383e41e8
commit
8677271b69
3 files changed
+13
-11
No files matched your search
@@ -6,14 +6,14 @@ import {
|
||||
ItemCategory
|
||||
} from './types';
|
||||
|
||||
export class ItemStore<TLegacy> implements IItemStore<TLegacy> {
|
||||
export class ItemStore<THero, TLegacy> implements IItemStore<THero, TLegacy> {
|
||||
/** 以道具图块数字为键的原始道具定义表 */
|
||||
private readonly dataMap: Map<number, IItemRawData> = new Map();
|
||||
private readonly dataMap: Map<number, IItemRawData<THero>> = new Map();
|
||||
|
||||
/** 当前挂载的旧样板道具转换器 */
|
||||
private converter: IItemLegacyConverter<TLegacy> | null = null;
|
||||
private converter: IItemLegacyConverter<THero, TLegacy> | null = null;
|
||||
|
||||
getData(num: number): IItemRawData | null {
|
||||
getData(num: number): IItemRawData<THero> | null {
|
||||
return this.dataMap.get(num) ?? null;
|
||||
}
|
||||
|
||||
@@ -21,15 +21,17 @@ export class ItemStore<TLegacy> implements IItemStore<TLegacy> {
|
||||
return this.dataMap.get(num)?.category ?? ItemCategory.Unknown;
|
||||
}
|
||||
|
||||
addItem(data: IItemRawData): void {
|
||||
addItem(data: IItemRawData<THero>): void {
|
||||
this.dataMap.set(data.num, data);
|
||||
}
|
||||
|
||||
attachLegacyConverter(converter: IItemLegacyConverter<TLegacy>): void {
|
||||
attachLegacyConverter(
|
||||
converter: IItemLegacyConverter<THero, TLegacy>
|
||||
): void {
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
fromLegacy(num: number, legacy: TLegacy): IItemRawData {
|
||||
fromLegacy(num: number, legacy: TLegacy): IItemRawData<THero> {
|
||||
const converter = this.converter;
|
||||
if (!converter) {
|
||||
logger.error(57);
|
||||
|
||||
Reference in new issue
Block a user