Пример #1
0
 public bool BeginRename(string name, int userData, float delay)
 {
     if (this.m_IsRenaming)
     {
         Debug.LogError("BeginRename fail: already renaming");
         return false;
     }
     this.m_Name = name;
     this.m_OriginalName = name;
     this.m_UserData = userData;
     this.m_UserAcceptedRename = false;
     this.m_IsWaitingForDelay = delay > 0f;
     this.m_IsRenaming = true;
     this.m_EditFieldRect = new Rect(0f, 0f, 0f, 0f);
     this.m_ClientGUIView = GUIView.current;
     if (delay > 0f)
     {
         this.m_DelayedCallback = new DelayedCallback(new Action(this, (IntPtr) this.BeginRenameInternalCallback), (double) delay);
     }
     else
     {
         this.BeginRenameInternalCallback();
     }
     return true;
 }
Пример #2
0
 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;
         }
     }
 }
Пример #3
0
 private static string GetGUIViewName(GUIView view)
 {
     HostView view2 = view as HostView;
     if (view2 != null)
     {
         return view2.actualView.GetType().Name;
     }
     return "Window";
 }
 private bool CanInspectView(GUIView view)
 {
     if (view == null)
     {
         return false;
     }
     EditorWindow editorWindow = GetEditorWindow(view);
     if ((editorWindow != null) && ((editorWindow == this) || (editorWindow == this.m_InstructionOverlayWindow)))
     {
         return false;
     }
     return true;
 }
 public void Show(GUIView view, Rect instructionRect, GUIStyle style)
 {
     base.minSize = Vector2.zero;
     this.m_InstructionStyle = style;
     this.m_InspectedGUIView = view;
     this.m_InstructionRect = instructionRect;
     Rect rect = new Rect(instructionRect);
     rect.x += this.m_InspectedGUIView.screenPosition.x;
     rect.y += this.m_InspectedGUIView.screenPosition.y;
     base.position = rect;
     this.m_RenderTextureNeedsRefresh = true;
     base.ShowWithMode(ShowMode.NoShadow);
     base.m_Parent.window.m_DontSaveToLayout = true;
     base.Repaint();
 }
Пример #6
0
 private void Show(GUIView sourceView)
 {
   this.m_DelegateView = sourceView;
   ContainerWindow instance = ScriptableObject.CreateInstance<ContainerWindow>();
   instance.m_DontSaveToLayout = true;
   instance.title = "EyeDropper";
   instance.hideFlags = HideFlags.DontSave;
   instance.mainView = (View) this;
   instance.Show(ShowMode.PopupMenu, true, false);
   this.AddToAuxWindowList();
   instance.SetInvisible();
   this.SetMinMaxSizes(new Vector2(0.0f, 0.0f), new Vector2(10000f, 10000f));
   instance.position = new Rect(-5000f, -5000f, 10000f, 10000f);
   this.wantsMouseMove = true;
   this.StealMouseCapture();
 }
Пример #7
0
			public void BeginGUI()
			{
				if (this.m_IgnoreBeginGUI)
				{
					return;
				}
				if (GUIUtility.keyboardControl == this.controlID)
				{
					this.controlThatHadFocus = GUIUtility.keyboardControl;
					this.controlThatHadFocusValue = this.content.text;
					this.viewThatHadFocus = GUIView.current;
				}
				else
				{
					this.controlThatHadFocus = 0;
				}
			}
        void DoWindowPopup()
        {
            string selectedName = inspected == null ? Styles.defaultWindowPopupText : GetViewName(inspected);

            GUILayout.Label(Styles.inspectedWindowLabel, GUILayout.ExpandWidth(false));

            Rect popupPosition = GUILayoutUtility.GetRect(GUIContent.Temp(selectedName), EditorStyles.toolbarDropDown, GUILayout.ExpandWidth(true));

            if (GUI.Button(popupPosition, GUIContent.Temp(selectedName), EditorStyles.toolbarDropDown))
            {
                List <GUIView> views = new List <GUIView>();
                GUIViewDebuggerHelper.GetViews(views);

                List <GUIContent> options = new List <GUIContent>(views.Count + 1);

                options.Add(EditorGUIUtility.TrTextContent("None"));

                int            selectedIndex   = 0;
                List <GUIView> selectableViews = new List <GUIView>(views.Count + 1);
                for (int i = 0; i < views.Count; ++i)
                {
                    GUIView view = views[i];

                    //We can't inspect ourselves, otherwise we get infinite recursion.
                    //Also avoid the InstructionOverlay
                    if (!CanInspectView(view))
                    {
                        continue;
                    }

                    GUIContent label = new GUIContent(string.Format("{0}. {1}", options.Count, GetViewName(view)));
                    options.Add(label);
                    selectableViews.Add(view);

                    if (view == inspected)
                    {
                        selectedIndex = selectableViews.Count;
                    }
                }
                //TODO: convert this to a Unity Window style popup. This way we could highlight the window on hover ;)
                EditorUtility.DisplayCustomMenu(popupPosition, options.ToArray(), selectedIndex, OnWindowSelected, selectableViews);
            }
        }
        public void Show(GUIView view, Rect instructionRect, GUIStyle style)
        {
            Rect rect;

            base.minSize            = Vector2.zero;
            this.m_InstructionStyle = style;
            this.m_InspectedGUIView = view;
            this.m_InstructionRect  = instructionRect;
            rect = new Rect(instructionRect)
            {
                x = rect.x + this.m_InspectedGUIView.screenPosition.x,
                y = rect.y + this.m_InspectedGUIView.screenPosition.y
            };
            base.position = rect;
            this.m_RenderTextureNeedsRefresh = true;
            base.ShowWithMode(ShowMode.NoShadow);
            base.m_Parent.window.m_DontSaveToLayout = true;
            base.Repaint();
        }
