From 9bda0ba1a4c7d26bd876e090f876370200e8b76c Mon Sep 17 00:00:00 2001 From: Vicente Russo Date: Sat, 19 Sep 2015 02:15:31 -0300 Subject: [PATCH 1/4] Fix vertical alignment of last item --- Scripts/FlowLayoutGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/FlowLayoutGroup.cs b/Scripts/FlowLayoutGroup.cs index e66405b..49f6a3f 100644 --- a/Scripts/FlowLayoutGroup.cs +++ b/Scripts/FlowLayoutGroup.cs @@ -158,7 +158,7 @@ namespace UnityEngine.UI.Extensions if (!layoutInput) { var h = CalculateRowVerticalOffset(groupHeight, yOffset, currentRowHeight); - + currentRowWidth -= Spacing; // Layout the final row LayoutRow(_rowList, currentRowWidth, currentRowHeight, workingWidth, padding.left, h, axis); } From cdde18f8d08c33dcd4f34525a6a858249e00f8d4 Mon Sep 17 00:00:00 2001 From: Vicente Russo Date: Sat, 19 Sep 2015 02:43:45 -0300 Subject: [PATCH 2/4] A minimalist working alternative for the ReturnKeyTriggersButton component --- Scripts/InputFieldEnterSubmit.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Scripts/InputFieldEnterSubmit.cs diff --git a/Scripts/InputFieldEnterSubmit.cs b/Scripts/InputFieldEnterSubmit.cs new file mode 100644 index 0000000..a1d6873 --- /dev/null +++ b/Scripts/InputFieldEnterSubmit.cs @@ -0,0 +1,30 @@ +/// Usage: Add this component to the input and add the +/// function to execute to the EnterSubmit event of this script + +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.Events; + +[RequireComponent(typeof(InputField))] +public class InputFieldEnterSubmit : MonoBehaviour +{ + + [System.Serializable] + public class EnterSubmitEvent : UnityEvent { } + + public EnterSubmitEvent EnterSubmit; + private InputField _input; + + void Awake() + { + _input = GetComponent(); + _input.onEndEdit.AddListener(OnEndEdit); + } + + public void OnEndEdit(string txt) + { + if (!Input.GetKeyDown(KeyCode.Return) && !Input.GetKeyDown(KeyCode.KeypadEnter)) return; + EnterSubmit.Invoke(txt); + } + +} From 64067d97b431ddc87fd70c94974fc13fc035b187 Mon Sep 17 00:00:00 2001 From: "Simon (darkside) Jackson" Date: Sun, 20 Sep 2015 00:24:17 +0100 Subject: [PATCH 3/4] Slight reorg and addition of the following components: * Radial layout * Tile Size Fitter * UI Circle Primative * Switch to RectTransform * Input Field Enter Submit (alt to ReturnKeyTrigger) --- Scripts/Editor/UIExtensionsMenuOptions.cs | 12 +- Scripts/InputFieldEnterSubmit.cs | 13 +- Scripts/InputFieldEnterSubmit.cs.meta | 8 + Scripts/Layout.meta | 5 + Scripts/{ => Layout}/FlowLayoutGroup.cs | 161 ++++++++++-------- Scripts/{ => Layout}/FlowLayoutGroup.cs.meta | 0 Scripts/{ => Layout}/HorizontalScrollSnap.cs | 2 +- .../{ => Layout}/HorizontalScrollSnap.cs.meta | 0 Scripts/Layout/RadialLayout.cs | 81 +++++++++ Scripts/Layout/RadialLayout.cs.meta | 8 + Scripts/Layout/TileSizeFitter.cs | 104 +++++++++++ Scripts/Layout/TileSizeFitter.cs.meta | 8 + Scripts/{ => Layout}/VerticalScrollSnap.cs | 2 +- .../{ => Layout}/VerticalScrollSnap.cs.meta | 0 Scripts/Primatives.meta | 5 + Scripts/Primatives/UICircle.cs | 121 +++++++++++++ Scripts/Primatives/UICircle.cs.meta | 8 + Scripts/{ => Primatives}/UILineRenderer.cs | 2 +- .../{ => Primatives}/UILineRenderer.cs.meta | 0 .../{ => Primatives}/UILineTextureRenderer.cs | 2 +- .../UILineTextureRenderer.cs.meta | 0 Scripts/Utilities.meta | 5 + Scripts/{ => Utilities}/SetPropertyUtility.cs | 0 .../SetPropertyUtility.cs.meta | 0 Scripts/Utilities/switchToRectTransform.cs | 24 +++ .../Utilities/switchToRectTransform.cs.meta | 8 + package.json | 23 +++ package.json.meta | 4 + 28 files changed, 526 insertions(+), 80 deletions(-) create mode 100644 Scripts/InputFieldEnterSubmit.cs.meta create mode 100644 Scripts/Layout.meta rename Scripts/{ => Layout}/FlowLayoutGroup.cs (77%) rename Scripts/{ => Layout}/FlowLayoutGroup.cs.meta (100%) rename Scripts/{ => Layout}/HorizontalScrollSnap.cs (96%) rename Scripts/{ => Layout}/HorizontalScrollSnap.cs.meta (100%) create mode 100644 Scripts/Layout/RadialLayout.cs create mode 100644 Scripts/Layout/RadialLayout.cs.meta create mode 100644 Scripts/Layout/TileSizeFitter.cs create mode 100644 Scripts/Layout/TileSizeFitter.cs.meta rename Scripts/{ => Layout}/VerticalScrollSnap.cs (96%) rename Scripts/{ => Layout}/VerticalScrollSnap.cs.meta (100%) create mode 100644 Scripts/Primatives.meta create mode 100644 Scripts/Primatives/UICircle.cs create mode 100644 Scripts/Primatives/UICircle.cs.meta rename Scripts/{ => Primatives}/UILineRenderer.cs (96%) rename Scripts/{ => Primatives}/UILineRenderer.cs.meta (100%) rename Scripts/{ => Primatives}/UILineTextureRenderer.cs (96%) rename Scripts/{ => Primatives}/UILineTextureRenderer.cs.meta (100%) create mode 100644 Scripts/Utilities.meta rename Scripts/{ => Utilities}/SetPropertyUtility.cs (100%) rename Scripts/{ => Utilities}/SetPropertyUtility.cs.meta (100%) create mode 100644 Scripts/Utilities/switchToRectTransform.cs create mode 100644 Scripts/Utilities/switchToRectTransform.cs.meta create mode 100644 package.json create mode 100644 package.json.meta diff --git a/Scripts/Editor/UIExtensionsMenuOptions.cs b/Scripts/Editor/UIExtensionsMenuOptions.cs index 79e1197..03d4d70 100644 --- a/Scripts/Editor/UIExtensionsMenuOptions.cs +++ b/Scripts/Editor/UIExtensionsMenuOptions.cs @@ -866,7 +866,7 @@ namespace UnityEditor.UI SetDefaultColorTransitionValues(slider); } - [MenuItem("GameObject/UI/Extensions/UI Line Renderer", false)] + [MenuItem("GameObject/UI/Extensions/Primatives/UI Line Renderer", false)] static public void AddUILineRenderer(MenuCommand menuCommand) { GameObject go = CreateUIElementRoot("UI LineRenderer", menuCommand, s_ImageGUIElementSize); @@ -874,13 +874,21 @@ namespace UnityEditor.UI Selection.activeGameObject = go; } - [MenuItem("GameObject/UI/Extensions/UI Line Texture Renderer", false)] + [MenuItem("GameObject/UI/Extensions/Primatives/UI Line Texture Renderer", false)] static public void AddUILineTextureRenderer(MenuCommand menuCommand) { GameObject go = CreateUIElementRoot("UI LineTextureRenderer", menuCommand, s_ImageGUIElementSize); go.AddComponent(); Selection.activeGameObject = go; } + + [MenuItem("GameObject/UI/Extensions/Primatives/UI Circle", false)] + static public void AddUICircle(MenuCommand menuCommand) + { + GameObject go = CreateUIElementRoot("UI Circle", menuCommand, s_ImageGUIElementSize); + go.AddComponent(); + Selection.activeGameObject = go; + } #endregion diff --git a/Scripts/InputFieldEnterSubmit.cs b/Scripts/InputFieldEnterSubmit.cs index a1d6873..56e9a55 100644 --- a/Scripts/InputFieldEnterSubmit.cs +++ b/Scripts/InputFieldEnterSubmit.cs @@ -1,11 +1,15 @@ -/// Usage: Add this component to the input and add the -/// function to execute to the EnterSubmit event of this script +/// Credit Vicente Russo +/// Sourced from - https://bitbucket.org/ddreaper/unity-ui-extensions/issues/23/returnkeytriggersbutton -using UnityEngine; -using UnityEngine.UI; using UnityEngine.Events; +namespace UnityEngine.UI.Extensions +{ +/// +/// Usage: Add this component to the input and add the function to execute to the EnterSubmit event of this script +/// [RequireComponent(typeof(InputField))] +[AddComponentMenu("UI/Extensions/Input Field Submit")] public class InputFieldEnterSubmit : MonoBehaviour { @@ -28,3 +32,4 @@ public class InputFieldEnterSubmit : MonoBehaviour } } +} diff --git a/Scripts/InputFieldEnterSubmit.cs.meta b/Scripts/InputFieldEnterSubmit.cs.meta new file mode 100644 index 0000000..f8e8522 --- /dev/null +++ b/Scripts/InputFieldEnterSubmit.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bfc77d7b04a86f845b59fb0979e8ec53 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Scripts/Layout.meta b/Scripts/Layout.meta new file mode 100644 index 0000000..0f460bb --- /dev/null +++ b/Scripts/Layout.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 759c961dc0e85a348ab9cd1278319ca0 +folderAsset: yes +DefaultImporter: + userData: diff --git a/Scripts/FlowLayoutGroup.cs b/Scripts/Layout/FlowLayoutGroup.cs similarity index 77% rename from Scripts/FlowLayoutGroup.cs rename to Scripts/Layout/FlowLayoutGroup.cs index 49f6a3f..3d4c050 100644 --- a/Scripts/FlowLayoutGroup.cs +++ b/Scripts/Layout/FlowLayoutGroup.cs @@ -1,7 +1,8 @@ /// Credit Simie /// Sourced from - http://forum.unity3d.com/threads/flowlayoutgroup.296709/ /// Example http://forum.unity3d.com/threads/flowlayoutgroup.296709/ - +/// Update by Martin Sharkbomb - http://forum.unity3d.com/threads/flowlayoutgroup.296709/#post-1977028 +/// Last item alignment fix by Vicente Russo - https://bitbucket.org/ddreaper/unity-ui-extensions/issues/22/flow-layout-group-align using System.Collections.Generic; @@ -13,80 +14,82 @@ namespace UnityEngine.UI.Extensions [AddComponentMenu("Layout/Extensions/Flow Layout Group")] public class FlowLayoutGroup : LayoutGroup { - public float Spacing = 0f; - + public float SpacingX = 0f; + public float SpacingY = 0f; + public bool ExpandHorizontalSpacing = false; + public bool ChildForceExpandWidth = false; public bool ChildForceExpandHeight = false; - + private float _layoutHeight; - + public override void CalculateLayoutInputHorizontal() { - + base.CalculateLayoutInputHorizontal(); - + var minWidth = GetGreatestMinimumChildWidth() + padding.left + padding.right; - + SetLayoutInputForAxis(minWidth, -1, -1, 0); - + } - + public override void SetLayoutHorizontal() { SetLayout(rectTransform.rect.width, 0, false); } - + public override void SetLayoutVertical() { SetLayout(rectTransform.rect.width, 1, false); } - + public override void CalculateLayoutInputVertical() { _layoutHeight = SetLayout(rectTransform.rect.width, 1, true); } - + protected bool IsCenterAlign { get { return childAlignment == TextAnchor.LowerCenter || childAlignment == TextAnchor.MiddleCenter || - childAlignment == TextAnchor.UpperCenter; + childAlignment == TextAnchor.UpperCenter; } } - + protected bool IsRightAlign { get { return childAlignment == TextAnchor.LowerRight || childAlignment == TextAnchor.MiddleRight || - childAlignment == TextAnchor.UpperRight; + childAlignment == TextAnchor.UpperRight; } } - + protected bool IsMiddleAlign { get { return childAlignment == TextAnchor.MiddleLeft || childAlignment == TextAnchor.MiddleRight || - childAlignment == TextAnchor.MiddleCenter; + childAlignment == TextAnchor.MiddleCenter; } } - + protected bool IsLowerAlign { get { return childAlignment == TextAnchor.LowerLeft || childAlignment == TextAnchor.LowerRight || - childAlignment == TextAnchor.LowerCenter; + childAlignment == TextAnchor.LowerCenter; } } - + /// /// Holds the rects that will make up the current row being processed /// private readonly IList _rowList = new List(); - + /// /// Main layout method /// @@ -96,93 +99,95 @@ namespace UnityEngine.UI.Extensions public float SetLayout(float width, int axis, bool layoutInput) { var groupHeight = rectTransform.rect.height; - + // Width that is available after padding is subtracted var workingWidth = rectTransform.rect.width - padding.left - padding.right; - + // Accumulates the total height of the rows, including spacing and padding. var yOffset = IsLowerAlign ? (float)padding.bottom : (float)padding.top; - + var currentRowWidth = 0f; var currentRowHeight = 0f; - + for (var i = 0; i < rectChildren.Count; i++) { - + // LowerAlign works from back to front var index = IsLowerAlign ? rectChildren.Count - 1 - i : i; - + var child = rectChildren[index]; - + var childWidth = LayoutUtility.GetPreferredSize(child, 0); var childHeight = LayoutUtility.GetPreferredSize(child, 1); - - // Max child width is layout group with - padding + + // Max child width is layout group width - padding childWidth = Mathf.Min(childWidth, workingWidth); - + // If adding this element would exceed the bounds of the row, // go to a new line after processing the current row if (currentRowWidth + childWidth > workingWidth) { - - currentRowWidth -= Spacing; - + + currentRowWidth -= SpacingX; + // Process current row elements positioning if (!layoutInput) { - + var h = CalculateRowVerticalOffset(groupHeight, yOffset, currentRowHeight); LayoutRow(_rowList, currentRowWidth, currentRowHeight, workingWidth, padding.left, h, axis); - + } - + // Clear existing row _rowList.Clear(); - + // Add the current row height to total height accumulator, and reset to 0 for the next row yOffset += currentRowHeight; - yOffset += Spacing; - + yOffset += SpacingY; + currentRowHeight = 0; currentRowWidth = 0; - + } - + currentRowWidth += childWidth; _rowList.Add(child); - + // We need the largest element height to determine the starting position of the next line if (childHeight > currentRowHeight) { currentRowHeight = childHeight; } - currentRowWidth += Spacing; + // Don't do this for the last one + if (i < rectChildren.Count - 1 ) + currentRowWidth += SpacingX; } - + if (!layoutInput) { var h = CalculateRowVerticalOffset(groupHeight, yOffset, currentRowHeight); - currentRowWidth -= Spacing; + currentRowWidth -= SpacingX; // Layout the final row LayoutRow(_rowList, currentRowWidth, currentRowHeight, workingWidth, padding.left, h, axis); } - + _rowList.Clear(); - + // Add the last rows height to the height accumulator yOffset += currentRowHeight; yOffset += IsLowerAlign ? padding.top : padding.bottom; - + if (layoutInput) { - + if(axis == 1) SetLayoutInputForAxis(yOffset, yOffset, -1, axis); - + } - + return yOffset; } - + private float CalculateRowVerticalOffset(float groupHeight, float yOffset, float currentRowHeight) { float h; - + if (IsLowerAlign) { h = groupHeight - yOffset - currentRowHeight; } else if (IsMiddleAlign) { @@ -192,36 +197,46 @@ namespace UnityEngine.UI.Extensions } return h; } - + protected void LayoutRow(IList contents, float rowWidth, float rowHeight, float maxWidth, float xOffset, float yOffset, int axis) { var xPos = xOffset; - + if (!ChildForceExpandWidth && IsCenterAlign) xPos += (maxWidth - rowWidth) * 0.5f; else if (!ChildForceExpandWidth && IsRightAlign) xPos += (maxWidth - rowWidth); - + var extraWidth = 0f; + var extraSpacing = 0f; if (ChildForceExpandWidth) { extraWidth = (maxWidth - rowWidth)/_rowList.Count; } - + else if (ExpandHorizontalSpacing) { + extraSpacing = (maxWidth - rowWidth)/(_rowList.Count - 1); + if (_rowList.Count > 1) { + if (IsCenterAlign) + xPos -= extraSpacing * 0.5f * (_rowList.Count - 1); + else if (IsRightAlign) + xPos -= extraSpacing * (_rowList.Count - 1); + } + } + for (var j = 0; j < _rowList.Count; j++) { - + var index = IsLowerAlign ? _rowList.Count - 1 - j : j; - + var rowChild = _rowList[index]; - + var rowChildWidth = LayoutUtility.GetPreferredSize(rowChild, 0) + extraWidth; var rowChildHeight = LayoutUtility.GetPreferredSize(rowChild, 1); - + if (ChildForceExpandHeight) rowChildHeight = rowHeight; - + rowChildWidth = Mathf.Min(rowChildWidth, maxWidth); - + var yPos = yOffset; if (IsMiddleAlign) @@ -229,25 +244,31 @@ namespace UnityEngine.UI.Extensions else if (IsLowerAlign) yPos += (rowHeight - rowChildHeight); + // + if (ExpandHorizontalSpacing && j > 0) + xPos += extraSpacing; + if (axis == 0) SetChildAlongAxis(rowChild, 0, xPos, rowChildWidth); else SetChildAlongAxis(rowChild, 1, yPos, rowChildHeight); - xPos += rowChildWidth + Spacing; + // Don't do horizontal spacing for the last one + if (j < _rowList.Count - 1 ) + xPos += rowChildWidth + SpacingX; } } - + public float GetGreatestMinimumChildWidth() { var max = 0f; - + for (var i = 0; i < rectChildren.Count; i++) { var w = LayoutUtility.GetMinWidth(rectChildren[i]); - + max = Mathf.Max(w, max); } - + return max; } } diff --git a/Scripts/FlowLayoutGroup.cs.meta b/Scripts/Layout/FlowLayoutGroup.cs.meta similarity index 100% rename from Scripts/FlowLayoutGroup.cs.meta rename to Scripts/Layout/FlowLayoutGroup.cs.meta diff --git a/Scripts/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs similarity index 96% rename from Scripts/HorizontalScrollSnap.cs rename to Scripts/Layout/HorizontalScrollSnap.cs index aafef0a..d2e6f2a 100644 --- a/Scripts/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -8,7 +8,7 @@ using UnityEngine.EventSystems; namespace UnityEngine.UI.Extensions { [RequireComponent(typeof(ScrollRect))] - [AddComponentMenu("UI/Extensions/Horizontal Scroll Snap")] + [AddComponentMenu("Layout/Extensions/Horizontal Scroll Snap")] public class HorizontalScrollSnap : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler { private Transform _screensContainer; diff --git a/Scripts/HorizontalScrollSnap.cs.meta b/Scripts/Layout/HorizontalScrollSnap.cs.meta similarity index 100% rename from Scripts/HorizontalScrollSnap.cs.meta rename to Scripts/Layout/HorizontalScrollSnap.cs.meta diff --git a/Scripts/Layout/RadialLayout.cs b/Scripts/Layout/RadialLayout.cs new file mode 100644 index 0000000..9982877 --- /dev/null +++ b/Scripts/Layout/RadialLayout.cs @@ -0,0 +1,81 @@ + +/// Credit ?? +/// Sourced from - http://www.justapixel.co.uk/radial-layouts-nice-and-simple-in-unity3ds-ui-system/ +/// Updated by ddreaper - removed dependency on a custom ScrollRect script. Now implements drag interfaces and standard Scroll Rect. + +/* +Radial Layout Group by Just a Pixel (Danny Goodayle) - http://www.justapixel.co.uk +Copyright (c) 2015 +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +namespace UnityEngine.UI.Extensions +{ +[AddComponentMenu("Layout/Extensions/Radial Layout")] +public class RadialLayout : LayoutGroup { + public float fDistance; + [Range(0f,360f)] + public float MinAngle, MaxAngle, StartAngle; + protected override void OnEnable() { base.OnEnable(); CalculateRadial(); } + public override void SetLayoutHorizontal() + { + } + public override void SetLayoutVertical() + { + } + public override void CalculateLayoutInputVertical() + { + CalculateRadial(); + } + public override void CalculateLayoutInputHorizontal() + { + CalculateRadial(); + } + protected override void OnValidate() + { + base.OnValidate(); + CalculateRadial(); + } + void CalculateRadial() + { + m_Tracker.Clear(); + if (transform.childCount == 0) + return; + float fOffsetAngle = ((MaxAngle - MinAngle)) / (transform.childCount -1); + + float fAngle = StartAngle; + for (int i = 0; i < transform.childCount; i++) + { + RectTransform child = (RectTransform)transform.GetChild(i); + if (child != null) + { + //Adding the elements to the tracker stops the user from modifiying their positions via the editor. + m_Tracker.Add(this, child, + DrivenTransformProperties.Anchors | + DrivenTransformProperties.AnchoredPosition | + DrivenTransformProperties.Pivot); + Vector3 vPos = new Vector3(Mathf.Cos(fAngle * Mathf.Deg2Rad), Mathf.Sin(fAngle * Mathf.Deg2Rad), 0); + child.localPosition = vPos * fDistance; + //Force objects to be center aligned, this can be changed however I'd suggest you keep all of the objects with the same anchor points. + child.anchorMin = child.anchorMax = child.pivot = new Vector2(0.5f, 0.5f); + fAngle += fOffsetAngle; + } + } + + } +} +} diff --git a/Scripts/Layout/RadialLayout.cs.meta b/Scripts/Layout/RadialLayout.cs.meta new file mode 100644 index 0000000..167703a --- /dev/null +++ b/Scripts/Layout/RadialLayout.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1ebce7906e5d20a4fb26d8b510b81926 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Scripts/Layout/TileSizeFitter.cs b/Scripts/Layout/TileSizeFitter.cs new file mode 100644 index 0000000..ee8abfb --- /dev/null +++ b/Scripts/Layout/TileSizeFitter.cs @@ -0,0 +1,104 @@ +/// Credit ?? +/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/page-3#post-2280109 + +using System.Collections; +using UnityEngine.EventSystems; + +namespace UnityEngine.UI.Extensions +{ +[ExecuteInEditMode] +[RequireComponent(typeof(RectTransform))] +[AddComponentMenu("Layout/Extensions/Tile Size Fitter")] +public class TileSizeFitter : UIBehaviour, ILayoutSelfController +{ + [SerializeField] private Vector2 m_Border = Vector2.zero; + public Vector2 Border { get { return m_Border; } set { if (SetPropertyUtility.SetStruct(ref m_Border, value)) SetDirty(); } } + + [SerializeField] private Vector2 m_TileSize = Vector2.zero; + public Vector2 TileSize { get { return m_TileSize; } set { if (SetPropertyUtility.SetStruct(ref m_TileSize, value)) SetDirty(); } } + + [System.NonSerialized] private RectTransform m_Rect; + private RectTransform rectTransform { get { if (m_Rect == null) m_Rect = GetComponent(); return m_Rect; } } + + private DrivenRectTransformTracker m_Tracker; + + #region Unity Lifetime calls + + protected override void OnEnable() + { + base.OnEnable(); + SetDirty(); + } + + protected override void OnDisable() + { + m_Tracker.Clear(); + LayoutRebuilder.MarkLayoutForRebuild(rectTransform); + base.OnDisable(); + } + + #endregion + + protected override void OnRectTransformDimensionsChange() + { + UpdateRect(); + } + + private void UpdateRect() + { + if (!IsActive()) + return; + + m_Tracker.Clear(); + + m_Tracker.Add(this, rectTransform, + DrivenTransformProperties.Anchors | + DrivenTransformProperties.AnchoredPosition); + rectTransform.anchorMin = Vector2.zero; + rectTransform.anchorMax = Vector2.one; + rectTransform.anchoredPosition = Vector2.zero; + + m_Tracker.Add(this, rectTransform, + DrivenTransformProperties.SizeDeltaX | + DrivenTransformProperties.SizeDeltaY); + Vector2 sizeDelta = GetParentSize() - Border; + if (TileSize.x > 0.001f) + sizeDelta.x -= Mathf.Floor(sizeDelta.x / TileSize.x) * TileSize.x; + else + sizeDelta.x = 0; + if (TileSize.y > 0.001f) + sizeDelta.y -= Mathf.Floor(sizeDelta.y / TileSize.y) * TileSize.y; + else + sizeDelta.y = 0; + rectTransform.sizeDelta = -sizeDelta; + } + + private Vector2 GetParentSize() + { + RectTransform parent = rectTransform.parent as RectTransform; + if (!parent) + return Vector2.zero; + return parent.rect.size; + } + + public virtual void SetLayoutHorizontal() { } + public virtual void SetLayoutVertical() { } + + protected void SetDirty() + { + if (!IsActive()) + return; + + UpdateRect(); + } + +#if UNITY_EDITOR + protected override void OnValidate() + { + m_TileSize.x = Mathf.Clamp(m_TileSize.x, 0.001f, 1000f); + m_TileSize.y = Mathf.Clamp(m_TileSize.y, 0.001f, 1000f); + SetDirty(); + } +#endif +} +} \ No newline at end of file diff --git a/Scripts/Layout/TileSizeFitter.cs.meta b/Scripts/Layout/TileSizeFitter.cs.meta new file mode 100644 index 0000000..1a442d3 --- /dev/null +++ b/Scripts/Layout/TileSizeFitter.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 614c629b8dffdb548b9bef9189606bb9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Scripts/VerticalScrollSnap.cs b/Scripts/Layout/VerticalScrollSnap.cs similarity index 96% rename from Scripts/VerticalScrollSnap.cs rename to Scripts/Layout/VerticalScrollSnap.cs index 44ead39..58f20e7 100644 --- a/Scripts/VerticalScrollSnap.cs +++ b/Scripts/Layout/VerticalScrollSnap.cs @@ -8,7 +8,7 @@ using UnityEngine.EventSystems; namespace UnityEngine.UI.Extensions { [RequireComponent(typeof(ScrollRect))] - [AddComponentMenu("UI/Extensions/Vertical Scroll Snap")] + [AddComponentMenu("Layout/Extensions/Vertical Scroll Snap")] public class VerticalScrollSnap : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler { private Transform _screensContainer; diff --git a/Scripts/VerticalScrollSnap.cs.meta b/Scripts/Layout/VerticalScrollSnap.cs.meta similarity index 100% rename from Scripts/VerticalScrollSnap.cs.meta rename to Scripts/Layout/VerticalScrollSnap.cs.meta diff --git a/Scripts/Primatives.meta b/Scripts/Primatives.meta new file mode 100644 index 0000000..ab52354 --- /dev/null +++ b/Scripts/Primatives.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: ce526e6e0c6202e4e9c5ee35dd79295d +folderAsset: yes +DefaultImporter: + userData: diff --git a/Scripts/Primatives/UICircle.cs b/Scripts/Primatives/UICircle.cs new file mode 100644 index 0000000..3d745e5 --- /dev/null +++ b/Scripts/Primatives/UICircle.cs @@ -0,0 +1,121 @@ +/// Credit ?? +/// Sourced from - http://forum.unity3d.com/threads/draw-circles-or-primitives-on-the-new-ui-canvas.272488/#post-2293224 + +using System.Collections.Generic; + +namespace UnityEngine.UI.Extensions +{ + [AddComponentMenu("UI/Extensions/Primatives/UI Circle")] + public class UICircle : Graphic + { + [SerializeField] + Texture m_Texture; + [Range(0, 100)] + public int fillPercent = 100; + public bool fill = true; + public float thickness = 5; + [Range(0, 360)] + public int segments = 360; + + public override Texture mainTexture + { + get + { + return m_Texture == null ? s_WhiteTexture : m_Texture; + } + } + + + /// + /// Texture to be used. + /// + public Texture texture + { + get + { + return m_Texture; + } + set + { + if (m_Texture == value) + return; + + m_Texture = value; + SetVerticesDirty(); + SetMaterialDirty(); + } + } + + protected void SetVbo(List vbo, Vector2[] vertices, Vector2[] uvs) + { + for (int i = 0; i < vertices.Length; i++) + { + var vert = UIVertex.simpleVert; + vert.color = color; + vert.position = vertices[i]; + vert.uv0 = uvs[i]; + vbo.Add(vert); + } + } + + + protected override void OnFillVBO(List vbo) + { + float outer = -rectTransform.pivot.x * rectTransform.rect.width; + float inner = -rectTransform.pivot.x * rectTransform.rect.width + this.thickness; + + vbo.Clear(); + + Vector2 prevX = Vector2.zero; + Vector2 prevY = Vector2.zero; + Vector2 uv0 = new Vector2(0, 0); + Vector2 uv1 = new Vector2(0, 1); + Vector2 uv2 = new Vector2(1, 1); + Vector2 uv3 = new Vector2(1, 0); + Vector2 pos0; + Vector2 pos1; + Vector2 pos2; + Vector2 pos3; + + float f = (this.fillPercent / 100f); + float degrees = 360f / segments; + int fa = (int)((segments + 1) * f); + + + for (int i = 0; i < fa; i++) + { + float rad = Mathf.Deg2Rad * (i * degrees); + float c = Mathf.Cos(rad); + float s = Mathf.Sin(rad); + + uv0 = new Vector2(0, 1); + uv1 = new Vector2(1, 1); + uv2 = new Vector2(1, 0); + uv3 = new Vector2(0, 0); + + pos0 = prevX; + pos1 = new Vector2(outer * c, outer * s); + + if (fill) + { + pos2 = Vector2.zero; + pos3 = Vector2.zero; + } + else + { + pos2 = new Vector2(inner * c, inner * s); + pos3 = prevY; + } + + prevX = pos1; + prevY = pos2; + + SetVbo(vbo, new[] { pos0, pos1, pos2, pos3 }, new[] { uv0, uv1, uv2, uv3 }); + + } + + } + + + } +} \ No newline at end of file diff --git a/Scripts/Primatives/UICircle.cs.meta b/Scripts/Primatives/UICircle.cs.meta new file mode 100644 index 0000000..b321084 --- /dev/null +++ b/Scripts/Primatives/UICircle.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8185cad1aa202d04ebb9e14ffa533a87 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Scripts/UILineRenderer.cs b/Scripts/Primatives/UILineRenderer.cs similarity index 96% rename from Scripts/UILineRenderer.cs rename to Scripts/Primatives/UILineRenderer.cs index e1b0700..a3d5273 100644 --- a/Scripts/UILineRenderer.cs +++ b/Scripts/Primatives/UILineRenderer.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; namespace UnityEngine.UI.Extensions { - [AddComponentMenu("UI/Extensions/UILineRenderer")] + [AddComponentMenu("UI/Extensions/Primatives/UILineRenderer")] public class UILineRenderer : MaskableGraphic { [SerializeField] diff --git a/Scripts/UILineRenderer.cs.meta b/Scripts/Primatives/UILineRenderer.cs.meta similarity index 100% rename from Scripts/UILineRenderer.cs.meta rename to Scripts/Primatives/UILineRenderer.cs.meta diff --git a/Scripts/UILineTextureRenderer.cs b/Scripts/Primatives/UILineTextureRenderer.cs similarity index 96% rename from Scripts/UILineTextureRenderer.cs rename to Scripts/Primatives/UILineTextureRenderer.cs index fbaaabd..dc6a84d 100644 --- a/Scripts/UILineTextureRenderer.cs +++ b/Scripts/Primatives/UILineTextureRenderer.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace UnityEngine.UI.Extensions { - [AddComponentMenu("UI/Extensions/UILineTextureRenderer")] + [AddComponentMenu("UI/Extensions/Primatives/UILineTextureRenderer")] public class UILineTextureRenderer : MaskableGraphic { [SerializeField] diff --git a/Scripts/UILineTextureRenderer.cs.meta b/Scripts/Primatives/UILineTextureRenderer.cs.meta similarity index 100% rename from Scripts/UILineTextureRenderer.cs.meta rename to Scripts/Primatives/UILineTextureRenderer.cs.meta diff --git a/Scripts/Utilities.meta b/Scripts/Utilities.meta new file mode 100644 index 0000000..19e3a76 --- /dev/null +++ b/Scripts/Utilities.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: 8ed31929d883df147b53ffeddcb4f25c +folderAsset: yes +DefaultImporter: + userData: diff --git a/Scripts/SetPropertyUtility.cs b/Scripts/Utilities/SetPropertyUtility.cs similarity index 100% rename from Scripts/SetPropertyUtility.cs rename to Scripts/Utilities/SetPropertyUtility.cs diff --git a/Scripts/SetPropertyUtility.cs.meta b/Scripts/Utilities/SetPropertyUtility.cs.meta similarity index 100% rename from Scripts/SetPropertyUtility.cs.meta rename to Scripts/Utilities/SetPropertyUtility.cs.meta diff --git a/Scripts/Utilities/switchToRectTransform.cs b/Scripts/Utilities/switchToRectTransform.cs new file mode 100644 index 0000000..fa72367 --- /dev/null +++ b/Scripts/Utilities/switchToRectTransform.cs @@ -0,0 +1,24 @@ +/// Credit ?? +/// Sourced from - http://forum.unity3d.com/threads/find-anchoredposition-of-a-recttransform-relative-to-another-recttransform.330560/#post-2300992 + +namespace UnityEngine.UI.Extensions +{ + + public static class RectTransformExtension + { +/// +/// Converts the anchoredPosition of the first RectTransform to the second RectTransform, +/// taking into consideration offset, anchors and pivot, and returns the new anchoredPosition +/// +public static Vector2 switchToRectTransform(this RectTransform from, RectTransform to) + { + Vector2 localPoint; + Vector2 fromPivotDerivedOffset = new Vector2(from.rect.width * from.pivot.x + from.rect.xMin, from.rect.height * from.pivot.y + from.rect.yMin); + Vector2 screenP = RectTransformUtility.WorldToScreenPoint(null, from.position); + screenP += fromPivotDerivedOffset; + RectTransformUtility.ScreenPointToLocalPointInRectangle(to, screenP, null, out localPoint); + Vector2 pivotDerivedOffset = new Vector2(to.rect.width * to.pivot.x + to.rect.xMin, to.rect.height * to.pivot.y + to.rect.yMin); + return to.anchoredPosition + localPoint - pivotDerivedOffset; + } + } +} \ No newline at end of file diff --git a/Scripts/Utilities/switchToRectTransform.cs.meta b/Scripts/Utilities/switchToRectTransform.cs.meta new file mode 100644 index 0000000..3a4c175 --- /dev/null +++ b/Scripts/Utilities/switchToRectTransform.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 977482c1b88728145ba612c0fdec3b92 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/package.json b/package.json new file mode 100644 index 0000000..229fcd4 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "Unity UI Extensions", + "version": "1.0.4", + "description": "An extension project for the Unity3D UI system, all crafted and contributed by the awesome Unity community", + "author": "Simon darkside Jackson <@SimonDarksideJ>", + "contributors": [{ + "name": "Foo Bar", + "email": "foo.bar@example.com" +}], + "repository": { + "type": "hg", + "url": "https://ddreaper@bitbucket.org/ddreaper/unity-ui-extensions" +}, + "bugs": { + "url": "https://bitbucket.org/ddreaper/unity-ui-extensions/issues" +}, + "keywords": [ + "nodejitsu", + "example", + "browsenpm" +], + "license": "MIT" +} \ No newline at end of file diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..c07e1f7 --- /dev/null +++ b/package.json.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1dbb3faeb54e2a4498b2472b8760548b +TextScriptImporter: + userData: From 5098410ffbde814e0665676070bfd08251fe4ed1 Mon Sep 17 00:00:00 2001 From: "Simon (darkside) Jackson" Date: Sun, 20 Sep 2015 01:21:29 +0100 Subject: [PATCH 4/4] Updated attributations Updated Readme Altered Project.json - revised license Added VR scripts - untested properly presently --- README.md | 42 +++++- Scripts/Editor/UIExtensionsMenuOptions.cs | 4 +- Scripts/InputFieldEnterSubmit.cs | 46 +++--- Scripts/Layout/RadialLayout.cs | 101 +++++++------ Scripts/Layout/TileSizeFitter.cs | 159 ++++++++++---------- Scripts/Primatives/UICircle.cs | 42 +++--- Scripts/Utilities/switchToRectTransform.cs | 38 ++--- Scripts/VR Extensions.meta | 5 + Scripts/VR Extensions/VRCursor.cs | 49 ++++++ Scripts/VR Extensions/VRCursor.cs.meta | 8 + Scripts/VR Extensions/VRInputModule.cs | 67 +++++++++ Scripts/VR Extensions/VRInputModule.cs.meta | 8 + package.json | 2 +- 13 files changed, 368 insertions(+), 203 deletions(-) create mode 100644 Scripts/VR Extensions.meta create mode 100644 Scripts/VR Extensions/VRCursor.cs create mode 100644 Scripts/VR Extensions/VRCursor.cs.meta create mode 100644 Scripts/VR Extensions/VRInputModule.cs create mode 100644 Scripts/VR Extensions/VRInputModule.cs.meta diff --git a/README.md b/README.md index 032f252..357b0bf 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,6 @@ Control | Description | Menu Command | Component Command | Notes | Credits | | | Component / UI / Extensions / AccordionItem |[demo video](http://forum.unity3d.com/threads/accordion-type-layout.271818/)| ChoMPHi **HSVPicker** | A colour picker UI | N/A | UI / Extensions / HSVPicker | Project folder includes prefab and sample scene | judah4 **SelectionBox** | An RTS style selection box control | UI / Extensions / Selection Box | UI / Extensions / Selection Box |[tutorial video](https://www.youtube.com/watch?v=UtM3HejKL5s)| Korindian, BenZed -**HorizontalScrollSnap** | A pages scroll rect that can work in steps / pages, includes button support | UI / Extensions / Horizontal Scroll Snap | UI / Extensions / Horizontal Scroll Snap |[tutorial video](https://www.youtube.com/watch?v=KJlIlWHlfMo)| BinaryX -**VerticalScrollSnap** | A pages scroll rect that can work in steps / pages, includes button support | UI / Extensions / Vertical Scroll Snap | UI / Extensions / Vertical Scroll Snap |[tutorial video](https://www.youtube.com/watch?v=KJlIlWHlfMo)| BinaryX, Simon Darkside Jackson **UIButton** | Improved Button control with additional events (PointerDown, PointerUp, PointerClick and PointerHeld) | UI / Extensions / UI Button | UI / Extensions / UI Button |Will update video, this has now been updated to a more reusable Selectable extension| AriathTheWise **UIFlippable** | Improved Image control with image flipping options | UI / Extensions / UI Flippable | UI / Extensions / Flippable |[tutorial video](https://www.youtube.com/watch?v=Htt2RNa2qy0)| ChoMPHi **UIWindowBase** | A draggable Window implementation | UI / Extensions / UI Window Base | UI / Extensions / UI Window Base |[tutorial video](https://www.youtube.com/watch?v=Htt2RNa2qy0)| GXMark, alexzzzz, CaoMengde777, TroyDavis @@ -46,8 +44,31 @@ Control | Description | Menu Command | Component Command | Notes | Credits **DropDownList** | A basic drop down list with text and image support | UI / Extensions / Dropdown List | UI / Extensions / Dropdown List |[tutorial video](https://www.youtube.com/watch?v=JrEfs47FoOE)| Perchik **BoundToolTip** | An alternate Tooltip implementation with central listener | UI / Extensions / Bound Tooltip / Tooltip | UI / Extensions / Bound Tooltip / Tooltip Item | Offset and tooltip placement needs work | Martin Sharkbomb | | | UI / Extensions / Bound Tooltip / Tooltip Trigger | | Martin Sharkbomb -**LineRenderer** | Graphic control for drawing lines in the UI System | UI / Extensions / UI Line Renderer | UI / Extensions / UI Line Renderer |[tutorial video](https://www.youtube.com/watch?v=OElcWAZGHi0)| jack.sydorenko -**UILineTextureRenderer** | Graphic control for drawing lines in the UI System | UI / Extensions / UI Line Texture Renderer | UI / Extensions / UI Line Texture Renderer |[tutorial video](https://www.youtube.com/watch?v=OElcWAZGHi0)| jack.sydorenko, jonbro5556 + + +## Primatives ## +================ + +Control | Description | Menu Command | Component Command | Notes | Credits +--------- | -------------- | ---------------------- | ---------------------------- | ------- | ---------- +**LineRenderer** | Graphic control for drawing lines in the UI System | UI / Extensions / Primatives / UI Line Renderer | UI / Extensions / Primatives / UI Line Renderer |[tutorial video](https://www.youtube.com/watch?v=OElcWAZGHi0)| jack.sydorenko +**UILineTextureRenderer** | Graphic control for drawing lines in the UI System | UI / Extensions / Primatives / UI Line Texture Renderer | UI / Extensions / Primatives / UI Line Texture Renderer |[tutorial video](https://www.youtube.com/watch?v=OElcWAZGHi0)| jack.sydorenko, jonbro5556 +**UICircle** | Graphic control for drawing circles in the UI System | UI / Extensions / Primatives / UI Circle | UI / Extensions / Primatives / UI Circle || zge + + + +## Layouts ## +================ + +Layout | Description | Menu Command | Component Command | Notes | Credits +--------- | -------------- | ---------------------- | ---------------------------- | ------- | ---------- +**HorizontalScrollSnap** | A pages scroll rect that can work in steps / pages, includes button support | Layout / Extensions / Horizontal Scroll Snap | Layout / Extensions / Horizontal Scroll Snap |[tutorial video](https://www.youtube.com/watch?v=KJlIlWHlfMo)| BinaryX +**VerticalScrollSnap** | A pages scroll rect that can work in steps / pages, includes button support | Layout / Extensions / Vertical Scroll Snap | Layout / Extensions / Vertical Scroll Snap |[tutorial video](https://www.youtube.com/watch?v=KJlIlWHlfMo)| BinaryX, Simon Darkside Jackson +**FlowLayoutGroup** | A more rugged grid style layout group || Layout / Extensions / Flow Layout Group | [Example Video](https://www.youtube.com/watch?v=tMe_3tJTZvc) | Simie +**RadialLayout** | A radial layout system || Layout / Extensions / Radial Layout || Danny Goodayle +**TileSizeFitter** | A fitter layout that will shink / expand content by tiles || Layout / Extensions / TileSizeFitter || Ges + + ## Effect components ## ===================== @@ -62,6 +83,14 @@ Effect | Description | Component Command | Notes | Credits **RaycastMask** | An example of an enhanced mask component able to work with the image data. Enables picking on image parts and not just the Rect Transform | UI / Effects / Extensions / Raycast Mask | | senritsu **UIFlippable** | Image component effect to flip the graphic | UI / Effects / Extensions / UI Flippable | | ChoMPHi +## VR Components## +======================= + +Component | Description | Component Command | Notes | Credits +--------- | -------------- | ---------------------------- | ------- | ------ +**VRCursor** | Cursor script for VR use (requires VRInputModule) | UI / Extensions / VR Cursoe | | Ralph Barbagallo +**VRInputModule** | Input module to support the VR Cursor | Event / Vr Input Module | | Ralph Barbagallo + ## Additional Components## ======================= @@ -71,7 +100,6 @@ Component | Description | Component Command | Notes | Credits **ReturnKeyTrigger** | Does something?? | UI / Extensions / ReturnKey Trigger | | Melang, ddreaper **TabNavigation** | An example Tab navigation script, updated to add manual navigation | UI / Extensions / Tab Navigation | | Melang, omatase **uGUITools** | | Menu / uGUI | | Senshi -**FlowLayoutGroup** | A more rugged grid style layout group | Layout / Extensions / Flow Layout Group | [Example Video](https://www.youtube.com/watch?v=tMe_3tJTZvc) | Simie **ScrollRectTweener** | Tweening solution for ScrollRects, add smoothing automatically | UI / Extensions / ScrollRectTweener | | Martin Sharkbomb **ScrollRectLinker** | ScrollRect Linker script, enable multiple ScrollRects to move together | UI / Extensions / ScrollRectLinker | | Martin Sharkbomb **ScrollRectEx** | Improved ScrollRect control, enables support for Nested ScrollRects | UI / Extensions / ScrollRectEx | | CaptainSchnittchen, GamesRUs @@ -79,11 +107,13 @@ Component | Description | Component Command | Notes | Credits **ImageExtended** | Improved Image control with rotation support and use of filled type without an Image (useful for masks) | UI / Extensions / Image Extended | | Ges **UIScrollToSelection** | Enables a ScrollRect to scroll based on the selected child automatically | UI / Extensions / UIScrollToSelection | | zero3growlithe **AimerInputModule** | Replacement Input module to allow for a reciclue to interace with WorldSpace canvas UI | UI / Extensions / Aimer Input Module | | Chris Trueman -**UISeclectableExtension** | Refactor of original UI Button control, can now add Press/Release and Hold events to any Selectable control | UI / Extensions / UI Selectable Extension | | AriathTheWise / Simon Jackson +**UISelectableExtension** | Refactor of original UI Button control, can now add Press/Release and Hold events to any Selectable control | UI / Extensions / UI Selectable Extension | | AriathTheWise / Simon Jackson +**switchToRectTransform** | RectTransform extension method to move one Rect to another | N/A | | Izitmee *More to come* +======================= ### How do I get set up? ### Either clone / download this repository to your machine and then copy the scripts in, or use the pre-packaged .UnityPackage for your version of Unity and import it as a custom package in to your project. diff --git a/Scripts/Editor/UIExtensionsMenuOptions.cs b/Scripts/Editor/UIExtensionsMenuOptions.cs index 03d4d70..3a23574 100644 --- a/Scripts/Editor/UIExtensionsMenuOptions.cs +++ b/Scripts/Editor/UIExtensionsMenuOptions.cs @@ -207,7 +207,7 @@ namespace UnityEditor.UI #region UI Extensions "Create" Menu items - [MenuItem("GameObject/UI/Extensions/Horizontal Scroll Snap", false)] + [MenuItem("GameObject/Layout/Extensions/Horizontal Scroll Snap", false)] static public void AddHorizontalScrollSnap(MenuCommand menuCommand) { GameObject horizontalScrollSnapRoot = CreateUIElementRoot("Horizontal Scroll Snap", menuCommand, s_ThickGUIElementSize); @@ -278,7 +278,7 @@ namespace UnityEditor.UI Selection.activeGameObject = horizontalScrollSnapRoot; } - [MenuItem("GameObject/UI/Extensions/Vertical Scroll Snap", false)] + [MenuItem("GameObject/Layout/Extensions/Vertical Scroll Snap", false)] static public void AddVerticallScrollSnap(MenuCommand menuCommand) { GameObject verticalScrollSnapRoot = CreateUIElementRoot("Vertical Scroll Snap", menuCommand, s_ThickGUIElementSize); diff --git a/Scripts/InputFieldEnterSubmit.cs b/Scripts/InputFieldEnterSubmit.cs index 56e9a55..36916e2 100644 --- a/Scripts/InputFieldEnterSubmit.cs +++ b/Scripts/InputFieldEnterSubmit.cs @@ -5,31 +5,29 @@ using UnityEngine.Events; namespace UnityEngine.UI.Extensions { -/// -/// Usage: Add this component to the input and add the function to execute to the EnterSubmit event of this script -/// -[RequireComponent(typeof(InputField))] -[AddComponentMenu("UI/Extensions/Input Field Submit")] -public class InputFieldEnterSubmit : MonoBehaviour -{ - - [System.Serializable] - public class EnterSubmitEvent : UnityEvent { } - - public EnterSubmitEvent EnterSubmit; - private InputField _input; - - void Awake() + /// + /// Usage: Add this component to the input and add the function to execute to the EnterSubmit event of this script + /// + [RequireComponent(typeof(InputField))] + [AddComponentMenu("UI/Extensions/Input Field Submit")] + public class InputFieldEnterSubmit : MonoBehaviour { - _input = GetComponent(); - _input.onEndEdit.AddListener(OnEndEdit); - } + [System.Serializable] + public class EnterSubmitEvent : UnityEvent { } - public void OnEndEdit(string txt) - { - if (!Input.GetKeyDown(KeyCode.Return) && !Input.GetKeyDown(KeyCode.KeypadEnter)) return; - EnterSubmit.Invoke(txt); - } + public EnterSubmitEvent EnterSubmit; + private InputField _input; -} + void Awake() + { + _input = GetComponent(); + _input.onEndEdit.AddListener(OnEndEdit); + } + + public void OnEndEdit(string txt) + { + if (!Input.GetKeyDown(KeyCode.Return) && !Input.GetKeyDown(KeyCode.KeypadEnter)) return; + EnterSubmit.Invoke(txt); + } + } } diff --git a/Scripts/Layout/RadialLayout.cs b/Scripts/Layout/RadialLayout.cs index 9982877..61e415e 100644 --- a/Scripts/Layout/RadialLayout.cs +++ b/Scripts/Layout/RadialLayout.cs @@ -1,5 +1,5 @@ -/// Credit ?? +/// Credit Danny Goodayle /// Sourced from - http://www.justapixel.co.uk/radial-layouts-nice-and-simple-in-unity3ds-ui-system/ /// Updated by ddreaper - removed dependency on a custom ScrollRect script. Now implements drag interfaces and standard Scroll Rect. @@ -25,57 +25,60 @@ THE SOFTWARE. namespace UnityEngine.UI.Extensions { -[AddComponentMenu("Layout/Extensions/Radial Layout")] -public class RadialLayout : LayoutGroup { - public float fDistance; - [Range(0f,360f)] - public float MinAngle, MaxAngle, StartAngle; - protected override void OnEnable() { base.OnEnable(); CalculateRadial(); } - public override void SetLayoutHorizontal() + [AddComponentMenu("Layout/Extensions/Radial Layout")] + public class RadialLayout : LayoutGroup { - } - public override void SetLayoutVertical() - { - } - public override void CalculateLayoutInputVertical() - { - CalculateRadial(); - } - public override void CalculateLayoutInputHorizontal() - { - CalculateRadial(); - } - protected override void OnValidate() - { - base.OnValidate(); - CalculateRadial(); - } - void CalculateRadial() - { - m_Tracker.Clear(); - if (transform.childCount == 0) - return; - float fOffsetAngle = ((MaxAngle - MinAngle)) / (transform.childCount -1); - - float fAngle = StartAngle; - for (int i = 0; i < transform.childCount; i++) + public float fDistance; + [Range(0f, 360f)] + public float MinAngle, MaxAngle, StartAngle; + protected override void OnEnable() { base.OnEnable(); CalculateRadial(); } + public override void SetLayoutHorizontal() { - RectTransform child = (RectTransform)transform.GetChild(i); - if (child != null) - { - //Adding the elements to the tracker stops the user from modifiying their positions via the editor. - m_Tracker.Add(this, child, - DrivenTransformProperties.Anchors | - DrivenTransformProperties.AnchoredPosition | - DrivenTransformProperties.Pivot); - Vector3 vPos = new Vector3(Mathf.Cos(fAngle * Mathf.Deg2Rad), Mathf.Sin(fAngle * Mathf.Deg2Rad), 0); - child.localPosition = vPos * fDistance; - //Force objects to be center aligned, this can be changed however I'd suggest you keep all of the objects with the same anchor points. - child.anchorMin = child.anchorMax = child.pivot = new Vector2(0.5f, 0.5f); - fAngle += fOffsetAngle; - } } + public override void SetLayoutVertical() + { + } + public override void CalculateLayoutInputVertical() + { + CalculateRadial(); + } + public override void CalculateLayoutInputHorizontal() + { + CalculateRadial(); + } +#if UNITY_EDITOR + protected override void OnValidate() + { + base.OnValidate(); + CalculateRadial(); + } +#endif + void CalculateRadial() + { + m_Tracker.Clear(); + if (transform.childCount == 0) + return; + float fOffsetAngle = ((MaxAngle - MinAngle)) / (transform.childCount - 1); + float fAngle = StartAngle; + for (int i = 0; i < transform.childCount; i++) + { + RectTransform child = (RectTransform)transform.GetChild(i); + if (child != null) + { + //Adding the elements to the tracker stops the user from modifiying their positions via the editor. + m_Tracker.Add(this, child, + DrivenTransformProperties.Anchors | + DrivenTransformProperties.AnchoredPosition | + DrivenTransformProperties.Pivot); + Vector3 vPos = new Vector3(Mathf.Cos(fAngle * Mathf.Deg2Rad), Mathf.Sin(fAngle * Mathf.Deg2Rad), 0); + child.localPosition = vPos * fDistance; + //Force objects to be center aligned, this can be changed however I'd suggest you keep all of the objects with the same anchor points. + child.anchorMin = child.anchorMax = child.pivot = new Vector2(0.5f, 0.5f); + fAngle += fOffsetAngle; + } + } + + } } } -} diff --git a/Scripts/Layout/TileSizeFitter.cs b/Scripts/Layout/TileSizeFitter.cs index ee8abfb..0d7f674 100644 --- a/Scripts/Layout/TileSizeFitter.cs +++ b/Scripts/Layout/TileSizeFitter.cs @@ -1,4 +1,4 @@ -/// Credit ?? +/// Credit Ges /// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/page-3#post-2280109 using System.Collections; @@ -6,99 +6,102 @@ using UnityEngine.EventSystems; namespace UnityEngine.UI.Extensions { -[ExecuteInEditMode] -[RequireComponent(typeof(RectTransform))] -[AddComponentMenu("Layout/Extensions/Tile Size Fitter")] -public class TileSizeFitter : UIBehaviour, ILayoutSelfController -{ - [SerializeField] private Vector2 m_Border = Vector2.zero; - public Vector2 Border { get { return m_Border; } set { if (SetPropertyUtility.SetStruct(ref m_Border, value)) SetDirty(); } } - - [SerializeField] private Vector2 m_TileSize = Vector2.zero; - public Vector2 TileSize { get { return m_TileSize; } set { if (SetPropertyUtility.SetStruct(ref m_TileSize, value)) SetDirty(); } } + [ExecuteInEditMode] + [RequireComponent(typeof(RectTransform))] + [AddComponentMenu("Layout/Extensions/Tile Size Fitter")] + public class TileSizeFitter : UIBehaviour, ILayoutSelfController + { + [SerializeField] + private Vector2 m_Border = Vector2.zero; + public Vector2 Border { get { return m_Border; } set { if (SetPropertyUtility.SetStruct(ref m_Border, value)) SetDirty(); } } - [System.NonSerialized] private RectTransform m_Rect; - private RectTransform rectTransform { get { if (m_Rect == null) m_Rect = GetComponent(); return m_Rect; } } + [SerializeField] + private Vector2 m_TileSize = Vector2.zero; + public Vector2 TileSize { get { return m_TileSize; } set { if (SetPropertyUtility.SetStruct(ref m_TileSize, value)) SetDirty(); } } - private DrivenRectTransformTracker m_Tracker; + [System.NonSerialized] + private RectTransform m_Rect; + private RectTransform rectTransform { get { if (m_Rect == null) m_Rect = GetComponent(); return m_Rect; } } - #region Unity Lifetime calls + private DrivenRectTransformTracker m_Tracker; - protected override void OnEnable() - { - base.OnEnable(); - SetDirty(); - } + #region Unity Lifetime calls - protected override void OnDisable() - { - m_Tracker.Clear(); - LayoutRebuilder.MarkLayoutForRebuild(rectTransform); - base.OnDisable(); - } + protected override void OnEnable() + { + base.OnEnable(); + SetDirty(); + } - #endregion + protected override void OnDisable() + { + m_Tracker.Clear(); + LayoutRebuilder.MarkLayoutForRebuild(rectTransform); + base.OnDisable(); + } - protected override void OnRectTransformDimensionsChange() - { - UpdateRect(); - } + #endregion - private void UpdateRect() - { - if (!IsActive()) - return; + protected override void OnRectTransformDimensionsChange() + { + UpdateRect(); + } - m_Tracker.Clear(); + private void UpdateRect() + { + if (!IsActive()) + return; - m_Tracker.Add(this, rectTransform, - DrivenTransformProperties.Anchors | - DrivenTransformProperties.AnchoredPosition); - rectTransform.anchorMin = Vector2.zero; - rectTransform.anchorMax = Vector2.one; - rectTransform.anchoredPosition = Vector2.zero; + m_Tracker.Clear(); - m_Tracker.Add(this, rectTransform, - DrivenTransformProperties.SizeDeltaX | - DrivenTransformProperties.SizeDeltaY); - Vector2 sizeDelta = GetParentSize() - Border; - if (TileSize.x > 0.001f) - sizeDelta.x -= Mathf.Floor(sizeDelta.x / TileSize.x) * TileSize.x; - else - sizeDelta.x = 0; - if (TileSize.y > 0.001f) - sizeDelta.y -= Mathf.Floor(sizeDelta.y / TileSize.y) * TileSize.y; - else - sizeDelta.y = 0; - rectTransform.sizeDelta = -sizeDelta; - } + m_Tracker.Add(this, rectTransform, + DrivenTransformProperties.Anchors | + DrivenTransformProperties.AnchoredPosition); + rectTransform.anchorMin = Vector2.zero; + rectTransform.anchorMax = Vector2.one; + rectTransform.anchoredPosition = Vector2.zero; - private Vector2 GetParentSize() - { - RectTransform parent = rectTransform.parent as RectTransform; - if (!parent) - return Vector2.zero; - return parent.rect.size; - } + m_Tracker.Add(this, rectTransform, + DrivenTransformProperties.SizeDeltaX | + DrivenTransformProperties.SizeDeltaY); + Vector2 sizeDelta = GetParentSize() - Border; + if (TileSize.x > 0.001f) + sizeDelta.x -= Mathf.Floor(sizeDelta.x / TileSize.x) * TileSize.x; + else + sizeDelta.x = 0; + if (TileSize.y > 0.001f) + sizeDelta.y -= Mathf.Floor(sizeDelta.y / TileSize.y) * TileSize.y; + else + sizeDelta.y = 0; + rectTransform.sizeDelta = -sizeDelta; + } - public virtual void SetLayoutHorizontal() { } - public virtual void SetLayoutVertical() { } + private Vector2 GetParentSize() + { + RectTransform parent = rectTransform.parent as RectTransform; + if (!parent) + return Vector2.zero; + return parent.rect.size; + } - protected void SetDirty() - { - if (!IsActive()) - return; + public virtual void SetLayoutHorizontal() { } + public virtual void SetLayoutVertical() { } - UpdateRect(); - } + protected void SetDirty() + { + if (!IsActive()) + return; + + UpdateRect(); + } #if UNITY_EDITOR - protected override void OnValidate() - { - m_TileSize.x = Mathf.Clamp(m_TileSize.x, 0.001f, 1000f); - m_TileSize.y = Mathf.Clamp(m_TileSize.y, 0.001f, 1000f); - SetDirty(); - } + protected override void OnValidate() + { + m_TileSize.x = Mathf.Clamp(m_TileSize.x, 0.001f, 1000f); + m_TileSize.y = Mathf.Clamp(m_TileSize.y, 0.001f, 1000f); + SetDirty(); + } #endif -} + } } \ No newline at end of file diff --git a/Scripts/Primatives/UICircle.cs b/Scripts/Primatives/UICircle.cs index 3d745e5..8eb2b81 100644 --- a/Scripts/Primatives/UICircle.cs +++ b/Scripts/Primatives/UICircle.cs @@ -1,11 +1,11 @@ -/// Credit ?? +/// Credit zge /// Sourced from - http://forum.unity3d.com/threads/draw-circles-or-primitives-on-the-new-ui-canvas.272488/#post-2293224 using System.Collections.Generic; namespace UnityEngine.UI.Extensions -{ - [AddComponentMenu("UI/Extensions/Primatives/UI Circle")] +{ + [AddComponentMenu("UI/Extensions/Primatives/UI Circle")] public class UICircle : Graphic { [SerializeField] @@ -16,7 +16,7 @@ namespace UnityEngine.UI.Extensions public float thickness = 5; [Range(0, 360)] public int segments = 360; - + public override Texture mainTexture { get @@ -24,8 +24,7 @@ namespace UnityEngine.UI.Extensions return m_Texture == null ? s_WhiteTexture : m_Texture; } } - - + /// /// Texture to be used. /// @@ -39,13 +38,13 @@ namespace UnityEngine.UI.Extensions { if (m_Texture == value) return; - + m_Texture = value; SetVerticesDirty(); SetMaterialDirty(); } } - + protected void SetVbo(List vbo, Vector2[] vertices, Vector2[] uvs) { for (int i = 0; i < vertices.Length; i++) @@ -57,15 +56,14 @@ namespace UnityEngine.UI.Extensions vbo.Add(vert); } } - - + protected override void OnFillVBO(List vbo) { float outer = -rectTransform.pivot.x * rectTransform.rect.width; float inner = -rectTransform.pivot.x * rectTransform.rect.width + this.thickness; - + vbo.Clear(); - + Vector2 prevX = Vector2.zero; Vector2 prevY = Vector2.zero; Vector2 uv0 = new Vector2(0, 0); @@ -76,26 +74,26 @@ namespace UnityEngine.UI.Extensions Vector2 pos1; Vector2 pos2; Vector2 pos3; - + float f = (this.fillPercent / 100f); float degrees = 360f / segments; int fa = (int)((segments + 1) * f); - - + + for (int i = 0; i < fa; i++) { float rad = Mathf.Deg2Rad * (i * degrees); float c = Mathf.Cos(rad); float s = Mathf.Sin(rad); - + uv0 = new Vector2(0, 1); uv1 = new Vector2(1, 1); uv2 = new Vector2(1, 0); uv3 = new Vector2(0, 0); - + pos0 = prevX; pos1 = new Vector2(outer * c, outer * s); - + if (fill) { pos2 = Vector2.zero; @@ -106,16 +104,12 @@ namespace UnityEngine.UI.Extensions pos2 = new Vector2(inner * c, inner * s); pos3 = prevY; } - + prevX = pos1; prevY = pos2; - + SetVbo(vbo, new[] { pos0, pos1, pos2, pos3 }, new[] { uv0, uv1, uv2, uv3 }); - } - } - - } } \ No newline at end of file diff --git a/Scripts/Utilities/switchToRectTransform.cs b/Scripts/Utilities/switchToRectTransform.cs index fa72367..f8e52f2 100644 --- a/Scripts/Utilities/switchToRectTransform.cs +++ b/Scripts/Utilities/switchToRectTransform.cs @@ -1,24 +1,24 @@ -/// Credit ?? +/// Credit Izitmee /// Sourced from - http://forum.unity3d.com/threads/find-anchoredposition-of-a-recttransform-relative-to-another-recttransform.330560/#post-2300992 +/// Updated by Brave Michael - http://forum.unity3d.com/threads/find-anchoredposition-of-a-recttransform-relative-to-another-recttransform.330560/#post-2300992 namespace UnityEngine.UI.Extensions { - - public static class RectTransformExtension - { -/// -/// Converts the anchoredPosition of the first RectTransform to the second RectTransform, -/// taking into consideration offset, anchors and pivot, and returns the new anchoredPosition -/// -public static Vector2 switchToRectTransform(this RectTransform from, RectTransform to) - { - Vector2 localPoint; - Vector2 fromPivotDerivedOffset = new Vector2(from.rect.width * from.pivot.x + from.rect.xMin, from.rect.height * from.pivot.y + from.rect.yMin); - Vector2 screenP = RectTransformUtility.WorldToScreenPoint(null, from.position); - screenP += fromPivotDerivedOffset; - RectTransformUtility.ScreenPointToLocalPointInRectangle(to, screenP, null, out localPoint); - Vector2 pivotDerivedOffset = new Vector2(to.rect.width * to.pivot.x + to.rect.xMin, to.rect.height * to.pivot.y + to.rect.yMin); - return to.anchoredPosition + localPoint - pivotDerivedOffset; - } - } + public static class RectTransformExtension + { + /// + /// Converts the anchoredPosition of the first RectTransform to the second RectTransform, + /// taking into consideration offset, anchors and pivot, and returns the new anchoredPosition + /// + public static Vector2 switchToRectTransform(this RectTransform from, RectTransform to) + { + Vector2 localPoint; + Vector2 fromPivotDerivedOffset = new Vector2(from.rect.width * from.pivot.x + from.rect.xMin, from.rect.height * from.pivot.y + from.rect.yMin); + Vector2 screenP = RectTransformUtility.WorldToScreenPoint(null, from.position); + screenP += fromPivotDerivedOffset; + RectTransformUtility.ScreenPointToLocalPointInRectangle(to, screenP, null, out localPoint); + Vector2 pivotDerivedOffset = new Vector2(to.rect.width * to.pivot.x + to.rect.xMin, to.rect.height * to.pivot.y + to.rect.yMin); + return to.anchoredPosition + localPoint - pivotDerivedOffset; + } + } } \ No newline at end of file diff --git a/Scripts/VR Extensions.meta b/Scripts/VR Extensions.meta new file mode 100644 index 0000000..93f163f --- /dev/null +++ b/Scripts/VR Extensions.meta @@ -0,0 +1,5 @@ +fileFormatVersion: 2 +guid: c84a253080bc0ec4995041aa5a6656ae +folderAsset: yes +DefaultImporter: + userData: diff --git a/Scripts/VR Extensions/VRCursor.cs b/Scripts/VR Extensions/VRCursor.cs new file mode 100644 index 0000000..c563deb --- /dev/null +++ b/Scripts/VR Extensions/VRCursor.cs @@ -0,0 +1,49 @@ +/// Credit Ralph Barbagallo (www.flarb.com /www.ralphbarbagallo.com / @flarb) +/// Sourced from - http://forum.unity3d.com/threads/vr-cursor-possible-unity-4-6-gui-bug-or-is-it-me + +using System.Collections; +namespace UnityEngine.UI.Extensions +{ + [AddComponentMenu("UI/Extensions/VR Cursor")] + public class VRCursor : MonoBehaviour + { + public float xSens; + public float ySens; + + private Collider currentCollider; + + // Update is called once per frame + void Update() + { + Vector3 thisPosition; + + thisPosition.x = Input.mousePosition.x * xSens; + thisPosition.y = Input.mousePosition.y * ySens - 1; + thisPosition.z = transform.position.z; + + transform.position = thisPosition; + + VRInputModule.cursorPosition = transform.position; + + if (Input.GetMouseButtonDown(0) && currentCollider) + { + VRInputModule.PointerSubmit(currentCollider.gameObject); + } + + } + + void OnTriggerEnter(Collider other) + { + //print("OnTriggerEnter other " + other.gameObject); + VRInputModule.PointerEnter(other.gameObject); + currentCollider = other; + } + + void OnTriggerExit(Collider other) + { + //print("OnTriggerExit other " + other.gameObject); + VRInputModule.PointerExit(other.gameObject); + currentCollider = null; + } + } +} \ No newline at end of file diff --git a/Scripts/VR Extensions/VRCursor.cs.meta b/Scripts/VR Extensions/VRCursor.cs.meta new file mode 100644 index 0000000..f4fa883 --- /dev/null +++ b/Scripts/VR Extensions/VRCursor.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3d7a94ee2faf9f04696882b3a2cbf035 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Scripts/VR Extensions/VRInputModule.cs b/Scripts/VR Extensions/VRInputModule.cs new file mode 100644 index 0000000..b78de0c --- /dev/null +++ b/Scripts/VR Extensions/VRInputModule.cs @@ -0,0 +1,67 @@ +/// Credit Ralph Barbagallo (www.flarb.com /www.ralphbarbagallo.com / @flarb) +/// Sourced from - http://forum.unity3d.com/threads/vr-cursor-possible-unity-4-6-gui-bug-or-is-it-me +/// Fix supplied by - http://forum.unity3d.com/threads/vr-cursor-possible-unity-4-6-gui-bug-or-is-it-me.296934/ + +using UnityEngine.EventSystems; +namespace UnityEngine.UI.Extensions +{ + [AddComponentMenu("Event/VR Input Module")] + public class VRInputModule : BaseInputModule + { + public static GameObject targetObject; + + static VRInputModule _singleton; + + private int counter; + + private static bool mouseClicked; + public static Vector3 cursorPosition; + + protected override void Awake() + { + _singleton = this; + } + + public override void Process() + { + if (targetObject == null) + { + mouseClicked = false; + return; + } + } + + public static void PointerSubmit(GameObject obj) + { + targetObject = obj; + mouseClicked = true; + if (mouseClicked) + { + //BaseEventData data = GetBaseEventData(); //Original from Process(). Can't be called here so is replaced by the next line: + BaseEventData data = new BaseEventData(_singleton.eventSystem); + data.selectedObject = targetObject; + ExecuteEvents.Execute(targetObject, data, ExecuteEvents.submitHandler); + print("clicked " + targetObject.name); + mouseClicked = false; + } + } + + public static void PointerExit(GameObject obj) + { + print("PointerExit " + obj.name); + PointerEventData pEvent = new PointerEventData(_singleton.eventSystem); + ExecuteEvents.Execute(obj, pEvent, ExecuteEvents.pointerExitHandler); + ExecuteEvents.Execute(obj, pEvent, ExecuteEvents.deselectHandler); //This fixes the problem + } + + public static void PointerEnter(GameObject obj) + { + print("PointerEnter " + obj.name); + PointerEventData pEvent = new PointerEventData(_singleton.eventSystem); + pEvent.pointerEnter = obj; + RaycastResult rcr = new RaycastResult() { worldPosition = cursorPosition }; + pEvent.pointerCurrentRaycast = rcr; + ExecuteEvents.Execute(obj, pEvent, ExecuteEvents.pointerEnterHandler); + } + } +} \ No newline at end of file diff --git a/Scripts/VR Extensions/VRInputModule.cs.meta b/Scripts/VR Extensions/VRInputModule.cs.meta new file mode 100644 index 0000000..42650a1 --- /dev/null +++ b/Scripts/VR Extensions/VRInputModule.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 303ab8dad3437bf46814373cfb86cc5d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/package.json b/package.json index 229fcd4..b4cdd10 100644 --- a/package.json +++ b/package.json @@ -19,5 +19,5 @@ "example", "browsenpm" ], - "license": "MIT" + "license": "BSD" } \ No newline at end of file