public static ContextualMenuPopulateEvent GetPooled(EventBase triggerEvent, DropdownMenu menu, IEventHandler target, ContextualMenuManager menuManager) { ContextualMenuPopulateEvent pooled = EventBase <ContextualMenuPopulateEvent> .GetPooled(triggerEvent); bool flag = triggerEvent != null; if (flag) { triggerEvent.Acquire(); pooled.triggerEvent = triggerEvent; IMouseEvent mouseEvent = triggerEvent as IMouseEvent; bool flag2 = mouseEvent != null; if (flag2) { pooled.modifiers = mouseEvent.modifiers; pooled.mousePosition = mouseEvent.mousePosition; pooled.localMousePosition = mouseEvent.mousePosition; pooled.mouseDelta = mouseEvent.mouseDelta; pooled.button = mouseEvent.button; pooled.clickCount = mouseEvent.clickCount; } else { IPointerEvent pointerEvent = triggerEvent as IPointerEvent; bool flag3 = pointerEvent != null; if (flag3) { pooled.modifiers = pointerEvent.modifiers; pooled.mousePosition = pointerEvent.position; pooled.localMousePosition = pointerEvent.position; pooled.mouseDelta = pointerEvent.deltaPosition; pooled.button = pointerEvent.button; pooled.clickCount = pointerEvent.clickCount; } } IMouseEventInternal mouseEventInternal = triggerEvent as IMouseEventInternal; bool flag4 = mouseEventInternal != null; if (flag4) { ((IMouseEventInternal)pooled).triggeredByOS = mouseEventInternal.triggeredByOS; } else { IPointerEventInternal pointerEventInternal = triggerEvent as IPointerEventInternal; bool flag5 = pointerEventInternal != null; if (flag5) { ((IMouseEventInternal)pooled).triggeredByOS = pointerEventInternal.triggeredByOS; } } } pooled.target = target; pooled.menu = menu; pooled.m_ContextualMenuManager = menuManager; return(pooled); }
public void DisplayMenu(EventBase triggerEvent, IEventHandler target) { DropdownMenu menu = new DropdownMenu(); using (ContextualMenuPopulateEvent pooled = ContextualMenuPopulateEvent.GetPooled(triggerEvent, menu, target, this)) { if (target != null) { target.SendEvent(pooled); } } }
private void ShowMenu() { IGenericMenu menu; if (createMenuCallback != null) { menu = createMenuCallback.Invoke(); } else { menu = elementPanel?.contextType == ContextType.Player ? new GenericDropdownMenu() : DropdownMenu.CreateDropdown(); } AddMenuItems(menu); menu.DropDown(visualInput.worldBound, this, true); }
protected internal abstract void DoDisplayMenu(DropdownMenu menu, EventBase triggerEvent);