ict.lixian.single/Assets/Scripts/UIManager/MediaContextMenu/MediaContextMenu.cs

40 lines
999 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using static MainCanvasManager;
public class MediaContextMenu : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
bool is_hovering;
public void OnPointerEnter(PointerEventData eventData)
{
is_hovering = true;
}
public void OnPointerExit(PointerEventData eventData)
{
is_hovering = false;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2))
{
if (!is_hovering)
{
//media_viwer_panel.current_media_item = null;//执行删除时按钮OnClick和Update时机问题
media_viwer_panel.context_menu_image.gameObject.SetActive(false);
}
}
}
}