From 96aa7567694c5cb6c53167a280953f3b9441caf6 Mon Sep 17 00:00:00 2001 From: NTG Date: Mon, 18 Aug 2025 14:09:56 +0900 Subject: [PATCH] =?UTF-8?q?RestaurantRunController=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_DDD/_Addressables/So/PopupUiState.asset | 4 +- .../So/RestaurantCustomerStateSo.asset | 3 -- .../So/RestaurantCustomerStateSo.asset.meta | 8 ---- .../So/ManagerDefinitionSo.asset | 2 +- .../_DDD/_Scripts/GameFlow/GameFlowManager.cs | 38 +++++++++---------- .../Conrtollers/RestaurantRunController.cs | 4 +- .../RestaurantState/RestaurantState.cs | 2 + 7 files changed, 26 insertions(+), 35 deletions(-) delete mode 100644 Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset delete mode 100644 Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset.meta diff --git a/Assets/_DDD/_Addressables/So/PopupUiState.asset b/Assets/_DDD/_Addressables/So/PopupUiState.asset index 10268a2da..2283d5b74 100644 --- a/Assets/_DDD/_Addressables/So/PopupUiState.asset +++ b/Assets/_DDD/_Addressables/So/PopupUiState.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd4e291d895647a4d067c88ad56775db752545db471dbcb275f8ebebe7a0e131 -size 1325 +oid sha256:ce0f58b16cd51536806732f34bb1c1c46f59b6ee19b1d85e982978d11c370cee +size 1962 diff --git a/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset b/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset deleted file mode 100644 index 46133547f..000000000 --- a/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3f4e00ac56c631cd92403826618ed6a1f8c7529e37f73bd999106cfaf42a117c -size 478 diff --git a/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset.meta b/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset.meta deleted file mode 100644 index 40f43b10b..000000000 --- a/Assets/_DDD/_Addressables/So/RestaurantCustomerStateSo.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6a8ae0a4b68a9b94889b9889b63ebacd -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset b/Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset index 407c77947..39efc89d5 100644 --- a/Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset +++ b/Assets/_DDD/_ScriptAssets/So/ManagerDefinitionSo.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55442c93e950336bb46b13c6fa735c3f10e15c0fe05c5c61481bce1468e4e9c5 +oid sha256:8b96712e0293df2bec2b51abf1b2ec239a4aaae75a3d2cfa311159772391598a size 1504 diff --git a/Assets/_DDD/_Scripts/GameFlow/GameFlowManager.cs b/Assets/_DDD/_Scripts/GameFlow/GameFlowManager.cs index 66a46d856..e3f3887dd 100644 --- a/Assets/_DDD/_Scripts/GameFlow/GameFlowManager.cs +++ b/Assets/_DDD/_Scripts/GameFlow/GameFlowManager.cs @@ -13,8 +13,8 @@ public enum GameFlowState : uint RunRestaurant = 1u << 1, SettlementRestaurant = 1u << 2, All = 0xFFFFFFFFu - } - + } + public class GameFlowManager : Singleton, IManager { public GameFlowDataSo GameFlowDataSo; @@ -28,32 +28,32 @@ public void PreInit() public Task Init() { - return Task.CompletedTask;; + return Task.CompletedTask; ; } - public void PostInit() + public async void PostInit() { if (IsGameStarted() == false) { - ChangeFlow(GameFlowState.ReadyForRestaurant); + await ChangeFlow(GameFlowState.ReadyForRestaurant); } } - + private bool IsGameStarted() => GameFlowDataSo.CurrentGameState != GameFlowState.None; - public void ChangeFlow(GameFlowState newFlowState) + public async Task ChangeFlow(GameFlowState newFlowState) { - if (!CanChangeFlow(newFlowState)) + if (CanChangeFlow(newFlowState) == false) { Debug.LogError("Can't change flow"); return; } - - _ = EndCurrentFlow(); - _ = ReadyNewFlow(newFlowState); + await EndCurrentFlow(); + + await ReadyNewFlow(newFlowState); } - + private bool CanChangeFlow(GameFlowState newFlowState) { return true; @@ -62,27 +62,27 @@ private bool CanChangeFlow(GameFlowState newFlowState) private async Task EndCurrentFlow() { var endCurrentFlowState = GameFlowDataSo.CurrentGameState; - + foreach (var handler in FlowHandlers) { await handler.OnExitCurrentFlow(endCurrentFlowState); } } - + private async Task ReadyNewFlow(GameFlowState newFlowState) { GameFlowDataSo.CurrentGameState = newFlowState; - + + await OpenFlowScene(newFlowState); + foreach (var handler in FlowHandlers) { await handler.OnReadyNewFlow(newFlowState); } - - await OpenFlowScene(newFlowState); StartFlow(); } - + private async Task OpenFlowScene(GameFlowState newFlowState) { if (GetFlowScene(newFlowState)) @@ -102,7 +102,7 @@ private bool GetFlowScene(GameFlowState flowState) private void StartFlow() { - + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs index eab8fbc18..6972d1e1b 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs @@ -8,8 +8,8 @@ public class RestaurantRunController : FlowController RestaurantCustomerStateSo _restaurantCustomerStateSo; public override Task InitializeController() { - return Task.CompletedTask; - + _restaurantCustomerStateSo = RestaurantState.instance.CustomerState; + return Task.CompletedTask; } public override Task InitializeState() diff --git a/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs b/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs index ac6f5fb99..2b74641a5 100644 --- a/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs @@ -9,6 +9,7 @@ public class RestaurantState : ScriptableSingleton public RestaurantRunStateSo RunState { get; private set; } public RestaurantEnvironmentStateSo EnvironmentState { get; private set; } public RestaurantPlayerStateSo PlayerState { get; private set; } + public RestaurantCustomerStateSo CustomerState { get; private set; } // TODO : Load from disk(SaveData) private void OnEnable() @@ -17,6 +18,7 @@ private void OnEnable() RunState = CreateInstance(); EnvironmentState = CreateInstance(); PlayerState = CreateInstance(); + CustomerState = CreateInstance(); } } } \ No newline at end of file