Improved Context Menus
Context menus now support dropdown options Context menus can now be created for UI elements with new dedicated cancellation click catcher Game manager creates context menus based on the object being clicked, no need for duplicate code in every context that object appears
This commit is contained in:
parent
36f0e4b364
commit
0ae4a388f5
14 changed files with 1062 additions and 226 deletions
27
Assets/Scripts/UI/MouseHover.cs
Normal file
27
Assets/Scripts/UI/MouseHover.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class MouseHover : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
public event Action<PointerEventData> OnEnter;
|
||||
public event Action<PointerEventData> OnExit;
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
OnEnter?.Invoke(eventData);
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
OnExit?.Invoke(eventData);
|
||||
}
|
||||
|
||||
public void ClearListeners()
|
||||
{
|
||||
OnEnter = null;
|
||||
OnExit = null;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue