using System.Collections.Generic;
using Framework.Manager;
using UnityEngine;
using UnityEngine.EventSystems;
namespace Zion.Scripts.ERP.查询需求计划平衡利库情况
{
public class DemandUIContextMenu : MonoBehaviour,IPointerClickHandler
{
///
/// 鼠标右键图像弹出上下文菜单
///
[Tooltip("鼠标右键点击后显示的菜单")] public GameObject contextMenu;
[Tooltip("是否在显示菜单时跟随鼠标位置")] public bool followMouse = true;
private RectTransform rectTransform;
private Canvas canvas;
private RectTransform canvasRectTransform;
private void Awake()
{
// 确保有菜单引用
if (contextMenu == null)
{
Debug.LogError("上下文菜单未设置!请指定一个GameObject作为菜单");
return;
}
// 获取菜单的RectTransform组件
rectTransform = contextMenu.GetComponent();
if (rectTransform == null)
{
Debug.LogError("上下文菜单必须有RectTransform组件!");
return;
}
// 获取父级Canvas
canvas = GetComponentInParent