static void SortPanels() { s_SortedRuntimePanels.Clear(); UIElementsUtility.GetAllPanels(s_SortedRuntimePanels, ContextType.Player); s_SortedRuntimePanels.Sort((a, b) => { var runtimePanelA = a as BaseRuntimePanel; var runtimePanelB = b as BaseRuntimePanel; if (runtimePanelA == null || runtimePanelB == null) { // Should never happen, so just being safe (after all there's a cast happening). return(0); } var diff = runtimePanelA.sortingPriority - runtimePanelB.sortingPriority; if (Mathf.Approximately(0, diff)) { // They're the same value, compare their count (panels created first show up first). return(runtimePanelA.m_RuntimePanelCreationIndex.CompareTo(runtimePanelB.m_RuntimePanelCreationIndex)); } return((diff < 0) ? -1 : 1); }); s_PanelOrderingDirty = false; }
private static void RemoveCachedPanelInternal(int instanceID) { UIElementsUtility.RemoveCachedPanel(instanceID); // un-register the playerloop callback as the last panel gets un-registered UIElementsUtility.GetAllPanels(panelsIteration, ContextType.Player); if (panelsIteration.Count == 0) { s_RegisteredPlayerloopCallback = false; UnregisterPlayerloopCallback(); } }
void IUIElementsUtility.UpdateSchedulers() { UIElementsUtility.s_PanelsIterationList.Clear(); UIElementsUtility.GetAllPanels(UIElementsUtility.s_PanelsIterationList, ContextType.Editor); foreach (Panel current in UIElementsUtility.s_PanelsIterationList) { current.timerEventScheduler.UpdateScheduledEvents(); current.UpdateAnimations(); current.UpdateBindings(); } }
public static void RepaintOverlayPanels() { UIElementsUtility.GetAllPanels(panelsIteration, ContextType.Player); foreach (RuntimePanel panel in panelsIteration) { if (!panel.drawToCameras && panel.targetTexture == null) { using (s_RepaintProfilerMarker.Auto()) panel.Repaint(Event.current); (panel.panelDebug?.debuggerOverlayPanel as Panel)?.Repaint(Event.current); } } }
public static void RepaintOverlayPanels() { UIElementsUtility.GetAllPanels(panelsIteration); foreach (var panel in panelsIteration) { // at the moment, all runtime panels who do not use a rendertexure are rendered as overlays. // later on, they'll be filtered based on render mode if (panel.contextType == ContextType.Player && (panel as RuntimePanel).targetTexture == null) { panel.Repaint(Event.current); } } }
void IUIElementsUtility.UpdateSchedulers() { // Since updating schedulers jumps into user code, the panels list might change while we're iterating, // we make a copy first. UIElementsUtility.GetAllPanels(s_PanelsIterationList, ContextType.Editor); foreach (var panel in s_PanelsIterationList) { // Dispatch all timer update messages to each scheduled item panel.timerEventScheduler.UpdateScheduledEvents(); panel.UpdateAnimations(); panel.UpdateBindings(); } }
public static void RepaintOverlayPanels() { UIElementsUtility.GetAllPanels(panelsIteration, ContextType.Player); foreach (var panel in panelsIteration) { // at the moment, all runtime panels who do not use a rendertexure are rendered as overlays. // later on, they'll be filtered based on render mode if ((panel as RuntimePanel).targetTexture == null) { using (s_RepaintProfilerMarker.Auto()) panel.Repaint(Event.current); (panel.panelDebug?.debuggerOverlayPanel as Panel)?.Repaint(Event.current); } } }
private static void RemoveCachedPanelInternal(int instanceID) { UIElementsUtility.RemoveCachedPanel(instanceID); s_PanelOrderingDirty = true; // We don't call GetSortedPanels() here to avoid always sorting when we remove multiple panels in a row // the ordering is dirty anyways, it will eventually get recreated s_SortedRuntimePanels.Clear(); UIElementsUtility.GetAllPanels(s_SortedRuntimePanels, ContextType.Player); // un-register the playerloop callback as the last panel gets un-registered if (s_SortedRuntimePanels.Count == 0) { s_RegisteredPlayerloopCallback = false; UnregisterPlayerloopCallback(); Canvas.SetExternalCanvasEnabled(false); } }
static void SortPanels() { s_SortedRuntimePanels.Clear(); UIElementsUtility.GetAllPanels(s_SortedRuntimePanels, ContextType.Player); s_SortedRuntimePanels.Sort((a, b) => { var diff = a.sortingPriority - b.sortingPriority; if (Mathf.Approximately(0, diff)) { return(0); } return((diff < 0) ? -1 : 1); }); s_PanelOrderingDirty = false; }