From 2c3f257353b16f352808faae91ae1d9a4cfd6722 Mon Sep 17 00:00:00 2001 From: NTG Date: Sun, 17 Aug 2025 15:43:02 +0900 Subject: [PATCH] =?UTF-8?q?Data=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20Tas?= =?UTF-8?q?k=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../So/RestaurantManagementDataSo.asset | 4 ++-- .../_Scripts/CameraSystem/CameraManager.cs | 3 ++- Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs | 4 ++-- .../InventoryUi/InventorySlotUiStrategy.cs | 13 +++++------- .../InventoryUi/InventoryView.cs | 8 +++---- .../RestaurantManagementUi/ItemDetailView.cs | 20 +++++++----------- .../ItemUi/IInteractableUi.cs | 2 +- .../ItemUi/IItemSlotUiStrategy.cs | 5 ++--- .../ItemUi/ItemSlotInteractor.cs | 9 +++----- .../ItemUi/ItemSlotUi.cs | 6 +++--- .../RestaurantManagementUi.cs | 4 ++-- .../TabUi/CommonTabButtonUi.cs | 3 +-- .../TodayMenuUi/TodayMenuSlotUiStrategy.cs | 11 ++++------ .../TodayMenuUi/TodayMenuView.cs | 21 +++++++++---------- .../TodayCookwareSlotUiStrategy.cs | 14 ++++--------- .../TodayRestaurantStateView.cs | 21 +++++++++---------- .../TodayWorkerSlotUiStrategy.cs | 15 +++++-------- .../DataObjects/RestaurantManagementDataSo.cs | 3 +++ .../RestaurantData/RestaurantDataSo.cs | 6 +++++- 19 files changed, 75 insertions(+), 97 deletions(-) diff --git a/Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset b/Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset index 04b27cce0..d41d91a49 100644 --- a/Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset +++ b/Assets/_DDD/_Addressables/So/RestaurantManagementDataSo.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c1336808a8b187e4031f87079aad93726159c97c2a87583e5da60d30afa85ca1 -size 797 +oid sha256:a622cbf827458ecee7b3b432db797b6784ac35ea1891015ff36cd0724f451ff2 +size 1005 diff --git a/Assets/_DDD/_Scripts/CameraSystem/CameraManager.cs b/Assets/_DDD/_Scripts/CameraSystem/CameraManager.cs index 3754a53dc..2dc72bc9d 100644 --- a/Assets/_DDD/_Scripts/CameraSystem/CameraManager.cs +++ b/Assets/_DDD/_Scripts/CameraSystem/CameraManager.cs @@ -22,7 +22,8 @@ public class CameraManager : Singleton, IManager private void OnDestroy() { - foreach (var cameraGameObject in _cameraGameObjects.Values) + var snapshot = new List(_cameraGameObjects.Values); + foreach (var cameraGameObject in snapshot) { if (cameraGameObject) { diff --git a/Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs b/Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs index ec7823daa..c129f25cd 100644 --- a/Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/BasePopupUi.cs @@ -20,9 +20,9 @@ protected override void Update() base.Update(); var currentSelectedGameObject = EventSystem.current.currentSelectedGameObject; - if (!currentSelectedGameObject || currentSelectedGameObject.activeInHierarchy == false) + if (currentSelectedGameObject == null || currentSelectedGameObject.activeInHierarchy == false) { - if (!GetInitialSelected()) return; + if (GetInitialSelected() == null) return; EventSystem.current.SetSelectedGameObject(GetInitialSelected()); } diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs index 17570e58b..4b63493be 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventorySlotUiStrategy.cs @@ -1,13 +1,12 @@ using System.Threading.Tasks; +using Mono.Cecil; using UnityEngine; namespace DDD { public class InventorySlotUiStrategy : IItemSlotUiStrategy { - public string AnimatorControllerKey => "InventorySlotUi"; - - public Task Setup(ItemSlotUi ui, ItemViewModel model) + public void Setup(ItemSlotUi ui, ItemViewModel model) { if (InventoryManager.Instance.ContainInventoryItem(model.Id)) { @@ -16,7 +15,7 @@ public Task Setup(ItemSlotUi ui, ItemViewModel model) ui.HideMark(); ui.SetButtonInteractable(true); - return Task.CompletedTask; + return; } // TODO : 임시 초기화 값 @@ -37,13 +36,11 @@ public Task Setup(ItemSlotUi ui, ItemViewModel model) ui.HideCountText(); ui.HideMark(); ui.SetButtonInteractable(false); - - return Task.CompletedTask; } - public async Task GetAnimatorController() + public RuntimeAnimatorController GetAnimatorController() { - return await AssetManager.LoadAsset(AnimatorControllerKey); + return RestaurantDataSo.instance.ManagementData.InventorySlotUiAnimatorController; } public void OnInventoryChanged(ItemSlotUi ui) diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventoryView.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventoryView.cs index 944ba72c2..3058a987c 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventoryView.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/InventoryUi/InventoryView.cs @@ -36,7 +36,7 @@ private void OnDisable() EventBus.Unregister(this); } - public async Task Initialize() + public void Initialize() { restaurantManagementStateSo = RestaurantState.instance.ManagementState; restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData; @@ -51,19 +51,19 @@ public async Task Initialize() { var itemSlotUi = Instantiate(restaurantManagementDataSo.ItemSlotUiPrefab, _slotParent); var slot = itemSlotUi.GetComponent(); - await slot.Initialize(model, new InventorySlotUiStrategy()); + slot.Initialize(model, new InventorySlotUiStrategy()); itemSlotUi.name = ItemSlotUiName + model.Id; var interactor = itemSlotUi.GetComponent(); if (model.ItemType == ItemType.Recipe) { - await interactor.Initialize(TodayMenuEventType.Add, new TodayMenuInteractorStrategy()); + interactor.Initialize(TodayMenuEventType.Add, new TodayMenuInteractorStrategy()); } else { if (DataManager.Instance.GetDataSo().TryGetDataById(model.Id, out var cookwareData)) { - await interactor.Initialize(TodayMenuEventType.Add, new TodayCookwareInteractorStrategy()); + interactor.Initialize(TodayMenuEventType.Add, new TodayCookwareInteractorStrategy()); } } diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemDetailView.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemDetailView.cs index 5ab01d0f3..789e8214b 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemDetailView.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemDetailView.cs @@ -23,32 +23,28 @@ public class ItemDetailView : MonoBehaviour, IEventHandler _tasteHashTagSlotUis = new(); private ItemViewModel _currentItemViewModel; - private TaskCompletionSource _isInitialized = new(); private const string CookwareDetailPanel = "CookwareDetailPanel"; private const string IngredientDetailPanel = "IngredientDetailPanel"; private const string RecipeDetailPanel = "RecipeDetailPanel"; - private async void Start() + private void Start() { - restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData; - restaurantManagementStateSo = RestaurantState.instance.ManagementState; - Debug.Assert(restaurantManagementDataSo != null, "RestaurantManagementSo is null"); - Debug.Assert(restaurantManagementStateSo != null, "RestaurantManagementSo is null"); - _nameLabel.text = string.Empty; _descriptionLabel.text = string.Empty; _cookwareImage.sprite = null; - - _isInitialized.SetResult(true); } private void OnEnable() { + if (restaurantManagementDataSo == null) + { + restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData; + } + EventBus.Register(this); } @@ -62,10 +58,8 @@ public void Invoke(ItemSlotSelectedEvent evt) Show(evt.Model); } - public async void Show(ItemViewModel model) + public void Show(ItemViewModel model) { - await _isInitialized.Task; - _currentItemViewModel = model; if (_currentItemViewModel == null) return; diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IInteractableUi.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IInteractableUi.cs index 73c87726d..340ea3fe8 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IInteractableUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IInteractableUi.cs @@ -4,6 +4,6 @@ namespace DDD { public interface IInteractableUi { - Task OnInteract(); + void OnInteract(); } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IItemSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IItemSlotUiStrategy.cs index ac0ed5bf0..15316b5f9 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IItemSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/IItemSlotUiStrategy.cs @@ -5,8 +5,7 @@ namespace DDD { public interface IItemSlotUiStrategy { - string AnimatorControllerKey { get; } - Task Setup(ItemSlotUi ui, ItemViewModel model); - Task GetAnimatorController(); + void Setup(ItemSlotUi ui, ItemViewModel model); + RuntimeAnimatorController GetAnimatorController(); } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotInteractor.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotInteractor.cs index 9203cad86..daf388bab 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotInteractor.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotInteractor.cs @@ -16,7 +16,7 @@ public class ItemSlotInteractor : MonoBehaviour, IInteractableUi { private ItemSlotUi _itemSlotUi; private RestaurantManagementStateSo restaurantManagementStateSo; - private TaskCompletionSource _isInitialized = new(); + private TodayMenuEventType _todayMenuEventType = TodayMenuEventType.None; public IItemSlotInteractorStrategy Strategy { get; private set; } @@ -26,19 +26,16 @@ private void Awake() _itemSlotUi = GetComponent(); } - public async Task Initialize(TodayMenuEventType todayMenuEventType, IItemSlotInteractorStrategy strategy) + public void Initialize(TodayMenuEventType todayMenuEventType, IItemSlotInteractorStrategy strategy) { _todayMenuEventType = todayMenuEventType; Strategy = strategy; restaurantManagementStateSo = RestaurantState.instance.ManagementState; - _isInitialized.SetResult(true); } - public async Task OnInteract() + public void OnInteract() { - await _isInitialized.Task; - switch (_todayMenuEventType) { case TodayMenuEventType.Add: diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotUi.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotUi.cs index 07584f8c3..e2c4a076b 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/ItemUi/ItemSlotUi.cs @@ -19,14 +19,14 @@ public class ItemSlotUi : MonoBehaviour, ISelectHandler, IAutoScrollItem [field: SerializeField] public ItemViewModel Model { get; private set; } public IItemSlotUiStrategy Strategy { get; private set; } - public async Task Initialize(ItemViewModel model, IItemSlotUiStrategy strategy) + public void Initialize(ItemViewModel model, IItemSlotUiStrategy strategy) { Model = model; Strategy = strategy; - var controller = await strategy.GetAnimatorController(); + var controller = strategy.GetAnimatorController(); _animator.runtimeAnimatorController = controller; - _ = Strategy.Setup(this, model); + Strategy.Setup(this, model); } public void SetIcon(Sprite sprite) => _icon.sprite = sprite; diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs index e26ae8313..fa8fe5383 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/RestaurantManagementUi.cs @@ -81,11 +81,11 @@ protected override GameObject GetInitialSelected() return null; } - public async override void Open(OpenPopupUiEvent evt) + public override void Open(OpenPopupUiEvent evt) { base.Open(evt); - await _inventoryView.Initialize(); + _inventoryView.Initialize(); // 각 그룹별로 허용된 카테고리 설정 SetupCategoryTabs(); diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TabUi/CommonTabButtonUi.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TabUi/CommonTabButtonUi.cs index 0b5f27f53..9c1f7d54d 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TabUi/CommonTabButtonUi.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TabUi/CommonTabButtonUi.cs @@ -113,11 +113,10 @@ private void SetActiveContents(bool isActive) } } - public Task OnInteract() + public void OnInteract() { _onSelected?.Invoke(_tabButtonValue); OnTabClicked?.Invoke(_tabButtonValue); - return Task.CompletedTask; } } } diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs index 2c7b04f18..5cc97f1e2 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuSlotUiStrategy.cs @@ -6,18 +6,15 @@ namespace DDD public class TodayMenuSlotUiStrategy : IItemSlotUiStrategy { private readonly RecipeType _recipeType; - private RestaurantManagementStateSo restaurantManagementStateSo; - - public string AnimatorControllerKey => "TodayMenuSlotUi"; public TodayMenuSlotUiStrategy(RecipeType recipeType) { _recipeType = recipeType; } - public async Task Setup(ItemSlotUi ui, ItemViewModel model) + public void Setup(ItemSlotUi ui, ItemViewModel model) { - restaurantManagementStateSo = RestaurantState.instance.ManagementState; + var restaurantManagementStateSo = RestaurantState.instance.ManagementState; if (model == null) { @@ -54,9 +51,9 @@ public async Task Setup(ItemSlotUi ui, ItemViewModel model) ui.SetButtonInteractable(true); } - public async Task GetAnimatorController() + public RuntimeAnimatorController GetAnimatorController() { - return await AssetManager.LoadAsset(AnimatorControllerKey); + return RestaurantDataSo.instance.ManagementData.TodayMenuSlotUiAnimatorController; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs index 197a28c0c..df9e75ccc 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayMenuUi/TodayMenuView.cs @@ -17,7 +17,7 @@ public class TodayMenuView : MonoBehaviour, IEventHandler, private void Start() { - _ = Initialize(); + Initialize(); } private void OnDestroy() @@ -26,11 +26,10 @@ private void OnDestroy() EventBus.Unregister(this); } - private async Task Initialize() + private void Initialize() { restaurantManagementStateSo = RestaurantState.instance.ManagementState; restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData; - Debug.Assert(restaurantManagementStateSo != null, "_restaurantManagementSo != null"); foreach (Transform child in _todayFoodContent) { @@ -43,9 +42,9 @@ private async Task Initialize() { var go = Instantiate(restaurantManagementDataSo.ItemSlotUiPrefab, _todayFoodContent); var slot = go.GetComponent(); - await slot.Initialize(null, new TodayMenuSlotUiStrategy(RecipeType.FoodRecipe)); + slot.Initialize(null, new TodayMenuSlotUiStrategy(RecipeType.FoodRecipe)); var itemSlotInteractor = go.GetComponent(); - await itemSlotInteractor.Initialize(TodayMenuEventType.Remove, new TodayMenuInteractorStrategy()); + itemSlotInteractor.Initialize(TodayMenuEventType.Remove, new TodayMenuInteractorStrategy()); _foodSlots.Add(slot); } @@ -61,9 +60,9 @@ private async Task Initialize() { var go = Instantiate(restaurantManagementDataSo.ItemSlotUiPrefab, _todayDrinkContent); var slot = go.GetComponent(); - await slot.Initialize(null, new TodayMenuSlotUiStrategy(RecipeType.DrinkRecipe)); + slot.Initialize(null, new TodayMenuSlotUiStrategy(RecipeType.DrinkRecipe)); var itemSlotInteractor = go.GetComponent(); - await itemSlotInteractor.Initialize(TodayMenuEventType.Remove, new TodayMenuInteractorStrategy()); + itemSlotInteractor.Initialize(TodayMenuEventType.Remove, new TodayMenuInteractorStrategy()); _drinkSlots.Add(slot); } @@ -93,14 +92,14 @@ private void UpdateView() var model = ItemViewModelFactory.CreateByItemId(foodRecipeIdCountPair.Key); var foodSlot = _foodSlots[foodIndex]; - _ = foodSlot.Initialize(model, new TodayMenuSlotUiStrategy(RecipeType.FoodRecipe)); + foodSlot.Initialize(model, new TodayMenuSlotUiStrategy(RecipeType.FoodRecipe)); foodSlot.Model.SetCount(foodRecipeIdCountPair.Value); foodIndex++; } for (int i = foodIndex; i < _foodSlots.Count; i++) { - _ = _foodSlots[i].Initialize(null, new TodayMenuSlotUiStrategy(RecipeType.FoodRecipe)); + _foodSlots[i].Initialize(null, new TodayMenuSlotUiStrategy(RecipeType.FoodRecipe)); } int drinkIndex = 0; @@ -110,14 +109,14 @@ private void UpdateView() var model = ItemViewModelFactory.CreateByItemId(drinkRecipeIdCountPair.Key); var drinkSlot = _drinkSlots[drinkIndex]; - _ = drinkSlot.Initialize(model, new TodayMenuSlotUiStrategy(RecipeType.DrinkRecipe)); + drinkSlot.Initialize(model, new TodayMenuSlotUiStrategy(RecipeType.DrinkRecipe)); drinkSlot.Model.SetCount(drinkRecipeIdCountPair.Value); drinkIndex++; } for (int i = drinkIndex; i < _drinkSlots.Count; i++) { - _ = _drinkSlots[i].Initialize(null, new TodayMenuSlotUiStrategy(RecipeType.DrinkRecipe)); + _drinkSlots[i].Initialize(null, new TodayMenuSlotUiStrategy(RecipeType.DrinkRecipe)); } } } diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs index d4976c995..1f97e859c 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayCookwareSlotUiStrategy.cs @@ -5,11 +5,7 @@ namespace DDD { public class TodayCookwareSlotUiStrategy : IItemSlotUiStrategy { - private RestaurantManagementStateSo restaurantManagementStateSo; - - public string AnimatorControllerKey => "TodayMenuSlotUi"; - - public Task Setup(ItemSlotUi ui, ItemViewModel model) + public void Setup(ItemSlotUi ui, ItemViewModel model) { if (model == null) { @@ -18,20 +14,18 @@ public Task Setup(ItemSlotUi ui, ItemViewModel model) ui.HideMark(); ui.SetButtonInteractable(false); - return Task.CompletedTask; + return; } ui.SetIcon(model.ItemSprite); ui.HideCountText(); ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭 ui.SetButtonInteractable(true); - - return Task.CompletedTask; } - public async Task GetAnimatorController() + public RuntimeAnimatorController GetAnimatorController() { - return await AssetManager.LoadAsset(AnimatorControllerKey); + return RestaurantDataSo.instance.ManagementData.TodayMenuSlotUiAnimatorController; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs index 4edaa5530..ba3e3e383 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayRestaurantStateView.cs @@ -17,7 +17,7 @@ public class TodayRestaurantStateView : MonoBehaviour, IEventHandler(this); } - private async Task Initialize() + private void Initialize() { restaurantManagementStateSo = RestaurantState.instance.ManagementState; restaurantManagementDataSo = RestaurantDataSo.instance.ManagementData; - Debug.Assert(restaurantManagementStateSo != null, "_restaurantManagementSo != null"); foreach (Transform child in _todayWorkerContent) { @@ -43,9 +42,9 @@ private async Task Initialize() { var go = Instantiate(restaurantManagementDataSo.ItemSlotUiPrefab, _todayWorkerContent); var slot = go.GetComponent(); - await slot.Initialize(null, new TodayWorkerSlotUiStrategy()); + slot.Initialize(null, new TodayWorkerSlotUiStrategy()); var itemSlotInteractor = go.GetComponent(); - await itemSlotInteractor.Initialize(TodayMenuEventType.Remove, new TodayCookwareInteractorStrategy()); + itemSlotInteractor.Initialize(TodayMenuEventType.Remove, new TodayCookwareInteractorStrategy()); _workerSlots.Add(slot); } @@ -60,9 +59,9 @@ private async Task Initialize() { var go = Instantiate(restaurantManagementDataSo.ItemSlotUiPrefab, _todayCookwareContent); var slot = go.GetComponent(); - await slot.Initialize(null, new TodayCookwareSlotUiStrategy()); + slot.Initialize(null, new TodayCookwareSlotUiStrategy()); var itemSlotInteractor = go.GetComponent(); - await itemSlotInteractor.Initialize(TodayMenuEventType.Remove, new TodayCookwareInteractorStrategy()); + itemSlotInteractor.Initialize(TodayMenuEventType.Remove, new TodayCookwareInteractorStrategy()); _cookwareSlots.Add(slot); } @@ -92,14 +91,14 @@ private void UpdateView() var model = ItemViewModelFactory.CreateByItemId(workerKey); var newWorkerSlot = _workerSlots[workerIndex]; - _ = newWorkerSlot.Initialize(model, new TodayWorkerSlotUiStrategy()); + newWorkerSlot.Initialize(model, new TodayWorkerSlotUiStrategy()); newWorkerSlot.Model.SetCount(1); workerIndex++; } for (int i = workerIndex; i < _workerSlots.Count; i++) { - _ = _workerSlots[i].Initialize(null, new TodayWorkerSlotUiStrategy()); + _workerSlots[i].Initialize(null, new TodayWorkerSlotUiStrategy()); } int cookwareIndex = 0; @@ -109,14 +108,14 @@ private void UpdateView() var model = ItemViewModelFactory.CreateByItemId(cookwareKey); var newCookwareSlot = _cookwareSlots[cookwareIndex]; - _ = newCookwareSlot.Initialize(model, new TodayCookwareSlotUiStrategy()); + newCookwareSlot.Initialize(model, new TodayCookwareSlotUiStrategy()); newCookwareSlot.Model.SetCount(1); cookwareIndex++; } for (int i = cookwareIndex; i < _cookwareSlots.Count; i++) { - _ = _cookwareSlots[i].Initialize(null, new TodayCookwareSlotUiStrategy()); + _cookwareSlots[i].Initialize(null, new TodayCookwareSlotUiStrategy()); } } } diff --git a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs index b84d51348..3919264cc 100644 --- a/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs +++ b/Assets/_DDD/_Scripts/GameUi/RestaurantManagementUi/TodayRestaurantStateUi/TodayWorkerSlotUiStrategy.cs @@ -1,15 +1,12 @@ using System.Threading.Tasks; +using Unity.VisualScripting.Antlr3.Runtime; using UnityEngine; namespace DDD { public class TodayWorkerSlotUiStrategy : IItemSlotUiStrategy { - private RestaurantManagementStateSo restaurantManagementStateSo; - - public string AnimatorControllerKey => "TodayMenuSlotUi"; - - public Task Setup(ItemSlotUi ui, ItemViewModel model) + public void Setup(ItemSlotUi ui, ItemViewModel model) { if (model == null) { @@ -18,20 +15,18 @@ public Task Setup(ItemSlotUi ui, ItemViewModel model) ui.HideMark(); ui.SetButtonInteractable(false); - return Task.CompletedTask; + return; } ui.SetIcon(model.ItemSprite); ui.HideCountText(); ui.ShowMark(DataManager.Instance.GetSprite(SpriteConstants.CheckNoSpriteKey)); // TODO : 추후에 장비와 매칭 ui.SetButtonInteractable(true); - - return Task.CompletedTask; } - public async Task GetAnimatorController() + public RuntimeAnimatorController GetAnimatorController() { - return await AssetManager.LoadAsset(AnimatorControllerKey); + return RestaurantDataSo.instance.ManagementData.TodayMenuSlotUiAnimatorController; } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs index 5ea724129..f771274ff 100644 --- a/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantData/DataObjects/RestaurantManagementDataSo.cs @@ -11,5 +11,8 @@ public class RestaurantManagementDataSo : ScriptableObject public Material FoodTasteMaterial; public Material DrinkTasteMateria; + + public RuntimeAnimatorController TodayMenuSlotUiAnimatorController; + public RuntimeAnimatorController InventorySlotUiAnimatorController; } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs b/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs index 89607427f..8fb226113 100644 --- a/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs +++ b/Assets/_DDD/_Scripts/RestaurantData/RestaurantDataSo.cs @@ -30,9 +30,13 @@ public async Task LoadData() await playerHandle.Task; await managementHandle.Task; - + PlayerData = playerHandle.Result; ManagementData = managementHandle.Result; + + Debug.Assert(PlayerData != null, "PlayerData is null"); + Debug.Assert(ManagementData != null, "ManagementData is null"); + _isLoaded = true; }