From 627b0aedf5078ee24921da56c872409410643316 Mon Sep 17 00:00:00 2001 From: NTG Date: Mon, 1 Sep 2025 17:20:09 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=B0=8F=20=EC=B0=BE=EB=8A=94=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RestaurantManagementUi.cs | 16 +++------- .../TabUi/TabGroupUi.cs | 32 +++++-------------- 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/RestaurantManagementUi/RestaurantManagementUi.cs b/Assets/_DDD/_Scripts/Restaurant/Ui/RestaurantManagementUi/RestaurantManagementUi.cs index 83edb0270..945d046bd 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Ui/RestaurantManagementUi/RestaurantManagementUi.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/RestaurantManagementUi/RestaurantManagementUi.cs @@ -65,7 +65,6 @@ protected override void OnCreatedInitializePopup() { InitializeViews(); InitializeTabGroups(); - SetupCategoryTabs(); SetupBindings(); } @@ -173,12 +172,6 @@ private void InitializeViews() } } - private void SetupCategoryTabs() - { - _menuCategoryTabs.UseDefaultAllowedValues(); - _cookwareCategoryTabs.UseDefaultAllowedValues(); - } - private void InitializeTabGroups() { _sectionTabs.Initialize(OnSectionTabSelected); @@ -189,7 +182,7 @@ private void InitializeTabGroups() private void UpdateSectionTabs() { if (_viewModel == null) return; - _sectionTabs.SelectTab((int)_viewModel.CurrentSection); + _sectionTabs.TrySelectTab((int)_viewModel.CurrentSection); } private void UpdateCategoryTabs() @@ -199,10 +192,10 @@ private void UpdateCategoryTabs() switch (_viewModel.CurrentSection) { case SectionButtonType.Menu: - _menuCategoryTabs.SelectTab((int)_viewModel.CurrentCategory); + _menuCategoryTabs.TrySelectTab((int)_viewModel.CurrentCategory); break; case SectionButtonType.Cookware: - _cookwareCategoryTabs.SelectTab((int)_viewModel.CurrentCategory); + _cookwareCategoryTabs.TrySelectTab((int)_viewModel.CurrentCategory); break; } } @@ -264,7 +257,8 @@ private void HandleCloseRequested() private void HandleMenuCategorySelected(InventoryCategoryType category) { - _menuCategoryTabs.SelectTab((int)category); + if (_menuCategoryTabs.TrySelectTab((int)category)) return; + if (_cookwareCategoryTabs.TrySelectTab((int)category)) return; } private void OnSectionTabSelected(int sectionValue) diff --git a/Assets/_DDD/_Scripts/Restaurant/Ui/RestaurantManagementUi/TabUi/TabGroupUi.cs b/Assets/_DDD/_Scripts/Restaurant/Ui/RestaurantManagementUi/TabUi/TabGroupUi.cs index 550ee59cf..b060b6325 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Ui/RestaurantManagementUi/TabUi/TabGroupUi.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Ui/RestaurantManagementUi/TabUi/TabGroupUi.cs @@ -76,22 +76,6 @@ public void Initialize(Action onTabSelected) InitializeTabs(); } - /// - /// 기본 허용 값들을 사용하여 탭을 초기화합니다. - /// - public void UseDefaultAllowedValues() - { - if (TabButtonConfig.TryGetValue(_tabButtonType, out List defaultValues)) - { - // 기본값을 바로 사용하여 탭 초기화 - InitializeTabsWithValues(defaultValues); - } - else - { - Debug.LogWarning($"TabButtonType {_tabButtonType}에 대한 설정이 정의되지 않았습니다.", this); - } - } - /// /// 지정된 값들로 탭들을 초기화합니다. /// @@ -144,24 +128,23 @@ private void InitializeTabs() /// private void HandleTabButtonClicked(int tabValue) { - SelectTab(tabValue); + TrySelectTab(tabValue); } /// /// 지정된 값을 가진 탭을 선택합니다. /// - public void SelectTab(int tabValue) + public bool TrySelectTab(int tabValue) { if (_tabLookup == null || _tabLookup.Count == 0) { Debug.LogWarning("탭 룩업이 초기화되지 않았습니다.", this); - return; + return false; } - if (!_tabLookup.ContainsKey(tabValue)) + if (_tabLookup.ContainsKey(tabValue) == false) { - Debug.LogWarning($"탭 값 {tabValue}에 해당하는 탭을 찾을 수 없습니다.", this); - return; + return false; } CurrentTabValue = tabValue; @@ -174,6 +157,7 @@ public void SelectTab(int tabValue) // 이벤트 호출 OnTabSelected?.Invoke(tabValue); + return true; } /// @@ -185,7 +169,7 @@ public void SelectFirstTab() if (_tabButtons[0] != null) { var firstTabValue = _tabButtons[0].TabValue; - SelectTab(firstTabValue); + TrySelectTab(firstTabValue); } } @@ -223,7 +207,7 @@ public void Move(int direction) // 상호작용 가능한 탭을 찾았으면 이동 if (IsTabInteractable(tabValues[newIndex])) { - SelectTab(tabValues[newIndex]); + TrySelectTab(tabValues[newIndex]); } }