namespace UIWidgets.Examples
{
using UIWidgets;
using UnityEngine;
///
/// TreeView with onDoubleClick event process in TreeView script.
///
public class TreeViewDoubleClick : TreeView
{
///
/// Removes the callback.
///
/// Item.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "HAA0603:Delegate allocation from a method group", Justification = "Required")]
protected override void RemoveCallback(TreeViewComponent item)
{
base.RemoveCallback(item);
if (item != null)
{
item.onDoubleClick.RemoveListener(DoubleClickListener);
}
}
///
/// Adds the callback.
///
/// Item.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "HAA0603:Delegate allocation from a method group", Justification = "Required")]
protected override void AddCallback(TreeViewComponent item)
{
base.AddCallback(item);
item.onDoubleClick.AddListener(DoubleClickListener);
}
void DoubleClickListener(int index)
{
var node = DataSource[index].Node;
// var component = GetItemComponent(index);
Debug.Log(node.Item.Name);
}
}
}