Пример #10
0
 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();
             }
         }
     }
 }
Пример #11
0
        public static void Show(Gradient newGradient)
        {
            GUIView current = GUIView.current;

            if (s_GradientPicker == null)
            {
                s_GradientPicker = (GradientPicker)EditorWindow.GetWindow(typeof(GradientPicker), true, "Gradient Editor", false);
                Vector2 vector  = new Vector2(360f, 224f);
                Vector2 vector2 = new Vector2(1900f, 3000f);
                s_GradientPicker.minSize        = vector;
                s_GradientPicker.maxSize        = vector2;
                s_GradientPicker.wantsMouseMove = true;
                s_GradientPicker.ShowAuxWindow();
            }
            else
            {
                s_GradientPicker.Repaint();
            }
            s_GradientPicker.m_DelegateView = current;
            s_GradientPicker.Init(newGradient);
        }
        bool CanInspectView(GUIView view)
        {
            if (view == null)
            {
                return(false);
            }

            EditorWindow editorWindow = GetEditorWindow(view);

            if (editorWindow == null)
            {
                return(true);
            }

            if (editorWindow == this)
            {
                return(false);
            }

            return(true);
        }
Пример #13
0
        public static void Show(Gradient newGradient)
        {
            GUIView current = GUIView.current;

            if ((UnityEngine.Object)GradientPicker.s_GradientPicker == (UnityEngine.Object)null)
            {
                GradientPicker.s_GradientPicker = (GradientPicker)EditorWindow.GetWindow(typeof(GradientPicker), true, "Gradient Editor", false);
                Vector2 vector2_1 = new Vector2(360f, 224f);
                Vector2 vector2_2 = new Vector2(1900f, 3000f);
                GradientPicker.s_GradientPicker.minSize        = vector2_1;
                GradientPicker.s_GradientPicker.maxSize        = vector2_2;
                GradientPicker.s_GradientPicker.wantsMouseMove = true;
                GradientPicker.s_GradientPicker.ShowAuxWindow();
            }
            else
            {
                GradientPicker.s_GradientPicker.Repaint();
            }
            GradientPicker.s_GradientPicker.m_DelegateView = current;
            GradientPicker.s_GradientPicker.Init(newGradient);
        }
Пример #14
0
        protected override void SetPosition(Rect newPos)
        {
            Rect windowPosition = base.windowPosition;

            base.SetPosition(newPos);
            if (windowPosition == base.windowPosition)
            {
                this.Internal_SetPosition(base.windowPosition);
            }
            else
            {
                this.Internal_SetPosition(base.windowPosition);
                this.m_BackgroundValid = false;
                this.panel.visualTree.SetSize(base.windowPosition.size);
                if (GUIView.positionChanged != null)
                {
                    GUIView.positionChanged(this);
                }
                this.Repaint();
            }
        }
Пример #15
0
        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;
        }
