misc: 정리

This commit is contained in:
2024-03-09 04:56:50 +00:00
parent fa29486af6
commit fda68b690d
2 changed files with 5 additions and 10 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import type { IResourceController, ValidEntity, ValidEntityType } from "./ResourceController.js";
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 _raw: Entity;
+4 -9
View File
@@ -9,6 +9,7 @@ import type { ITroopEntity } from "./TroopEntity.js";
import type { LazyEntityUpdater } from "./LazyEntityUpdater.js";
import type { ICityEntity } from "./CityEntity.js";
import type { INationEntity } from "./NationEntity.js";
import type { ValuesOf } from "@sammo/util";
export type ValidEntityList = {
'General': IGeneralEntity;
@@ -17,7 +18,7 @@ export type ValidEntityList = {
'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 interface IResourceController{
@@ -29,7 +30,7 @@ export interface IResourceController{
getNation(id: NationID): Nation | undefined;
getGeneral(id: GeneralID): General | undefined;
getGameEnv(): Promise<GameEnv>;
getGameEnv(): GameEnv;
findAllNations(): Map<NationID, Nation>;
findAllCities(): Map<CityID, City>;
@@ -45,17 +46,11 @@ export interface IResourceController{
_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;
createGeneral(raw: IGeneralEntity): General;
createNation(raw: INationEntity): Nation;
createTroop(raw: ITroopEntity): Troop;
//createNation
reserveDeleteTroop(id: TroopID): void;
reserveDeleteGeneral(id: GeneralID): void;