diff --git a/Scripts/HSVPicker/HexRGB.cs b/Scripts/HSVPicker/HexRGB.cs
index c63ba66..0c3ba70 100644
--- a/Scripts/HSVPicker/HexRGB.cs
+++ b/Scripts/HSVPicker/HexRGB.cs
@@ -7,7 +7,8 @@ namespace UnityEngine.UI.Extensions
{
public class HexRGB : MonoBehaviour
{
- public Text textColor;
+ // Unity 5.1/2 needs an InputFiled vs grabbing the text component
+ public InputField hexInput;
public HSVPicker hsvpicker;
@@ -15,7 +16,7 @@ namespace UnityEngine.UI.Extensions
{
Color color = hsvpicker.currentColor;
string hex = ColorToHex(color);
- textColor.text = hex;
+ hexInput.text = hex;
}
public static string ColorToHex(Color color)
@@ -28,8 +29,7 @@ namespace UnityEngine.UI.Extensions
public void ManipulateViaHex2RGB()
{
- string hex = textColor.text;
-
+ string hex = hexInput.text;
Vector3 rgb = Hex2RGB(hex);
Color color = NormalizeVector4(rgb, 255f, 1f); print(rgb);
diff --git a/Scripts/InputModules.meta b/Scripts/InputModules.meta
new file mode 100644
index 0000000..2969fc2
--- /dev/null
+++ b/Scripts/InputModules.meta
@@ -0,0 +1,5 @@
+fileFormatVersion: 2
+guid: a0789c2f62bad6b4c800a3dc502fa18e
+folderAsset: yes
+DefaultImporter:
+ userData:
diff --git a/Scripts/AimerInputModule.cs b/Scripts/InputModules/AimerInputModule.cs
similarity index 100%
rename from Scripts/AimerInputModule.cs
rename to Scripts/InputModules/AimerInputModule.cs
diff --git a/Scripts/AimerInputModule.cs.meta b/Scripts/InputModules/AimerInputModule.cs.meta
similarity index 78%
rename from Scripts/AimerInputModule.cs.meta
rename to Scripts/InputModules/AimerInputModule.cs.meta
index 9a98d82..ee7993f 100644
--- a/Scripts/AimerInputModule.cs.meta
+++ b/Scripts/InputModules/AimerInputModule.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: f7d3d69aa5226dc4493464d3b5e4ddc3
+guid: 08b9f423b73fdfb47b59e7de89863600
MonoImporter:
serializedVersion: 2
defaultReferences: []
diff --git a/Scripts/InputModules/GamePadInputModule.cs b/Scripts/InputModules/GamePadInputModule.cs
new file mode 100644
index 0000000..f58ce8e
--- /dev/null
+++ b/Scripts/InputModules/GamePadInputModule.cs
@@ -0,0 +1,227 @@
+using System;
+using UnityEngine.Serialization;
+
+namespace UnityEngine.EventSystems
+{
+ [AddComponentMenu("Event/GamePad Input Module")]
+ public class GamePadInputModule : BaseInputModule
+ {
+ private float m_PrevActionTime;
+ Vector2 m_LastMoveVector;
+ int m_ConsecutiveMoveCount = 0;
+
+ protected GamePadInputModule()
+ {}
+
+ [SerializeField]
+ private string m_HorizontalAxis = "Horizontal";
+
+ ///
+ /// Name of the vertical axis for movement (if axis events are used).
+ ///
+ [SerializeField]
+ private string m_VerticalAxis = "Vertical";
+
+ ///
+ /// Name of the submit button.
+ ///
+ [SerializeField]
+ private string m_SubmitButton = "Submit";
+
+ ///
+ /// Name of the submit button.
+ ///
+ [SerializeField]
+ private string m_CancelButton = "Cancel";
+
+ [SerializeField]
+ private float m_InputActionsPerSecond = 10;
+
+ [SerializeField]
+ private float m_RepeatDelay = 0.5f;
+
+ public float inputActionsPerSecond
+ {
+ get { return m_InputActionsPerSecond; }
+ set { m_InputActionsPerSecond = value; }
+ }
+
+ public float repeatDelay
+ {
+ get { return m_RepeatDelay; }
+ set { m_RepeatDelay = value; }
+ }
+
+ ///
+ /// Name of the horizontal axis for movement (if axis events are used).
+ ///
+ public string horizontalAxis
+ {
+ get { return m_HorizontalAxis; }
+ set { m_HorizontalAxis = value; }
+ }
+
+ ///
+ /// Name of the vertical axis for movement (if axis events are used).
+ ///
+ public string verticalAxis
+ {
+ get { return m_VerticalAxis; }
+ set { m_VerticalAxis = value; }
+ }
+
+ public string submitButton
+ {
+ get { return m_SubmitButton; }
+ set { m_SubmitButton = value; }
+ }
+
+ public string cancelButton
+ {
+ get { return m_CancelButton; }
+ set { m_CancelButton = value; }
+ }
+
+ public override bool ShouldActivateModule()
+ {
+ if (!base.ShouldActivateModule())
+ return false;
+
+ var shouldActivate = true;
+ shouldActivate |= Input.GetButtonDown(m_SubmitButton);
+ shouldActivate |= Input.GetButtonDown(m_CancelButton);
+ shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_HorizontalAxis), 0.0f);
+ shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_VerticalAxis), 0.0f);
+ return shouldActivate;
+ }
+
+ public override void ActivateModule()
+ {
+ StandaloneInputModule StandAloneSystem = GetComponent();
+
+ if (StandAloneSystem && StandAloneSystem.enabled)
+ {
+ Debug.LogError("StandAloneInputSystem should not be used with the GamePadInputModule, " +
+ "please remove it from the Event System in this scene or disable it when this module is in use");
+ }
+
+ base.ActivateModule();
+
+ var toSelect = eventSystem.currentSelectedGameObject;
+ if (toSelect == null)
+ toSelect = eventSystem.firstSelectedGameObject;
+
+ eventSystem.SetSelectedGameObject(toSelect, GetBaseEventData());
+ }
+
+ public override void DeactivateModule()
+ {
+ base.DeactivateModule();
+ }
+
+ public override void Process()
+ {
+ bool usedEvent = SendUpdateEventToSelectedObject();
+
+ if (eventSystem.sendNavigationEvents)
+ {
+ if (!usedEvent)
+ usedEvent |= SendMoveEventToSelectedObject();
+
+ if (!usedEvent)
+ SendSubmitEventToSelectedObject();
+ }
+ }
+
+ ///
+ /// Process submit keys.
+ ///
+ protected bool SendSubmitEventToSelectedObject()
+ {
+ if (eventSystem.currentSelectedGameObject == null)
+ return false;
+
+ var data = GetBaseEventData();
+ if (Input.GetButtonDown(m_SubmitButton))
+ ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.submitHandler);
+
+ if (Input.GetButtonDown(m_CancelButton))
+ ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.cancelHandler);
+ return data.used;
+ }
+
+ private Vector2 GetRawMoveVector()
+ {
+ Vector2 move = Vector2.zero;
+ move.x = Input.GetAxisRaw(m_HorizontalAxis);
+ move.y = Input.GetAxisRaw(m_VerticalAxis);
+
+ if (Input.GetButtonDown(m_HorizontalAxis))
+ {
+ if (move.x < 0)
+ move.x = -1f;
+ if (move.x > 0)
+ move.x = 1f;
+ }
+ if (Input.GetButtonDown(m_VerticalAxis))
+ {
+ if (move.y < 0)
+ move.y = -1f;
+ if (move.y > 0)
+ move.y = 1f;
+ }
+ return move;
+ }
+
+ ///
+ /// Process events.
+ ///
+ protected bool SendMoveEventToSelectedObject()
+ {
+ float time = Time.unscaledTime;
+
+ Vector2 movement = GetRawMoveVector();
+ if (Mathf.Approximately(movement.x, 0f) && Mathf.Approximately(movement.y, 0f))
+ {
+ m_ConsecutiveMoveCount = 0;
+ return false;
+ }
+
+ // If user pressed key again, always allow event
+ bool allow = Input.GetButtonDown(m_HorizontalAxis) || Input.GetButtonDown(m_VerticalAxis);
+ bool similarDir = (Vector2.Dot(movement, m_LastMoveVector) > 0);
+ if (!allow)
+ {
+ // Otherwise, user held down key or axis.
+ // If direction didn't change at least 90 degrees, wait for delay before allowing consequtive event.
+ if (similarDir && m_ConsecutiveMoveCount == 1)
+ allow = (time > m_PrevActionTime + m_RepeatDelay);
+ // If direction changed at least 90 degree, or we already had the delay, repeat at repeat rate.
+ else
+ allow = (time > m_PrevActionTime + 1f / m_InputActionsPerSecond);
+ }
+ if (!allow)
+ return false;
+
+ // Debug.Log(m_ProcessingEvent.rawType + " axis:" + m_AllowAxisEvents + " value:" + "(" + x + "," + y + ")");
+ var axisEventData = GetAxisEventData(movement.x, movement.y, 0.6f);
+ ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
+ if (!similarDir)
+ m_ConsecutiveMoveCount = 0;
+ m_ConsecutiveMoveCount++;
+ m_PrevActionTime = time;
+ m_LastMoveVector = movement;
+ return axisEventData.used;
+ }
+
+ protected bool SendUpdateEventToSelectedObject()
+ {
+ if (eventSystem.currentSelectedGameObject == null)
+ return false;
+
+ var data = GetBaseEventData();
+ ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.updateSelectedHandler);
+ return data.used;
+ }
+ }
+}
diff --git a/Scripts/InputModules/GamePadInputModule.cs.meta b/Scripts/InputModules/GamePadInputModule.cs.meta
new file mode 100644
index 0000000..a331d60
--- /dev/null
+++ b/Scripts/InputModules/GamePadInputModule.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 26158f38115d49a4a915f46c7eced4ab
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Scripts/Primatives/UICircle.cs b/Scripts/Primatives/UICircle.cs
index dfa8748..5f222cc 100644
--- a/Scripts/Primatives/UICircle.cs
+++ b/Scripts/Primatives/UICircle.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace UnityEngine.UI.Extensions
{
[AddComponentMenu("UI/Extensions/Primitives/UI Circle")]
- public class UICircle : Graphic
+ public class UICircle : MaskableGraphic
{
[SerializeField]
Texture m_Texture;
diff --git a/Scripts/Utilities/HoverTooltip.cs b/Scripts/Utilities/HoverTooltip.cs
new file mode 100644
index 0000000..8de77a0
--- /dev/null
+++ b/Scripts/Utilities/HoverTooltip.cs
@@ -0,0 +1,314 @@
+/// Credit drHogan
+/// Sourced from - http://www.hammerandravens.com/multi-use-tooltip-system-in-unity3d/
+
+namespace UnityEngine.UI.Extensions
+{
+ public class HoverTooltip : MonoBehaviour
+ {
+ //manually selectable padding for the background image
+ public int horizontalPadding;
+ public int verticalPadding;
+
+ //tooltip text
+ public Text thisText;
+
+ //horizontal layout of the tooltip
+ public HorizontalLayoutGroup hlG;
+
+ //tooltip background image
+ public RectTransform bgImage;
+ Image bgImageSource;
+
+ //needed as the layout refreshes only on the first Update() call
+ bool firstUpdate;
+
+ //if the tooltip is inside a UI element
+ bool inside;
+
+ //size of the tooltip, needed to track if out of screen
+ // public float width;
+ // public float height;
+
+ //detect canvas mode so to apply different behaviors to different canvas modes, currently only RenderMode.ScreenSpaceCamera implemented
+ int canvasMode;
+ RenderMode GUIMode;
+
+ //the scene GUI camera
+ Camera GUICamera;
+
+ //the default tooltip object has the following pivots, so that the offset from the mouse is always proportional to the screen resolution (the y pivot)
+ //Pivot(0.5,-0.5)
+
+ //screen viewport corners for out of screen detection
+ Vector3 lowerLeft;
+ Vector3 upperRight;
+
+ //scale factor of proportionality to the reference resolution (1280x720)
+ float currentYScaleFactor;
+ float currentXScaleFactor;
+
+ //standard X and Y offsets of the new tooltip
+ float defaultYOffset;
+ float defaultXOffset;
+
+ //real on screen sizes of the tooltip object
+ float tooltipRealHeight;
+ float tooltipRealWidth;
+
+ // Use this for initialization
+ void Start()
+ {
+ //in this line you need to change the string in order to get your Camera //TODO MAYBE DO IT FROM THE INSPECTOR
+ GUICamera = GameObject.Find("GUICamera").GetComponent();
+ GUIMode = this.transform.parent.parent.GetComponent