From fda68b690d3e1eea08b2fbe8f4e9a3340976ee6e Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sat, 9 Mar 2024 04:56:50 +0000 Subject: [PATCH] =?UTF-8?q?misc:=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- @sammo/game_logic/src/LazyEntityUpdater.ts | 2 +- @sammo/game_logic/src/ResourceController.ts | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/@sammo/game_logic/src/LazyEntityUpdater.ts b/@sammo/game_logic/src/LazyEntityUpdater.ts index c70b18f..fec7620 100644 --- a/@sammo/game_logic/src/LazyEntityUpdater.ts +++ b/@sammo/game_logic/src/LazyEntityUpdater.ts @@ -1,7 +1,7 @@ import type { IResourceController, ValidEntity, ValidEntityType } from "./ResourceController.js"; export abstract class LazyEntityUpdater{ - protected abstract readonly _indirectNames: (keyof Entity)[]; + protected abstract readonly _indirectNames: ReadonlyArray; protected abstract readonly _entityType: ValidEntityType; protected abstract readonly _raw: Entity; diff --git a/@sammo/game_logic/src/ResourceController.ts b/@sammo/game_logic/src/ResourceController.ts index 30554d4..0d1d698 100644 --- a/@sammo/game_logic/src/ResourceController.ts +++ b/@sammo/game_logic/src/ResourceController.ts @@ -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; export type ValidEntityType = 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; + getGameEnv(): GameEnv; findAllNations(): Map; findAllCities(): Map; @@ -45,17 +46,11 @@ export interface IResourceController{ _getAllChanges(): Map; - - setDirtyGeneral(rawGeneral: IGeneralEntity): void; - setDirtyCity(city: City): void; - setDirtyTroop(troop: Troop | TroopID): void; - setDirtyNation(nation: Nation): void; - setDirty(entity: LazyEntityUpdater): void; createGeneral(raw: IGeneralEntity): General; + createNation(raw: INationEntity): Nation; createTroop(raw: ITroopEntity): Troop; - //createNation reserveDeleteTroop(id: TroopID): void; reserveDeleteGeneral(id: GeneralID): void;