commit
c59110665d
|
@ -26,7 +26,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
// Check if the "Enter" key was just released with the chat input not focused
|
// Check if the "Enter" key was just released with the chat input not focused
|
||||||
if (Input.GetKeyUp(KeyCode.Return) && !_inputField.isFocused)
|
if (UIExtensionsInputManager.GetKeyUp(KeyCode.Return) && !_inputField.isFocused)
|
||||||
{
|
{
|
||||||
// If we need to ignore the keypress, do nothing - otherwise activate the input field
|
// If we need to ignore the keypress, do nothing - otherwise activate the input field
|
||||||
if (_ignoreNextActivation)
|
if (_ignoreNextActivation)
|
||||||
|
@ -60,7 +60,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
public void OnEndEdit(string textString)
|
public void OnEndEdit(string textString)
|
||||||
{
|
{
|
||||||
// If the edit ended because we clicked away, don't do anything extra
|
// If the edit ended because we clicked away, don't do anything extra
|
||||||
if (!Input.GetKeyDown(KeyCode.Return))
|
if (!UIExtensionsInputManager.GetKeyDown(KeyCode.Return))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,14 +147,14 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
void BeginSelection(){
|
void BeginSelection(){
|
||||||
// Click somewhere in the Game View.
|
// Click somewhere in the Game View.
|
||||||
if (!Input.GetMouseButtonDown(0))
|
if (!UIExtensionsInputManager.GetMouseButtonDown(0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//The boxRect will be inactive up until the point we start selecting
|
//The boxRect will be inactive up until the point we start selecting
|
||||||
boxRect.gameObject.SetActive(true);
|
boxRect.gameObject.SetActive(true);
|
||||||
|
|
||||||
// Get the initial click position of the mouse.
|
// Get the initial click position of the mouse.
|
||||||
origin = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
|
origin = new Vector2(UIExtensionsInputManager.MousePosition.x, UIExtensionsInputManager.MousePosition.y);
|
||||||
|
|
||||||
//If the initial click point is not inside the selection mask, we abort the selection
|
//If the initial click point is not inside the selection mask, we abort the selection
|
||||||
if (!PointIsValidAgainstSelectionMask(origin)) {
|
if (!PointIsValidAgainstSelectionMask(origin)) {
|
||||||
|
@ -185,7 +185,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
selectableList.Add (selectable);
|
selectableList.Add (selectable);
|
||||||
|
|
||||||
//We're using left shift to act as the "Add To Selection" command. So if left shift isn't pressed, we want everything to begin deselected
|
//We're using left shift to act as the "Add To Selection" command. So if left shift isn't pressed, we want everything to begin deselected
|
||||||
if (!Input.GetKey (KeyCode.LeftShift)) {
|
if (!UIExtensionsInputManager.GetKey (KeyCode.LeftShift)) {
|
||||||
selectable.selected = false;
|
selectable.selected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
IBoxSelectable GetSelectableAtMousePosition() {
|
IBoxSelectable GetSelectableAtMousePosition() {
|
||||||
//Firstly, we cannot click on something that is not inside the selection mask (if we have one)
|
//Firstly, we cannot click on something that is not inside the selection mask (if we have one)
|
||||||
if (!PointIsValidAgainstSelectionMask(Input.mousePosition)) {
|
if (!PointIsValidAgainstSelectionMask(UIExtensionsInputManager.MousePosition)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
//Once we've found the rendering camera, we check if the selectables rectTransform contains the click. That way we
|
//Once we've found the rendering camera, we check if the selectables rectTransform contains the click. That way we
|
||||||
//Can click anywhere on a rectTransform to select it.
|
//Can click anywhere on a rectTransform to select it.
|
||||||
if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, screenCamera)) {
|
if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, UIExtensionsInputManager.MousePosition, screenCamera)) {
|
||||||
|
|
||||||
//And if it does, we select it and send it back
|
//And if it does, we select it and send it back
|
||||||
return selectable;
|
return selectable;
|
||||||
|
@ -240,7 +240,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
var selectableScreenPoint = GetScreenPointOfSelectable(selectable);
|
var selectableScreenPoint = GetScreenPointOfSelectable(selectable);
|
||||||
|
|
||||||
//Check that the click fits within the screen-radius of the selectable
|
//Check that the click fits within the screen-radius of the selectable
|
||||||
if (Vector2.Distance(selectableScreenPoint, Input.mousePosition) <= radius) {
|
if (Vector2.Distance(selectableScreenPoint, UIExtensionsInputManager.MousePosition) <= radius) {
|
||||||
|
|
||||||
//And if it does, we select it and send it back
|
//And if it does, we select it and send it back
|
||||||
return selectable;
|
return selectable;
|
||||||
|
@ -255,11 +255,11 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
void DragSelection(){
|
void DragSelection(){
|
||||||
//Return if we're not dragging or if the selection has been aborted (BoxRect disabled)
|
//Return if we're not dragging or if the selection has been aborted (BoxRect disabled)
|
||||||
if (!Input.GetMouseButton(0) || !boxRect.gameObject.activeSelf)
|
if (!UIExtensionsInputManager.GetMouseButton(0) || !boxRect.gameObject.activeSelf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Store the current mouse position in screen space.
|
// Store the current mouse position in screen space.
|
||||||
Vector2 currentMousePosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
|
Vector2 currentMousePosition = new Vector2(UIExtensionsInputManager.MousePosition.x, UIExtensionsInputManager.MousePosition.y);
|
||||||
|
|
||||||
// How far have we moved the mouse?
|
// How far have we moved the mouse?
|
||||||
Vector2 difference = currentMousePosition - origin;
|
Vector2 difference = currentMousePosition - origin;
|
||||||
|
@ -414,7 +414,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
void EndSelection(){
|
void EndSelection(){
|
||||||
//Get out if we haven't finished selecting, or if the selection has been aborted (boxRect disabled)
|
//Get out if we haven't finished selecting, or if the selection has been aborted (boxRect disabled)
|
||||||
if (!Input.GetMouseButtonUp(0) || !boxRect.gameObject.activeSelf)
|
if (!UIExtensionsInputManager.GetMouseButtonUp(0) || !boxRect.gameObject.activeSelf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
clickedAfterDrag = GetSelectableAtMousePosition();
|
clickedAfterDrag = GetSelectableAtMousePosition();
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: a0789c2f62bad6b4c800a3dc502fa18e
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
|
@ -1,163 +0,0 @@
|
||||||
/// Credit Chris Trueman
|
|
||||||
/// Sourced from - http://forum.unity3d.com/threads/use-reticle-like-mouse-for-worldspace-uis.295271/
|
|
||||||
|
|
||||||
namespace UnityEngine.EventSystems.Extensions
|
|
||||||
{
|
|
||||||
[RequireComponent(typeof(EventSystem))]
|
|
||||||
[AddComponentMenu("Event/Extensions/Aimer Input Module")]
|
|
||||||
public class AimerInputModule : PointerInputModule
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The Input axis name used to activate the object under the reticle.
|
|
||||||
/// </summary>
|
|
||||||
public string activateAxis = "Submit";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The aimer offset position. Aimer is center screen use this offset to change that.
|
|
||||||
/// </summary>
|
|
||||||
public Vector2 aimerOffset = new Vector2(0, 0);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The object under aimer. A static access field that lets you know what is under the aimer.
|
|
||||||
/// This field can return null.
|
|
||||||
/// </summary>
|
|
||||||
public static GameObject objectUnderAimer;
|
|
||||||
|
|
||||||
protected AimerInputModule() { }
|
|
||||||
|
|
||||||
public override void ActivateModule()
|
|
||||||
{
|
|
||||||
StandaloneInputModule StandAloneSystem = GetComponent<StandaloneInputModule>();
|
|
||||||
|
|
||||||
if (StandAloneSystem != null && StandAloneSystem.enabled)
|
|
||||||
{
|
|
||||||
Debug.LogError("Aimer Input Module is incompatible with the StandAloneInputSystem, " +
|
|
||||||
"please remove it from the Event System in this scene or disable it when this module is in use");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Process()
|
|
||||||
{
|
|
||||||
bool pressed = Input.GetButtonDown(activateAxis);
|
|
||||||
bool released = Input.GetButtonUp(activateAxis);
|
|
||||||
|
|
||||||
PointerEventData pointer = GetAimerPointerEventData();
|
|
||||||
|
|
||||||
ProcessInteraction(pointer, pressed, released);
|
|
||||||
|
|
||||||
if (!released)
|
|
||||||
ProcessMove(pointer);
|
|
||||||
else
|
|
||||||
RemovePointerData(pointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual PointerEventData GetAimerPointerEventData()
|
|
||||||
{
|
|
||||||
PointerEventData pointerData;
|
|
||||||
|
|
||||||
//Not certain on the use of this.
|
|
||||||
//I know that -1 is the mouse and anything positive would be a finger/touch, 0 being the first finger, 1 being the second and so one till the system limit is reached.
|
|
||||||
//So that is the reason I choose -2.
|
|
||||||
GetPointerData(-2, out pointerData, true);
|
|
||||||
|
|
||||||
pointerData.Reset();
|
|
||||||
|
|
||||||
pointerData.position = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f) + aimerOffset;
|
|
||||||
|
|
||||||
eventSystem.RaycastAll(pointerData, m_RaycastResultCache);
|
|
||||||
var raycast = FindFirstRaycast(m_RaycastResultCache);
|
|
||||||
pointerData.pointerCurrentRaycast = raycast;
|
|
||||||
m_RaycastResultCache.Clear();
|
|
||||||
return pointerData;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProcessInteraction(PointerEventData pointer, bool pressed, bool released)
|
|
||||||
{
|
|
||||||
var currentOverGo = pointer.pointerCurrentRaycast.gameObject;
|
|
||||||
|
|
||||||
objectUnderAimer = ExecuteEvents.GetEventHandler<ISubmitHandler>(currentOverGo);//we only want objects that we can submit on.
|
|
||||||
|
|
||||||
if (pressed)
|
|
||||||
{
|
|
||||||
pointer.eligibleForClick = true;
|
|
||||||
pointer.delta = Vector2.zero;
|
|
||||||
pointer.pressPosition = pointer.position;
|
|
||||||
pointer.pointerPressRaycast = pointer.pointerCurrentRaycast;
|
|
||||||
|
|
||||||
// search for the control that will receive the press
|
|
||||||
// if we can't find a press handler set the press
|
|
||||||
// handler to be what would receive a click.
|
|
||||||
var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointer, ExecuteEvents.submitHandler);
|
|
||||||
|
|
||||||
// didn't find a press handler... search for a click handler
|
|
||||||
if (newPressed == null)
|
|
||||||
{
|
|
||||||
newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointer, ExecuteEvents.pointerDownHandler);
|
|
||||||
if (newPressed == null)
|
|
||||||
newPressed = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pointer.eligibleForClick = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newPressed != pointer.pointerPress)
|
|
||||||
{
|
|
||||||
pointer.pointerPress = newPressed;
|
|
||||||
pointer.rawPointerPress = currentOverGo;
|
|
||||||
pointer.clickCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the drag handler as well
|
|
||||||
pointer.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>(currentOverGo);
|
|
||||||
|
|
||||||
if (pointer.pointerDrag != null)
|
|
||||||
ExecuteEvents.Execute<IBeginDragHandler>(pointer.pointerDrag, pointer, ExecuteEvents.beginDragHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (released)
|
|
||||||
{
|
|
||||||
//Debug.Log("Executing pressup on: " + pointer.pointerPress);
|
|
||||||
ExecuteEvents.Execute(pointer.pointerPress, pointer, ExecuteEvents.pointerUpHandler);
|
|
||||||
|
|
||||||
//Debug.Log("KeyCode: " + pointer.eventData.keyCode);
|
|
||||||
|
|
||||||
// see if we mouse up on the same element that we clicked on...
|
|
||||||
var pointerUpHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo);
|
|
||||||
|
|
||||||
// PointerClick
|
|
||||||
if (pointer.pointerPress == pointerUpHandler && pointer.eligibleForClick)
|
|
||||||
{
|
|
||||||
float time = Time.unscaledTime;
|
|
||||||
|
|
||||||
if (time - pointer.clickTime < 0.3f)
|
|
||||||
++pointer.clickCount;
|
|
||||||
else
|
|
||||||
pointer.clickCount = 1;
|
|
||||||
pointer.clickTime = time;
|
|
||||||
|
|
||||||
ExecuteEvents.Execute(pointer.pointerPress, pointer, ExecuteEvents.pointerClickHandler);
|
|
||||||
}
|
|
||||||
else if (pointer.pointerDrag != null)
|
|
||||||
{
|
|
||||||
ExecuteEvents.ExecuteHierarchy(currentOverGo, pointer, ExecuteEvents.dropHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
pointer.eligibleForClick = false;
|
|
||||||
pointer.pointerPress = null;
|
|
||||||
pointer.rawPointerPress = null;
|
|
||||||
|
|
||||||
if (pointer.pointerDrag != null)
|
|
||||||
ExecuteEvents.Execute(pointer.pointerDrag, pointer, ExecuteEvents.endDragHandler);
|
|
||||||
|
|
||||||
pointer.pointerDrag = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DeactivateModule()
|
|
||||||
{
|
|
||||||
base.DeactivateModule();
|
|
||||||
ClearSelection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 08b9f423b73fdfb47b59e7de89863600
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
|
@ -1,226 +0,0 @@
|
||||||
/// Credit Simon (simonDarksideJ) Jackson
|
|
||||||
/// Sourced from - UI SIM source and My Brain
|
|
||||||
|
|
||||||
namespace UnityEngine.EventSystems
|
|
||||||
{
|
|
||||||
[AddComponentMenu("Event/Extensions/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";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name of the vertical axis for movement (if axis events are used).
|
|
||||||
/// </summary>
|
|
||||||
[SerializeField]
|
|
||||||
private string m_VerticalAxis = "Vertical";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name of the submit button.
|
|
||||||
/// </summary>
|
|
||||||
[SerializeField]
|
|
||||||
private string m_SubmitButton = "Submit";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name of the submit button.
|
|
||||||
/// </summary>
|
|
||||||
[SerializeField]
|
|
||||||
private string m_CancelButton = "Cancel";
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private float m_InputActionsPerSecond = 10;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private float m_RepeatDelay = 0.1f;
|
|
||||||
|
|
||||||
public float inputActionsPerSecond
|
|
||||||
{
|
|
||||||
get { return m_InputActionsPerSecond; }
|
|
||||||
set { m_InputActionsPerSecond = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public float repeatDelay
|
|
||||||
{
|
|
||||||
get { return m_RepeatDelay; }
|
|
||||||
set { m_RepeatDelay = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name of the horizontal axis for movement (if axis events are used).
|
|
||||||
/// </summary>
|
|
||||||
public string horizontalAxis
|
|
||||||
{
|
|
||||||
get { return m_HorizontalAxis; }
|
|
||||||
set { m_HorizontalAxis = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name of the vertical axis for movement (if axis events are used).
|
|
||||||
/// </summary>
|
|
||||||
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<StandaloneInputModule>();
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Process submit keys.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Process events.
|
|
||||||
/// </summary>
|
|
||||||
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 consecutive 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;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,16 +3,13 @@
|
||||||
/// Sourced from - https://github.com/ryanslikesocool/Unity-Card-UI
|
/// Sourced from - https://github.com/ryanslikesocool/Unity-Card-UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace UnityEngine.UI.Extensions
|
namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
|
|
||||||
public class CardStack2D : MonoBehaviour
|
public class CardStack2D : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float cardMoveSpeed = 8f;
|
private float cardMoveSpeed = 8f;
|
||||||
|
@ -25,8 +22,14 @@ public class CardStack2D : MonoBehaviour
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int usedCardXPos = 1280;
|
private int usedCardXPos = 1280;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
|
private KeyCode leftButton = KeyCode.LeftArrow;
|
||||||
|
[SerializeField]
|
||||||
|
private KeyCode rightButton = KeyCode.RightArrow;
|
||||||
|
[SerializeField]
|
||||||
private Transform[] cards = null;
|
private Transform[] cards = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int cardArrayOffset;
|
private int cardArrayOffset;
|
||||||
private Vector3[] cardPositions;
|
private Vector3[] cardPositions;
|
||||||
private int xPowerDifference;
|
private int xPowerDifference;
|
||||||
|
@ -76,12 +79,12 @@ public class CardStack2D : MonoBehaviour
|
||||||
if (canUseHorizontalAxis)
|
if (canUseHorizontalAxis)
|
||||||
{
|
{
|
||||||
///Controls for the cards.
|
///Controls for the cards.
|
||||||
if (Input.GetAxisRaw("Horizontal") < 0 && cardArrayOffset > 0)
|
if ((UIExtensionsInputManager.GetAxisRaw("Horizontal") < 0 || UIExtensionsInputManager.GetKey(leftButton)) && cardArrayOffset > 0)
|
||||||
{
|
{
|
||||||
cardArrayOffset--;
|
cardArrayOffset--;
|
||||||
StartCoroutine(ButtonCooldown());
|
StartCoroutine(ButtonCooldown());
|
||||||
}
|
}
|
||||||
else if (Input.GetAxisRaw("Horizontal") > 0 && cardArrayOffset < cards.Length - 1)
|
else if ((UIExtensionsInputManager.GetAxisRaw("Horizontal") > 0 || UIExtensionsInputManager.GetKey(rightButton)) && cardArrayOffset < cards.Length - 1)
|
||||||
{
|
{
|
||||||
cardArrayOffset++;
|
cardArrayOffset++;
|
||||||
StartCoroutine(ButtonCooldown());
|
StartCoroutine(ButtonCooldown());
|
||||||
|
@ -116,5 +119,5 @@ public class CardStack2D : MonoBehaviour
|
||||||
yield return new WaitForSeconds(buttonCooldownTime);
|
yield return new WaitForSeconds(buttonCooldownTime);
|
||||||
canUseHorizontalAxis = true;
|
canUseHorizontalAxis = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -200,7 +200,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!Input.GetMouseButton(0))
|
if (!UIExtensionsInputManager.GetMouseButton(0))
|
||||||
{
|
{
|
||||||
// scroll slowly to nearest element when not dragged
|
// scroll slowly to nearest element when not dragged
|
||||||
ScrollingElements();
|
ScrollingElements();
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
// On Android the back button is sent as Esc
|
// On Android the back button is sent as Esc
|
||||||
if (Input.GetKeyDown(KeyCode.Escape) && menuStack.Count > 0)
|
if (UIExtensionsInputManager.GetKeyDown(KeyCode.Escape) && menuStack.Count > 0)
|
||||||
{
|
{
|
||||||
menuStack.Peek().OnBackPressed();
|
menuStack.Peek().OnBackPressed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Tab) && Input.GetKey(KeyCode.LeftShift))
|
if (UIExtensionsInputManager.GetKeyDown(KeyCode.Tab) && UIExtensionsInputManager.GetKey(KeyCode.LeftShift))
|
||||||
{
|
{
|
||||||
if (NavigationMode == NavigationMode.Manual && NavigationPath.Length > 0)
|
if (NavigationMode == NavigationMode.Manual && NavigationPath.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Input.GetKeyDown(KeyCode.Tab))
|
else if (UIExtensionsInputManager.GetKeyDown(KeyCode.Tab))
|
||||||
{
|
{
|
||||||
if (NavigationMode == NavigationMode.Manual && NavigationPath.Length > 0)
|
if (NavigationMode == NavigationMode.Manual && NavigationPath.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -135,7 +135,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
public void OnScreenSpaceCamera()
|
public void OnScreenSpaceCamera()
|
||||||
{
|
{
|
||||||
//get the dynamic position of the pos in viewport coordinates
|
//get the dynamic position of the pos in viewport coordinates
|
||||||
Vector3 newPos = GUICamera.ScreenToViewportPoint(Input.mousePosition);
|
Vector3 newPos = GUICamera.ScreenToViewportPoint(UIExtensionsInputManager.MousePosition);
|
||||||
|
|
||||||
// store in val the updated position (x or y) of the tooltip edge of interest
|
// store in val the updated position (x or y) of the tooltip edge of interest
|
||||||
float val;
|
float val;
|
||||||
|
|
|
@ -55,10 +55,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
switch (tooltipPositioningType) {
|
switch (tooltipPositioningType) {
|
||||||
case TooltipPositioningType.mousePosition:
|
case TooltipPositioningType.mousePosition:
|
||||||
StartHover(Input.mousePosition + offset, true);
|
StartHover(UIExtensionsInputManager.MousePosition + offset, true);
|
||||||
break;
|
break;
|
||||||
case TooltipPositioningType.mousePositionAndFollow:
|
case TooltipPositioningType.mousePositionAndFollow:
|
||||||
StartHover(Input.mousePosition + offset, true);
|
StartHover(UIExtensionsInputManager.MousePosition + offset, true);
|
||||||
hovered = true;
|
hovered = true;
|
||||||
StartCoroutine(HoveredMouseFollowingLoop());
|
StartCoroutine(HoveredMouseFollowingLoop());
|
||||||
break;
|
break;
|
||||||
|
@ -72,7 +72,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
IEnumerator HoveredMouseFollowingLoop() {
|
IEnumerator HoveredMouseFollowingLoop() {
|
||||||
while (hovered) {
|
while (hovered) {
|
||||||
StartHover(Input.mousePosition + offset);
|
StartHover(UIExtensionsInputManager.MousePosition + offset);
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
public void OnEndEdit(string txt)
|
public void OnEndEdit(string txt)
|
||||||
{
|
{
|
||||||
if (!Input.GetKeyDown(KeyCode.Return) && !Input.GetKeyDown(KeyCode.KeypadEnter))
|
if (!UIExtensionsInputManager.GetKeyDown(KeyCode.Return) && !UIExtensionsInputManager.GetKeyDown(KeyCode.KeypadEnter))
|
||||||
return;
|
return;
|
||||||
EnterSubmit.Invoke(txt);
|
EnterSubmit.Invoke(txt);
|
||||||
if (defocusInput)
|
if (defocusInput)
|
||||||
|
|
|
@ -0,0 +1,273 @@
|
||||||
|
/// Credit SimonDarksideJ
|
||||||
|
/// Sourced from: https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/issues/348/menu-manager-does-not-work-with-the-new
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
using UnityEngine.InputSystem.Controls;
|
||||||
|
|
||||||
|
namespace UnityEngine.UI.Extensions
|
||||||
|
{
|
||||||
|
public static class UIExtensionsInputManager
|
||||||
|
{
|
||||||
|
#if !ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
private static bool[] mouseButtons = new bool[3] { false, false, false };
|
||||||
|
private static Dictionary<KeyCode, bool> keys = new Dictionary<KeyCode, bool>();
|
||||||
|
private static Dictionary<String, bool> buttons = new Dictionary<String, bool>();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public static bool GetMouseButton(int button)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetMouseButton(button);
|
||||||
|
#else
|
||||||
|
if (Mouse.current == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Mouse.current.leftButton.isPressed;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetMouseButtonDown(int button)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetMouseButtonDown(button);
|
||||||
|
#else
|
||||||
|
if (Mouse.current == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Mouse.current.leftButton.isPressed)
|
||||||
|
{
|
||||||
|
if (!mouseButtons[button])
|
||||||
|
{
|
||||||
|
mouseButtons[button] = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetMouseButtonUp(int button)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetMouseButtonUp(button);
|
||||||
|
#else
|
||||||
|
if (Mouse.current == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mouseButtons[button] && !Mouse.current.leftButton.isPressed)
|
||||||
|
{
|
||||||
|
mouseButtons[button] = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetButton(string input)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetButton(input);
|
||||||
|
#else
|
||||||
|
ButtonControl buttonPressed = GetButtonControlFromString(input);
|
||||||
|
|
||||||
|
if (!buttons.ContainsKey(input))
|
||||||
|
{
|
||||||
|
buttons.Add(input, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buttonPressed != null ? buttonPressed.isPressed : false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ButtonControl GetButtonControlFromString(string input)
|
||||||
|
{
|
||||||
|
if (Gamepad.current == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (input)
|
||||||
|
{
|
||||||
|
case "Submit":
|
||||||
|
return Gamepad.current.aButton;
|
||||||
|
case "Cancel":
|
||||||
|
return Gamepad.current.bButton;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetButtonDown(string input)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetButtonDown(input);
|
||||||
|
#else
|
||||||
|
ButtonControl buttonPressed = GetButtonControlFromString(input);
|
||||||
|
|
||||||
|
if (buttonPressed.isPressed)
|
||||||
|
{
|
||||||
|
if (!buttons.ContainsKey(input))
|
||||||
|
{
|
||||||
|
buttons.Add(input, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!buttons[input])
|
||||||
|
{
|
||||||
|
buttons[input] = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buttons[input] = false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetButtonUp(string input)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetButtonUp(input);
|
||||||
|
#else
|
||||||
|
ButtonControl buttonPressed = GetButtonControlFromString(input);
|
||||||
|
|
||||||
|
if (buttons[input] && !buttonPressed.isPressed)
|
||||||
|
{
|
||||||
|
buttons[input] = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetKey(KeyCode key)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetKey(key);
|
||||||
|
#else
|
||||||
|
KeyControl keyPressed = GetKeyControlFromKeyCode(key);
|
||||||
|
if (!keys.ContainsKey(key))
|
||||||
|
{
|
||||||
|
keys.Add(key, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyPressed != null ? keyPressed.isPressed : false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private static KeyControl GetKeyControlFromKeyCode(KeyCode key)
|
||||||
|
{
|
||||||
|
if (Keyboard.current == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case KeyCode.Escape:
|
||||||
|
return Keyboard.current.escapeKey;
|
||||||
|
case KeyCode.KeypadEnter:
|
||||||
|
return Keyboard.current.numpadEnterKey;
|
||||||
|
case KeyCode.UpArrow:
|
||||||
|
return Keyboard.current.upArrowKey;
|
||||||
|
case KeyCode.DownArrow:
|
||||||
|
return Keyboard.current.downArrowKey;
|
||||||
|
case KeyCode.RightArrow:
|
||||||
|
return Keyboard.current.rightArrowKey;
|
||||||
|
case KeyCode.LeftArrow:
|
||||||
|
return Keyboard.current.leftArrowKey;
|
||||||
|
case KeyCode.LeftShift:
|
||||||
|
return Keyboard.current.leftShiftKey;
|
||||||
|
case KeyCode.Tab:
|
||||||
|
return Keyboard.current.tabKey;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetKeyDown(KeyCode key)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetKeyDown(key);
|
||||||
|
#else
|
||||||
|
KeyControl keyPressed = GetKeyControlFromKeyCode(key);
|
||||||
|
if (keyPressed.isPressed)
|
||||||
|
{
|
||||||
|
if (!keys.ContainsKey(key))
|
||||||
|
{
|
||||||
|
keys.Add(key, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!keys[key])
|
||||||
|
{
|
||||||
|
keys[key] = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
keys[key] = false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetKeyUp(KeyCode key)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetKeyUp(key);
|
||||||
|
#else
|
||||||
|
KeyControl keyPressed = GetKeyControlFromKeyCode(key);
|
||||||
|
if (keys[key] && !keyPressed.isPressed)
|
||||||
|
{
|
||||||
|
keys[key] = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float GetAxisRaw(string axis)
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.GetAxisRaw(axis);
|
||||||
|
#else
|
||||||
|
if (Gamepad.current == null)
|
||||||
|
{
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (axis)
|
||||||
|
{
|
||||||
|
case "Horizontal":
|
||||||
|
return Gamepad.current.leftStick.x.ReadValue();
|
||||||
|
case "Vertical":
|
||||||
|
return Gamepad.current.leftStick.y.ReadValue();
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0f;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 MousePosition
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||||
|
return Input.mousePosition;
|
||||||
|
#else
|
||||||
|
return Mouse.current.position.ReadValue();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 26158f38115d49a4a915f46c7eced4ab
|
guid: de7e73fc10fb95143a19dbc76c2595a7
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {instanceID: 0}
|
||||||
userData:
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -124,7 +124,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
for (int i = 0; i < CancelScrollKeycodes.Count; i++)
|
for (int i = 0; i < CancelScrollKeycodes.Count; i++)
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(CancelScrollKeycodes[i]) == true)
|
if (UIExtensionsInputManager.GetKeyDown(CancelScrollKeycodes[i]) == true)
|
||||||
{
|
{
|
||||||
IsManualScrollingAvailable = true;
|
IsManualScrollingAvailable = true;
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,15 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
Vector3 thisPosition;
|
Vector3 thisPosition;
|
||||||
|
|
||||||
thisPosition.x = Input.mousePosition.x * xSens;
|
thisPosition.x = UIExtensionsInputManager.MousePosition.x * xSens;
|
||||||
thisPosition.y = Input.mousePosition.y * ySens - 1;
|
thisPosition.y = UIExtensionsInputManager.MousePosition.y * ySens - 1;
|
||||||
thisPosition.z = transform.position.z;
|
thisPosition.z = transform.position.z;
|
||||||
|
|
||||||
transform.position = thisPosition;
|
transform.position = thisPosition;
|
||||||
|
|
||||||
VRInputModule.cursorPosition = transform.position;
|
VRInputModule.cursorPosition = transform.position;
|
||||||
|
|
||||||
if (Input.GetMouseButtonDown(0) && currentCollider)
|
if (UIExtensionsInputManager.GetMouseButtonDown(0) && currentCollider)
|
||||||
{
|
{
|
||||||
VRInputModule.PointerSubmit(currentCollider.gameObject);
|
VRInputModule.PointerSubmit(currentCollider.gameObject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "UnityUIExtensions",
|
"name": "UnityUIExtensions",
|
||||||
"references": [
|
"references": [
|
||||||
"GUID:2bafac87e7f4b9b418d9448d219b01ab"
|
"GUID:2bafac87e7f4b9b418d9448d219b01ab",
|
||||||
|
"GUID:75469ad4d38634e559750d17036d5f7c"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
@ -10,5 +11,6 @@
|
||||||
"precompiledReferences": [],
|
"precompiledReferences": [],
|
||||||
"autoReferenced": true,
|
"autoReferenced": true,
|
||||||
"defineConstraints": [],
|
"defineConstraints": [],
|
||||||
"versionDefines": []
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
}
|
}
|
Loading…
Reference in New Issue