From 9d57bcb040625fd422721f71f9c9951cf74459ea Mon Sep 17 00:00:00 2001 From: NTG Date: Tue, 19 Aug 2025 13:51:42 +0900 Subject: [PATCH 1/9] =?UTF-8?q?so=20=EC=8B=B1=EA=B8=80=ED=86=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_Scripts/GameController/GameController.cs | 23 +--- Assets/_DDD/_Scripts/GameData/GameData.cs | 2 +- .../Localization/LocalizationManager.cs | 2 +- .../Localization/SmartStringVariables.cs | 10 +- Assets/_DDD/_Scripts/GameState/GameState.cs | 2 +- .../RestaurantManagementUi/ChecklistView.cs | 2 +- .../InventoryUi/InventorySlotUiStrategy.cs | 2 +- .../InventoryUi/InventoryView.cs | 4 +- .../RestaurantManagementUi/ItemDetailView.cs | 2 +- .../RestaurantManagementUi.cs | 2 +- .../TodayMenuInteractorStrategy.cs | 4 +- .../TodayMenuUi/TodayMenuSlotUiStrategy.cs | 4 +- .../TodayMenuUi/TodayMenuView.cs | 4 +- .../TodayCookwareInteractorStrategy.cs | 4 +- .../TodayCookwareSlotUiStrategy.cs | 4 +- .../TodayRestaurantStateView.cs | 4 +- .../TodayWorkerSlotUiStrategy.cs | 2 +- .../Player/RestaurantPlayerInput.cs | 2 +- .../Player/RestaurantPlayerInteraction.cs | 2 +- .../Player/RestaurantPlayerMovement.cs | 2 +- .../RestaurantEnvironmentController.cs | 2 +- .../RestaurantManagementController.cs | 2 +- .../Conrtollers/RestaurantRunController.cs | 5 +- .../Tasks/CreateRestaurantEnvironment.cs | 2 +- .../Tasks/CreateRestaurantPlayer.cs | 2 +- .../RestaurantController.cs | 21 +-- .../_Scripts/RestaurantData/RestaurantData.cs | 2 +- .../Solvers/RestaurantOpenEventSolver.cs | 2 +- .../FlowStates/RestaurantCustomerState.cs | 2 +- .../FlowStates/RestaurantManagementState.cs | 2 +- .../RestaurantState/RestaurantState.cs | 2 +- .../_Scripts/Utilities/ScriptSingleton.cs | 128 ++++++++++++++++++ .../Utilities/ScriptSingleton.cs.meta | 2 + 33 files changed, 185 insertions(+), 72 deletions(-) create mode 100644 Assets/_DDD/_Scripts/Utilities/ScriptSingleton.cs create mode 100644 Assets/_DDD/_Scripts/Utilities/ScriptSingleton.cs.meta diff --git a/Assets/_DDD/_Scripts/GameController/GameController.cs b/Assets/_DDD/_Scripts/GameController/GameController.cs index e55d54ab9..2b22a55cd 100644 --- a/Assets/_DDD/_Scripts/GameController/GameController.cs +++ b/Assets/_DDD/_Scripts/GameController/GameController.cs @@ -10,22 +10,22 @@ public class GameController : Singleton, IManager, IGameFlowHand { [SerializeField] private AssetReference _gameData; - public GameData GameData { get; private set; } - public GameState GameState { get; private set; } + public GameData GetGameData() => GameData.Instance; + public GameState GetGameState() => GameState.Instance; private List _gameFlowControllers = new(); private static readonly List GameFlowControllerTypes = new(); public void PreInit() { - LoadOrCreateRestaurantState(); + CreateGameState(); RegisterFlowHandler(); } public async Task Init() { await LoadData(); - await GameData.LoadData(); + await GetGameData().LoadData(); await InitializeAllFlowControllers(); } @@ -33,10 +33,9 @@ public void PostInit() { } - private void LoadOrCreateRestaurantState() + private void CreateGameState() { - // TODO : Load states from saved files. if none, create them. - GameState = ScriptableObject.CreateInstance(); + GameState.CreateScriptSingleton(); } private void RegisterFlowHandler() @@ -49,7 +48,7 @@ private async Task InitializeAllFlowControllers() // Create controllers and initialize them foreach (var gameFlowControllerType in GameFlowControllerTypes) { - // create new controllers from restaurantFlowControllerType + // create new controllers from gameFlowControllerType var newController = ScriptableObject.CreateInstance(gameFlowControllerType); var newFlowController = newController as FlowController; _gameFlowControllers.Add(newFlowController); @@ -64,14 +63,6 @@ private async Task InitializeAllFlowControllers() private async Task LoadData() { - var gameDataHandle = _gameData.LoadAssetAsync(); - - await gameDataHandle.Task; - - GameData = gameDataHandle.Result; - - Debug.Assert(GameData != null, "GameData is null"); - await Task.CompletedTask; } diff --git a/Assets/_DDD/_Scripts/GameData/GameData.cs b/Assets/_DDD/_Scripts/GameData/GameData.cs index f6bc5666c..e25d84940 100644 --- a/Assets/_DDD/_Scripts/GameData/GameData.cs +++ b/Assets/_DDD/_Scripts/GameData/GameData.cs @@ -5,7 +5,7 @@ namespace DDD { [CreateAssetMenu(fileName = "GameData", menuName = "GameData/GameData")] - public class GameData : ScriptableObject + public class GameData : ScriptSingleton { [SerializeField] private AssetReference _gameLocalizationData; diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs index 5d04adfdd..e43ed2d8a 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs @@ -97,7 +97,7 @@ public string GetString(string key) var entryRef = key; var locale = LocalizationSettings.SelectedLocale; - VariablesGroupAsset variables = GameController.Instance.GameData.LocalizationData.SmartStringVariableGroup; + VariablesGroupAsset variables = GameData.Instance.LocalizationData.SmartStringVariableGroup; if (variables != null) { _singleArgBuffer.Clear(); diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/SmartStringVariables.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/SmartStringVariables.cs index 8234cca30..2ee3199b6 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/SmartStringVariables.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/SmartStringVariables.cs @@ -50,8 +50,8 @@ public void PreInit() { } public async Task Init() { - var gameLevelStateSo = GameController.Instance.GameState.LevelState; - var restaurantStateSo = RestaurantController.Instance.RestaurantState.ManagementState; + var gameLevelStateSo = GameState.Instance.LevelState; + var restaurantStateSo = RestaurantState.Instance.ManagementState; // 예시: day 초기 세팅 (없으면 생성, 타입 다르면 교체) Set(_smartStringKeys[smartStringKey.Day], gameLevelStateSo.Level); @@ -71,7 +71,7 @@ public void PostInit() EventBus.Register(this); } - private RestaurantManagementState GetRestaurantState() => RestaurantController.Instance.RestaurantState.ManagementState; + private RestaurantManagementState GetRestaurantState() => RestaurantState.Instance.ManagementState; public void Invoke(SmartVariablesDirtyEvent evt) { @@ -113,7 +113,7 @@ public void RefreshChecklistTargets() public void RefreshDay() { - var gameLevelStateSo = GameController.Instance.GameState.LevelState; + var gameLevelStateSo = GameState.Instance.LevelState; Set(_smartStringKeys[smartStringKey.Day], gameLevelStateSo.Level); } @@ -179,7 +179,7 @@ public void SetEnum(string key, TEnum value) where TEnum : struct return null; } - var smartStringVariableGroup = GameController.Instance.GameData.LocalizationData.SmartStringVariableGroup; + var smartStringVariableGroup = GameData.Instance.LocalizationData.SmartStringVariableGroup; if (smartStringVariableGroup.TryGetValue(key, out var existing)) { diff --git a/Assets/_DDD/_Scripts/GameState/GameState.cs b/Assets/_DDD/_Scripts/GameState/GameState.cs index e87610fc5..70dfbc792 100644 --- a/Assets/_DDD/_Scripts/GameState/GameState.cs +++ b/Assets/_DDD/_Scripts/GameState/GameState.cs @@ -3,7 +3,7 @@ namespace DDD { - public class GameState : ScriptableObject + public class GameState : ScriptSingleton { [SerializeField] private AssetReference _gameLevelState; diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ChecklistView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ChecklistView.cs index 5ebdb649c..5e079848f 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ChecklistView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ChecklistView.cs @@ -29,7 +29,7 @@ public class ChecklistView : MonoBehaviour, IEventHandler, public void Initalize() { - restaurantManagementStateSo = RestaurantController.Instance.RestaurantState.ManagementState; + restaurantManagementStateSo = RestaurantState.Instance.ManagementState; _checklistDatas = new List(3); _checklistDatas = GetComponentsInChildren().ToList(); diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs index e179eb69a..03aa32396 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs @@ -40,7 +40,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) public RuntimeAnimatorController GetAnimatorController() { - return RestaurantController.Instance.RestaurantData.ManagementData.InventorySlotUiAnimatorController; + return RestaurantData.Instance.ManagementData.InventorySlotUiAnimatorController; } public void OnInventoryChanged(ItemSlotUi ui) diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventoryView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventoryView.cs index 13b7c0912..5217129a9 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventoryView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/InventoryUi/InventoryView.cs @@ -38,8 +38,8 @@ private void OnDisable() public void Initialize() { - restaurantManagementStateSo = RestaurantController.Instance.RestaurantState.ManagementState; - restaurantManagementDataSo = RestaurantController.Instance.RestaurantData.ManagementData; + restaurantManagementStateSo = RestaurantState.Instance.ManagementState; + restaurantManagementDataSo = RestaurantData.Instance.ManagementData; Debug.Assert(restaurantManagementDataSo != null, "_todayMenuDataSo != null"); Clear(); diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ItemDetailView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ItemDetailView.cs index dcc9dfa26..5cd0a253a 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ItemDetailView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/ItemDetailView.cs @@ -49,7 +49,7 @@ private void OnDisable() public void Initialize() { - restaurantManagementDataSo = RestaurantController.Instance.RestaurantData.ManagementData; + restaurantManagementDataSo = RestaurantData.Instance.ManagementData; } public void Invoke(ItemSlotSelectedEvent evt) diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/RestaurantManagementUi.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/RestaurantManagementUi.cs index 28977f600..573a78fe6 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/RestaurantManagementUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/RestaurantManagementUi.cs @@ -60,7 +60,7 @@ private void UpdateHoldProgress() private void ProcessCompleteBatchAction() { - if (RestaurantController.Instance.RestaurantState.ManagementState.GetChecklistStates().Any(state => state == false)) + if (RestaurantState.Instance.ManagementState.GetChecklistStates().Any(state => state == false)) { ShowChecklistFailedPopup(); } diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs index 32ff38f3d..5a3987a33 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuInteractorStrategy.cs @@ -10,7 +10,7 @@ public void OnAdded(ItemSlotUi itemSlotUi) if (inventorySlotUiStrategy.CanCrafting(itemSlotUi)) { - RestaurantController.Instance.RestaurantState.ManagementState.TryAddTodayMenu(itemSlotUi.Model); + RestaurantState.Instance.ManagementState.TryAddTodayMenu(itemSlotUi.Model); } else { @@ -25,7 +25,7 @@ public void OnRemoved(ItemSlotUi itemSlotUi) { if (itemSlotUi.Strategy is InventorySlotUiStrategy) return; - RestaurantController.Instance.RestaurantState.ManagementState.TryRemoveTodayMenu(itemSlotUi.Model); + RestaurantState.Instance.ManagementState.TryRemoveTodayMenu(itemSlotUi.Model); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs index 47a9bf655..3403b5020 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs @@ -35,7 +35,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) } string markSpriteKey = null; - if (RestaurantController.Instance.RestaurantState.ManagementState.IsCookwareMatched(ui.Model.Id)) + if (RestaurantState.Instance.ManagementState.IsCookwareMatched(ui.Model.Id)) { markSpriteKey = SpriteConstants.CheckYesSpriteKey; } @@ -51,7 +51,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) public RuntimeAnimatorController GetAnimatorController() { - return RestaurantController.Instance.RestaurantData.ManagementData.TodayMenuSlotUiAnimatorController; + return RestaurantData.Instance.ManagementData.TodayMenuSlotUiAnimatorController; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs index cb08f7142..977cf8ba2 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs @@ -23,8 +23,8 @@ private void OnDestroy() public void Initialize() { - restaurantManagementStateSo = RestaurantController.Instance.RestaurantState.ManagementState; - restaurantManagementDataSo = RestaurantController.Instance.RestaurantData.ManagementData; + restaurantManagementStateSo = RestaurantState.Instance.ManagementState; + restaurantManagementDataSo = RestaurantData.Instance.ManagementData; foreach (Transform child in _todayFoodContent) { diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs index 443aef47a..9d18d85b9 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareInteractorStrategy.cs @@ -10,7 +10,7 @@ public void OnAdded(ItemSlotUi itemSlotUi) if (inventorySlotUiStrategy.CanCrafting(itemSlotUi)) { - RestaurantController.Instance.RestaurantState.ManagementState.TryAddTodayCookware(itemSlotUi.Model); + RestaurantState.Instance.ManagementState.TryAddTodayCookware(itemSlotUi.Model); } else { @@ -25,7 +25,7 @@ public void OnRemoved(ItemSlotUi itemSlotUi) { if (itemSlotUi.Strategy is InventorySlotUiStrategy) return; - RestaurantController.Instance.RestaurantState.ManagementState.TryRemoveTodayCookware(itemSlotUi.Model); + RestaurantState.Instance.ManagementState.TryRemoveTodayCookware(itemSlotUi.Model); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs index 92830d63c..fff5e0830 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs @@ -18,7 +18,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) } string markSpriteKey = null; - if (RestaurantController.Instance.RestaurantState.ManagementState.IsTodayMenuMatched(ui.Model.Id)) + if (RestaurantState.Instance.ManagementState.IsTodayMenuMatched(ui.Model.Id)) { markSpriteKey = SpriteConstants.CheckYesSpriteKey; } @@ -34,7 +34,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) public RuntimeAnimatorController GetAnimatorController() { - return RestaurantController.Instance.RestaurantData.ManagementData.TodayMenuSlotUiAnimatorController; + return RestaurantData.Instance.ManagementData.TodayMenuSlotUiAnimatorController; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs index c97db971e..55ec2df61 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs @@ -23,8 +23,8 @@ private void OnDestroy() public void Initialize() { - restaurantManagementStateSo = RestaurantController.Instance.RestaurantState.ManagementState; - restaurantManagementDataSo = RestaurantController.Instance.RestaurantData.ManagementData; + restaurantManagementStateSo = RestaurantState.Instance.ManagementState; + restaurantManagementDataSo = RestaurantData.Instance.ManagementData; foreach (Transform child in _todayWorkerContent) { diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs index 82a01cb85..f403f9aef 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs @@ -26,7 +26,7 @@ public void Setup(ItemSlotUi ui, ItemViewModel model) public RuntimeAnimatorController GetAnimatorController() { - return RestaurantController.Instance.RestaurantData.ManagementData.TodayMenuSlotUiAnimatorController; + return RestaurantData.Instance.ManagementData.TodayMenuSlotUiAnimatorController; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs index 4d5160068..dc22b7dcb 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInput.cs @@ -9,7 +9,7 @@ public class RestaurantPlayerInput : MonoBehaviour private void Start() { - _playerDataSo = RestaurantController.Instance.RestaurantData.PlayerData; + _playerDataSo = RestaurantData.Instance.PlayerData; _playerDataSo.OpenManagementUiAction = InputManager.Instance.GetAction(InputActionMaps.Restaurant, nameof(RestaurantActions.OpenManagementUi)); _playerDataSo.OpenManagementUiAction.performed += OnOpenManagementUi; diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs index 7ea8e0740..8f648cef9 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerInteraction.cs @@ -17,7 +17,7 @@ protected override void Start() private Task Initialize() { - _restaurantPlayerDataSo = RestaurantController.Instance.RestaurantData.PlayerData; + _restaurantPlayerDataSo = RestaurantData.Instance.PlayerData; Debug.Assert(_restaurantPlayerDataSo != null, "_restaurantPlayerDataSo is null"); _restaurantPlayerDataSo!.InteractAction = InputManager.Instance.GetAction(InputActionMaps.Restaurant, nameof(RestaurantActions.Interact)); diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs index 578d6779c..f564d2ae6 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerMovement.cs @@ -81,7 +81,7 @@ private System.Threading.Tasks.Task InitializePlayerData() { try { - _playerDataSo = RestaurantController.Instance.RestaurantData.PlayerData; + _playerDataSo = RestaurantData.Instance.PlayerData; SubscribeToInputEvents(); _isInitialized = true; } diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantEnvironmentController.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantEnvironmentController.cs index 609f59a57..b45a751c0 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantEnvironmentController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantEnvironmentController.cs @@ -13,7 +13,7 @@ public override Task InitializeController() public override Task InitializeState() { - _environmentState = RestaurantController.Instance.RestaurantState.EnvironmentState; + _environmentState = RestaurantState.Instance.EnvironmentState; return Task.CompletedTask; } diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantManagementController.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantManagementController.cs index e16b28c25..0237687fd 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantManagementController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantManagementController.cs @@ -13,7 +13,7 @@ public override Task InitializeController() public override Task InitializeState() { // Load default asset - RestaurantController.Instance.RestaurantState.ManagementState.InitializeReadyForRestaurant(); + RestaurantState.Instance.ManagementState.InitializeReadyForRestaurant(); return Task.CompletedTask; } diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs index ca7338ba9..5b48a8551 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/RestaurantRunController.cs @@ -8,14 +8,13 @@ public class RestaurantRunController : FlowController RestaurantCustomerState _restaurantCustomerStateSo; public override Task InitializeController() { - _restaurantCustomerStateSo = RestaurantController.Instance.RestaurantState.CustomerState; - return Task.CompletedTask; + _restaurantCustomerStateSo = RestaurantState.Instance.CustomerState; + return Task.CompletedTask; } public override Task InitializeState() { return Task.CompletedTask; - } public override async Task OnReadyNewFlow(GameFlowState newFlowState) diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantEnvironment.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantEnvironment.cs index e61d338a5..e8372b8ad 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantEnvironment.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantEnvironment.cs @@ -15,7 +15,7 @@ public override Task RunFlowTask() { // TODO : Base prefab from EnvironmentDataSo - var props = RestaurantController.Instance.RestaurantState.EnvironmentState.Props; + var props = RestaurantState.Instance.EnvironmentState.Props; foreach (var prop in props) { // TODO : Instantiate and Initialize diff --git a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantPlayer.cs b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantPlayer.cs index fbee756b5..f5ac043ea 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantPlayer.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/Conrtollers/Tasks/CreateRestaurantPlayer.cs @@ -20,7 +20,7 @@ public override Task RunFlowTask() return Task.CompletedTask; } - var playerPrefab = RestaurantController.Instance.RestaurantData.PlayerData.PlayerPrefab; + var playerPrefab = RestaurantData.Instance.PlayerData.PlayerPrefab; if (playerPrefab == null) { Debug.LogError("PlayerPrefab이 설정되지 않았습니다!"); diff --git a/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs b/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs index e3d82a1a2..0069fff33 100644 --- a/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs +++ b/Assets/_DDD/_Scripts/RestaurantController/RestaurantController.cs @@ -10,8 +10,8 @@ public class RestaurantController : Singleton, IManager, I { [SerializeField] private AssetReference _restaurantData; - public RestaurantData RestaurantData { get; private set; } - public RestaurantState RestaurantState { get; private set; } + public RestaurantData GetRestaurantData() => RestaurantData.Instance; + public RestaurantState GetRestaurantState() => RestaurantState.Instance; private List _restaurantFlowControllers = new(); @@ -27,14 +27,14 @@ public class RestaurantController : Singleton, IManager, I public void PreInit() { - LoadOrCreateRestaurantState(); + CreateRestaurantState(); RegisterFlowHandler(); } public async Task Init() { await LoadData(); - await RestaurantData.LoadData(); + await GetRestaurantData().LoadData(); await InitializeAllFlowControllers(); } @@ -42,10 +42,9 @@ public void PostInit() { } - private void LoadOrCreateRestaurantState() + private void CreateRestaurantState() { - // TODO : Load states from saved files. if none, create them. - RestaurantState = ScriptableObject.CreateInstance(); + RestaurantState.CreateScriptSingleton(); } private void RegisterFlowHandler() @@ -73,13 +72,7 @@ private async Task InitializeAllFlowControllers() private async Task LoadData() { - var restaurantDataHandle = _restaurantData.LoadAssetAsync(); - - await restaurantDataHandle.Task; - - RestaurantData = restaurantDataHandle.Result; - - Debug.Assert(RestaurantData != null, "RestaurantData is null"); + await Task.CompletedTask; } public async Task OnReadyNewFlow(GameFlowState newFlowState) diff --git a/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs b/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs index c87be817e..3f8892c30 100644 --- a/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs +++ b/Assets/_DDD/_Scripts/RestaurantData/RestaurantData.cs @@ -5,7 +5,7 @@ namespace DDD { [CreateAssetMenu(fileName = "RestaurantData", menuName = "RestaurantData/RestaurantData", order = 0)] - public class RestaurantData : ScriptableObject + public class RestaurantData : ScriptSingleton { [SerializeField] private AssetReference _restaurantPlayerData; [SerializeField] private AssetReference _restaurantManagementData; diff --git a/Assets/_DDD/_Scripts/RestaurantEvent/Solvers/RestaurantOpenEventSolver.cs b/Assets/_DDD/_Scripts/RestaurantEvent/Solvers/RestaurantOpenEventSolver.cs index ec7aaa66d..516d49444 100644 --- a/Assets/_DDD/_Scripts/RestaurantEvent/Solvers/RestaurantOpenEventSolver.cs +++ b/Assets/_DDD/_Scripts/RestaurantEvent/Solvers/RestaurantOpenEventSolver.cs @@ -15,7 +15,7 @@ public bool ExecuteInteraction(IInteractor interactor, IInteractable interactabl private RestaurantManagementState GetManagementState() { - return RestaurantController.Instance.RestaurantState.ManagementState; + return RestaurantState.Instance.ManagementState; } public bool CanExecuteInteraction(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payloadSo = null) diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs index 9e9f1ca13..26daa3568 100644 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantCustomerState.cs @@ -51,7 +51,7 @@ private async Task InitializeRunRestaurant() { _iCustomerFactory = new CustomerFactory(); - var currentGameLevel = GameController.Instance.GameState.LevelState.Level; + var currentGameLevel = GameState.Instance.LevelState.Level; if (_levelDataSo == null) { _levelDataSo = DataManager.Instance.GetDataSo(); diff --git a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs index 7b375b979..1ad52ed1b 100644 --- a/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/FlowStates/RestaurantManagementState.cs @@ -86,7 +86,7 @@ public bool IsOpenable() public RestaurantManagementData GetManagementData() { - return RestaurantController.Instance.RestaurantData.ManagementData; + return RestaurantData.Instance.ManagementData; } public bool TryAddTodayMenu(ItemViewModel model) diff --git a/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs b/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs index 1d3533637..9370ee616 100644 --- a/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs +++ b/Assets/_DDD/_Scripts/RestaurantState/RestaurantState.cs @@ -2,7 +2,7 @@ namespace DDD { - public class RestaurantState : ScriptableObject + public class RestaurantState : ScriptSingleton { public RestaurantManagementState ManagementState { get; private set; } public RestaurantRunState RunState { get; private set; } diff --git a/Assets/_DDD/_Scripts/Utilities/ScriptSingleton.cs b/Assets/_DDD/_Scripts/Utilities/ScriptSingleton.cs new file mode 100644 index 000000000..9cffb682e --- /dev/null +++ b/Assets/_DDD/_Scripts/Utilities/ScriptSingleton.cs @@ -0,0 +1,128 @@ +using System; +using JetBrains.Annotations; +using UnityEngine; +using UnityEngine.AddressableAssets; +using UnityEngine.ResourceManagement.AsyncOperations; + +namespace DDD +{ + /// + /// Addressables를 통해 ScriptableObject 에셋을 로드하여 싱글톤으로 제공하는 베이스 클래스. + /// - 첫 접근 시 Addressables에서 타입명(네임스페이스 제외)을 키로 동기 로드합니다. + /// - 로드에 실패하면 예외를 발생합니다. (새로 생성하지 않습니다) + /// - 이미 로드된 경우 캐시된 인스턴스를 반환합니다. + /// + /// 구현 타입 + public abstract class ScriptSingleton : ScriptableObject where T : ScriptSingleton + { + #region Fields + [CanBeNull] + private static T _instance; + + [NotNull] + private static readonly object _lock = new(); + + private static bool _isQuitting; + #endregion + + #region Properties + [NotNull] + public static T Instance + { + get + { + if (_instance != null) + return _instance; + + if (_isQuitting) + throw new InvalidOperationException($"애플리케이션 종료 중에는 '{typeof(T).Name}' 인스턴스를 로드할 수 없습니다."); + + lock (_lock) + { + // 이중 체크 락킹 패턴 + if (_instance != null) + return _instance; + + try + { + var key = ResolveAddressKey(); + var handle = Addressables.LoadAssetAsync(key); + + // 동기 로드: 메인 스레드에서 호출할 것을 권장합니다. + var loaded = handle.WaitForCompletion(); + + if (handle.Status != AsyncOperationStatus.Succeeded || loaded == null) + { + throw new InvalidOperationException($"Addressables 로드 실패: 타입='{typeof(T).Name}', key='{key}'"); + } + + _instance = loaded; + _instance.hideFlags = HideFlags.DontUnloadUnusedAsset; + _instance.OnInstanceLoaded(); + + return _instance; + } + catch (Exception) + { + throw; + } + } + } + } + #endregion + + #region Methods + /// + /// 새로운 인스턴스를 생성하고 싱글톤으로 등록합니다. + /// Addressables에 등록되지 않은 경우 사용합니다. + /// + public static T CreateScriptSingleton() + { + if (_instance != null) + { + Debug.LogWarning($"[ScriptSingleton] {typeof(T).Name} 인스턴스가 이미 존재합니다. 기존 인스턴스를 반환합니다."); + return _instance; + } + + lock (_lock) + { + if (_instance != null) + return _instance; + + var newInstance = ScriptableObject.CreateInstance(); + _instance = newInstance; + _instance.hideFlags = HideFlags.DontUnloadUnusedAsset; + _instance.OnInstanceLoaded(); + + Debug.Log($"[ScriptSingleton] {typeof(T).Name} 인스턴스를 생성하고 싱글톤으로 등록했습니다."); + return _instance; + } + } + + /// + /// 사용자 정의 초기화 훅. 인스턴스가 로드된 뒤 1회 호출됩니다. + /// + protected virtual void OnInstanceLoaded() { } + + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] + private static void RegisterQuitHandler() + { + Application.quitting -= OnApplicationQuitting; + Application.quitting += OnApplicationQuitting; + } + + private static void OnApplicationQuitting() + { + _isQuitting = true; + } + + /// + /// Address Key를 해석합니다. 요구사항에 따라 타입명(네임스페이스 제외) 그대로를 사용합니다. + /// + private static string ResolveAddressKey() + { + return typeof(T).Name; + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/Utilities/ScriptSingleton.cs.meta b/Assets/_DDD/_Scripts/Utilities/ScriptSingleton.cs.meta new file mode 100644 index 000000000..528f97b45 --- /dev/null +++ b/Assets/_DDD/_Scripts/Utilities/ScriptSingleton.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0544b64d4ef0a744dbd9ee6bcf4ecc00 \ No newline at end of file From 3482e1ade6685237a94224f95fb5f20a2c038475 Mon Sep 17 00:00:00 2001 From: Jeonghyeon Ha Date: Tue, 19 Aug 2025 14:12:48 +0900 Subject: [PATCH 2/9] added ai guideline --- .aiignore | 7 +++++++ .junie/guidelines.md | 47 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 .aiignore create mode 100644 .junie/guidelines.md diff --git a/.aiignore b/.aiignore new file mode 100644 index 000000000..79c7497ff --- /dev/null +++ b/.aiignore @@ -0,0 +1,7 @@ +# An .aiignore file follows the same syntax as a .gitignore file. +# .gitignore documentation: https://git-scm.com/docs/gitignore +# Junie will ask for explicit approval before view or edit the file or file within a directory listed in .aiignore. +# Only files contents is protected, Junie is still allowed to view file names even if they are listed in .aiignore. +# Be aware that the files you included in .aiignore can still be accessed by Junie in two cases: +# - If Brave Mode is turned on. +# - If a command has been added to the Allowlist — Junie will not ask for confirmation, even if it accesses - files and folders listed in .aiignore. diff --git a/.junie/guidelines.md b/.junie/guidelines.md new file mode 100644 index 000000000..c7c9c1834 --- /dev/null +++ b/.junie/guidelines.md @@ -0,0 +1,47 @@ +# 프로젝트 가이드라인 — ProjectDDD (Unity) + +이 저장소는 주로 Unity 에디터를 통해 편집 및 실행됩니다. 코드는 Unity의 .NET/Mono 환경을 대상으로 하며, 컴파일은 일반적인 `dotnet` CLI 빌드가 아니라 대개 Unity가 주도합니다. + +## 저장소 레이아웃(상위 수준) +- `Assets/` – 게임 콘텐츠와 스크립트. 대부분의 수정은 여기서 이루어집니다. +- `Packages/` – Unity 패키지 매니페스트와 임베디드 패키지. +- `ProjectSettings/` 및 `UserSettings/` – Unity 설정. 지시가 없는 한 수동으로 수정하지 마십시오. +- `Library/`, `Temp/`, `obj/`, `Logs/` – Unity/IDE가 생성. 이 디렉터리는 수정하거나 커밋하지 마십시오. +- `ServerData/`, `Docs/` – 프로젝트별 데이터와 문서가 있다면 여기에 있습니다. +- 다수의 `*.csproj` 파일 – Rider/IDE 지원을 위한 자동 생성 파일; 특별히 필요하지 않는 한 수동 수정 금지. + +## 이 프로젝트에서 Junie의 작업 방식 +- 문제를 직접 해결하는 최소하고도 목표 지향적인 코드 변경을 선호합니다. +- Unity가 생성한 폴더들(`Library/`, `Temp/`, `obj/`, `Logs/`)이나 패키지 캐시 내용은 수정하지 않습니다. +- 새로운 스크립트는 `Assets/` 아래 적절한 도메인 폴더에 배치합니다. `_DDD/_Scripts` 하위의 기존 폴더 규칙을 유지합니다. +- `.csproj` 파일은 수정하지 않습니다. Unity가 재생성합니다. +- Addressables를 다룰 때는 그룹 설정을 일관되게 유지하고 의도치 않은 대용량 데이터 변경을 커밋하지 않습니다. + +## 빌드, 실행, 테스트 +- 기본 실행 환경은 Unity Editor/Player입니다. 독립 실행형 단위 테스트가 없을 수 있습니다. +- 작업이 명시적으로 요구하지 않는 한 .NET 테스트 러너나 CLI 빌드를 시도하지 말고, 컴파일은 Unity에 맡기십시오. +- 코드를 추가할 때는 Unity에서 컴파일 가능한지 확인하십시오(런타임 코드에서 에디터 전용 API 직접 호출 금지, 네임스페이스 올바름, 사용할 수 없는 API 사용 금지). +- 본 문서와 같은 순수 문서/설정 작업에서는 빌드가 필요 없습니다. + +## 코딩 및 스타일 가이드(C#/Unity) +- 표준 C# 컨벤션을 따르십시오: 공용 타입과 멤버는 PascalCase, 지역 변수와 매개변수는 camelCase. +- private 직렬화 필드는 `[SerializeField] private Type _fieldName;` 형태를 선호하고, 필요 시 프로퍼티로 노출하십시오. +- Unity API 호출은 메인 스레드에서 수행하십시오. `Update`/`FixedUpdate` 내부의 과도한 할당을 피하십시오. +- `async`/`await`는 신중하게 사용하십시오. 대부분의 엔진 API 호출에는 Unity 메인 스레드 동기화가 필요합니다. +- 거대한 모놀리식 구조보다 작은, 역할에 집중된 컴포넌트 구성을 선호합니다. 프로젝트의 DDD 경계를 준수하십시오. +- null 체크와 가드 절을 추가하고, 개발 빌드에서는 명확한 메시지와 함께 빠르게 실패하도록 하십시오. + +## Addressables 및 리소스 +- `Addressables.LoadAssetAsync`로 로드하고, 사용 후 핸들을 해제하여 누수를 방지하십시오. +- 일반 게임 플레이 코드에서 Addressable 그룹을 프로그래밍적으로 수정하지 마십시오. 그룹/라벨 변경은 명시적으로 필요하지 않는 한 에디터에서 수행하십시오. + +## 수정 금지(명시적 지시가 없는 한) +- `Library/`, `Temp/`, `obj/`, `Logs/`, 그리고 `Library/PackageCache/` 아래의 Unity 패키지 캐시. +- 루트의 자동 생성 `*.csproj` 파일. +- 작업과 무관한 대용량 바이너리 에셋. + +## 자동화 작업의 완료 정의 +- 이슈를 완전히 충족하는 최소 변경을 제공합니다. +- 각 응답에 계획, 진행 상황, 다음 단계를 포함한 ``를 포함합니다. +- 코드가 변경되었다면, 에지 케이스를 고려하고 런타임 경로에서 에디터 전용 API 사용을 피하십시오. +- 제출 전에 의도치 않은 파일(특히 생성 디렉터리와 Addressable 그룹)이 수정되지 않았는지 확인하십시오. From 727b7e2f91dbb1fc424deebc4bcc01a6c1f52cdb Mon Sep 17 00:00:00 2001 From: NTG Date: Tue, 19 Aug 2025 15:16:21 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EB=8F=99?= =?UTF-8?q?=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/Runtime/Febucci.TextAnimator.Demo.Runtime.asmdef | 3 ++- .../Scripts/Editor/Febucci.TextAnimator.Editor.asmdef | 3 ++- .../TextMeshPro/Febucci.TextAnimator.TMP.Runtime.asmdef | 3 ++- .../Drawing/PackageTools/Editor/PackageToolsEditor.asmdef | 3 ++- .../Editor/AstarPathfindingProjectEditor.asmdef | 3 ++- .../PackageTools/Editor/PackageToolsEditor.asmdef | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Assets/Plugins/Febucci/Text Animator/Example/Scripts/Runtime/Febucci.TextAnimator.Demo.Runtime.asmdef b/Assets/Plugins/Febucci/Text Animator/Example/Scripts/Runtime/Febucci.TextAnimator.Demo.Runtime.asmdef index 983c6bbb7..91b2ce27e 100644 --- a/Assets/Plugins/Febucci/Text Animator/Example/Scripts/Runtime/Febucci.TextAnimator.Demo.Runtime.asmdef +++ b/Assets/Plugins/Febucci/Text Animator/Example/Scripts/Runtime/Febucci.TextAnimator.Demo.Runtime.asmdef @@ -2,7 +2,8 @@ "name": "Febucci.TextAnimator.Demo.Runtime", "references": [ "Unity.TextMeshPro", - "Febucci.TextAnimator.Runtime" + "Febucci.TextAnimator.Runtime", + "Febucci.Attributes.Runtime" ], "optionalUnityReferences": [], "includePlatforms": [], diff --git a/Assets/Plugins/Febucci/Text Animator/Scripts/Editor/Febucci.TextAnimator.Editor.asmdef b/Assets/Plugins/Febucci/Text Animator/Scripts/Editor/Febucci.TextAnimator.Editor.asmdef index 092219b88..b42980268 100644 --- a/Assets/Plugins/Febucci/Text Animator/Scripts/Editor/Febucci.TextAnimator.Editor.asmdef +++ b/Assets/Plugins/Febucci/Text Animator/Scripts/Editor/Febucci.TextAnimator.Editor.asmdef @@ -2,7 +2,8 @@ "name": "Febucci.TextAnimator.Editor", "rootNamespace": "", "references": [ - "GUID:1e113d3b5d77bc04eab508251483e8ff" + "GUID:1e113d3b5d77bc04eab508251483e8ff", + "GUID:448b0b55421917e4784a8f2f7449081f" ], "includePlatforms": [ "Editor" diff --git a/Assets/Plugins/Febucci/Text Animator/Scripts/Runtime/Components/Animator/TextMeshPro/Febucci.TextAnimator.TMP.Runtime.asmdef b/Assets/Plugins/Febucci/Text Animator/Scripts/Runtime/Components/Animator/TextMeshPro/Febucci.TextAnimator.TMP.Runtime.asmdef index 81ab5c0cd..07b837537 100644 --- a/Assets/Plugins/Febucci/Text Animator/Scripts/Runtime/Components/Animator/TextMeshPro/Febucci.TextAnimator.TMP.Runtime.asmdef +++ b/Assets/Plugins/Febucci/Text Animator/Scripts/Runtime/Components/Animator/TextMeshPro/Febucci.TextAnimator.TMP.Runtime.asmdef @@ -3,7 +3,8 @@ "rootNamespace": "", "references": [ "GUID:1e113d3b5d77bc04eab508251483e8ff", - "GUID:6055be8ebefd69e48b49212b09b47b2f" + "GUID:6055be8ebefd69e48b49212b09b47b2f", + "GUID:448b0b55421917e4784a8f2f7449081f" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/PackageToolsEditor.asmdef b/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/PackageToolsEditor.asmdef index 9bb80fcfe..b2e57062f 100644 --- a/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/PackageToolsEditor.asmdef +++ b/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/PackageToolsEditor.asmdef @@ -2,7 +2,8 @@ "name": "DrawingPackageToolsEditor", "rootNamespace": "", "references": [ - "GUID:f4059aaf6c60a4a58a177a2609feb769" + "GUID:f4059aaf6c60a4a58a177a2609feb769", + "GUID:de4e6084e6d474788bb8c799d6b461eb" ], "includePlatforms": [ "Editor" diff --git a/Packages/com.arongranberg.astar/Editor/AstarPathfindingProjectEditor.asmdef b/Packages/com.arongranberg.astar/Editor/AstarPathfindingProjectEditor.asmdef index 2eb1163c3..e5195dbc3 100644 --- a/Packages/com.arongranberg.astar/Editor/AstarPathfindingProjectEditor.asmdef +++ b/Packages/com.arongranberg.astar/Editor/AstarPathfindingProjectEditor.asmdef @@ -7,7 +7,8 @@ "GUID:f4059aaf6c60a4a58a177a2609feb769", "GUID:de4e6084e6d474788bb8c799d6b461eb", "GUID:734d92eba21c94caba915361bd5ac177", - "GUID:e0cd26848372d4e5c891c569017e11f1" + "GUID:e0cd26848372d4e5c891c569017e11f1", + "GUID:db11b4b5d7520bc479416b48c98206cb" ], "includePlatforms": [ "Editor" diff --git a/Packages/com.arongranberg.astar/PackageTools/Editor/PackageToolsEditor.asmdef b/Packages/com.arongranberg.astar/PackageTools/Editor/PackageToolsEditor.asmdef index 62bd63ca7..656d3cd1d 100644 --- a/Packages/com.arongranberg.astar/PackageTools/Editor/PackageToolsEditor.asmdef +++ b/Packages/com.arongranberg.astar/PackageTools/Editor/PackageToolsEditor.asmdef @@ -2,7 +2,8 @@ "name": "AstarPackageToolsEditor", "rootNamespace": "", "references": [ - "GUID:f4059aaf6c60a4a58a177a2609feb769" + "GUID:f4059aaf6c60a4a58a177a2609feb769", + "GUID:de4e6084e6d474788bb8c799d6b461eb" ], "includePlatforms": [ "Editor" From 33eb9439f56ca92614cf18530c0791e3e2d1352b Mon Sep 17 00:00:00 2001 From: NTG Date: Tue, 19 Aug 2025 16:33:00 +0900 Subject: [PATCH 4/9] =?UTF-8?q?sprites=20reimport=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 --- .../AssetPostprocessorSprite.cs | 53 ++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/Assets/_DDD/_Scripts/AssetPostprocessors/AssetPostprocessorSprite.cs b/Assets/_DDD/_Scripts/AssetPostprocessors/AssetPostprocessorSprite.cs index aa7773680..1c4c17d5e 100644 --- a/Assets/_DDD/_Scripts/AssetPostprocessors/AssetPostprocessorSprite.cs +++ b/Assets/_DDD/_Scripts/AssetPostprocessors/AssetPostprocessorSprite.cs @@ -203,6 +203,13 @@ public static void CreateAtlas(string path, string destPath) if (objects.Count == 0) return; + // Validate destination path extension + if (!destPath.EndsWith(ExtenstionConstants.SpriteAtlasExtenstionLower, System.StringComparison.OrdinalIgnoreCase)) + { + Debug.LogWarning($"[SpriteAtlas] destPath must end with .spriteatlas : {destPath}"); + return; + } + Utils.MakeFolderFromFilePath(destPath); var atlas = new SpriteAtlasAsset(); @@ -216,9 +223,17 @@ public static void CreateAtlas(string path, string destPath) atlas.Add(objects.ToArray()); SpriteAtlasAsset.Save(atlas, destPath); - AssetDatabase.Refresh(); - var sai = (SpriteAtlasImporter)AssetImporter.GetAtPath(destPath); + // Ensure importer is created/applied synchronously before accessing it + AssetDatabase.ImportAsset(destPath, ImportAssetOptions.ForceUpdate | ImportAssetOptions.ForceSynchronousImport); + + var sai = AssetImporter.GetAtPath(destPath) as SpriteAtlasImporter; + if (sai == null) + { + Debug.LogWarning($"[SpriteAtlas] Importer not ready for '{destPath}'. Skipping settings this pass."); + return; + } + sai.packingSettings = new SpriteAtlasPackingSettings { enableRotation = false, @@ -235,8 +250,11 @@ public static void CreateAtlas(string path, string destPath) generateMipMaps = false }; - // 저장 후 설정 반영을 위해 동기 임포트, 그리고 즉시 패킹 수행 + // Persist settings and reimport synchronously to apply them + AssetDatabase.WriteImportSettingsIfDirty(destPath); AssetDatabase.ImportAsset(destPath, ImportAssetOptions.ForceUpdate | ImportAssetOptions.ForceSynchronousImport); + + // Finally, pack the atlas for the active build target var packedAtlas = AssetDatabase.LoadAssetAtPath(destPath); if (packedAtlas != null) { @@ -253,10 +271,22 @@ public static void CreateSingleAtlas(string path, string destPath) AssetDatabase.DeleteAsset(destPath); } + // Validate destination path extension + if (!destPath.EndsWith(ExtenstionConstants.SpriteAtlasExtenstionLower, System.StringComparison.OrdinalIgnoreCase)) + { + Debug.LogWarning($"[SpriteAtlas] destPath must end with .spriteatlas : {destPath}"); + return; + } + Utils.MakeFolderFromFilePath(destPath); var atlas = new SpriteAtlasAsset(); var sprite = AssetDatabase.LoadAssetAtPath(path); + if (sprite == null) + { + Debug.LogWarning($"[SpriteAtlas] Source sprite not found at '{path}'. Skipping atlas: '{destPath}'"); + return; + } atlas.Add(new Object[] { sprite }); var spriteAtlasComponents = new List(); @@ -267,9 +297,17 @@ public static void CreateSingleAtlas(string path, string destPath) } SpriteAtlasAsset.Save(atlas, destPath); - AssetDatabase.Refresh(); - var sai = (SpriteAtlasImporter)AssetImporter.GetAtPath(destPath); + // Ensure importer is created/applied synchronously before accessing it + AssetDatabase.ImportAsset(destPath, ImportAssetOptions.ForceUpdate | ImportAssetOptions.ForceSynchronousImport); + + var sai = AssetImporter.GetAtPath(destPath) as SpriteAtlasImporter; + if (sai == null) + { + Debug.LogWarning($"[SpriteAtlas] Importer not ready for '{destPath}'. Skipping settings this pass."); + return; + } + sai.packingSettings = new SpriteAtlasPackingSettings { enableRotation = false, @@ -286,8 +324,11 @@ public static void CreateSingleAtlas(string path, string destPath) generateMipMaps = false }; - // 저장 후 설정 반영을 위해 동기 임포트, 그리고 즉시 패킹 수행 + // Persist settings and reimport synchronously to apply them + AssetDatabase.WriteImportSettingsIfDirty(destPath); AssetDatabase.ImportAsset(destPath, ImportAssetOptions.ForceUpdate | ImportAssetOptions.ForceSynchronousImport); + + // Finally, pack the atlas for the active build target var packedAtlas = AssetDatabase.LoadAssetAtPath(destPath); if (packedAtlas != null) { From 365ac96de6892ab6d16dbe39fddf3ce6befc0691 Mon Sep 17 00:00:00 2001 From: NTG Date: Tue, 19 Aug 2025 16:36:44 +0900 Subject: [PATCH 5/9] =?UTF-8?q?ui=20=ED=94=84=EB=A6=AC=ED=8C=B9=20navigati?= =?UTF-8?q?on=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameUi/PopupUis/RestaurantManagementUi.prefab | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/RestaurantManagementUi.prefab b/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/RestaurantManagementUi.prefab index e5af66f89..18147a5e8 100644 --- a/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/RestaurantManagementUi.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/RestaurantManagementUi.prefab @@ -1091,6 +1091,10 @@ PrefabInstance: propertyPath: m_Name value: CookwareTabButton objectReference: {fileID: 0} + - target: {fileID: 1035128454163554855, guid: b8766f1471289d74bbcdc2f5ad979e8b, type: 3} + propertyPath: m_Navigation.m_Mode + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2720195383270857804, guid: b8766f1471289d74bbcdc2f5ad979e8b, type: 3} propertyPath: m_text value: "\uC7A5\uBE44" @@ -4858,6 +4862,10 @@ PrefabInstance: propertyPath: m_Name value: MenuTabButton objectReference: {fileID: 0} + - target: {fileID: 1035128454163554855, guid: b8766f1471289d74bbcdc2f5ad979e8b, type: 3} + propertyPath: m_Navigation.m_Mode + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2720195383270857804, guid: b8766f1471289d74bbcdc2f5ad979e8b, type: 3} propertyPath: m_text value: "\uBA54\uB274" @@ -8348,6 +8356,10 @@ PrefabInstance: propertyPath: m_Interactable value: 0 objectReference: {fileID: 0} + - target: {fileID: 1035128454163554855, guid: b8766f1471289d74bbcdc2f5ad979e8b, type: 3} + propertyPath: m_Navigation.m_Mode + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2720195383270857804, guid: b8766f1471289d74bbcdc2f5ad979e8b, type: 3} propertyPath: m_text value: "\uC810\uC6D0" From ac3f1a4b9bb28318cd3f83809075e507d0887a92 Mon Sep 17 00:00:00 2001 From: NTG Date: Tue, 19 Aug 2025 18:24:36 +0900 Subject: [PATCH 6/9] =?UTF-8?q?Scene=20=EB=A1=9C=EB=94=A9=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_Scripts/AssetManagement/AssetManager.cs | 4 +- .../GameFramework/Scene/SceneManager.cs | 90 +++++++------------ 2 files changed, 33 insertions(+), 61 deletions(-) diff --git a/Assets/_DDD/_Scripts/AssetManagement/AssetManager.cs b/Assets/_DDD/_Scripts/AssetManagement/AssetManager.cs index 8f06ed425..d1ab863b7 100644 --- a/Assets/_DDD/_Scripts/AssetManagement/AssetManager.cs +++ b/Assets/_DDD/_Scripts/AssetManagement/AssetManager.cs @@ -76,9 +76,9 @@ public static async Task> LoadAssetsByLabel(string label) where T : U return new List(); } - public static async Task LoadScene(AssetReference assetReference, LoadSceneMode mode = LoadSceneMode.Additive) + public static async Task LoadScene(AssetReference assetReference, LoadSceneMode mode = LoadSceneMode.Additive, bool activateOnLoad = true) { - var handle = Addressables.LoadSceneAsync(assetReference, mode); + var handle = Addressables.LoadSceneAsync(assetReference, mode, activateOnLoad); await handle.Task; if (handle.Status == AsyncOperationStatus.Succeeded) diff --git a/Assets/_DDD/_Scripts/GameFramework/Scene/SceneManager.cs b/Assets/_DDD/_Scripts/GameFramework/Scene/SceneManager.cs index 0bcfca570..87a4f38ef 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Scene/SceneManager.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Scene/SceneManager.cs @@ -69,6 +69,34 @@ public void PostInit() } + public async Task PreloadAll() + { + var flowToSceneMapping = GameFlowManager.Instance.GameFlowSceneMappingSo.FlowToSceneMapping; + + foreach (var flowAssetPair in flowToSceneMapping) + { + if (_loadedSceneDatas.ContainsKey(flowAssetPair.Key)) continue; + + var runtimeKey = GetRuntimeKey(flowAssetPair.Value); + if (_assetKeyToSceneData.TryGetValue(runtimeKey, out var existing)) + { + _loadedSceneDatas[flowAssetPair.Key] = existing; + continue; + } + + var instance = await AssetManager.LoadScene(flowAssetPair.Value, activateOnLoad:false); + if (!instance.Scene.IsValid()) + { + Debug.LogError($"[SceneManager] {flowAssetPair.Key}의 씬 로딩 실패"); + continue; + } + + var data = new SceneData(instance.Scene, instance); + _loadedSceneDatas[flowAssetPair.Key] = data; + _assetKeyToSceneData[runtimeKey] = data; + } + } + public async Task PreloadScene(GameFlowState gameFlowState) { if (_loadedSceneDatas.ContainsKey(gameFlowState)) return; @@ -93,41 +121,10 @@ public async Task PreloadScene(GameFlowState gameFlowState) return; } - DeactivateScene(loadedInstance.Scene); - var data = new SceneData(loadedInstance.Scene, loadedInstance); _loadedSceneDatas[gameFlowState] = data; _assetKeyToSceneData[runtimeKey] = data; } - - public async Task PreloadAll() - { - var flowToSceneMapping = GameFlowManager.Instance.GameFlowSceneMappingSo.FlowToSceneMapping; - - foreach (var flowAssetPair in flowToSceneMapping) - { - if (_loadedSceneDatas.ContainsKey(flowAssetPair.Key)) continue; - - var runtimeKey = GetRuntimeKey(flowAssetPair.Value); - if (_assetKeyToSceneData.TryGetValue(runtimeKey, out var existing)) - { - _loadedSceneDatas[flowAssetPair.Key] = existing; - continue; - } - - var instance = await AssetManager.LoadScene(flowAssetPair.Value); - if (!instance.Scene.IsValid()) - { - Debug.LogError($"[SceneManager] {flowAssetPair.Key}의 씬 로딩 실패"); - continue; - } - - DeactivateScene(instance.Scene); - var data = new SceneData(instance.Scene, instance); - _loadedSceneDatas[flowAssetPair.Key] = data; - _assetKeyToSceneData[runtimeKey] = data; - } - } public async Task ActivateScene(GameFlowState newFlowState) { @@ -148,19 +145,10 @@ public async Task ActivateScene(GameFlowState newFlowState) { await handler.OnBeforeSceneActivate(); } - - foreach (var root in sceneData.Scene.GetRootGameObjects()) + + if (sceneData.SceneInstance.HasValue) { - root.SetActive(true); - } - - if (sceneData.Scene.IsValid()) - { - UnityEngine.SceneManagement.SceneManager.SetActiveScene(sceneData.Scene); - } - else - { - Debug.LogError($"[SceneManager] {newFlowState}의 Scene이 유효하지 않습니다."); + await sceneData.SceneInstance.Value.ActivateAsync(); } foreach (var handler in _sceneTransitionHandlerSo.Handlers.Where(handler => handler != null)) @@ -169,22 +157,6 @@ public async Task ActivateScene(GameFlowState newFlowState) } } - public void DeactivateScene(GameFlowState gameFlowState) - { - if (_loadedSceneDatas.TryGetValue(gameFlowState, out var sceneData)) - { - DeactivateScene(sceneData.Scene); - } - } - - private void DeactivateScene(Scene scene) - { - foreach (var rootObject in scene.GetRootGameObjects()) - { - rootObject.SetActive(false); - } - } - public async Task UnloadScene(GameFlowState gameFlowState) { if (_loadedSceneDatas.TryGetValue(gameFlowState, out var sceneData)) From 5e23e96af5eaec4dbee5564cbd07b185bc23cd93 Mon Sep 17 00:00:00 2001 From: NTG Date: Tue, 19 Aug 2025 18:24:46 +0900 Subject: [PATCH 7/9] =?UTF-8?q?=EC=B9=B4=EB=A9=94=EB=9D=BC=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_Scripts/CameraSystem/CameraGameObject.cs | 11 +++++++++++ .../_Scripts/CameraSystem/CameraManager.cs | 19 +++---------------- .../Player/RestaurantPlayerCharacter.cs | 16 +++++++--------- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/Assets/_DDD/_Scripts/CameraSystem/CameraGameObject.cs b/Assets/_DDD/_Scripts/CameraSystem/CameraGameObject.cs index ebf16598c..948f89cc0 100644 --- a/Assets/_DDD/_Scripts/CameraSystem/CameraGameObject.cs +++ b/Assets/_DDD/_Scripts/CameraSystem/CameraGameObject.cs @@ -15,6 +15,17 @@ private void Awake() _cinemachineCamera = GetComponent(); } + private void OnEnable() + { + CameraManager.Instance.RegisterCamera(this); + } + + private void OnDisable() + { + var cameraManager = CameraManager.Instance; + cameraManager?.UnRegisterCamera(this); + } + public int GetPriority() => _cinemachineCamera.Priority; public void SetPriority(int newPriority) => _cinemachineCamera.Priority = newPriority; public void SetFollowTarget(Transform target) => _cinemachineCamera.Follow = target; diff --git a/Assets/_DDD/_Scripts/CameraSystem/CameraManager.cs b/Assets/_DDD/_Scripts/CameraSystem/CameraManager.cs index 2dc72bc9d..4e0dfde75 100644 --- a/Assets/_DDD/_Scripts/CameraSystem/CameraManager.cs +++ b/Assets/_DDD/_Scripts/CameraSystem/CameraManager.cs @@ -2,7 +2,6 @@ using System.Threading.Tasks; using Sirenix.OdinInspector; using Unity.Cinemachine; -using UnityEngine; namespace DDD { @@ -44,12 +43,7 @@ public Task Init() public void PostInit() { - var cameraGameObjects = FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None); - foreach (var cameraGameObject in cameraGameObjects) - { - RegisterCamera(cameraGameObject); - } - _initializationTask.SetResult(true); + } public void RegisterCamera(CameraGameObject cameraGameObject) @@ -72,16 +66,9 @@ public void SwitchCamera(CameraType cameraType, CinemachineBlendDefinition.Style } } - public async Task GetCameraGameObject(CameraType cameraType) + public CameraGameObject GetCameraGameObject(CameraType cameraType) { - await _initializationTask.Task; - - if (_cameraGameObjects.TryGetValue(cameraType, out var cameraGameObject)) - { - return cameraGameObject; - } - - return null; + return _cameraGameObjects.GetValueOrDefault(cameraType); } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs index 0b44d6e17..ea20068fb 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/Player/RestaurantPlayerCharacter.cs @@ -1,22 +1,20 @@ -using System.Threading.Tasks; -using UnityEngine; - namespace DDD { public class RestaurantPlayerCharacter : RestaurantCharacter { - protected override void Awake() + protected override async void Awake() { base.Awake(); - _ = Initialize(); + PlayerManager.Instance.RegisterPlayer(gameObject); } - private async Task Initialize() + protected override void Start() { - PlayerManager.Instance.RegisterPlayer(gameObject); - var cameraObject = await CameraManager.Instance.GetCameraGameObject(CameraType.RestaurantBaseCamera); - cameraObject?.SetFollowAndLookAtTarget(transform); + base.Start(); + + var cameraObject = CameraManager.Instance.GetCameraGameObject(CameraType.RestaurantBaseCamera); + cameraObject.SetFollowAndLookAtTarget(transform); } } } \ No newline at end of file From 52a98a20a2282207f599711884690f008359837e Mon Sep 17 00:00:00 2001 From: NTG Date: Tue, 19 Aug 2025 18:26:14 +0900 Subject: [PATCH 8/9] =?UTF-8?q?guide=20=EC=B2=B4=EB=A6=AC=ED=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .junie/guidelines.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.junie/guidelines.md b/.junie/guidelines.md index c7c9c1834..9d60af9c3 100644 --- a/.junie/guidelines.md +++ b/.junie/guidelines.md @@ -45,3 +45,7 @@ - 각 응답에 계획, 진행 상황, 다음 단계를 포함한 ``를 포함합니다. - 코드가 변경되었다면, 에지 케이스를 고려하고 런타임 경로에서 에디터 전용 API 사용을 피하십시오. - 제출 전에 의도치 않은 파일(특히 생성 디렉터리와 Addressable 그룹)이 수정되지 않았는지 확인하십시오. + +## 깃 +- 깃 커밋 시, 한국어로 커밋 메시지를 작성합니다. +- 깃 커밋 메시지는 간결하고 핵심 정보만 포함해야 합니다. \ No newline at end of file From 72ad7b61864973ca6c2e2661848a4bab39c45c4a Mon Sep 17 00:00:00 2001 From: NTG Date: Tue, 19 Aug 2025 19:13:31 +0900 Subject: [PATCH 9/9] =?UTF-8?q?ui=20input=20binding=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssetGroups/Default Local Group.asset | 4 ++-- .../Uis/GameUi/PopupUis/ConfirmUi.prefab | 1 + .../PopupUis/RestaurantManagementUi.prefab | 1 + ...i_RestaurantUiActions_InputBindingSo.asset | 3 --- ...i_RestaurantUiActions_InputBindingSo.asset | 3 --- ...ndingSo.meta => UiActionInputBinding.meta} | 0 .../ConfirmUi_InputBindingSo.asset | 3 +++ .../ConfirmUi_InputBindingSo.asset.meta} | 0 ...estaurantManagementUi_InputBindingSo.asset | 3 +++ ...antManagementUi_InputBindingSo.asset.meta} | 0 .../_DDD/_Scripts/GameUi/PopupUi/PopupUi.cs | 22 +++++++------------ .../_Scripts/GameUi/PopupUi/PopupUiState.cs | 1 - .../InputSystem/BaseUiActionsInputBinding.cs | 14 ++++++++++++ ...meta => BaseUiActionsInputBinding.cs.meta} | 0 .../BaseUiActionsInputBindingSo.cs | 17 -------------- .../RestaurantActionsInputBinding.cs | 7 ++++++ ... => RestaurantActionsInputBinding.cs.meta} | 0 .../RestaurantActionsInputBindingSo.cs | 7 ------ .../RestaurantUiActionsInputBinding.cs | 7 ++++++ ...> RestaurantUiActionsInputBinding.cs.meta} | 0 .../RestaurantUiActionsInputBindingSo.cs | 7 ------ 21 files changed, 46 insertions(+), 54 deletions(-) delete mode 100644 Assets/_DDD/_Addressables/So/InputBindingSo/ConfirmUi_RestaurantUiActions_InputBindingSo.asset delete mode 100644 Assets/_DDD/_Addressables/So/InputBindingSo/RestaurantManagementUi_RestaurantUiActions_InputBindingSo.asset rename Assets/_DDD/_Addressables/So/{InputBindingSo.meta => UiActionInputBinding.meta} (100%) create mode 100644 Assets/_DDD/_Addressables/So/UiActionInputBinding/ConfirmUi_InputBindingSo.asset rename Assets/_DDD/_Addressables/So/{InputBindingSo/ConfirmUi_RestaurantUiActions_InputBindingSo.asset.meta => UiActionInputBinding/ConfirmUi_InputBindingSo.asset.meta} (100%) create mode 100644 Assets/_DDD/_Addressables/So/UiActionInputBinding/RestaurantManagementUi_InputBindingSo.asset rename Assets/_DDD/_Addressables/So/{InputBindingSo/RestaurantManagementUi_RestaurantUiActions_InputBindingSo.asset.meta => UiActionInputBinding/RestaurantManagementUi_InputBindingSo.asset.meta} (100%) create mode 100644 Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBinding.cs rename Assets/_DDD/_Scripts/InputSystem/{BaseUiActionsInputBindingSo.cs.meta => BaseUiActionsInputBinding.cs.meta} (100%) delete mode 100644 Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBindingSo.cs create mode 100644 Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBinding.cs rename Assets/_DDD/_Scripts/InputSystem/{RestaurantActionsInputBindingSo.cs.meta => RestaurantActionsInputBinding.cs.meta} (100%) delete mode 100644 Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBindingSo.cs create mode 100644 Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBinding.cs rename Assets/_DDD/_Scripts/InputSystem/{RestaurantUiActionsInputBindingSo.cs.meta => RestaurantUiActionsInputBinding.cs.meta} (100%) delete mode 100644 Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBindingSo.cs diff --git a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset index 61fb24fef..94992991a 100644 --- a/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset +++ b/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d20a85268616dfd7559e8b9efe1e58f72a9cb6a91cad858e4f790a7704c44fc5 -size 26385 +oid sha256:35523eef20414dc140e1eea9265a5ffde3b29b1deb002e5582fa29d09e742441 +size 26345 diff --git a/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/ConfirmUi.prefab b/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/ConfirmUi.prefab index 4aec318f9..2343b3045 100644 --- a/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/ConfirmUi.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/ConfirmUi.prefab @@ -812,6 +812,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _enableBlockImage: 1 + _uiActionsInputBinding: {fileID: 11400000, guid: 99d3d87bd43df65488e757c43a308f36, type: 2} _messageLabel: {fileID: 3495127426411772216} _messageLabelLocalizeStringEvent: {fileID: 7334955628972040157} _cancelButton: {fileID: 3014273876221658359} diff --git a/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/RestaurantManagementUi.prefab b/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/RestaurantManagementUi.prefab index 18147a5e8..1a346f07d 100644 --- a/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/RestaurantManagementUi.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/Uis/GameUi/PopupUis/RestaurantManagementUi.prefab @@ -6336,6 +6336,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _enableBlockImage: 1 + _uiActionsInputBinding: {fileID: 11400000, guid: 8073fcaf56fc7c34e996d0d47044f146, type: 2} _checklistView: {fileID: 7075966153492927588} _inventoryView: {fileID: 3570087040626823091} _itemDetailView: {fileID: 7657801840785021781} diff --git a/Assets/_DDD/_Addressables/So/InputBindingSo/ConfirmUi_RestaurantUiActions_InputBindingSo.asset b/Assets/_DDD/_Addressables/So/InputBindingSo/ConfirmUi_RestaurantUiActions_InputBindingSo.asset deleted file mode 100644 index 999378c83..000000000 --- a/Assets/_DDD/_Addressables/So/InputBindingSo/ConfirmUi_RestaurantUiActions_InputBindingSo.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7ecf24a92c7cdd20d5fe3f4b96dba252130175de30c18edc2f8ac33fad3660d4 -size 475 diff --git a/Assets/_DDD/_Addressables/So/InputBindingSo/RestaurantManagementUi_RestaurantUiActions_InputBindingSo.asset b/Assets/_DDD/_Addressables/So/InputBindingSo/RestaurantManagementUi_RestaurantUiActions_InputBindingSo.asset deleted file mode 100644 index 66834f26b..000000000 --- a/Assets/_DDD/_Addressables/So/InputBindingSo/RestaurantManagementUi_RestaurantUiActions_InputBindingSo.asset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c201c159c8eaf4a2023c66d7c60a127a58900595633ce4b8cc13ac5e7d01c6cf -size 488 diff --git a/Assets/_DDD/_Addressables/So/InputBindingSo.meta b/Assets/_DDD/_Addressables/So/UiActionInputBinding.meta similarity index 100% rename from Assets/_DDD/_Addressables/So/InputBindingSo.meta rename to Assets/_DDD/_Addressables/So/UiActionInputBinding.meta diff --git a/Assets/_DDD/_Addressables/So/UiActionInputBinding/ConfirmUi_InputBindingSo.asset b/Assets/_DDD/_Addressables/So/UiActionInputBinding/ConfirmUi_InputBindingSo.asset new file mode 100644 index 000000000..310e570a3 --- /dev/null +++ b/Assets/_DDD/_Addressables/So/UiActionInputBinding/ConfirmUi_InputBindingSo.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15d0830d58383256f0b4da13b44a630f007b55164ac88efcb57fa3b477b8e415 +size 455 diff --git a/Assets/_DDD/_Addressables/So/InputBindingSo/ConfirmUi_RestaurantUiActions_InputBindingSo.asset.meta b/Assets/_DDD/_Addressables/So/UiActionInputBinding/ConfirmUi_InputBindingSo.asset.meta similarity index 100% rename from Assets/_DDD/_Addressables/So/InputBindingSo/ConfirmUi_RestaurantUiActions_InputBindingSo.asset.meta rename to Assets/_DDD/_Addressables/So/UiActionInputBinding/ConfirmUi_InputBindingSo.asset.meta diff --git a/Assets/_DDD/_Addressables/So/UiActionInputBinding/RestaurantManagementUi_InputBindingSo.asset b/Assets/_DDD/_Addressables/So/UiActionInputBinding/RestaurantManagementUi_InputBindingSo.asset new file mode 100644 index 000000000..6a0024958 --- /dev/null +++ b/Assets/_DDD/_Addressables/So/UiActionInputBinding/RestaurantManagementUi_InputBindingSo.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac93465aba4266ea03085e75f08ca4cfb799f45a3c10d82cfedeea292ed75ab4 +size 468 diff --git a/Assets/_DDD/_Addressables/So/InputBindingSo/RestaurantManagementUi_RestaurantUiActions_InputBindingSo.asset.meta b/Assets/_DDD/_Addressables/So/UiActionInputBinding/RestaurantManagementUi_InputBindingSo.asset.meta similarity index 100% rename from Assets/_DDD/_Addressables/So/InputBindingSo/RestaurantManagementUi_RestaurantUiActions_InputBindingSo.asset.meta rename to Assets/_DDD/_Addressables/So/UiActionInputBinding/RestaurantManagementUi_InputBindingSo.asset.meta diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/PopupUi.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/PopupUi.cs index 3e0377e2c..2e2d7fffc 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/PopupUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/PopupUi.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Sirenix.OdinInspector; using UnityEngine; using UnityEngine.InputSystem; @@ -20,30 +21,23 @@ public static IEnumerable GetFlags(this T input) where T : Enum public abstract class PopupUi : BasePopupUi where T : Enum { - protected BaseUiActionsInputBindingSo _baseUiActionsInputBindingSo; + [SerializeField, Required] protected BaseUiActionsInputBinding _uiActionsInputBinding; protected readonly List<(InputAction action, Action handler)> _registeredHandlers = new(); - public override InputActionMaps InputActionMaps => _baseUiActionsInputBindingSo.InputActionMaps; + public override InputActionMaps InputActionMaps => _uiActionsInputBinding.InputActionMaps; private bool _isTopPopup => UiManager.Instance.PopupUiState.IsTopPopup(this); - - private const string InputBindingSo = "InputBindingSo"; - protected override async void TryRegister() + protected override void TryRegister() { base.TryRegister(); - UiManager.Instance?.PopupUiState?.RegisterPopupUI(this); - - string addressableKey = $"{GetType().Name}_{typeof(T).Name}_{InputBindingSo}"; - _baseUiActionsInputBindingSo = await AssetManager.LoadAsset>(addressableKey); - - Debug.Assert(_baseUiActionsInputBindingSo != null, $"{GetType().Name} class InputBindingSo not found: {addressableKey}"); + UiManager.Instance.PopupUiState.RegisterPopupUI(this); - foreach (var actionEnum in _baseUiActionsInputBindingSo.BindingActions.GetFlags()) + foreach (var actionEnum in _uiActionsInputBinding.BindingActions.GetFlags()) { if (actionEnum.Equals(default(T))) continue; - var inputAction = InputManager.Instance.GetAction(_baseUiActionsInputBindingSo.InputActionMaps, actionEnum.ToString()); + var inputAction = InputManager.Instance.GetAction(_uiActionsInputBinding.InputActionMaps, actionEnum.ToString()); if (inputAction == null) continue; var startedHandler = new Action(context => @@ -96,7 +90,7 @@ public override void Open(OpenPopupUiEvent evt) if (UiManager.Instance.PopupUiState.IsTopPopup(this)) { - InputManager.Instance.SwitchCurrentActionMap(_baseUiActionsInputBindingSo.InputActionMaps); + InputManager.Instance.SwitchCurrentActionMap(_uiActionsInputBinding.InputActionMaps); } } diff --git a/Assets/_DDD/_Scripts/GameUi/PopupUi/PopupUiState.cs b/Assets/_DDD/_Scripts/GameUi/PopupUi/PopupUiState.cs index 6b737267c..69d34f7e8 100644 --- a/Assets/_DDD/_Scripts/GameUi/PopupUi/PopupUiState.cs +++ b/Assets/_DDD/_Scripts/GameUi/PopupUi/PopupUiState.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Sirenix.OdinInspector; using UnityEngine; diff --git a/Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBinding.cs b/Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBinding.cs new file mode 100644 index 000000000..617aa841b --- /dev/null +++ b/Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBinding.cs @@ -0,0 +1,14 @@ +using System; +using Sirenix.OdinInspector; +using UnityEngine; + +namespace DDD +{ + public class BaseUiActionsInputBinding : ScriptableObject where T : Enum + { + public InputActionMaps InputActionMaps; + + [EnumToggleButtons] + public T BindingActions; + } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBindingSo.cs.meta b/Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBinding.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBindingSo.cs.meta rename to Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBinding.cs.meta diff --git a/Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBindingSo.cs b/Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBindingSo.cs deleted file mode 100644 index b34b9f99c..000000000 --- a/Assets/_DDD/_Scripts/InputSystem/BaseUiActionsInputBindingSo.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using Sirenix.OdinInspector; -using UnityEngine; - -namespace DDD -{ - public class BaseUiActionsInputBindingSo : ScriptableObject where T : Enum - { - public InputActionMaps InputActionMaps; - - [EnumToggleButtons] - public T BindingActions; - - [ReadOnly, LabelText("Addressable Key")] - public string AddressableKey => $"{typeof(T).Name}_InputBindingSo"; - } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBinding.cs b/Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBinding.cs new file mode 100644 index 000000000..0b02feb28 --- /dev/null +++ b/Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBinding.cs @@ -0,0 +1,7 @@ +using UnityEngine; + +namespace DDD +{ + [CreateAssetMenu(fileName = "_UiActionsInputBinding", menuName = "Ui/RestaurantActions_InputBindingSo")] + public class RestaurantActionsInputBinding : BaseUiActionsInputBinding { } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBindingSo.cs.meta b/Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBinding.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBindingSo.cs.meta rename to Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBinding.cs.meta diff --git a/Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBindingSo.cs b/Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBindingSo.cs deleted file mode 100644 index 50fdd086d..000000000 --- a/Assets/_DDD/_Scripts/InputSystem/RestaurantActionsInputBindingSo.cs +++ /dev/null @@ -1,7 +0,0 @@ -using UnityEngine; - -namespace DDD -{ - [CreateAssetMenu(fileName = "_RestaurantActions_InputBindingSo", menuName = "Ui/RestaurantActions_InputBindingSo")] - public class RestaurantActionsInputBindingSo : BaseUiActionsInputBindingSo { } -} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBinding.cs b/Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBinding.cs new file mode 100644 index 000000000..6674e29ee --- /dev/null +++ b/Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBinding.cs @@ -0,0 +1,7 @@ +using UnityEngine; + +namespace DDD +{ + [CreateAssetMenu(fileName = "_UiActionsInputBinding", menuName = "Ui/RestaurantUiActions_InputBindingSo")] + public class RestaurantUiActionsInputBinding : BaseUiActionsInputBinding { } +} \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBindingSo.cs.meta b/Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBinding.cs.meta similarity index 100% rename from Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBindingSo.cs.meta rename to Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBinding.cs.meta diff --git a/Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBindingSo.cs b/Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBindingSo.cs deleted file mode 100644 index 4935b53c9..000000000 --- a/Assets/_DDD/_Scripts/InputSystem/RestaurantUiActionsInputBindingSo.cs +++ /dev/null @@ -1,7 +0,0 @@ -using UnityEngine; - -namespace DDD -{ - [CreateAssetMenu(fileName = "_RestaurantUiActions_InputBindingSo", menuName = "Ui/RestaurantUiActions_InputBindingSo")] - public class RestaurantUiActionsInputBindingSo : BaseUiActionsInputBindingSo { } -} \ No newline at end of file