UTKProperyWIndow 수정 중
This commit is contained in:
@@ -12,23 +12,49 @@ public class UTKTreeListWindowSample : MonoBehaviour
|
||||
[SerializeField]
|
||||
public UIDocument uiDocument;
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("시작 시 적용할 테마")]
|
||||
private UTKTheme initialTheme = UTKTheme.Dark;
|
||||
|
||||
private UTKToggle _themeToggle;
|
||||
|
||||
private UTKTreeListWindow treeListWindow;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
uiDocument ??= GetComponent<UIDocument>();
|
||||
|
||||
// UIDocument에서 UTKTreeListWindow 인스턴스 생성해서 할당
|
||||
treeListWindow = new UTKTreeListWindow();
|
||||
uiDocument.rootVisualElement.Add(treeListWindow);
|
||||
|
||||
// UTKTreeListWindow가 할당되지 않은 경우 경고
|
||||
if (treeListWindow == null)
|
||||
// UIDocument 참조 확인
|
||||
var doc = GetComponent<UIDocument>();
|
||||
if (doc == null)
|
||||
{
|
||||
Debug.LogWarning("[UTKTreeListWindowSample] treeListWindow가 할당되지 않았습니다.");
|
||||
Debug.LogError("UIDocument가 할당되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
uiDocument = doc;
|
||||
|
||||
var toggle = uiDocument.rootVisualElement.Q<UTKToggle>("toggle");
|
||||
if (toggle == null)
|
||||
{
|
||||
Debug.LogError("UXML에서 UTKToggle을 찾을 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
_themeToggle = toggle;
|
||||
|
||||
var window = uiDocument.rootVisualElement.Q<UTKTreeListWindow>("window");
|
||||
if (window == null)
|
||||
{
|
||||
Debug.LogError("UXML에서 UTKTreeListWindow를 찾을 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
treeListWindow = window;
|
||||
|
||||
UTKThemeManager.Instance.RegisterRoot(uiDocument.rootVisualElement);
|
||||
UTKThemeManager.Instance.SetTheme(initialTheme);
|
||||
|
||||
_themeToggle.OnValueChanged += (isOn) =>
|
||||
{
|
||||
UTKThemeManager.Instance.SetTheme(!isOn ? UTKTheme.Dark : UTKTheme.Light);
|
||||
};
|
||||
|
||||
// 테스트용 계층적 트리 데이터 생성
|
||||
CreateTestData();
|
||||
|
||||
Reference in New Issue
Block a user