Various patches and also enabled the ReorderableList in SS-Camera / Worldspace
parent
e4991aba05
commit
a059c148a6
|
@ -549,9 +549,10 @@ namespace UnityEditor.UI
|
||||||
|
|
||||||
Selection.activeGameObject = uiVerticalScrollerRoot;
|
Selection.activeGameObject = uiVerticalScrollerRoot;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Extensions/UI Button", false)]
|
#region UI Button
|
||||||
|
[MenuItem("GameObject/UI/Extensions/UI Button", false)]
|
||||||
static public void AddUIButton(MenuCommand menuCommand)
|
static public void AddUIButton(MenuCommand menuCommand)
|
||||||
{
|
{
|
||||||
GameObject uiButtonRoot = CreateUIElementRoot("UI Button", menuCommand, s_ThickGUIElementSize);
|
GameObject uiButtonRoot = CreateUIElementRoot("UI Button", menuCommand, s_ThickGUIElementSize);
|
||||||
|
@ -578,8 +579,10 @@ namespace UnityEditor.UI
|
||||||
|
|
||||||
Selection.activeGameObject = uiButtonRoot;
|
Selection.activeGameObject = uiButtonRoot;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Extensions/UI Flippable", false)]
|
#region UI Flippable
|
||||||
|
[MenuItem("GameObject/UI/Extensions/UI Flippable", false)]
|
||||||
static public void AddUIFlippableImage(MenuCommand menuCommand)
|
static public void AddUIFlippableImage(MenuCommand menuCommand)
|
||||||
{
|
{
|
||||||
GameObject go = CreateUIElementRoot("UI Flippable", menuCommand, s_ImageGUIElementSize);
|
GameObject go = CreateUIElementRoot("UI Flippable", menuCommand, s_ImageGUIElementSize);
|
||||||
|
@ -587,8 +590,10 @@ namespace UnityEditor.UI
|
||||||
go.AddComponent<UIFlippable>();
|
go.AddComponent<UIFlippable>();
|
||||||
Selection.activeGameObject = go;
|
Selection.activeGameObject = go;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Extensions/UI Window Base", false)]
|
#region UI WindowBase
|
||||||
|
[MenuItem("GameObject/UI/Extensions/UI Window Base", false)]
|
||||||
static public void AddUIWindowBase(MenuCommand menuCommand)
|
static public void AddUIWindowBase(MenuCommand menuCommand)
|
||||||
{
|
{
|
||||||
GameObject go = CreateUIElementRoot("UI Window Base", menuCommand, s_ThickGUIElementSize);
|
GameObject go = CreateUIElementRoot("UI Window Base", menuCommand, s_ThickGUIElementSize);
|
||||||
|
@ -596,9 +601,10 @@ namespace UnityEditor.UI
|
||||||
go.AddComponent<Image>();
|
go.AddComponent<Image>();
|
||||||
Selection.activeGameObject = go;
|
Selection.activeGameObject = go;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Accordian
|
#region Accordian
|
||||||
[MenuItem("GameObject/UI/Extensions/Accordion/Accordion Group", false)]
|
[MenuItem("GameObject/UI/Extensions/Accordion/Accordion Group", false)]
|
||||||
static public void AddAccordionGroup(MenuCommand menuCommand)
|
static public void AddAccordionGroup(MenuCommand menuCommand)
|
||||||
{
|
{
|
||||||
GameObject go = CreateUIElementRoot("Accordion Group", menuCommand, s_ThickGUIElementSize);
|
GameObject go = CreateUIElementRoot("Accordion Group", menuCommand, s_ThickGUIElementSize);
|
||||||
|
@ -1134,6 +1140,7 @@ namespace UnityEditor.UI
|
||||||
go.AddComponent<UIGridRenderer>();
|
go.AddComponent<UIGridRenderer>();
|
||||||
Selection.activeGameObject = go;
|
Selection.activeGameObject = go;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Re-Orderable Lists
|
#region Re-Orderable Lists
|
||||||
|
@ -1401,7 +1408,7 @@ namespace UnityEditor.UI
|
||||||
[MenuItem("GameObject/UI/Extensions/Re-orderable Lists/Re-orderable Vertical List", false)]
|
[MenuItem("GameObject/UI/Extensions/Re-orderable Lists/Re-orderable Vertical List", false)]
|
||||||
static public void AddReorderableVerticalList(MenuCommand menuCommand)
|
static public void AddReorderableVerticalList(MenuCommand menuCommand)
|
||||||
{
|
{
|
||||||
GameObject reorderableScrollRoot = CreateUIElementRoot("Re-orderable Vertial List", menuCommand, s_ThickGUIElementSize);
|
GameObject reorderableScrollRoot = CreateUIElementRoot("Re-orderable Vertical List", menuCommand, s_ThickGUIElementSize);
|
||||||
|
|
||||||
GameObject childContent = CreateUIObject("List_Content", reorderableScrollRoot);
|
GameObject childContent = CreateUIObject("List_Content", reorderableScrollRoot);
|
||||||
|
|
||||||
|
@ -1643,9 +1650,10 @@ namespace UnityEditor.UI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Extensions/UI Knob", false)]
|
#region UI Knob
|
||||||
|
[MenuItem("GameObject/UI/Extensions/UI Knob", false)]
|
||||||
static public void AddUIKnob(MenuCommand menuCommand)
|
static public void AddUIKnob(MenuCommand menuCommand)
|
||||||
{
|
{
|
||||||
GameObject go = CreateUIElementRoot("UI Knob", menuCommand, s_ImageGUIElementSize);
|
GameObject go = CreateUIElementRoot("UI Knob", menuCommand, s_ImageGUIElementSize);
|
||||||
|
@ -1653,14 +1661,17 @@ namespace UnityEditor.UI
|
||||||
go.AddComponent<UI_Knob>();
|
go.AddComponent<UI_Knob>();
|
||||||
Selection.activeGameObject = go;
|
Selection.activeGameObject = go;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
[MenuItem("GameObject/UI/Extensions/TextPic", false)]
|
|
||||||
|
#region TextPic
|
||||||
|
[MenuItem("GameObject/UI/Extensions/TextPic", false)]
|
||||||
static public void AddTextPic(MenuCommand menuCommand)
|
static public void AddTextPic(MenuCommand menuCommand)
|
||||||
{
|
{
|
||||||
GameObject go = CreateUIElementRoot("TextPic", menuCommand, s_ImageGUIElementSize);
|
GameObject go = CreateUIElementRoot("TextPic", menuCommand, s_ImageGUIElementSize);
|
||||||
go.AddComponent<TextPic>();
|
go.AddComponent<TextPic>();
|
||||||
Selection.activeGameObject = go;
|
Selection.activeGameObject = go;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region BoxSlider
|
#region BoxSlider
|
||||||
[MenuItem("GameObject/UI/Extensions/Box Slider", false)]
|
[MenuItem("GameObject/UI/Extensions/Box Slider", false)]
|
||||||
|
@ -1699,7 +1710,7 @@ namespace UnityEditor.UI
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Non Drawing Graphic options
|
#region Non Drawing Graphic options
|
||||||
[MenuItem("GameObject/UI/Extensions/NonDrawingGraphicClickable", false)]
|
[MenuItem("GameObject/UI/Extensions/NonDrawingGraphic", false)]
|
||||||
static public void AddNonDrawingGraphic(MenuCommand menuCommand)
|
static public void AddNonDrawingGraphic(MenuCommand menuCommand)
|
||||||
{
|
{
|
||||||
GameObject go = CreateUIElementRoot("NonDrawing Graphic", menuCommand, s_ImageGUIElementSize);
|
GameObject go = CreateUIElementRoot("NonDrawing Graphic", menuCommand, s_ImageGUIElementSize);
|
||||||
|
@ -1707,7 +1718,7 @@ namespace UnityEditor.UI
|
||||||
Selection.activeGameObject = go;
|
Selection.activeGameObject = go;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Extensions/NonDrawingGraphic", false)]
|
[MenuItem("GameObject/UI/Extensions/NonDrawingGraphicClickable", false)]
|
||||||
static public void AddClickableNonDrawingGraphic(MenuCommand menuCommand)
|
static public void AddClickableNonDrawingGraphic(MenuCommand menuCommand)
|
||||||
{
|
{
|
||||||
GameObject go = CreateUIElementRoot("NonDrawing Graphic-Clickable", menuCommand, s_ImageGUIElementSize);
|
GameObject go = CreateUIElementRoot("NonDrawing Graphic-Clickable", menuCommand, s_ImageGUIElementSize);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -133,20 +133,20 @@ namespace UnityEngine.UI.Extensions
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_rectTransform = GetComponent<RectTransform>();
|
_rectTransform = GetComponent<RectTransform>();
|
||||||
_inputRT = _rectTransform.FindChild("InputField").GetComponent<RectTransform>();
|
_inputRT = _rectTransform.Find("InputField").GetComponent<RectTransform>();
|
||||||
_mainInput = _inputRT.GetComponent<InputField>();
|
_mainInput = _inputRT.GetComponent<InputField>();
|
||||||
|
|
||||||
//_arrow_Button = _rectTransform.FindChild ("ArrowBtn").GetComponent<Button> ();
|
//_arrow_Button = _rectTransform.FindChild ("ArrowBtn").GetComponent<Button> ();
|
||||||
|
|
||||||
_overlayRT = _rectTransform.FindChild("Overlay").GetComponent<RectTransform>();
|
_overlayRT = _rectTransform.Find("Overlay").GetComponent<RectTransform>();
|
||||||
_overlayRT.gameObject.SetActive(false);
|
_overlayRT.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
|
||||||
_scrollPanelRT = _overlayRT.FindChild("ScrollPanel").GetComponent<RectTransform>();
|
_scrollPanelRT = _overlayRT.Find("ScrollPanel").GetComponent<RectTransform>();
|
||||||
_scrollBarRT = _scrollPanelRT.FindChild("Scrollbar").GetComponent<RectTransform>();
|
_scrollBarRT = _scrollPanelRT.Find("Scrollbar").GetComponent<RectTransform>();
|
||||||
_slidingAreaRT = _scrollBarRT.FindChild("SlidingArea").GetComponent<RectTransform>();
|
_slidingAreaRT = _scrollBarRT.Find("SlidingArea").GetComponent<RectTransform>();
|
||||||
// scrollHandleRT = slidingAreaRT.FindChild("Handle").GetComponent<RectTransform>();
|
// scrollHandleRT = slidingAreaRT.FindChild("Handle").GetComponent<RectTransform>();
|
||||||
_itemsPanelRT = _scrollPanelRT.FindChild("Items").GetComponent<RectTransform>();
|
_itemsPanelRT = _scrollPanelRT.Find("Items").GetComponent<RectTransform>();
|
||||||
//itemPanelLayout = itemsPanelRT.gameObject.GetComponent<LayoutGroup>();
|
//itemPanelLayout = itemsPanelRT.gameObject.GetComponent<LayoutGroup>();
|
||||||
|
|
||||||
_canvas = GetComponentInParent<Canvas>();
|
_canvas = GetComponentInParent<Canvas>();
|
||||||
|
@ -157,7 +157,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
_scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
_scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
||||||
_scrollRect.content = _itemsPanelRT;
|
_scrollRect.content = _itemsPanelRT;
|
||||||
|
|
||||||
itemTemplate = _rectTransform.FindChild("ItemTemplate").gameObject;
|
itemTemplate = _rectTransform.Find("ItemTemplate").gameObject;
|
||||||
itemTemplate.SetActive(false);
|
itemTemplate.SetActive(false);
|
||||||
}
|
}
|
||||||
catch (System.NullReferenceException ex)
|
catch (System.NullReferenceException ex)
|
||||||
|
@ -238,7 +238,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
if (i < AvailableOptions.Count)
|
if (i < AvailableOptions.Count)
|
||||||
{
|
{
|
||||||
itemObjs[i].name = "Item " + i + " " + _panelItems[i];
|
itemObjs[i].name = "Item " + i + " " + _panelItems[i];
|
||||||
itemObjs[i].transform.FindChild("Text").GetComponent<Text>().text = _panelItems[i]; //set the text value
|
itemObjs[i].transform.Find("Text").GetComponent<Text>().text = _panelItems[i]; //set the text value
|
||||||
|
|
||||||
Button itemBtn = itemObjs[i].GetComponent<Button>();
|
Button itemBtn = itemObjs[i].GetComponent<Button>();
|
||||||
itemBtn.onClick.RemoveAllListeners();
|
itemBtn.onClick.RemoveAllListeners();
|
||||||
|
|
|
@ -91,18 +91,18 @@ namespace UnityEngine.UI.Extensions
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_rectTransform = GetComponent<RectTransform>();
|
_rectTransform = GetComponent<RectTransform>();
|
||||||
_inputRT = _rectTransform.FindChild("InputField").GetComponent<RectTransform>();
|
_inputRT = _rectTransform.Find("InputField").GetComponent<RectTransform>();
|
||||||
_mainInput = _inputRT.GetComponent<InputField>();
|
_mainInput = _inputRT.GetComponent<InputField>();
|
||||||
|
|
||||||
_overlayRT = _rectTransform.FindChild("Overlay").GetComponent<RectTransform>();
|
_overlayRT = _rectTransform.Find("Overlay").GetComponent<RectTransform>();
|
||||||
_overlayRT.gameObject.SetActive(false);
|
_overlayRT.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
|
||||||
_scrollPanelRT = _overlayRT.FindChild("ScrollPanel").GetComponent<RectTransform>();
|
_scrollPanelRT = _overlayRT.Find("ScrollPanel").GetComponent<RectTransform>();
|
||||||
_scrollBarRT = _scrollPanelRT.FindChild("Scrollbar").GetComponent<RectTransform>();
|
_scrollBarRT = _scrollPanelRT.Find("Scrollbar").GetComponent<RectTransform>();
|
||||||
_slidingAreaRT = _scrollBarRT.FindChild("SlidingArea").GetComponent<RectTransform>();
|
_slidingAreaRT = _scrollBarRT.Find("SlidingArea").GetComponent<RectTransform>();
|
||||||
// scrollHandleRT = slidingAreaRT.FindChild("Handle").GetComponent<RectTransform>();
|
// scrollHandleRT = slidingAreaRT.FindChild("Handle").GetComponent<RectTransform>();
|
||||||
_itemsPanelRT = _scrollPanelRT.FindChild("Items").GetComponent<RectTransform>();
|
_itemsPanelRT = _scrollPanelRT.Find("Items").GetComponent<RectTransform>();
|
||||||
//itemPanelLayout = itemsPanelRT.gameObject.GetComponent<LayoutGroup>();
|
//itemPanelLayout = itemsPanelRT.gameObject.GetComponent<LayoutGroup>();
|
||||||
|
|
||||||
_canvas = GetComponentInParent<Canvas>();
|
_canvas = GetComponentInParent<Canvas>();
|
||||||
|
@ -113,7 +113,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
_scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
_scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
||||||
_scrollRect.content = _itemsPanelRT;
|
_scrollRect.content = _itemsPanelRT;
|
||||||
|
|
||||||
itemTemplate = _rectTransform.FindChild("ItemTemplate").gameObject;
|
itemTemplate = _rectTransform.Find("ItemTemplate").gameObject;
|
||||||
itemTemplate.SetActive(false);
|
itemTemplate.SetActive(false);
|
||||||
}
|
}
|
||||||
catch (System.NullReferenceException ex)
|
catch (System.NullReferenceException ex)
|
||||||
|
@ -192,7 +192,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
if (i < AvailableOptions.Count)
|
if (i < AvailableOptions.Count)
|
||||||
{
|
{
|
||||||
itemObjs[i].name = "Item " + i + " " + _panelItems[i];
|
itemObjs[i].name = "Item " + i + " " + _panelItems[i];
|
||||||
itemObjs[i].transform.FindChild("Text").GetComponent<Text>().text = _panelItems[i]; //set the text value
|
itemObjs[i].transform.Find("Text").GetComponent<Text>().text = _panelItems[i]; //set the text value
|
||||||
|
|
||||||
Button itemBtn = itemObjs[i].GetComponent<Button>();
|
Button itemBtn = itemObjs[i].GetComponent<Button>();
|
||||||
itemBtn.onClick.RemoveAllListeners();
|
itemBtn.onClick.RemoveAllListeners();
|
||||||
|
|
|
@ -94,17 +94,17 @@ namespace UnityEngine.UI.Extensions
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_rectTransform = GetComponent<RectTransform>();
|
_rectTransform = GetComponent<RectTransform>();
|
||||||
_mainButton = new DropDownListButton(_rectTransform.FindChild("MainButton").gameObject);
|
_mainButton = new DropDownListButton(_rectTransform.Find("MainButton").gameObject);
|
||||||
|
|
||||||
_overlayRT = _rectTransform.FindChild("Overlay").GetComponent<RectTransform>();
|
_overlayRT = _rectTransform.Find("Overlay").GetComponent<RectTransform>();
|
||||||
_overlayRT.gameObject.SetActive(false);
|
_overlayRT.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
|
||||||
_scrollPanelRT = _overlayRT.FindChild("ScrollPanel").GetComponent<RectTransform>();
|
_scrollPanelRT = _overlayRT.Find("ScrollPanel").GetComponent<RectTransform>();
|
||||||
_scrollBarRT = _scrollPanelRT.FindChild("Scrollbar").GetComponent<RectTransform>();
|
_scrollBarRT = _scrollPanelRT.Find("Scrollbar").GetComponent<RectTransform>();
|
||||||
_slidingAreaRT = _scrollBarRT.FindChild("SlidingArea").GetComponent<RectTransform>();
|
_slidingAreaRT = _scrollBarRT.Find("SlidingArea").GetComponent<RectTransform>();
|
||||||
// scrollHandleRT = slidingAreaRT.FindChild("Handle").GetComponent<RectTransform>();
|
// scrollHandleRT = slidingAreaRT.FindChild("Handle").GetComponent<RectTransform>();
|
||||||
_itemsPanelRT = _scrollPanelRT.FindChild("Items").GetComponent<RectTransform>();
|
_itemsPanelRT = _scrollPanelRT.Find("Items").GetComponent<RectTransform>();
|
||||||
//itemPanelLayout = itemsPanelRT.gameObject.GetComponent<LayoutGroup>();
|
//itemPanelLayout = itemsPanelRT.gameObject.GetComponent<LayoutGroup>();
|
||||||
|
|
||||||
_canvas = GetComponentInParent<Canvas>();
|
_canvas = GetComponentInParent<Canvas>();
|
||||||
|
@ -116,7 +116,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
_scrollRect.content = _itemsPanelRT;
|
_scrollRect.content = _itemsPanelRT;
|
||||||
|
|
||||||
|
|
||||||
_itemTemplate = _rectTransform.FindChild("ItemTemplate").gameObject;
|
_itemTemplate = _rectTransform.Find("ItemTemplate").gameObject;
|
||||||
_itemTemplate.SetActive(false);
|
_itemTemplate.SetActive(false);
|
||||||
}
|
}
|
||||||
catch (System.NullReferenceException ex)
|
catch (System.NullReferenceException ex)
|
||||||
|
|
|
@ -19,8 +19,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
rectTransform = btnObj.GetComponent<RectTransform>();
|
rectTransform = btnObj.GetComponent<RectTransform>();
|
||||||
btnImg = btnObj.GetComponent<Image>();
|
btnImg = btnObj.GetComponent<Image>();
|
||||||
btn = btnObj.GetComponent<Button>();
|
btn = btnObj.GetComponent<Button>();
|
||||||
txt = rectTransform.FindChild("Text").GetComponent<Text>();
|
txt = rectTransform.Find("Text").GetComponent<Text>();
|
||||||
img = rectTransform.FindChild("Image").GetComponent<Image>();
|
img = rectTransform.Find("Image").GetComponent<Image>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -84,10 +84,6 @@ namespace UnityEngine.UI.Extensions
|
||||||
Debug.LogError("You need to have a Graphic control (such as an Image) for the list [" + name + "] to be droppable", gameObject);
|
Debug.LogError("You need to have a Graphic control (such as an Image) for the list [" + name + "] to be droppable", gameObject);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GetCanvas().renderMode > RenderMode.ScreenSpaceCamera)
|
|
||||||
{
|
|
||||||
Debug.LogError("The ReOrderable List is only supported on a Screen-Space Canvas at the moment");
|
|
||||||
}
|
|
||||||
|
|
||||||
_listContent = ContentLayout.gameObject.AddComponent<ReorderableListContent>();
|
_listContent = ContentLayout.gameObject.AddComponent<ReorderableListContent>();
|
||||||
_listContent.Init(this);
|
_listContent.Init(this);
|
||||||
|
|
|
@ -78,10 +78,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
_draggingObject = clone.GetComponent<RectTransform>();
|
_draggingObject = clone.GetComponent<RectTransform>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Put _dragging object into the draggin area
|
//Put _dragging object into the dragging area
|
||||||
_draggingObjectOriginalSize = gameObject.GetComponent<RectTransform>().rect.size;
|
_draggingObjectOriginalSize = gameObject.GetComponent<RectTransform>().rect.size;
|
||||||
_draggingObjectLE = _draggingObject.GetComponent<LayoutElement>();
|
_draggingObjectLE = _draggingObject.GetComponent<LayoutElement>();
|
||||||
_draggingObject.SetParent(_reorderableList.DraggableArea, false);
|
_draggingObject.SetParent(_reorderableList.DraggableArea, true);
|
||||||
_draggingObject.SetAsLastSibling();
|
_draggingObject.SetAsLastSibling();
|
||||||
|
|
||||||
//Create a fake element for previewing placement
|
//Create a fake element for previewing placement
|
||||||
|
@ -222,6 +222,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
RefreshSizes();
|
RefreshSizes();
|
||||||
_draggingObject.SetParent(_currentReorderableListRaycasted.Content, false);
|
_draggingObject.SetParent(_currentReorderableListRaycasted.Content, false);
|
||||||
|
_draggingObject.rotation = _currentReorderableListRaycasted.transform.rotation;
|
||||||
_draggingObject.SetSiblingIndex(_fakeElement.GetSiblingIndex());
|
_draggingObject.SetSiblingIndex(_fakeElement.GetSiblingIndex());
|
||||||
|
|
||||||
_reorderableList.OnElementAdded.Invoke(args);
|
_reorderableList.OnElementAdded.Invoke(args);
|
||||||
|
@ -271,6 +272,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
RefreshSizes();
|
RefreshSizes();
|
||||||
_draggingObject.SetParent(_reorderableList.Content, false);
|
_draggingObject.SetParent(_reorderableList.Content, false);
|
||||||
|
_draggingObject.rotation = _reorderableList.Content.transform.rotation;
|
||||||
_draggingObject.SetSiblingIndex(_fromIndex);
|
_draggingObject.SetSiblingIndex(_fromIndex);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,44 +8,44 @@ namespace UnityEngine.UI.Extensions
|
||||||
public class UIGridRenderer : UILineRenderer
|
public class UIGridRenderer : UILineRenderer
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int m_gridWidth = 10;
|
private int m_GridColumns = 10;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int m_gridHeight = 10;
|
private int m_GridRows = 10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Width of the grid in Cells.
|
/// Number of columns in the Grid
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int GridWidth
|
public int GridColumns
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_gridWidth;
|
return m_GridColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_gridWidth == value)
|
if (m_GridColumns == value)
|
||||||
return;
|
return;
|
||||||
m_gridWidth = value;
|
m_GridColumns = value;
|
||||||
SetAllDirty();
|
SetAllDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Height of the Grid in cells.
|
/// Number of rows in the grid.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int GridHeight
|
public int GridRows
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_gridHeight;
|
return m_GridRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (m_gridHeight == value)
|
if (m_GridRows == value)
|
||||||
return;
|
return;
|
||||||
m_gridHeight = value;
|
m_GridRows = value;
|
||||||
SetAllDirty();
|
SetAllDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,16 +54,16 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
relativeSize = true;
|
relativeSize = true;
|
||||||
|
|
||||||
int ArraySize = (GridHeight * 3) + 1;
|
int ArraySize = (GridRows * 3) + 1;
|
||||||
if(GridHeight % 2 == 0)
|
if(GridRows % 2 == 0)
|
||||||
++ArraySize; // needs one more line
|
++ArraySize; // needs one more line
|
||||||
|
|
||||||
ArraySize += (GridWidth * 3) + 1;
|
ArraySize += (GridColumns * 3) + 1;
|
||||||
|
|
||||||
m_points = new Vector2[ArraySize];
|
m_points = new Vector2[ArraySize];
|
||||||
|
|
||||||
int Index = 0;
|
int Index = 0;
|
||||||
for(int i = 0; i < GridHeight; ++i)
|
for(int i = 0; i < GridRows; ++i)
|
||||||
{
|
{
|
||||||
float xFrom = 1;
|
float xFrom = 1;
|
||||||
float xTo = 0;
|
float xTo = 0;
|
||||||
|
@ -74,7 +74,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
xTo = 1;
|
xTo = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
float y = ((float)i) / GridHeight;
|
float y = ((float)i) / GridRows;
|
||||||
m_points[Index].x = xFrom;
|
m_points[Index].x = xFrom;
|
||||||
m_points[Index].y = y;
|
m_points[Index].y = y;
|
||||||
++Index;
|
++Index;
|
||||||
|
@ -82,11 +82,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
m_points[Index].y = y;
|
m_points[Index].y = y;
|
||||||
++Index;
|
++Index;
|
||||||
m_points[Index].x = xTo;
|
m_points[Index].x = xTo;
|
||||||
m_points[Index].y = (float)(i + 1) / GridHeight;
|
m_points[Index].y = (float)(i + 1) / GridRows;
|
||||||
++Index;
|
++Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GridHeight % 2 == 0)
|
if(GridRows % 2 == 0)
|
||||||
{
|
{
|
||||||
// two lines to get to 0, 1
|
// two lines to get to 0, 1
|
||||||
m_points[Index].x = 1;
|
m_points[Index].x = 1;
|
||||||
|
@ -99,7 +99,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
++Index;
|
++Index;
|
||||||
|
|
||||||
// line is now at 0,1, so we can draw the columns
|
// line is now at 0,1, so we can draw the columns
|
||||||
for(int i = 0; i < GridWidth; ++i)
|
for(int i = 0; i < GridColumns; ++i)
|
||||||
{
|
{
|
||||||
float yFrom = 1;
|
float yFrom = 1;
|
||||||
float yTo = 0;
|
float yTo = 0;
|
||||||
|
@ -110,19 +110,19 @@ namespace UnityEngine.UI.Extensions
|
||||||
yTo = 1;
|
yTo = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
float x = ((float)i) / GridWidth;
|
float x = ((float)i) / GridColumns;
|
||||||
m_points[Index].x = x;
|
m_points[Index].x = x;
|
||||||
m_points[Index].y = yFrom;
|
m_points[Index].y = yFrom;
|
||||||
++Index;
|
++Index;
|
||||||
m_points[Index].x = x;
|
m_points[Index].x = x;
|
||||||
m_points[Index].y = yTo;
|
m_points[Index].y = yTo;
|
||||||
++Index;
|
++Index;
|
||||||
m_points[Index].x = (float)(i + 1) / GridWidth;
|
m_points[Index].x = (float)(i + 1) / GridColumns;
|
||||||
m_points[Index].y = yTo;
|
m_points[Index].y = yTo;
|
||||||
++Index;
|
++Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GridWidth % 2 == 0)
|
if(GridColumns % 2 == 0)
|
||||||
{
|
{
|
||||||
// one more line to get to 1, 1
|
// one more line to get to 1, 1
|
||||||
m_points[Index].x = 1;
|
m_points[Index].x = 1;
|
||||||
|
|
Loading…
Reference in New Issue