2015-10-30 00:07:17 +08:00
|
|
|
|
/// Credit Ziboo
|
|
|
|
|
/// Sourced from - http://forum.unity3d.com/threads/free-reorderable-list.364600/
|
2015-10-29 07:07:35 +08:00
|
|
|
|
|
2015-10-30 00:07:17 +08:00
|
|
|
|
namespace UnityEngine.UI.Extensions
|
2015-10-29 07:07:35 +08:00
|
|
|
|
{
|
2015-10-30 00:07:17 +08:00
|
|
|
|
public class ReorderableListDebug : MonoBehaviour
|
2015-10-29 07:07:35 +08:00
|
|
|
|
{
|
2015-10-30 00:07:17 +08:00
|
|
|
|
public Text DebugLabel;
|
|
|
|
|
|
|
|
|
|
void Awake()
|
2015-10-29 07:07:35 +08:00
|
|
|
|
{
|
2015-10-30 00:07:17 +08:00
|
|
|
|
foreach (var list in FindObjectsOfType<ReorderableList>())
|
|
|
|
|
{
|
|
|
|
|
list.OnElementDropped.AddListener(ElementDropped);
|
|
|
|
|
}
|
2015-10-29 07:07:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-10-30 00:07:17 +08:00
|
|
|
|
private void ElementDropped(ReorderableList.ReorderableListEventStruct droppedStruct)
|
|
|
|
|
{
|
|
|
|
|
DebugLabel.text = "";
|
2015-10-30 05:01:19 +08:00
|
|
|
|
DebugLabel.text += "Dropped Object: " + droppedStruct.DroppedObject.name + "\n";
|
2015-10-30 00:07:17 +08:00
|
|
|
|
DebugLabel.text += "Is Clone ?: " + droppedStruct.IsAClone + "\n";
|
|
|
|
|
if (droppedStruct.IsAClone)
|
|
|
|
|
DebugLabel.text += "Source Object: " + droppedStruct.SourceObject.name + "\n";
|
|
|
|
|
DebugLabel.text += string.Format("From {0} at Index {1} \n", droppedStruct.FromList.name, droppedStruct.FromIndex);
|
2020-10-03 04:20:17 +08:00
|
|
|
|
DebugLabel.text += string.Format("To {0} at Index {1} \n", droppedStruct.ToList == null ? "Empty space" : droppedStruct.ToList.name, droppedStruct.ToIndex);
|
2015-10-30 00:07:17 +08:00
|
|
|
|
}
|
2015-10-29 07:07:35 +08:00
|
|
|
|
}
|
2015-10-30 00:07:17 +08:00
|
|
|
|
}
|