VanguardReMaster/client/Assets/Vanguard/Runtime/UI/RightClickRelay.cs

22 lines
707 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using UnityEngine;
using UnityEngine.EventSystems;
namespace Vanguard.UI
{
/// <summary>
/// Правый клик по объекту. В отличие от EventTrigger реализует только
/// IPointerClickHandler, поэтому колесо мыши проходит к ScrollRect.
/// </summary>
public sealed class RightClickRelay : MonoBehaviour, IPointerClickHandler
{
public Action<PointerEventData> Clicked;
public void OnPointerClick(PointerEventData eventData)
{
if (eventData != null && eventData.button == PointerEventData.InputButton.Right)
Clicked?.Invoke(eventData);
}
}
}