Resolved a number of .NET warnings and invalid properties

pull/413/head
Simon (Darkside) Jackson 2019-03-07 18:11:51 +00:00
parent 22b2ec2ec2
commit 43eaa870e1
23 changed files with 104 additions and 105 deletions

View File

@ -6,7 +6,7 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example01Scene : MonoBehaviour public class Example01Scene : MonoBehaviour
{ {
[SerializeField] [SerializeField]
Example01ScrollView scrollView; Example01ScrollView scrollView = null;
void Start() void Start()
{ {

View File

@ -6,7 +6,7 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example01ScrollView : FancyScrollView<Example01CellDto> public class Example01ScrollView : FancyScrollView<Example01CellDto>
{ {
[SerializeField] [SerializeField]
ScrollPositionController scrollPositionController; ScrollPositionController scrollPositionController = null;
void Awake() void Awake()
{ {

View File

@ -6,9 +6,9 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example01ScrollViewCell : FancyScrollViewCell<Example01CellDto> public class Example01ScrollViewCell : FancyScrollViewCell<Example01CellDto>
{ {
[SerializeField] [SerializeField]
Animator animator; Animator animator = null;
[SerializeField] [SerializeField]
Text message; Text message = null;
static readonly int scrollTriggerHash = Animator.StringToHash("scroll"); static readonly int scrollTriggerHash = Animator.StringToHash("scroll");

View File

@ -6,7 +6,7 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example02Scene : MonoBehaviour public class Example02Scene : MonoBehaviour
{ {
[SerializeField] [SerializeField]
Example02ScrollView scrollView; Example02ScrollView scrollView = null;
void Start() void Start()
{ {

View File

@ -6,7 +6,7 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example02ScrollView : FancyScrollView<Example02CellDto, Example02ScrollViewContext> public class Example02ScrollView : FancyScrollView<Example02CellDto, Example02ScrollViewContext>
{ {
[SerializeField] [SerializeField]
ScrollPositionController scrollPositionController; ScrollPositionController scrollPositionController = null;
void Awake() void Awake()
{ {

View File

@ -6,13 +6,13 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example02ScrollViewCell : FancyScrollViewCell<Example02CellDto, Example02ScrollViewContext> public class Example02ScrollViewCell : FancyScrollViewCell<Example02CellDto, Example02ScrollViewContext>
{ {
[SerializeField] [SerializeField]
Animator animator; Animator animator = null;
[SerializeField] [SerializeField]
Text message; Text message = null;
[SerializeField] [SerializeField]
Image image; Image image = null;
[SerializeField] [SerializeField]
Button button; Button button = null;
static readonly int scrollTriggerHash = Animator.StringToHash("scroll"); static readonly int scrollTriggerHash = Animator.StringToHash("scroll");

View File

@ -6,7 +6,7 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example03Scene : MonoBehaviour public class Example03Scene : MonoBehaviour
{ {
[SerializeField] [SerializeField]
Example03ScrollView scrollView; Example03ScrollView scrollView = null;
void Start() void Start()
{ {

View File

@ -6,7 +6,7 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example03ScrollView : FancyScrollView<Example03CellDto, Example03ScrollViewContext> public class Example03ScrollView : FancyScrollView<Example03CellDto, Example03ScrollViewContext>
{ {
[SerializeField] [SerializeField]
ScrollPositionController scrollPositionController; ScrollPositionController scrollPositionController = null;
void Awake() void Awake()
{ {

View File

@ -6,13 +6,13 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example03ScrollViewCell : FancyScrollViewCell<Example03CellDto, Example03ScrollViewContext> public class Example03ScrollViewCell : FancyScrollViewCell<Example03CellDto, Example03ScrollViewContext>
{ {
[SerializeField] [SerializeField]
Animator animator; Animator animator = null;
[SerializeField] [SerializeField]
Text message; Text message = null;
[SerializeField] [SerializeField]
Image image; Image image = null;
[SerializeField] [SerializeField]
Button button; Button button = null;
static readonly int scrollTriggerHash = Animator.StringToHash("scroll"); static readonly int scrollTriggerHash = Animator.StringToHash("scroll");

View File

@ -8,13 +8,13 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example04Scene : MonoBehaviour public class Example04Scene : MonoBehaviour
{ {
[SerializeField] [SerializeField]
Example04ScrollView scrollView; Example04ScrollView scrollView = null;
[SerializeField] [SerializeField]
Button prevCellButton; Button prevCellButton = null;
[SerializeField] [SerializeField]
Button nextCellButton; Button nextCellButton = null;
[SerializeField] [SerializeField]
Text selectedItemInfo; Text selectedItemInfo = null;
void Start() void Start()
{ {

View File

@ -7,7 +7,7 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example04ScrollView : FancyScrollView<Example04CellDto, Example04ScrollViewContext> public class Example04ScrollView : FancyScrollView<Example04CellDto, Example04ScrollViewContext>
{ {
[SerializeField] [SerializeField]
ScrollPositionController scrollPositionController; ScrollPositionController scrollPositionController = null;
Action<int> onSelectedIndexChanged; Action<int> onSelectedIndexChanged;

View File

@ -6,13 +6,13 @@ namespace UnityEngine.UI.Extensions.Examples
public class Example04ScrollViewCell : FancyScrollViewCell<Example04CellDto, Example04ScrollViewContext> public class Example04ScrollViewCell : FancyScrollViewCell<Example04CellDto, Example04ScrollViewContext>
{ {
[SerializeField] [SerializeField]
Animator animator; Animator animator = null;
[SerializeField] [SerializeField]
Text message; Text message = null;
[SerializeField] [SerializeField]
Image image; Image image = null;
[SerializeField] [SerializeField]
Button button; Button button = null;
static readonly int scrollTriggerHash = Animator.StringToHash("scroll"); static readonly int scrollTriggerHash = Animator.StringToHash("scroll");

View File

@ -298,8 +298,12 @@ namespace UnityEngine.UI.Extensions
anchorMin[0] = anchorMax[0] = (NormalizedValueX); anchorMin[0] = anchorMax[0] = (NormalizedValueX);
anchorMin[1] = anchorMax[1] = (NormalizedValueY); anchorMin[1] = anchorMax[1] = (NormalizedValueY);
m_HandleRect.anchorMin = anchorMin; if (Application.isPlaying)
m_HandleRect.anchorMax = anchorMax; {
m_HandleRect.anchorMin = anchorMin;
m_HandleRect.anchorMax = anchorMax;
}
} }
} }

View File

@ -33,7 +33,7 @@ namespace UnityEngine.UI.Extensions.ColorPicker
List<GameObject> rgbSliders = new List<GameObject>(); List<GameObject> rgbSliders = new List<GameObject>();
[SerializeField] [SerializeField]
GameObject alphaSlider; GameObject alphaSlider = null;
public void SetHSVSlidersOn(bool value) public void SetHSVSlidersOn(bool value)
{ {

View File

@ -371,8 +371,8 @@ namespace UnityEngine.UI.Extensions
pSystem = null; pSystem = null;
Initialize(); Initialize();
} }
void OnDestroy() protected override void OnDestroy()
{ {
currentMaterial = null; currentMaterial = null;
currentTexture = null; currentTexture = null;

View File

@ -17,22 +17,22 @@ public class CardExpanding2D : MonoBehaviour
private float lerpSpeed = 8f; private float lerpSpeed = 8f;
[SerializeField] [SerializeField]
private RectTransform buttonRect; private RectTransform buttonRect = null;
private Vector2 closeButtonMin; private Vector2 closeButtonMin = Vector2.zero;
private Vector2 closeButtonMax; private Vector2 closeButtonMax = Vector2.zero;
[SerializeField] [SerializeField]
private Vector2 cardSize; private Vector2 cardSize = Vector2.zero;
[SerializeField] [SerializeField]
private Vector2 pageSize; private Vector2 pageSize = Vector2.zero;
private Vector2 cardCenter; private Vector2 cardCenter = Vector2.zero;
private Vector2 pageCenter = Vector2.zero; private Vector2 pageCenter = Vector2.zero;
private Vector2 cardMin; private Vector2 cardMin = Vector2.zero;
private Vector2 cardMax; private Vector2 cardMax = Vector2.zero;
private Vector2 pageMin; private Vector2 pageMin = Vector2.zero;
private Vector2 pageMax; private Vector2 pageMax = Vector2.zero;
private RectTransform rectTrans; private RectTransform rectTrans;
///I wouldn't recommend changing animationActive's value here unless you want the card to start as a page. ///I wouldn't recommend changing animationActive's value here unless you want the card to start as a page.

View File

@ -18,7 +18,7 @@ public class CardPopup2D : MonoBehaviour
[SerializeField] [SerializeField]
private float centeringSpeed = 4f; private float centeringSpeed = 4f;
[SerializeField] [SerializeField]
private bool singleScene; private bool singleScene = false;
private Rigidbody rbody; private Rigidbody rbody;
private bool isFalling; private bool isFalling;

View File

@ -25,7 +25,7 @@ public class CardStack2D : MonoBehaviour
[SerializeField] [SerializeField]
private int usedCardXPos = 1280; private int usedCardXPos = 1280;
[SerializeField] [SerializeField]
private Transform[] cards; private Transform[] cards = null;
private int cardArrayOffset; private int cardArrayOffset;
private Vector3[] cardPositions; private Vector3[] cardPositions;

View File

@ -39,7 +39,7 @@ namespace UnityEngine.UI.Extensions
[SerializeField] [SerializeField]
[Tooltip("Event is triggered whenever the scroll rect starts to move, even when triggered programatically")] [Tooltip("Event is triggered whenever the scroll rect starts to move, even when triggered programatically")]
private StartMovementEvent m_StartMovementEvent = new StartMovementEvent(); private StartMovementEvent m_StartMovementEvent = new StartMovementEvent();
public StartMovementEvent startMovementEvent public StartMovementEvent MovementStarted
{ {
get get
{ {
@ -54,7 +54,7 @@ namespace UnityEngine.UI.Extensions
[SerializeField] [SerializeField]
[Tooltip("Event is triggered whenever the closest item to the center of the scrollrect changes")] [Tooltip("Event is triggered whenever the closest item to the center of the scrollrect changes")]
private CurrentItemChangeEvent m_CurrentItemChangeEvent = new CurrentItemChangeEvent(); private CurrentItemChangeEvent m_CurrentItemChangeEvent = new CurrentItemChangeEvent();
public CurrentItemChangeEvent currentItemChangeEvent public CurrentItemChangeEvent CurrentItemChanged
{ {
get get
{ {
@ -69,7 +69,7 @@ namespace UnityEngine.UI.Extensions
[SerializeField] [SerializeField]
[Tooltip("Event is triggered when the ContentSnapScroll decides which item it is going to snap to. Returns the index of the closest position.")] [Tooltip("Event is triggered when the ContentSnapScroll decides which item it is going to snap to. Returns the index of the closest position.")]
private FoundItemToSnapToEvent m_FoundItemToSnapToEvent = new FoundItemToSnapToEvent(); private FoundItemToSnapToEvent m_FoundItemToSnapToEvent = new FoundItemToSnapToEvent();
public FoundItemToSnapToEvent foundItemToSnapToEvent public FoundItemToSnapToEvent ItemFoundToSnap
{ {
get get
{ {
@ -84,7 +84,7 @@ namespace UnityEngine.UI.Extensions
[SerializeField] [SerializeField]
[Tooltip("Event is triggered when we finally settle on an element. Returns the index of the item's position.")] [Tooltip("Event is triggered when we finally settle on an element. Returns the index of the item's position.")]
private SnappedToItemEvent m_SnappedToItemEvent = new SnappedToItemEvent(); private SnappedToItemEvent m_SnappedToItemEvent = new SnappedToItemEvent();
public SnappedToItemEvent snappedToItemEvent public SnappedToItemEvent ItemSnappedTo
{ {
get get
{ {
@ -96,20 +96,18 @@ namespace UnityEngine.UI.Extensions
} }
} }
private ScrollRect scrollRect; private ScrollRect scrollRect = null;
private RectTransform scrollRectTransform; private RectTransform scrollRectTransform = null;
private RectTransform contentTransform; private RectTransform contentTransform = null;
private List<Vector3> contentPositions; private List<Vector3> contentPositions = null;
private Vector3 lerpTarget; private Vector3 lerpTarget = Vector3.zero;
private float totalScrollableWidth; private float totalScrollableWidth = 0;
private DrivenRectTransformTracker tracker; private DrivenRectTransformTracker tracker ;
private bool lerp; private float mLerpTime = 0;
private float mLerpTime; private int _closestItem = 0;
private int _closestItem; private bool mSliding = false;
private bool lerpToContentRunning; private bool mLerping = false;
private bool mSliding; private bool ContentIsHorizonalLayoutGroup
private bool mLerping;
private bool contentIsHorizonalLayoutGroup
{ {
get get
{ {
@ -121,18 +119,18 @@ namespace UnityEngine.UI.Extensions
/// <summary> /// <summary>
/// Returns if the SnapScroll is moving /// Returns if the SnapScroll is moving
/// </summary> /// </summary>
public bool moving public bool Moving
{ {
get get
{ {
return sliding || lerping; return Sliding || Lerping;
} }
} }
/// <summary> /// <summary>
/// Returns if the SnapScroll is moving because of a touch /// Returns if the SnapScroll is moving because of a touch
/// </summary> /// </summary>
public bool sliding public bool Sliding
{ {
get get
{ {
@ -142,7 +140,7 @@ namespace UnityEngine.UI.Extensions
/// <summary> /// <summary>
/// Returns if the SnapScroll is moving programmatically /// Returns if the SnapScroll is moving programmatically
/// </summary> /// </summary>
public bool lerping public bool Lerping
{ {
get get
{ {
@ -154,7 +152,7 @@ namespace UnityEngine.UI.Extensions
/// Returns the closest item's index /// Returns the closest item's index
/// *Note this is zero based, and based on position not child order /// *Note this is zero based, and based on position not child order
/// </summary> /// </summary>
public int closestItemIndex public int ClosestItemIndex
{ {
get get
{ {
@ -165,7 +163,7 @@ namespace UnityEngine.UI.Extensions
/// Returns the lerpTarget's index /// Returns the lerpTarget's index
/// *Note this is zero-based, and based on position not child order /// *Note this is zero-based, and based on position not child order
/// </summary> /// </summary>
public int lerpTargetIndex public int LerpTargetIndex
{ {
get get
{ {
@ -216,7 +214,7 @@ namespace UnityEngine.UI.Extensions
private void SetupSnapScroll() private void SetupSnapScroll()
{ {
if (contentIsHorizonalLayoutGroup) if (ContentIsHorizonalLayoutGroup)
{ {
//because you can't get the anchored positions of UI elements //because you can't get the anchored positions of UI elements
//when they are in a layout group (as far as I could tell) //when they are in a layout group (as far as I could tell)
@ -320,9 +318,9 @@ namespace UnityEngine.UI.Extensions
/// <param name="info">All of the info about how you want it to move</param> /// <param name="info">All of the info about how you want it to move</param>
public void GoTo(MoveInfo info) public void GoTo(MoveInfo info)
{ {
if (!moving && info.index != closestItemIndex) if (!Moving && info.index != ClosestItemIndex)
{ {
startMovementEvent.Invoke(); MovementStarted.Invoke();
} }
if (info.indexType == MoveInfo.IndexType.childIndex) if (info.indexType == MoveInfo.IndexType.childIndex)
@ -341,7 +339,7 @@ namespace UnityEngine.UI.Extensions
{ {
int clampedIndex = Mathf.Clamp(index, 0, contentPositions.Count - 1); //contentPositions amount == the amount of available children int clampedIndex = Mathf.Clamp(index, 0, contentPositions.Count - 1); //contentPositions amount == the amount of available children
if (contentIsHorizonalLayoutGroup) //the contentPositions are in child order if (ContentIsHorizonalLayoutGroup) //the contentPositions are in child order
{ {
lerpTarget = contentPositions[clampedIndex]; lerpTarget = contentPositions[clampedIndex];
if (jump) if (jump)
@ -408,13 +406,13 @@ namespace UnityEngine.UI.Extensions
public void NextItem() public void NextItem()
{ {
int index; int index;
if (sliding) if (Sliding)
{ {
index = closestItemIndex + 1; index = ClosestItemIndex + 1;
} }
else else
{ {
index = lerpTargetIndex + 1; index = LerpTargetIndex + 1;
} }
MoveInfo info = new MoveInfo(MoveInfo.IndexType.positionIndex, index, jumpToItem, lerpTime); MoveInfo info = new MoveInfo(MoveInfo.IndexType.positionIndex, index, jumpToItem, lerpTime);
GoTo(info); GoTo(info);
@ -427,13 +425,13 @@ namespace UnityEngine.UI.Extensions
public void PreviousItem() public void PreviousItem()
{ {
int index; int index;
if (sliding) if (Sliding)
{ {
index = closestItemIndex - 1; index = ClosestItemIndex - 1;
} }
else else
{ {
index = lerpTargetIndex - 1; index = LerpTargetIndex - 1;
} }
MoveInfo info = new MoveInfo(MoveInfo.IndexType.positionIndex, index, jumpToItem, lerpTime); MoveInfo info = new MoveInfo(MoveInfo.IndexType.positionIndex, index, jumpToItem, lerpTime);
GoTo(info); GoTo(info);
@ -464,9 +462,9 @@ namespace UnityEngine.UI.Extensions
public void OnBeginDrag(PointerEventData ped) public void OnBeginDrag(PointerEventData ped)
{ {
StopMovement(); StopMovement();
if (!moving) if (!Moving)
{ {
startMovementEvent.Invoke(); MovementStarted.Invoke();
} }
} }
@ -477,11 +475,11 @@ namespace UnityEngine.UI.Extensions
private void Update() private void Update()
{ {
if (_closestItem != closestItemIndex) if (_closestItem != ClosestItemIndex)
{ {
currentItemChangeEvent.Invoke(closestItemIndex); CurrentItemChanged.Invoke(ClosestItemIndex);
ChangePaginationInfo(closestItemIndex); ChangePaginationInfo(ClosestItemIndex);
_closestItem = closestItemIndex; _closestItem = ClosestItemIndex;
} }
} }
@ -494,7 +492,7 @@ namespace UnityEngine.UI.Extensions
} }
lerpTarget = FindClosestFrom(contentTransform.localPosition); lerpTarget = FindClosestFrom(contentTransform.localPosition);
foundItemToSnapToEvent.Invoke(lerpTargetIndex); ItemFoundToSnap.Invoke(LerpTargetIndex);
while (Vector3.Distance(contentTransform.localPosition, lerpTarget) > 1) while (Vector3.Distance(contentTransform.localPosition, lerpTarget) > 1)
{ {
@ -504,12 +502,12 @@ namespace UnityEngine.UI.Extensions
mSliding = false; mSliding = false;
scrollRect.velocity = Vector2.zero; scrollRect.velocity = Vector2.zero;
contentTransform.localPosition = lerpTarget; contentTransform.localPosition = lerpTarget;
snappedToItemEvent.Invoke(lerpTargetIndex); ItemSnappedTo.Invoke(LerpTargetIndex);
} }
private IEnumerator LerpToContent() private IEnumerator LerpToContent()
{ {
foundItemToSnapToEvent.Invoke(lerpTargetIndex); ItemFoundToSnap.Invoke(LerpTargetIndex);
mLerping = true; mLerping = true;
Vector3 originalContentPos = contentTransform.localPosition; Vector3 originalContentPos = contentTransform.localPosition;
float elapsedTime = 0; float elapsedTime = 0;
@ -519,7 +517,7 @@ namespace UnityEngine.UI.Extensions
contentTransform.localPosition = Vector3.Lerp(originalContentPos, lerpTarget, (elapsedTime / mLerpTime)); contentTransform.localPosition = Vector3.Lerp(originalContentPos, lerpTarget, (elapsedTime / mLerpTime));
yield return null; yield return null;
} }
snappedToItemEvent.Invoke(lerpTargetIndex); ItemSnappedTo.Invoke(LerpTargetIndex);
mLerping = false; mLerping = false;
} }
#endregion #endregion

View File

@ -8,15 +8,15 @@ namespace UnityEngine.UI.Extensions
public abstract class FancyScrollView<TData, TContext> : MonoBehaviour where TContext : class public abstract class FancyScrollView<TData, TContext> : MonoBehaviour where TContext : class
{ {
[SerializeField, Range(float.Epsilon, 1f)] [SerializeField, Range(float.Epsilon, 1f)]
float cellInterval; float cellInterval = 0;
[SerializeField, Range(0f, 1f)] [SerializeField, Range(0f, 1f)]
float cellOffset; float cellOffset = 0;
[SerializeField] [SerializeField]
bool loop; bool loop = false;
[SerializeField] [SerializeField]
GameObject cellBase; GameObject cellBase = null;
[SerializeField] [SerializeField]
Transform cellContainer; Transform cellContainer = null;
readonly List<FancyScrollViewCell<TData, TContext>> cells = new List<FancyScrollViewCell<TData, TContext>>(); readonly List<FancyScrollViewCell<TData, TContext>> cells = new List<FancyScrollViewCell<TData, TContext>>();
float currentPosition; float currentPosition;

View File

@ -10,7 +10,7 @@ namespace UnityEngine.UI.Extensions
public class ScrollPositionController : UIBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler public class ScrollPositionController : UIBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
{ {
[SerializeField] [SerializeField]
RectTransform viewport; RectTransform viewport = null;
[SerializeField] [SerializeField]
ScrollDirection directionOfRecognize = ScrollDirection.Vertical; ScrollDirection directionOfRecognize = ScrollDirection.Vertical;
[SerializeField] [SerializeField]

View File

@ -29,9 +29,8 @@ namespace UnityEngine.UI.Extensions
private bool scrollToSelection = true; private bool scrollToSelection = true;
// references // references
private RectTransform scrollWindow; private RectTransform scrollWindow = null;
private RectTransform currentCanvas; private ScrollRect targetScrollRect = null;
private ScrollRect targetScrollRect;
#endregion #endregion
// Use this for initialization // Use this for initialization
@ -85,8 +84,6 @@ namespace UnityEngine.UI.Extensions
// move the current scroll rect to correct position // move the current scroll rect to correct position
float selectionPos = -selection.anchoredPosition.y; float selectionPos = -selection.anchoredPosition.y;
//float elementHeight = layoutListGroup.sizeDelta.y / layoutListGroup.transform.childCount;
//float maskHeight = currentCanvas.sizeDelta.y + scrollWindow.sizeDelta.y;
float listPixelAnchor = layoutListGroup.anchoredPosition.y; float listPixelAnchor = layoutListGroup.anchoredPosition.y;
// get the element offset value depending on the cursor move direction // get the element offset value depending on the cursor move direction
@ -104,8 +101,6 @@ namespace UnityEngine.UI.Extensions
// move the current scroll rect to correct position // move the current scroll rect to correct position
float selectionPos = -selection.anchoredPosition.x; float selectionPos = -selection.anchoredPosition.x;
//float elementWidth = layoutListGroup.sizeDelta.x / layoutListGroup.transform.childCount;
//float maskWidth = currentCanvas.sizeDelta.y + scrollWindow.sizeDelta.y;
float listPixelAnchor = layoutListGroup.anchoredPosition.x; float listPixelAnchor = layoutListGroup.anchoredPosition.x;
// get the element offset value depending on the cursor move direction // get the element offset value depending on the cursor move direction

View File

@ -12,8 +12,6 @@ namespace UnityEngine.UI.Extensions
static VRInputModule _singleton; static VRInputModule _singleton;
private int counter;
private static bool mouseClicked; private static bool mouseClicked;
public static Vector3 cursorPosition; public static Vector3 cursorPosition;
@ -38,8 +36,10 @@ namespace UnityEngine.UI.Extensions
if (mouseClicked) if (mouseClicked)
{ {
//BaseEventData data = GetBaseEventData(); //Original from Process(). Can't be called here so is replaced by the next line: //BaseEventData data = GetBaseEventData(); //Original from Process(). Can't be called here so is replaced by the next line:
BaseEventData data = new BaseEventData(_singleton.eventSystem); BaseEventData data = new BaseEventData(_singleton.eventSystem)
data.selectedObject = targetObject; {
selectedObject = targetObject
};
ExecuteEvents.Execute(targetObject, data, ExecuteEvents.submitHandler); ExecuteEvents.Execute(targetObject, data, ExecuteEvents.submitHandler);
print("clicked " + targetObject.name); print("clicked " + targetObject.name);
mouseClicked = false; mouseClicked = false;
@ -57,8 +57,10 @@ namespace UnityEngine.UI.Extensions
public static void PointerEnter(GameObject obj) public static void PointerEnter(GameObject obj)
{ {
print("PointerEnter " + obj.name); print("PointerEnter " + obj.name);
PointerEventData pEvent = new PointerEventData(_singleton.eventSystem); PointerEventData pEvent = new PointerEventData(_singleton.eventSystem)
pEvent.pointerEnter = obj; {
pointerEnter = obj
};
RaycastResult rcr = new RaycastResult() { worldPosition = cursorPosition }; RaycastResult rcr = new RaycastResult() { worldPosition = cursorPosition };
pEvent.pointerCurrentRaycast = rcr; pEvent.pointerCurrentRaycast = rcr;
ExecuteEvents.Execute(obj, pEvent, ExecuteEvents.pointerEnterHandler); ExecuteEvents.Execute(obj, pEvent, ExecuteEvents.pointerEnterHandler);