Пример #16
0
        private void DoWindowPopup()
        {
            string t = "<Please Select>";

            if (this.m_Inspected != null)
            {
                t = GetViewName(this.m_Inspected);
            }
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            GUILayout.Label("Inspected Window: ", options);
            GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.ExpandWidth(true) };
            Rect position = GUILayoutUtility.GetRect(GUIContent.Temp(t), EditorStyles.toolbarDropDown, optionArray2);

            if (GUI.Button(position, GUIContent.Temp(t), EditorStyles.toolbarDropDown))
            {
                List <GUIView> views = new List <GUIView>();
                GUIViewDebuggerHelper.GetViews(views);
                List <GUIContent> list2 = new List <GUIContent>(views.Count + 1)
                {
                    new GUIContent("None")
                };
                int            selected = 0;
                List <GUIView> userData = new List <GUIView>(views.Count + 1);
                for (int i = 0; i < views.Count; i++)
                {
                    GUIView view = views[i];
                    if (this.CanInspectView(view))
                    {
                        GUIContent item = new GUIContent(list2.Count + ". " + GetViewName(view));
                        list2.Add(item);
                        userData.Add(view);
                        if (view == this.m_Inspected)
                        {
                            selected = userData.Count;
                        }
                    }
                }
                EditorUtility.DisplayCustomMenu(position, list2.ToArray(), selected, new EditorUtility.SelectMenuItemFunction(this.OnWindowSelected), userData);
            }
        }
Пример #17
0
        public static void Show(Gradient newGradient)
        {
            GUIView current = GUIView.current;

            if (GradientPicker.s_GradientPicker == null)
            {
                GradientPicker.s_GradientPicker = (GradientPicker)EditorWindow.GetWindow(typeof(GradientPicker), true, "Gradient Editor", false);
                Vector2 minSize = new Vector2(360f, 224f);
                Vector2 maxSize = new Vector2(1900f, 3000f);
                GradientPicker.s_GradientPicker.minSize        = minSize;
                GradientPicker.s_GradientPicker.maxSize        = maxSize;
                GradientPicker.s_GradientPicker.wantsMouseMove = true;
                GradientPicker.s_GradientPicker.ShowAuxWindow();
            }
            else
            {
                GradientPicker.s_GradientPicker.Repaint();
            }
            GradientPicker.s_GradientPicker.m_DelegateView = current;
            GradientPicker.s_GradientPicker.Init(newGradient);
            GradientPreviewCache.ClearCache();
        }
Пример #18
0
        private static void Start(GUIView viewToUpdate, Action <Color> colorPickedCallback, bool stealFocus)
        {
            EyeDropper.instance.m_DelegateView        = viewToUpdate;
            EyeDropper.instance.m_ColorPickedCallback = colorPickedCallback;
            ContainerWindow containerWindow = ScriptableObject.CreateInstance <ContainerWindow>();

            containerWindow.m_DontSaveToLayout = true;
            containerWindow.title     = "EyeDropper";
            containerWindow.hideFlags = HideFlags.DontSave;
            containerWindow.rootView  = EyeDropper.instance;
            containerWindow.Show(ShowMode.PopupMenu, true, false);
            EyeDropper.instance.AddToAuxWindowList();
            containerWindow.SetInvisible();
            EyeDropper.instance.SetMinMaxSizes(new Vector2(0f, 0f), new Vector2(8192f, 8192f));
            containerWindow.position           = new Rect(-4096f, -4096f, 8192f, 8192f);
            EyeDropper.instance.wantsMouseMove = true;
            EyeDropper.instance.StealMouseCapture();
            if (stealFocus)
            {
                EyeDropper.instance.Focus();
            }
        }
Пример #19
0
 public static void Show(GUIView viewToUpdate, Color col, bool showAlpha)
 {
     ColorPicker.get.m_DelegateView = viewToUpdate;
     ColorPicker.color = col;
     ColorPicker.get.m_OriginalColor  = col;
     ColorPicker.get.m_ShowAlpha      = showAlpha;
     ColorPicker.get.m_ModalUndoGroup = Undo.GetCurrentGroup();
     if (ColorPicker.get.m_IsOSColorPicker)
     {
         OSColorPicker.Show(showAlpha);
     }
     else
     {
         ColorPicker get = ColorPicker.get;
         get.title = "Color";
         float y = (float)EditorPrefs.GetInt("CPickerHeight", (int)get.position.height);
         get.minSize = new Vector2(193f, y);
         get.maxSize = new Vector2(193f, y);
         get.InitIfNeeded();
         get.ShowAuxWindow();
     }
 }
Пример #20
0
 public void HighlightInstruction(GUIView view, Rect instructionRect, GUIStyle style)
 {
     if (this.m_ShowHighlighter)
     {
         this.ClearInstructionHighlighter();
         if (this.m_PaddingHighlighter == null)
         {
             this.m_PaddingHighlighter = new VisualElement();
             this.m_PaddingHighlighter.style.backgroundColor = GUIViewDebuggerWindow.Styles.paddingHighlighterColor;
             this.m_ContentHighlighter = new VisualElement();
             this.m_ContentHighlighter.style.backgroundColor = GUIViewDebuggerWindow.Styles.contentHighlighterColor;
         }
         this.m_PaddingHighlighter.layout = instructionRect;
         view.visualTree.Add(this.m_PaddingHighlighter);
         if (style != null)
         {
             instructionRect = style.padding.Remove(instructionRect);
         }
         this.m_ContentHighlighter.layout = instructionRect;
         view.visualTree.Add(this.m_ContentHighlighter);
     }
 }
