private void RepaintClientView() { if (m_ClientGUIView != null) { m_ClientGUIView.Repaint(); } }
public void Repaint() { if (m_Parent != null) { m_Parent.Repaint(); } }
internal static void ControlHighlightGUI(GUIView self) { if (((s_View != null) && (self.window == s_View.window)) && (activeVisible && !searching)) { if ((Event.current.type == EventType.ExecuteCommand) && (Event.current.commandName == "HandleControlHighlight")) { if (self.screenPosition.Overlaps(s_RepaintRegion)) { self.Repaint(); } } else if (Event.current.type == EventType.Repaint) { Rect rect = GUIUtility.ScreenToGUIRect(activeRect); rect = highlightStyle.padding.Add(rect); float num = (Mathf.Cos(((s_HighlightElapsedTime * 3.141593f) * 2f) * 0.45f) + 1f) * 0.5f; float num2 = Mathf.Min((float) 1f, (float) (0.01f + (s_HighlightElapsedTime / 0.33f))); num2 += Mathf.Sin(num2 * 3.141593f) * 0.5f; Vector2 vector = (Vector2) (new Vector2(((rect.width + 5f) / rect.width) - 1f, ((rect.height + 5f) / rect.height) - 1f) * num); Vector2 scale = (Vector2) ((Vector2.one + vector) * num2); Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.8f - (0.3f * num)); GUIUtility.ScaleAroundPivot(scale, rect.center); highlightStyle.Draw(rect, false, false, false, false); GUI.color = color; GUI.matrix = matrix; } } }
internal static void ControlHighlightGUI(GUIView self) { if (!(Highlighter.s_View == null) && !(self.window != Highlighter.s_View.window)) { if (Highlighter.activeVisible && !Highlighter.searching) { if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "HandleControlHighlight") { if (self.screenPosition.Overlaps(Highlighter.s_RepaintRegion)) { self.Repaint(); } } else if (Event.current.type == EventType.Repaint) { Rect rect = GUIUtility.ScreenToGUIRect(Highlighter.activeRect); rect = Highlighter.highlightStyle.padding.Add(rect); float num = (Mathf.Cos(Highlighter.s_HighlightElapsedTime * 3.14159274f * 2f * 0.45f) + 1f) * 0.5f; float num2 = Mathf.Min(1f, 0.01f + Highlighter.s_HighlightElapsedTime / 0.33f); num2 += Mathf.Sin(num2 * 3.14159274f) * 0.5f; Vector2 b = new Vector2((rect.width + 5f) / rect.width - 1f, (rect.height + 5f) / rect.height - 1f) * num; Vector2 scale = (Vector2.one + b) * num2; Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, Mathf.Clamp01(0.8f * num2 - 0.3f * num)); GUIUtility.ScaleAroundPivot(scale, rect.center); Highlighter.highlightStyle.Draw(rect, false, false, false, false); GUI.color = color; GUI.matrix = matrix; } } } }
internal static void ControlHighlightGUI(GUIView self) { if (((s_View != null) && (self.window == s_View.window)) && (activeVisible && !searching)) { if ((Event.current.type == EventType.ExecuteCommand) && (Event.current.commandName == "HandleControlHighlight")) { if (self.screenPosition.Overlaps(s_RepaintRegion)) { self.Repaint(); } } else if (Event.current.type == EventType.Repaint) { Rect rect = GUIUtility.ScreenToGUIRect(activeRect); rect = highlightStyle.padding.Add(rect); float num = (Mathf.Cos(((s_HighlightElapsedTime * 3.141593f) * 2f) * 0.45f) + 1f) * 0.5f; float num2 = Mathf.Min((float)1f, (float)(0.01f + (s_HighlightElapsedTime / 0.33f))); num2 += Mathf.Sin(num2 * 3.141593f) * 0.5f; Vector2 vector = (Vector2)(new Vector2(((rect.width + 5f) / rect.width) - 1f, ((rect.height + 5f) / rect.height) - 1f) * num); Vector2 scale = (Vector2)((Vector2.one + vector) * num2); Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.8f - (0.3f * num)); GUIUtility.ScaleAroundPivot(scale, rect.center); highlightStyle.Draw(rect, false, false, false, false); GUI.color = color; GUI.matrix = matrix; } } }
internal static void ControlHighlightGUI(GUIView self) { if ((Object)Highlighter.s_View == (Object)null || (Object)self.window != (Object)Highlighter.s_View.window || (!Highlighter.activeVisible || Highlighter.searching)) { return; } if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "HandleControlHighlight") { if (!self.screenPosition.Overlaps(Highlighter.s_RepaintRegion)) { return; } self.Repaint(); } else { if (Event.current.type != EventType.Repaint) { return; } Rect position = Highlighter.highlightStyle.padding.Add(GUIUtility.ScreenToGUIRect(Highlighter.activeRect)); float num1 = (float)(((double)Mathf.Cos((float)((double)Highlighter.s_HighlightElapsedTime * 3.14159274101257 * 2.0 * 0.449999988079071)) + 1.0) * 0.5); float num2 = Mathf.Min(1f, (float)(0.00999999977648258 + (double)Highlighter.s_HighlightElapsedTime / 0.330000013113022)); float num3 = num2 + Mathf.Sin(num2 * 3.141593f) * 0.5f; Vector2 scale = (Vector2.one + new Vector2((float)(((double)position.width + 5.0) / (double)position.width - 1.0), (float)(((double)position.height + 5.0) / (double)position.height - 1.0)) * num1) * num3; Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, (float)(0.800000011920929 - 0.300000011920929 * (double)num1)); GUIUtility.ScaleAroundPivot(scale, position.center); Highlighter.highlightStyle.Draw(position, false, false, false, false); GUI.color = color; GUI.matrix = matrix; } }
private static void ControlHighlightGUI() { if (!activeVisible || searching) { return; } if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "HandleControlHighlight") { if (s_View.screenPosition.Overlaps(s_RepaintRegion)) { s_View.Repaint(); } return; } if (Event.current.type != EventType.Repaint) { return; } Rect localRect = GUIUtility.ScreenToGUIRect(activeRect); localRect = highlightStyle.padding.Add(localRect); // Animation calculations // Value pulses between 0 and 1 float pulseValue = (Mathf.Cos(s_HighlightElapsedTime * Mathf.PI * 2 * kPulseSpeed) + 1) * 0.5f; // Value expands from 0.01 to 1 and stays at 1 float popupScale = Mathf.Min(1, 0.01f + s_HighlightElapsedTime / kPopupDuration); // Value goes from 0.01 towards 1, overshoots a bit, and ends at 1. popupScale = popupScale + Mathf.Sin(popupScale * Mathf.PI) * 0.5f; // Scale calculations Vector2 pulseScaleAddition = new Vector2( (localRect.width + kExpansionMovementSize) / localRect.width - 1.0f, (localRect.height + kExpansionMovementSize) / localRect.height - 1.0f ) * pulseValue; Vector2 scale = (Vector2.one + pulseScaleAddition) * popupScale; // Cache old values Matrix4x4 oldMatrix = GUI.matrix; Color oldColor = GUI.color; // Set pulsing values GUI.color = new Color(1, 1, 1, Mathf.Clamp01(0.8f * popupScale - 0.3f * pulseValue)); GUIUtility.ScaleAroundPivot(scale, localRect.center); // Draw highlight highlightStyle.Draw(localRect, false, false, false, false); // Reset to old values GUI.color = oldColor; GUI.matrix = oldMatrix; }
internal static void RequestRepaintAllViews() { UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(GUIView)); for (int i = 0; i < array.Length; i++) { GUIView gUIView = (GUIView)array[i]; gUIView.Repaint(); } }
public static void FlagStyleSheetChange() { StyleSheetCache.ClearCaches(); Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; Panel value = current.Value; if (value.contextType == ContextType.Editor) { value.styleContext.DirtyStyleSheets(); value.visualTree.Dirty(ChangeType.Styles); GUIView gUIView = EditorUtility.InstanceIDToObject(value.instanceID) as GUIView; if (gUIView != null) { gUIView.Repaint(); } } } }
private static void UpdateSchedulersInternal(HashSet <UnityEngine.Object> tmpDirtySet) { DataWatchService.sharedInstance.PollNativeData(); Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; Panel value = current.Value; if (value.contextType == ContextType.Editor) { IScheduler scheduler = value.scheduler; value.timerEventScheduler.UpdateScheduledEvents(); if (value.visualTree.IsDirty(ChangeType.Repaint)) { GUIView gUIView = value.ownerObject as GUIView; if (gUIView != null) { gUIView.Repaint(); } } } } }
private static void UpdateSchedulers() { Dictionary <int, Panel> .Enumerator panelsIterator = UIElementsUtility.GetPanelsIterator(); while (panelsIterator.MoveNext()) { KeyValuePair <int, Panel> current = panelsIterator.Current; Panel value = current.Value; if (value.contextType == ContextType.Editor) { IScheduler scheduler = value.scheduler; value.timerEventScheduler.UpdateScheduledEvents(); DataWatchService dataWatchService = value.dataWatch as DataWatchService; dataWatchService.ProcessNotificationQueue(); if (value.visualTree.IsDirty(ChangeType.Repaint)) { GUIView gUIView = EditorUtility.InstanceIDToObject(value.instanceID) as GUIView; if (gUIView != null) { gUIView.Repaint(); } } } } }
public static void Unmaximize(EditorWindow win) { HostView parent = win.m_Parent; if (parent == null) { UnityEngine.Debug.LogError("Host view was not found"); WindowLayout.RevertFactorySettings(); } else { UnityEngine.Object[] array = InternalEditorUtility.LoadSerializedFileAndForget(Path.Combine(WindowLayout.layoutsProjectPath, "CurrentMaximizeLayout.dwlt")); if (array.Length < 2) { UnityEngine.Debug.Log("Maximized serialized file backup not found"); WindowLayout.RevertFactorySettings(); } else { SplitView splitView = array[0] as SplitView; EditorWindow editorWindow = array[1] as EditorWindow; if (splitView == null) { UnityEngine.Debug.Log("Maximization failed because the root split view was not found"); WindowLayout.RevertFactorySettings(); } else { ContainerWindow window = win.m_Parent.window; if (window == null) { UnityEngine.Debug.Log("Maximization failed because the root split view has no container window"); WindowLayout.RevertFactorySettings(); } else { try { ContainerWindow.SetFreezeDisplay(true); if (!parent.parent) { throw new Exception(); } int idx = parent.parent.IndexOfChild(parent); Rect position = parent.position; View parent2 = parent.parent; parent2.RemoveChild(idx); parent2.AddChild(splitView, idx); splitView.position = position; DockArea dockArea = editorWindow.m_Parent as DockArea; int idx2 = dockArea.m_Panes.IndexOf(editorWindow); parent.actualView = null; win.m_Parent = null; dockArea.AddTab(idx2, win); dockArea.RemoveTab(editorWindow); UnityEngine.Object.DestroyImmediate(editorWindow); UnityEngine.Object[] array2 = array; for (int i = 0; i < array2.Length; i++) { UnityEngine.Object @object = array2[i]; EditorWindow editorWindow2 = @object as EditorWindow; if (editorWindow2 != null) { editorWindow2.MakeParentsSettingsMatchMe(); } } parent2.Initialize(parent2.window); parent2.position = parent2.position; splitView.Reflow(); UnityEngine.Object.DestroyImmediate(parent); win.Focus(); window.DisplayAllViews(); win.m_Parent.MakeVistaDWMHappyDance(); } catch (Exception arg) { UnityEngine.Debug.Log("Maximization failed: " + arg); WindowLayout.RevertFactorySettings(); } try { if (Application.platform == RuntimePlatform.OSXEditor && SystemInfo.operatingSystem.Contains("10.7") && SystemInfo.graphicsDeviceVendor.Contains("ATI")) { UnityEngine.Object[] array3 = Resources.FindObjectsOfTypeAll(typeof(GUIView)); for (int j = 0; j < array3.Length; j++) { GUIView gUIView = (GUIView)array3[j]; gUIView.Repaint(); } } } finally { ContainerWindow.SetFreezeDisplay(false); } } } } } }
internal static void ControlHighlightGUI(GUIView self) { if ((Object) Highlighter.s_View == (Object) null || (Object) self.window != (Object) Highlighter.s_View.window || (!Highlighter.activeVisible || Highlighter.searching)) return; if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "HandleControlHighlight") { if (!self.screenPosition.Overlaps(Highlighter.s_RepaintRegion)) return; self.Repaint(); } else { if (Event.current.type != EventType.Repaint) return; Rect position = Highlighter.highlightStyle.padding.Add(GUIUtility.ScreenToGUIRect(Highlighter.activeRect)); float num1 = (float) (((double) Mathf.Cos((float) ((double) Highlighter.s_HighlightElapsedTime * 3.14159274101257 * 2.0 * 0.449999988079071)) + 1.0) * 0.5); float num2 = Mathf.Min(1f, (float) (0.00999999977648258 + (double) Highlighter.s_HighlightElapsedTime / 0.330000013113022)); float num3 = num2 + Mathf.Sin(num2 * 3.141593f) * 0.5f; Vector2 scale = (Vector2.one + new Vector2((float) (((double) position.width + 5.0) / (double) position.width - 1.0), (float) (((double) position.height + 5.0) / (double) position.height - 1.0)) * num1) * num3; Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, (float) (0.800000011920929 - 0.300000011920929 * (double) num1)); GUIUtility.ScaleAroundPivot(scale, position.center); Highlighter.highlightStyle.Draw(position, false, false, false, false); GUI.color = color; GUI.matrix = matrix; } }
private void UpdateExploredGUIStyle(Vector2 screenPos) { GUIView mouseUnderView = GetViewUnderMouse(screenPos, m_ExploredViews); ExploredDrawInstructionIndex = -1; ExploredStyle = null; if (mouseUnderView != m_ExploredView) { if (m_ExploredView) { GUIViewDebuggerHelper.StopDebugging(); // Debug.Log("Stop debugging: " + GetViewName(m_ExploredView)); } m_ExploredView = CanInspectView(mouseUnderView) ? mouseUnderView : null; if (m_ExploredView) { // Start debugging GUIViewDebuggerHelper.DebugWindow(m_ExploredView); // Debug.Log("Start debugging: " + GetViewName(m_ExploredView)); // Since we have attached the debugger, this view hasn't logged its repaint steps yet. m_ExploredView.Repaint(); } } if (m_ExploredView) { var drawInstructions = new List <IMGUIDrawInstruction>(); GUIViewDebuggerHelper.GetDrawInstructions(drawInstructions); var localPosition = new Vector2(screenPos.x - mouseUnderView.screenPosition.x, screenPos.y - mouseUnderView.screenPosition.y); GUIStyle mouseUnderStyle = null; /** Note: no perfect way to find the style under cursor: * - Lots of style rect overlap * - by starting with the end, we hope to follow the "Last drawn instruction is the one on top" * - Some styles are "transparent" and drawn last (TabWindowBackground and such) * - We try to go with the smallest rect that fits */ Rect styleRect = new Rect(0, 0, 10000, 10000); var smallestRectArea = styleRect.width * styleRect.height; for (var i = drawInstructions.Count - 1; i >= 0; --i) { var instr = drawInstructions[i]; if (instr.rect.Contains(localPosition) && smallestRectArea > instr.rect.width * instr.rect.height) { mouseUnderStyle = instr.usedGUIStyle; styleRect = instr.rect; smallestRectArea = instr.rect.width * instr.rect.height; ExploredDrawInstructionIndex = i; // Debug.Log(GetViewName(m_ExploredView) + " - Found Style: " + instr.usedGUIStyle.name); } } if (Highlighter != null && mouseUnderStyle != null) { var visualElement = m_ExploredView.windowBackend.visualTree as VisualElement; if (visualElement != null) { // Debug.Log(GetViewName(m_ExploredView) + " - Highlight Style: " + mouseUnderStyle.name); Highlighter.HighlightElement(visualElement, styleRect, mouseUnderStyle); } } ExploredStyle = mouseUnderStyle; } }
internal static void ControlHighlightGUI(GUIView self) { if (Highlighter.s_View == null || self.window != Highlighter.s_View.window) { return; } if (!Highlighter.activeVisible || Highlighter.searching) { return; } if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "HandleControlHighlight") { if (self.screenPosition.Overlaps(Highlighter.s_RepaintRegion)) { self.Repaint(); } return; } if (Event.current.type != EventType.Repaint) { return; } Rect rect = GUIUtility.ScreenToGUIRect(Highlighter.activeRect); rect = Highlighter.highlightStyle.padding.Add(rect); float num = (Mathf.Cos(Highlighter.s_HighlightElapsedTime * 3.14159274f * 2f * 0.45f) + 1f) * 0.5f; float num2 = Mathf.Min(1f, 0.01f + Highlighter.s_HighlightElapsedTime / 0.33f); num2 += Mathf.Sin(num2 * 3.14159274f) * 0.5f; Vector2 b = new Vector2((rect.width + 5f) / rect.width - 1f, (rect.height + 5f) / rect.height - 1f) * num; Vector2 scale = (Vector2.one + b) * num2; Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.8f - 0.3f * num); GUIUtility.ScaleAroundPivot(scale, rect.center); Highlighter.highlightStyle.Draw(rect, false, false, false, false); GUI.color = color; GUI.matrix = matrix; }