82 lines
2.5 KiB
C#
82 lines
2.5 KiB
C#
#nullable enable
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
using UVC.UIToolkit;
|
|
|
|
namespace Factory.UIToolkit.Modal
|
|
{
|
|
/// <summary>
|
|
/// 설정 표시 정보 탭 뷰.
|
|
/// UTKReordableList를 사용하여 표시 항목의 순서, 사용 유무, 내용을 관리합니다.
|
|
/// </summary>
|
|
[UxmlElement]
|
|
public partial class UTKFactorySettingModalContent : VisualElement, IDisposable, IUTKModalContent<object>
|
|
{
|
|
private UTKTabView tabView;
|
|
|
|
public UTKFactorySettingModalContent()
|
|
{
|
|
style.flexGrow = 1;
|
|
|
|
tabView = new UTKTabView();
|
|
tabView.style.flexGrow = 1;
|
|
tabView.TabWidth = 140; // 탭 너비 설정
|
|
|
|
// 탭 정렬 방향 설정
|
|
tabView.Align = TabAlign.Left; // 탭을 왼쪽에 세로로 배치
|
|
|
|
// 탭 추가
|
|
var tab1 = tabView.AddUTKTab("일반정보");
|
|
tab1.Add(new UTKFactorySettingModalContentGeneral());
|
|
|
|
var tab2 = tabView.AddUTKTab("표시정보");
|
|
tab2.Add(new UTKFactorySettingModalContentDisplay());
|
|
|
|
var tab3 = tabView.AddUTKTab("알람설정");
|
|
tab3.Add(new UTKFactorySettingModalContentAlarm());
|
|
|
|
var tab4 = tabView.AddUTKTab("입력설정");
|
|
tab4.Add(new UTKFactorySettingModalContentInput());
|
|
|
|
tabView.OnTabChanged += OnTabChanged;
|
|
tabView.tabClosed += OnTabClosed;
|
|
Add(tabView);
|
|
}
|
|
|
|
public UTKFactorySettingModalContent(int tabIndex = 0, object? data = null) : this()
|
|
{
|
|
// 생성자에서 탭 인덱스를 받아서 초기 탭 설정
|
|
tabView.SelectedIndex = tabIndex;
|
|
}
|
|
|
|
private void OnTabChanged(int index, UnityEngine.UIElements.Tab? tab)
|
|
{
|
|
Debug.Log($"Selected Tab Index: {index}");
|
|
|
|
}
|
|
|
|
private void OnTabClosed(UnityEngine.UIElements.Tab tab, int index)
|
|
{
|
|
Debug.Log($"Closed Tab Index: {index}");
|
|
}
|
|
|
|
public object? GetResult()
|
|
{
|
|
IUTKTabContent? content = UTKTabView.FindTabContent(tabView.activeTab);
|
|
if (content != null) {
|
|
return content.Hide();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
// 필요한 경우 리소스 정리
|
|
tabView.OnTabChanged -= OnTabChanged;
|
|
tabView.tabClosed -= OnTabClosed;
|
|
}
|
|
}
|
|
|
|
} |