Пример #21
0
        private void DoWindowPopup()
        {
            string t = (!(this.inspected == null)) ? GUIViewDebuggerWindow.GetViewName(this.inspected) : GUIViewDebuggerWindow.Styles.defaultWindowPopupText;

            GUILayout.Label(GUIViewDebuggerWindow.Styles.inspectedWindowLabel, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            });
            Rect rect = GUILayoutUtility.GetRect(GUIContent.Temp(t), EditorStyles.toolbarDropDown, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true)
            });

            if (GUI.Button(rect, GUIContent.Temp(t), EditorStyles.toolbarDropDown))
            {
                List <GUIView> list = new List <GUIView>();
                GUIViewDebuggerHelper.GetViews(list);
                List <GUIContent> list2 = new List <GUIContent>(list.Count + 1);
                list2.Add(EditorGUIUtility.TrTextContent("None", null, null));
                int            selected = 0;
                List <GUIView> list3    = new List <GUIView>(list.Count + 1);
                for (int i = 0; i < list.Count; i++)
                {
                    GUIView gUIView = list[i];
                    if (this.CanInspectView(gUIView))
                    {
                        GUIContent item = new GUIContent(string.Format("{0}. {1}", list2.Count, GUIViewDebuggerWindow.GetViewName(gUIView)));
                        list2.Add(item);
                        list3.Add(gUIView);
                        if (gUIView == this.inspected)
                        {
                            selected = list3.Count;
                        }
                    }
                }
                EditorUtility.DisplayCustomMenu(rect, list2.ToArray(), selected, new EditorUtility.SelectMenuItemFunction(this.OnWindowSelected), list3);
            }
        }
        private void OnWindowSelected(object userdata, string[] options, int selected)
        {
            --selected;
            GUIView guiView = selected < 0 ? (GUIView)null : ((List <GUIView>)userdata)[selected];

            if ((UnityEngine.Object) this.m_Inspected != (UnityEngine.Object)guiView)
            {
                if ((UnityEngine.Object) this.m_InstructionOverlayWindow != (UnityEngine.Object)null)
                {
                    this.m_InstructionOverlayWindow.Close();
                }
                this.m_Inspected = guiView;
                if ((UnityEngine.Object) this.m_Inspected != (UnityEngine.Object)null)
                {
                    GUIViewDebuggerHelper.DebugWindow(this.m_Inspected);
                    this.m_Inspected.Repaint();
                }
                this.m_ListViewState.row = -1;
                this.m_ListViewState.selectionChanged = true;
                this.m_Instruction = (GUIViewDebuggerWindow.GUIInstruction)null;
            }
            this.Repaint();
        }
Пример #23
0
 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();
                 }
             }
         }
     }
 }
Пример #24
0
        public static void Show(string tooltip, Rect rect, GUIView hostView = null)
        {
            if (s_guiView == null)
            {
                s_guiView = ScriptableObject.CreateInstance <TooltipView>();
            }

            if (s_guiView.window == null)
            {
                var newWindow = ScriptableObject.CreateInstance <ContainerWindow>();
                newWindow.m_DontSaveToLayout = true;
                newWindow.rootView           = s_guiView;
                newWindow.SetMinMaxSizes(new Vector2(10.0f, 10.0f), new Vector2(2000.0f, 2000.0f));
                s_guiView.SetWindow(newWindow);
            }

            if (s_guiView.m_tooltip.text == tooltip && rect == s_guiView.m_hoverRect)
            {
                return;
            }

            s_guiView.Setup(tooltip, rect, hostView);
        }
Пример #25
0
 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();
                 }
             }
         }
     }
 }
Пример #26
0
        private static bool SetWindow(string windowTitle)
        {
            Object[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof(GUIView));
            GUIView  guiView1         = (GUIView)null;

            foreach (GUIView guiView2 in objectsOfTypeAll)
            {
                if (guiView2 is HostView)
                {
                    if ((guiView2 as HostView).actualView.titleContent.text == windowTitle)
                    {
                        guiView1 = guiView2;
                        break;
                    }
                }
                else if ((bool)((Object)guiView2.window) && guiView2.GetType().Name == windowTitle)
                {
                    guiView1 = guiView2;
                    break;
                }
            }
            Highlighter.s_View = guiView1;
            return((Object)guiView1 != (Object)null);
        }
