mirror of
https://github.com/motajs/template.git
synced 2026-08-06 17:42:30 +08:00
style: LF -> CRLF
This commit is contained in:
parent
f6383e41e8
commit
8677271b69
@ -9,5 +9,5 @@
|
|||||||
"vueIndentScriptAndStyle": false,
|
"vueIndentScriptAndStyle": false,
|
||||||
"arrowParens": "avoid",
|
"arrowParens": "avoid",
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"endOfLine": "auto"
|
"endOfLine": "crlf"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { isNil } from 'lodash-es';
|
import { isNil } from 'lodash-es';
|
||||||
import { IDataCommon, ItemCategory, SaveCompression } from '@user/data-common';
|
import { IDataCommon, ItemCategory, SaveCompression } from '@user/data-common';
|
||||||
import { HeroEquipsStore } from './equipment';
|
import { HeroEquipsStore } from './equipStore';
|
||||||
import {
|
import {
|
||||||
IHeroItems,
|
IHeroItems,
|
||||||
IHeroItemSave,
|
IHeroItemSave,
|
||||||
@ -25,7 +25,7 @@ export class HeroItems<THero> implements IHeroItems<THero> {
|
|||||||
* 将 item 参数解析为 num,字符串 id 通过 tileStore 转换为 num
|
* 将 item 参数解析为 num,字符串 id 通过 tileStore 转换为 num
|
||||||
* @param item 道具图块数字或 id
|
* @param item 道具图块数字或 id
|
||||||
*/
|
*/
|
||||||
private resolveNum(item: number | string): number | null {
|
private resolveNum(item: number | string): number | undefined {
|
||||||
if (typeof item === 'number') return item;
|
if (typeof item === 'number') return item;
|
||||||
return this.state.tileStore.idToNumber(item);
|
return this.state.tileStore.idToNumber(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,14 +6,14 @@ import {
|
|||||||
ItemCategory
|
ItemCategory
|
||||||
} from './types';
|
} 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;
|
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;
|
return this.dataMap.get(num)?.category ?? ItemCategory.Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
addItem(data: IItemRawData): void {
|
addItem(data: IItemRawData<THero>): void {
|
||||||
this.dataMap.set(data.num, data);
|
this.dataMap.set(data.num, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
attachLegacyConverter(converter: IItemLegacyConverter<TLegacy>): void {
|
attachLegacyConverter(
|
||||||
|
converter: IItemLegacyConverter<THero, TLegacy>
|
||||||
|
): void {
|
||||||
this.converter = converter;
|
this.converter = converter;
|
||||||
}
|
}
|
||||||
|
|
||||||
fromLegacy(num: number, legacy: TLegacy): IItemRawData {
|
fromLegacy(num: number, legacy: TLegacy): IItemRawData<THero> {
|
||||||
const converter = this.converter;
|
const converter = this.converter;
|
||||||
if (!converter) {
|
if (!converter) {
|
||||||
logger.error(57);
|
logger.error(57);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user