Initial Checkin of new Re-Orderable List.

Still ToDo:
1: complete testing scenarios
2: Update Editor script to add new auto-create option

--HG--
branch : develop_5.2
pull/413/head
Simon (darkside) Jackson 2015-10-29 16:07:17 +00:00
parent 953770528d
commit a88c7a9c1b
5 changed files with 335 additions and 311 deletions

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 281614f4c0e3b7a4d9056bd377134172
folderAsset: yes
timeCreated: 1446117980
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,10 +1,14 @@
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
/// Credit Ziboo
/// Sourced from - http://forum.unity3d.com/threads/free-reorderable-list.364600/
public class ReorderableList : MonoBehaviour
using System;
using UnityEngine.Events;
namespace UnityEngine.UI.Extensions
{
[AddComponentMenu("UI/Extensions/Re-orderable list")]
public class ReorderableList : MonoBehaviour
{
public LayoutGroup ContentLayout;
public bool IsDraggable = true;
@ -71,4 +75,5 @@ public class ReorderableList : MonoBehaviour
}
#endregion
}
}

View File

@ -1,9 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// Credit Ziboo
/// Sourced from - http://forum.unity3d.com/threads/free-reorderable-list.364600/
public class ReorderableListContent : MonoBehaviour
using System.Collections;
using System.Collections.Generic;
namespace UnityEngine.UI.Extensions
{
public class ReorderableListContent : MonoBehaviour
{
private List<Transform> _cachedChildren;
private List<ReorderableListElement> _cachedListElement;
private ReorderableListElement _ele;
@ -55,4 +59,5 @@ public class ReorderableListContent : MonoBehaviour
}
}
}
}
}

View File

@ -1,11 +1,10 @@
using System;
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
/// Credit Ziboo
/// Sourced from - http://forum.unity3d.com/threads/free-reorderable-list.364600/
public class ReorderableListDebug : MonoBehaviour
namespace UnityEngine.UI.Extensions
{
public class ReorderableListDebug : MonoBehaviour
{
public Text DebugLabel;
void Awake()
@ -23,7 +22,8 @@ public class ReorderableListDebug : MonoBehaviour
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);
DebugLabel.text += string.Format("To {0} at Index {1} \n", droppedStruct.ToList.name,droppedStruct.ToIndex);
DebugLabel.text += string.Format("From {0} at Index {1} \n", droppedStruct.FromList.name, droppedStruct.FromIndex);
DebugLabel.text += string.Format("To {0} at Index {1} \n", droppedStruct.ToList.name, droppedStruct.ToIndex);
}
}
}

View File

@ -1,11 +1,15 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
/// Credit Ziboo
/// Sourced from - http://forum.unity3d.com/threads/free-reorderable-list.364600/
[RequireComponent(typeof (RectTransform))]
public class ReorderableListElement : MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler
using System.Collections.Generic;
using UnityEngine.EventSystems;
namespace UnityEngine.UI.Extensions
{
[RequireComponent(typeof(RectTransform))]
public class ReorderableListElement : MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler
{
private readonly List<RaycastResult> _raycastResults = new List<RaycastResult>();
private ReorderableList _currentReorderableListRaycasted;
private RectTransform _draggingObject;
@ -206,4 +210,5 @@ public class ReorderableListElement : MonoBehaviour, IDragHandler, IBeginDragHan
_reorderableList = reorderableList;
_rect = GetComponent<RectTransform>();
}
}
}