Пример #27
0
        public void HighlightInstruction(GUIView view, Rect instructionRect, GUIStyle style)
        {
            if (!m_ShowHighlighter)
            {
                return;
            }

            ClearInstructionHighlighter();

            if (m_PaddingHighlighter == null)
            {
                var borderWidth = 1f;
                m_PaddingHighlighter = new VisualElement();
                m_PaddingHighlighter.style.borderColor       = UIElementsDebugger.Styles.kSizePaddingSecondaryColor;
                m_PaddingHighlighter.style.borderLeftWidth   = borderWidth;
                m_PaddingHighlighter.style.borderRightWidth  = borderWidth;
                m_PaddingHighlighter.style.borderTopWidth    = borderWidth;
                m_PaddingHighlighter.style.borderBottomWidth = borderWidth;
                m_PaddingHighlighter.pickingMode             = PickingMode.Ignore;
                m_ContentHighlighter = new VisualElement();
                m_ContentHighlighter.style.borderColor       = UIElementsDebugger.Styles.kSizeSecondaryColor;
                m_ContentHighlighter.style.borderLeftWidth   = borderWidth;
                m_ContentHighlighter.style.borderRightWidth  = borderWidth;
                m_ContentHighlighter.style.borderTopWidth    = borderWidth;
                m_ContentHighlighter.style.borderBottomWidth = borderWidth;
                m_ContentHighlighter.pickingMode             = PickingMode.Ignore;
            }
            m_PaddingHighlighter.layout = instructionRect;
            view.visualTree.Add(m_PaddingHighlighter);
            if (style != null)
            {
                instructionRect = style.padding.Remove(instructionRect);
            }
            m_ContentHighlighter.layout = instructionRect;
            view.visualTree.Add(m_ContentHighlighter);
        }
 private void OnWindowSelected(object userdata, string[] options, int selected)
 {
   --selected;
   GUIView guiView = selected < 0 ? (GUIView) null : ((List<GUIView>) userdata)[selected];
   if ((UnityEngine.Object) this.m_Inspected != (UnityEngine.Object) guiView)
   {
     if ((UnityEngine.Object) this.m_InstructionOverlayWindow != (UnityEngine.Object) null)
       this.m_InstructionOverlayWindow.Close();
     this.m_Inspected = guiView;
     if ((UnityEngine.Object) this.m_Inspected != (UnityEngine.Object) null)
     {
       GUIViewDebuggerHelper.DebugWindow(this.m_Inspected);
       this.m_Inspected.Repaint();
     }
     this.m_ListViewState.row = -1;
     this.m_ListViewState.selectionChanged = true;
     this.m_Instruction = (GUIViewDebuggerWindow.GUIInstruction) null;
   }
   this.Repaint();
 }
 private bool CanInspectView(GUIView view)
 {
   EditorWindow editorWindow = GUIViewDebuggerWindow.GetEditorWindow(view);
   return (UnityEngine.Object) editorWindow == (UnityEngine.Object) null || !((UnityEngine.Object) editorWindow == (UnityEngine.Object) this) && !((UnityEngine.Object) editorWindow == (UnityEngine.Object) this.m_InstructionOverlayWindow);
 }
Пример #30
0
 internal void GrabPixels(RenderTexture rd, Rect rect)
 {
     GUIView.INTERNAL_CALL_GrabPixels(this, rd, ref rect);
 }
Пример #31
0
 public PopupMenuEvent(string cmd, GUIView v)
 {
   this.commandName = cmd;
   this.receiver = v;
 }
 private void HighlightInstruction(GUIView view, Rect instructionRect, GUIStyle style)
 {
   if (this.m_ListViewState.row < 0 || !this.m_ShowOverlay)
     return;
   if ((UnityEngine.Object) this.m_InstructionOverlayWindow == (UnityEngine.Object) null)
     this.m_InstructionOverlayWindow = ScriptableObject.CreateInstance<InstructionOverlayWindow>();
   this.m_InstructionOverlayWindow.Show(view, instructionRect, style);
   this.Focus();
 }
