misc: 정리
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import type { IResourceController, ValidEntity, ValidEntityType } from "./ResourceController.js";
|
import type { IResourceController, ValidEntity, ValidEntityType } from "./ResourceController.js";
|
||||||
|
|
||||||
export abstract class LazyEntityUpdater<Entity extends ValidEntity>{
|
export abstract class LazyEntityUpdater<Entity extends ValidEntity>{
|
||||||
protected abstract readonly _indirectNames: (keyof Entity)[];
|
protected abstract readonly _indirectNames: ReadonlyArray<keyof Entity>;
|
||||||
protected abstract readonly _entityType: ValidEntityType<Entity>;
|
protected abstract readonly _entityType: ValidEntityType<Entity>;
|
||||||
|
|
||||||
protected abstract readonly _raw: Entity;
|
protected abstract readonly _raw: Entity;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type { ITroopEntity } from "./TroopEntity.js";
|
|||||||
import type { LazyEntityUpdater } from "./LazyEntityUpdater.js";
|
import type { LazyEntityUpdater } from "./LazyEntityUpdater.js";
|
||||||
import type { ICityEntity } from "./CityEntity.js";
|
import type { ICityEntity } from "./CityEntity.js";
|
||||||
import type { INationEntity } from "./NationEntity.js";
|
import type { INationEntity } from "./NationEntity.js";
|
||||||
|
import type { ValuesOf } from "@sammo/util";
|
||||||
|
|
||||||
export type ValidEntityList = {
|
export type ValidEntityList = {
|
||||||
'General': IGeneralEntity;
|
'General': IGeneralEntity;
|
||||||
@@ -17,7 +18,7 @@ export type ValidEntityList = {
|
|||||||
'Troop': ITroopEntity;
|
'Troop': ITroopEntity;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ValidEntity = ValidEntityList[keyof ValidEntityList];
|
export type ValidEntity = ValuesOf<ValidEntityList>;
|
||||||
export type ValidEntityType<Entity> = Entity extends ValidEntityList[infer T extends keyof ValidEntityList] ? T : never;
|
export type ValidEntityType<Entity> = Entity extends ValidEntityList[infer T extends keyof ValidEntityList] ? T : never;
|
||||||
|
|
||||||
export interface IResourceController{
|
export interface IResourceController{
|
||||||
@@ -29,7 +30,7 @@ export interface IResourceController{
|
|||||||
getNation(id: NationID): Nation | undefined;
|
getNation(id: NationID): Nation | undefined;
|
||||||
getGeneral(id: GeneralID): General | undefined;
|
getGeneral(id: GeneralID): General | undefined;
|
||||||
|
|
||||||
getGameEnv(): Promise<GameEnv>;
|
getGameEnv(): GameEnv;
|
||||||
|
|
||||||
findAllNations(): Map<NationID, Nation>;
|
findAllNations(): Map<NationID, Nation>;
|
||||||
findAllCities(): Map<CityID, City>;
|
findAllCities(): Map<CityID, City>;
|
||||||
@@ -45,17 +46,11 @@ export interface IResourceController{
|
|||||||
|
|
||||||
_getAllChanges(): Map<unknown, unknown>;
|
_getAllChanges(): Map<unknown, unknown>;
|
||||||
|
|
||||||
|
|
||||||
setDirtyGeneral(rawGeneral: IGeneralEntity): void;
|
|
||||||
setDirtyCity(city: City): void;
|
|
||||||
setDirtyTroop(troop: Troop | TroopID): void;
|
|
||||||
setDirtyNation(nation: Nation): void;
|
|
||||||
|
|
||||||
setDirty(entity: LazyEntityUpdater<any>): void;
|
setDirty(entity: LazyEntityUpdater<any>): void;
|
||||||
|
|
||||||
createGeneral(raw: IGeneralEntity): General;
|
createGeneral(raw: IGeneralEntity): General;
|
||||||
|
createNation(raw: INationEntity): Nation;
|
||||||
createTroop(raw: ITroopEntity): Troop;
|
createTroop(raw: ITroopEntity): Troop;
|
||||||
//createNation
|
|
||||||
|
|
||||||
reserveDeleteTroop(id: TroopID): void;
|
reserveDeleteTroop(id: TroopID): void;
|
||||||
reserveDeleteGeneral(id: GeneralID): void;
|
reserveDeleteGeneral(id: GeneralID): void;
|
||||||
|
|||||||
Reference in New Issue
Block a user