using UnityEngine; using UnityEngine.EventSystems; namespace UIWidgets { [RequireComponent(typeof(TreeViewComponent))] public class TreeViewNodeDragSupport : DragSupport> { [SerializeField] public ListViewIconsItemComponent DragInfo; protected virtual void Start() { if (DragInfo != null) { DragInfo.gameObject.SetActive(false); } } protected override void InitDrag(PointerEventData eventData) { base.Data = GetComponent().Node; ShowDragInfo(); } protected virtual void ShowDragInfo() { if (!(DragInfo == null)) { DragInfo.transform.SetParent(base.DragPoint, false); DragInfo.transform.localPosition = new Vector3(-5f, 5f, 0f); DragInfo.SetData(new ListViewIconsItemDescription { Name = base.Data.Item.Name, LocalizedName = base.Data.Item.LocalizedName, Icon = base.Data.Item.Icon, Value = base.Data.Item.Value }); DragInfo.gameObject.SetActive(true); } } protected virtual void HideDragInfo() { if (!(DragInfo == null)) { DragInfo.gameObject.SetActive(false); } } public override void Dropped(bool success) { HideDragInfo(); base.Dropped(success); } } }