Пример #33
0
		internal void Show(UnityEngine.Object obj, Type requiredType, SerializedProperty property, bool allowSceneObjects, List<int> allowedInstanceIDs)
		{
			this.m_AllowSceneObjects = allowSceneObjects;
			this.m_IsShowingAssets = true;
			this.m_AllowedIDs = allowedInstanceIDs;
			string text = string.Empty;
			if (property != null)
			{
				text = property.objectReferenceTypeString;
				obj = property.objectReferenceValue;
				UnityEngine.Object targetObject = property.serializedObject.targetObject;
				if (targetObject != null && EditorUtility.IsPersistent(targetObject))
				{
					this.m_AllowSceneObjects = false;
				}
			}
			else
			{
				if (requiredType != null)
				{
					text = requiredType.Name;
				}
			}
			if (this.m_AllowSceneObjects)
			{
				if (obj != null)
				{
					if (typeof(Component).IsAssignableFrom(obj.GetType()))
					{
						obj = ((Component)obj).gameObject;
					}
					this.m_IsShowingAssets = (EditorUtility.IsPersistent(obj) || ObjectSelector.GuessIfUserIsLookingForAnAsset(text, false));
				}
				else
				{
					this.m_IsShowingAssets = ObjectSelector.GuessIfUserIsLookingForAnAsset(text, true);
				}
			}
			else
			{
				this.m_IsShowingAssets = true;
			}
			this.m_DelegateView = GUIView.current;
			this.m_RequiredType = text;
			this.m_SearchFilter = string.Empty;
			this.m_OriginalSelection = obj;
			this.m_ModalUndoGroup = Undo.GetCurrentGroup();
			ContainerWindow.SetFreezeDisplay(true);
			base.ShowWithMode(ShowMode.AuxWindow);
			base.title = "Select " + text;
			Rect position = this.m_Parent.window.position;
			position.width = EditorPrefs.GetFloat("ObjectSelectorWidth", 200f);
			position.height = EditorPrefs.GetFloat("ObjectSelectorHeight", 390f);
			base.position = position;
			base.minSize = new Vector2(200f, 335f);
			base.maxSize = new Vector2(10000f, 10000f);
			this.SetupPreview();
			base.Focus();
			ContainerWindow.SetFreezeDisplay(false);
			this.m_FocusSearchFilter = true;
			this.m_Parent.AddToAuxWindowList();
			int num = (!(obj != null)) ? 0 : obj.GetInstanceID();
			if (property != null && property.hasMultipleDifferentValues)
			{
				num = 0;
			}
			if (ObjectSelector.ShouldTreeViewBeUsed(text))
			{
				this.m_ObjectTreeWithSearch.Init(base.position, this, new UnityAction<ObjectTreeForSelector.TreeSelectorData>(this.CreateAndSetTreeView), new UnityAction<TreeViewItem>(this.TreeViewSelection), new UnityAction(this.ItemWasDoubleClicked), num, 0);
			}
			else
			{
				this.InitIfNeeded();
				this.m_ListArea.InitSelection(new int[]
				{
					num
				});
				if (num != 0)
				{
					this.m_ListArea.Frame(num, true, false);
				}
			}
		}
Пример #34
0
 public void SetHostView(GUIView view);
Пример #35
0
 public virtual void OnGUI(Rect rect, float xScroll)
 {
     Event current = Event.current;
     if (this.m_GUIView == null)
     {
         this.m_GUIView = GUIView.current;
     }
     this.DetectSizeChanges(rect);
     GUIClip.Push(rect, new Vector2(-xScroll, 0f), Vector2.zero, false);
     Rect totalHeaderRect = new Rect(0f, 0f, rect.width, rect.height);
     float widthOfAllVisibleColumns = this.state.widthOfAllVisibleColumns;
     float width = ((totalHeaderRect.width <= widthOfAllVisibleColumns) ? widthOfAllVisibleColumns : totalHeaderRect.width) + GUI.skin.verticalScrollbar.fixedWidth;
     Rect position = new Rect(0f, 0f, width, totalHeaderRect.height);
     GUI.Label(position, GUIContent.none, DefaultStyles.background);
     if ((current.type == EventType.ContextClick) && position.Contains(current.mousePosition))
     {
         current.Use();
         this.DoContextMenu();
     }
     this.UpdateColumnHeaderRects(totalHeaderRect);
     for (int i = 0; i < this.state.visibleColumns.Length; i++)
     {
         int index = this.state.visibleColumns[i];
         MultiColumnHeaderState.Column column = this.state.columns[index];
         Rect headerRect = this.m_ColumnRects[i];
         Rect dividerRect = new Rect(headerRect.xMax - 1f, headerRect.y + 4f, 1f, headerRect.height - 8f);
         this.DrawDivider(dividerRect);
         Rect rect6 = new Rect(dividerRect.x - (this.m_DividerWidth * 0.5f), totalHeaderRect.y, this.m_DividerWidth, totalHeaderRect.height);
         column.width = EditorGUI.WidthResizer(rect6, column.width, column.minWidth, column.maxWidth);
         this.ColumnHeaderGUI(column, headerRect, index);
     }
     GUIClip.Pop();
 }
