개선
This commit is contained in:
@@ -72,6 +72,12 @@ namespace UVC.UI.List.Tree
|
||||
[SerializeField]
|
||||
protected Button itemButton;
|
||||
|
||||
/// <summary>
|
||||
/// text가 배치 된 RectTransform.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
protected RectTransform layout;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 데이터 필드 (Data Fields)
|
||||
@@ -91,6 +97,8 @@ namespace UVC.UI.List.Tree
|
||||
/// </summary>
|
||||
protected bool isAnimating = false;
|
||||
|
||||
protected VerticalLayoutGroup? childRootLayoutGroup = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 초기화 (Initialization)
|
||||
@@ -123,7 +131,12 @@ namespace UVC.UI.List.Tree
|
||||
valueText.text = data.Name;
|
||||
|
||||
// 3. 자식 아이템들을 UI로 생성
|
||||
Debug.Log("Creating Children for " + data.Name + ", " + data.Children.Count);
|
||||
//Debug.Log("Creating Children for " + data.Name + ", " + data.Children.Count);
|
||||
|
||||
if (childRootLayoutGroup == null)
|
||||
{
|
||||
childRootLayoutGroup = childRoot.GetComponent<VerticalLayoutGroup>();
|
||||
}
|
||||
|
||||
|
||||
if (data.Children.Count > 0)
|
||||
@@ -164,7 +177,7 @@ namespace UVC.UI.List.Tree
|
||||
if (dragHandler == null)
|
||||
{
|
||||
dragHandler = gameObject.AddComponent<TreeListItemDragHandler>();
|
||||
Debug.Log($"[TreeListItem.Init] 새로운 TreeListItemDragHandler 추가: {data.Name}");
|
||||
//Debug.Log($"[TreeListItem.Init] 새로운 TreeListItemDragHandler 추가: {data.Name}");
|
||||
}
|
||||
|
||||
dragHandler.SetDragDropManager(this, control, dragDropManager);
|
||||
@@ -173,7 +186,7 @@ namespace UVC.UI.List.Tree
|
||||
// Register view to map
|
||||
treeList.RegisterView(data, this);
|
||||
|
||||
Debug.Log($"[TreeListItem.Init] 초기화 완료: {data.Name}");
|
||||
//Debug.Log($"[TreeListItem.Init] 초기화 완료: {data.Name}");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -305,7 +318,7 @@ namespace UVC.UI.List.Tree
|
||||
else if (changedType == ChangedType.RemoveChild)
|
||||
{
|
||||
//따로 할것 없음 - 펼침 버튼 갱신 용
|
||||
Debug.Log($"RemoveChild 처리 완료 {changedData.Name}, {index}");
|
||||
//Debug.Log($"RemoveChild 처리 완료 {changedData.Name}, {index}");
|
||||
}
|
||||
|
||||
UniTask.DelayFrame(1).ContinueWith(() =>
|
||||
@@ -539,6 +552,12 @@ namespace UVC.UI.List.Tree
|
||||
treeList.ItemPrefab, // 복제할 프리팹
|
||||
childRoot // 부모로 배치할 위치
|
||||
);
|
||||
|
||||
//item.layout의 너비를 childRootLayoutGroup의 padding.left 만큼 줄이기
|
||||
if (item != null && item.layout != null && childRootLayoutGroup != null)
|
||||
{
|
||||
item.layout.sizeDelta = new Vector2(layout.sizeDelta.x - childRootLayoutGroup.padding.left, item.layout.sizeDelta.y);
|
||||
}
|
||||
|
||||
// 2️. 생성된 아이템 초기화
|
||||
item.Init(data, treeList, treeList.DragDropManager);
|
||||
|
||||
Reference in New Issue
Block a user