mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 11:45:09 +00:00
Event Selection Bug (#404)
The currentEventIndex will no longer change when another UI element is in front of it.
This commit is contained in:
parent
ac1804a901
commit
6b7e5b67d7
2 changed files with 485 additions and 10 deletions
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
using TMPro;
|
||||
using DG.Tweening;
|
||||
|
@ -9,6 +10,7 @@ using Starpelly;
|
|||
|
||||
using HeavenStudio.Editor.Track;
|
||||
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class GridGameSelector : MonoBehaviour
|
||||
|
@ -25,9 +27,9 @@ namespace HeavenStudio.Editor
|
|||
private RectTransform eventsParent;
|
||||
|
||||
[Header("Properties")]
|
||||
[SerializeField] private int currentEventIndex;
|
||||
private Minigames.Minigame mg;
|
||||
private bool gameOpen;
|
||||
[SerializeField] private int currentEventIndex;
|
||||
private int dragTimes;
|
||||
public float posDif;
|
||||
public int ignoreSelectCount;
|
||||
|
@ -48,7 +50,7 @@ namespace HeavenStudio.Editor
|
|||
|
||||
private void Update()
|
||||
{
|
||||
if(!(EventParameterManager.instance.active || Conductor.instance.NotStopped()))
|
||||
if (!(EventParameterManager.instance.active || Conductor.instance.NotStopped()) && !IsPointerOverUIElement())
|
||||
{
|
||||
if (gameOpen)
|
||||
{
|
||||
|
@ -177,6 +179,31 @@ namespace HeavenStudio.Editor
|
|||
eventsParent.GetChild(index).GetComponent<TMP_Text>().color = EditorTheme.theme.properties.EventSelectedCol.Hex2RGB();
|
||||
}
|
||||
|
||||
public bool IsPointerOverUIElement()
|
||||
{
|
||||
return IsPointerOverUIElement(GetEventSystemRaycastResults());
|
||||
}
|
||||
|
||||
private bool IsPointerOverUIElement(List<RaycastResult> eventSystemRaysastResults)
|
||||
{
|
||||
for (int index = 0; index < eventSystemRaysastResults.Count; index++)
|
||||
{
|
||||
RaycastResult curRaysastResult = eventSystemRaysastResults[index];
|
||||
if (curRaysastResult.gameObject.layer == 5)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static List<RaycastResult> GetEventSystemRaycastResults()
|
||||
{
|
||||
PointerEventData eventData = new PointerEventData(EventSystem.current);
|
||||
eventData.position = Input.mousePosition;
|
||||
List<RaycastResult> raysastResults = new List<RaycastResult>();
|
||||
EventSystem.current.RaycastAll(eventData, raysastResults);
|
||||
return raysastResults;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
|
Loading…
Reference in a new issue