Пример #36
0
 public PopupCallbackInfo(int controlID)
 {
   this.m_ControlID = controlID;
   this.m_SourceView = GUIView.current;
 }
 private static EditorWindow GetEditorWindow(GUIView view)
 {
   HostView hostView = view as HostView;
   if ((UnityEngine.Object) hostView != (UnityEngine.Object) null)
     return hostView.actualView;
   return (EditorWindow) null;
 }
Пример #38
0
 private static extern void INTERNAL_CALL_Internal_SetPosition(GUIView self, ref Rect windowPosition);
 private static string GetViewName(GUIView view)
 {
   EditorWindow editorWindow = GUIViewDebuggerWindow.GetEditorWindow(view);
   if ((UnityEngine.Object) editorWindow != (UnityEngine.Object) null)
     return editorWindow.titleContent.text;
   return view.GetType().Name;
 }
Пример #40
0
 private static extern void INTERNAL_CALL_GrabPixels(GUIView self, RenderTexture rd, ref Rect rect);
Пример #41
0
 public static void Start(GUIView viewToUpdate)
 {
   EyeDropper.get.Show(viewToUpdate);
 }
Пример #42
0
 private static void ShowCurvePopup(GUIView viewToUpdate, Rect ranges)
 {
   CurveEditorSettings settings = new CurveEditorSettings();
   if ((double) ranges.width > 0.0 && (double) ranges.height > 0.0 && ((double) ranges.width != double.PositiveInfinity && (double) ranges.height != double.PositiveInfinity))
   {
     settings.hRangeMin = ranges.xMin;
     settings.hRangeMax = ranges.xMax;
     settings.vRangeMin = ranges.yMin;
     settings.vRangeMax = ranges.yMax;
   }
   CurveEditorWindow.instance.Show(GUIView.current, settings);
 }
Пример #43
0
 public void InitWebView(GUIView host, int x, int y, int width, int height, bool showResizeHandle);
Пример #44
0
 private static bool SetWindow(string windowTitle)
 {
     UnityEngine.Object[] objArray = Resources.FindObjectsOfTypeAll(typeof(GUIView));
     GUIView view = null;
     foreach (GUIView view2 in objArray)
     {
         if (view2 is HostView)
         {
             if (!((view2 as HostView).actualView.titleContent.text == windowTitle))
             {
                 continue;
             }
             view = view2;
             break;
         }
         if ((view2.window != null) && (view2.GetType().Name == windowTitle))
         {
             view = view2;
             break;
         }
     }
     s_View = view;
     return (view != null);
 }
Пример #45
0
 public void Show(GUIView viewToUpdate, CurveEditorSettings settings)
 {
     this.delegateView = viewToUpdate;
     this.Init(settings);
     base.ShowAuxWindow();
     base.titleContent = new GUIContent("Curve");
     base.minSize = new Vector2(240f, 286f);
     base.maxSize = new Vector2(10000f, 10000f);
 }
Пример #46
0
        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);
                            }
                        }
                    }
                }
            }
        }
Пример #47
0
 public static void Start(GUIView viewToUpdate)
 {
     get.Show(viewToUpdate);
 }
Пример #48
0
 private static extern void INTERNAL_CALL_SetInternalGameViewRect(GUIView self, ref Rect rect);
 internal static extern void DebugWindow(GUIView view);
Пример #50
0
 private void Internal_SetPosition(Rect windowPosition)
 {
     GUIView.INTERNAL_CALL_Internal_SetPosition(this, ref windowPosition);
 }
Пример #51
0
 public static void ShowPopup(GUIView viewToUpdate)
 {
     instance.Show(viewToUpdate, null);
 }
Пример #52
0
 public void SetInternalGameViewDimensions(Rect rect, Rect clippedRect, Vector2 targetSize)
 {
     GUIView.INTERNAL_CALL_SetInternalGameViewDimensions(this, ref rect, ref clippedRect, ref targetSize);
 }
