public void DispatchEvent(EventBase evt, IPanel panel) { bool flag = panel != null; if (flag) { Focusable leafFocusedElement = panel.focusController.GetLeafFocusedElement(); bool flag2 = leafFocusedElement != null; if (flag2) { bool isIMGUIContainer = leafFocusedElement.isIMGUIContainer; if (isIMGUIContainer) { IMGUIContainer iMGUIContainer = (IMGUIContainer)leafFocusedElement; bool flag3 = !evt.Skip(iMGUIContainer) && iMGUIContainer.SendEventToIMGUI(evt, true, true); if (flag3) { evt.StopPropagation(); evt.PreventDefault(); } bool flag4 = !evt.isPropagationStopped && evt.propagateToIMGUI; if (flag4) { evt.skipElements.Add(iMGUIContainer); EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } else { evt.target = panel.focusController.GetLeafFocusedElement(); EventDispatchUtilities.PropagateEvent(evt); bool flag5 = !evt.isPropagationStopped && evt.propagateToIMGUI; if (flag5) { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } } else { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } evt.propagateToIMGUI = false; evt.stopDispatch = true; }
internal static void PropagateToIMGUIContainer(VisualElement root, EventBase evt) { bool flag = evt.imguiEvent == null || root.elementPanel.contextType == ContextType.Player; if (!flag) { bool isIMGUIContainer = root.isIMGUIContainer; if (isIMGUIContainer) { IMGUIContainer iMGUIContainer = root as IMGUIContainer; bool flag2 = evt.Skip(iMGUIContainer); if (flag2) { return; } Focusable expr_54 = evt.target as Focusable; bool flag3 = expr_54 != null && expr_54.focusable; bool flag4 = iMGUIContainer.SendEventToIMGUI(evt, !flag3, true); if (flag4) { evt.StopPropagation(); evt.PreventDefault(); } bool flag5 = evt.imguiEvent.rawType == EventType.Used; if (flag5) { Debug.Assert(evt.isPropagationStopped); } } bool flag6 = root.imguiContainerDescendantCount > 0; if (flag6) { int childCount = root.hierarchy.childCount; for (int i = 0; i < childCount; i++) { EventDispatchUtilities.PropagateToIMGUIContainer(root.hierarchy[i], evt); bool isPropagationStopped = evt.isPropagationStopped; if (isPropagationStopped) { break; } } } } }