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
release
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; /// Credit Ziboo
using UnityEngine; /// Sourced from - http://forum.unity3d.com/threads/free-reorderable-list.364600/
using UnityEngine.Events;
using UnityEngine.UI;
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 LayoutGroup ContentLayout;
public bool IsDraggable = true; public bool IsDraggable = true;
@ -71,4 +75,5 @@ public class ReorderableList : MonoBehaviour
} }
#endregion #endregion
}
} }

View File

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

View File

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

View File

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