Пример #53
0
        public void HandleEdgesStart(Rect windowPosition)
        {
            bool left   = windowPosition.x == 0f;
            bool flag   = windowPosition.y == 0f;
            bool flag2  = Mathf.Abs(windowPosition.xMax - this.position.width) < 2f;
            bool bottom = Mathf.Abs(windowPosition.yMax - this.position.height) < 2f;

            ContainerWindow.InitIcons();
            if (ContainerWindow.macEditor)
            {
                if (flag2 && flag && this.showMode != ShowMode.Utility && this.showMode != ShowMode.PopupMenu)
                {
                    GUIView  focusedView = GUIView.focusedView;
                    GUIStyle style;
                    GUIStyle style2;
                    GUIStyle style3;
                    if (focusedView && focusedView.window == this)
                    {
                        style  = ContainerWindow.s_ButtonClose;
                        style2 = ContainerWindow.s_ButtonMin;
                        style3 = ContainerWindow.s_ButtonMax;
                    }
                    else
                    {
                        style2 = (style = (style3 = ContainerWindow.s_ButtonInactive));
                    }
                    if (GUI.Button(new Rect(windowPosition.width - 13f - 4f, 0f, 13f, 13f), GUIContent.none, style))
                    {
                        this.Close();
                    }
                    if (GUI.Button(new Rect(windowPosition.width - 26f - 3f - 4f, 0f, 13f, 13f), GUIContent.none, style2))
                    {
                        this.Minimize();
                        GUIUtility.ExitGUI();
                    }
                    if (GUI.Button(new Rect(windowPosition.width - 39f - 6f - 4f, 0f, 13f, 13f), GUIContent.none, style3))
                    {
                        this.ToggleMaximize();
                    }
                }
                if (this.MacWindowCanResize(windowPosition))
                {
                    this.DragWindowEdgesMac(left, flag, flag2, bottom, windowPosition);
                }
            }
            else
            {
                if (flag2 && flag && this.showMode != ShowMode.Utility && this.showMode != ShowMode.PopupMenu)
                {
                    if (GUI.Button(new Rect(windowPosition.width - 13f - 4f, 0f, 13f, 13f), GUIContent.none, ContainerWindow.s_ButtonClose))
                    {
                        this.Close();
                    }
                    if (GUI.Button(new Rect(windowPosition.width - 26f - 3f - 4f, 0f, 13f, 13f), GUIContent.none, ContainerWindow.s_ButtonMax))
                    {
                        this.ToggleMaximize();
                    }
                }
                if (!this.maximized)
                {
                    this.DragWindowEdgesWin(left, flag, flag2, bottom, windowPosition);
                }
            }
        }
Пример #54
0
 public static void Show(GUIView viewToUpdate, Color col)
 {
   ColorPicker.Show(viewToUpdate, col, true, false, (ColorPickerHDRConfig) null);
 }
Пример #55
0
 private static extern void INTERNAL_CALL_SetInternalGameViewDimensions(GUIView self, ref Rect rect, ref Rect clippedRect, ref Vector2 targetSize);
Пример #56
0
 public static void Show(GUIView viewToUpdate, Color col, bool showAlpha, bool hdr, ColorPickerHDRConfig hdrConfig)
 {
   ColorPicker get = ColorPicker.get;
   get.m_HDR = hdr;
   get.m_HDRConfig = new ColorPickerHDRConfig(hdrConfig ?? ColorPicker.defaultHDRConfig);
   get.m_DelegateView = viewToUpdate;
   get.SetColor(col);
   get.m_OriginalColor = ColorPicker.get.m_Color;
   get.m_ShowAlpha = showAlpha;
   get.m_ModalUndoGroup = Undo.GetCurrentGroup();
   if (get.m_HDR)
     get.m_IsOSColorPicker = false;
   if (get.m_IsOSColorPicker)
   {
     OSColorPicker.Show(showAlpha);
   }
   else
   {
     get.titleContent = !hdr ? EditorGUIUtility.TextContent("Color") : EditorGUIUtility.TextContent("HDR Color");
     float y = (float) EditorPrefs.GetInt("CPickerHeight", (int) get.position.height);
     get.minSize = new Vector2(233f, y);
     get.maxSize = new Vector2(233f, y);
     get.InitIfNeeded();
     get.ShowAuxWindow();
   }
 }
Пример #57
0
 private static extern void INTERNAL_CALL_Internal_SetPosition(GUIView self, ref Rect windowPosition);
Пример #58
0
 private static bool SetWindow(string windowTitle)
 {
   Object[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof (GUIView));
   GUIView guiView1 = (GUIView) null;
   foreach (GUIView guiView2 in objectsOfTypeAll)
   {
     if (guiView2 is HostView)
     {
       if ((guiView2 as HostView).actualView.titleContent.text == windowTitle)
       {
         guiView1 = guiView2;
         break;
       }
     }
     else if ((bool) ((Object) guiView2.window) && guiView2.GetType().Name == windowTitle)
     {
       guiView1 = guiView2;
       break;
     }
   }
   Highlighter.s_View = guiView1;
   return (Object) guiView1 != (Object) null;
 }
Пример #59
0
 private static extern void INTERNAL_CALL_GrabPixels(GUIView self, RenderTexture rd, ref Rect rect);
Пример #60
0
 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;
   }
 }