您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

39 行
884 B

using UnityEngine;
using UnityEngine.RMGUI;
namespace RMGUI.GraphView
{
public delegate EventPropagation ContextualMenuDelegate(Event evt, Object customData);
public class ContextualMenu : Manipulator
{
private readonly ContextualMenuDelegate m_Callback;
private readonly Object m_CustomData;
public ContextualMenu(ContextualMenuDelegate callback)
{
phaseInterest = EventPhase.Capture;
m_Callback = callback;
m_CustomData = null;
}
public ContextualMenu(ContextualMenuDelegate callback, Object customData)
{
m_Callback = callback;
m_CustomData = customData;
}
public override EventPropagation HandleEvent(Event evt, VisualElement finalTarget)
{
switch (evt.type)
{
case EventType.ContextClick:
if (m_Callback != null)
return m_Callback(evt, m_CustomData);
break;
}
return EventPropagation.Continue;
}
}
}