디자인 변경 중
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
@@ -85,9 +85,9 @@ namespace UVC.UI.Toolbar.View
|
||||
[Header("UI Prefabs")]
|
||||
[Tooltip("표준 버튼 UI에 사용될 프리팹입니다.")]
|
||||
public GameObject standardButtonPrefab;
|
||||
[Tooltip("토글 버튼 UI에 사용될 프리팹입니다.")]
|
||||
[Tooltip("토글 버튼 UI에 사용될 프리팹입니다. IsOn=false로 설정해 놔야 합니다.")]
|
||||
public GameObject toggleButtonPrefab;
|
||||
[Tooltip("라디오 버튼 UI에 사용될 프리팹입니다.")]
|
||||
[Tooltip("라디오 버튼 UI에 사용될 프리팹입니다. IsOn=false로 설정해 놔야 합니다.")]
|
||||
public GameObject radioButtonPrefab;
|
||||
[Tooltip("확장 가능한 버튼 UI에 사용될 프리팹입니다.")]
|
||||
public GameObject expandableButtonPrefab;
|
||||
@@ -113,7 +113,7 @@ namespace UVC.UI.Toolbar.View
|
||||
/// 각 버튼 타입(표준, 토글 등)에 맞는 IButtonViewProcessor 구현체를 등록하여 사용합니다.
|
||||
/// </summary>
|
||||
private Dictionary<System.Type, IButtonViewProcessor> _buttonViewProcessors = new Dictionary<System.Type, IButtonViewProcessor>();
|
||||
|
||||
|
||||
|
||||
// --- 헬퍼 클래스 ---
|
||||
private ToggleGroupManager _toggleGroupManager;
|
||||
@@ -147,7 +147,7 @@ namespace UVC.UI.Toolbar.View
|
||||
|
||||
// UI 컨테이너와 레이아웃 그룹을 자동으로 찾거나 설정합니다.
|
||||
if (toolbarContainer == null) toolbarContainer = GetComponent<Transform>();
|
||||
if (toolbarContainer == null) toolbarContainer = GetComponentInChildren<Transform>(true);
|
||||
if (toolbarContainer == null) toolbarContainer = GetComponentInChildren<Transform>(true);
|
||||
if (toolbarContainer == null) Debug.LogError("ToolbarView: toolbarContainer가 할당되지 않았습니다.", this);
|
||||
|
||||
if (layoutGroup == null && toolbarContainer != null)
|
||||
@@ -225,7 +225,7 @@ namespace UVC.UI.Toolbar.View
|
||||
pair.Key.ClearEventHandlers();
|
||||
}
|
||||
if (pair.Value != null)
|
||||
{
|
||||
{
|
||||
// UI 컴포넌트의 이벤트 리스너를 명시적으로 해제합니다.
|
||||
Toggle toggleComponent = pair.Value.GetComponent<Toggle>();
|
||||
if (toggleComponent != null) toggleComponent.onValueChanged.RemoveAllListeners();
|
||||
@@ -288,7 +288,7 @@ namespace UVC.UI.Toolbar.View
|
||||
// 모델의 각 아이템을 순회하며 UI를 생성합니다.
|
||||
foreach (var itemModel in ToolbarModel.Items)
|
||||
{
|
||||
GameObject itemUIObject = null;
|
||||
GameObject? itemUIObject = null;
|
||||
|
||||
if (itemModel is ToolbarSeparator)
|
||||
{
|
||||
@@ -297,7 +297,7 @@ namespace UVC.UI.Toolbar.View
|
||||
else Debug.LogError("ToolbarView: separatorPrefab이 할당되지 않았습니다.", this);
|
||||
}
|
||||
else if (itemModel is ToolbarButtonBase buttonModel)
|
||||
{
|
||||
{
|
||||
// 버튼 모델인 경우
|
||||
IButtonViewProcessor processor = GetButtonViewProcessor(buttonModel.GetType());
|
||||
if (processor != null)
|
||||
@@ -383,8 +383,8 @@ namespace UVC.UI.Toolbar.View
|
||||
Image iconImageComponent = itemObj.transform.Find("Icon")?.GetComponent<Image>() ?? itemObj.GetComponentInChildren<Image>(true);
|
||||
if (iconImageComponent != null)
|
||||
{
|
||||
string iconPathToLoad = (model is ToolbarToggleButton toggleButton && !toggleButton.IsSelected)
|
||||
? toggleButton.OffIconSpritePath
|
||||
string iconPathToLoad = (model is ToolbarToggleButton toggleButton && !toggleButton.IsSelected)
|
||||
? toggleButton.OffIconSpritePath
|
||||
: model.IconSpritePath;
|
||||
|
||||
if (!string.IsNullOrEmpty(iconPathToLoad))
|
||||
@@ -432,7 +432,7 @@ namespace UVC.UI.Toolbar.View
|
||||
protected Sprite LoadSpriteFromResources(string spritePath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(spritePath)) return null;
|
||||
|
||||
|
||||
Sprite loadedSprite = Resources.Load<Sprite>(spritePath);
|
||||
if (loadedSprite == null)
|
||||
{
|
||||
@@ -455,7 +455,7 @@ namespace UVC.UI.Toolbar.View
|
||||
/// 툴바 UI를 정리(ClearToolbar)하여 메모리 누수를 방지합니다.
|
||||
/// </summary>
|
||||
protected virtual void OnDestroy()
|
||||
{
|
||||
{
|
||||
ClearToolbar();
|
||||
|
||||
if (TooltipManager.Instance != null && TooltipManager.Instance.IsInitialized)
|
||||
|
||||
Reference in New Issue
Block a user