コード例 #1
0
 public void Repaint()
 {
     if (m_OwnerWindow != null)
     {
         m_OwnerWindow.Repaint();
     }
 }
コード例 #2
0
ファイル: _BBEditor.cs プロジェクト: Mr-Ventures/Tutorials
    static void SelectSettingsGO()
    {
        UnityEditor.Selection.activeObject = UnityEditor.AssetDatabase.LoadMainAssetAtPath("Assets/Resources/" + "Settings" + ".asset");

        // Lock settings window
        {
            Type type = Assembly.GetAssembly(typeof(UnityEditor.Editor)).GetType("UnityEditor.InspectorWindow");
            UnityEngine.Object [] findObjectsOfTypeAll = Resources.FindObjectsOfTypeAll(type);
            if (findObjectsOfTypeAll.Length == 0)
            {
                return;
            }

            foreach (var window in findObjectsOfTypeAll)
            {
                UnityEditor.EditorWindow settingsWindow = (UnityEditor.EditorWindow)window;

                // Lock the taller settings window
                if (settingsWindow.position.height > 600)
                {
                    PropertyInfo propertyInfo = type.GetProperty("isLocked");
                    propertyInfo.SetValue(settingsWindow, true, null);
                    settingsWindow.Repaint();
                }
            }
        }
    }
コード例 #3
0
        public void StopExploreStyle()
        {
            // Debug.Log("Start Style Explorer");
            IsPicking = false;
            EditorApplication.update -= FindStyleUnderMouse;
            m_ExploredViews.Clear();
            m_ExploredView = null;
            ExploredStyle  = null;
            ExploredDrawInstructionIndex = -1;
            m_UpdateExploredGUIStyle     = false;

            if (Highlighter != null)
            {
                Highlighter.ClearElement();
            }

            m_BoundWindow.Repaint();
        }
コード例 #4
0
 public void OnGUI(Rect rect, EditorWindow owner)
 {
     EditorGUI.DrawRect(rect, StyleCollection.instance.menuTreeBgColor);
     OnGUI(rect);
     if (owner)
     {
         owner.Repaint();
     }
 }
コード例 #5
0
 private void SelectAllPoints(EditorWindow window)
 {
     m_Selection.Clear();
     for (int i = 0; i < m_LineRenderer.positionCount; ++i)
     {
         m_Selection.Add(i);
     }
     window.Repaint();
 }
コード例 #6
0
        private static void InitSearchableWindow(Rect rect, string label, int selectedIndex, string[] displayedOptions)
        {
            var dataSource = new MultiLevelDataSource();

            dataSource.displayedOptions = displayedOptions;
            dataSource.selectedIndex    = selectedIndex;
            dataSource.label            = label;

            s_Instance.dataSource = dataSource;

            s_Instance.windowClosed += (w) =>
            {
                if (s_ParentWindow != null)
                {
                    s_ParentWindow.Repaint();
                }
            };

            s_Instance.Init(rect);
        }
コード例 #7
0
        protected void RowClicked(Event evt, MemoryElement memoryElement)
        {
            m_MemorySelection.SetSelection(memoryElement);
            GUIUtility.keyboardControl = m_ControlID;

            if (evt.clickCount == 2 && memoryElement.memoryInfo != null && memoryElement.memoryInfo.instanceId != 0)
            {
                Selection.instanceIDs      = new int[0];
                Selection.activeInstanceID = memoryElement.memoryInfo.instanceId;
            }
            evt.Use();
            if (memoryElement.memoryInfo != null)
            {
                EditorGUIUtility.PingObject(memoryElement.memoryInfo.instanceId);
            }

            if (m_DetailView != null)
            {
                m_DetailView.SetRoot(memoryElement.memoryInfo == null ? null : new MemoryElement(memoryElement.memoryInfo, false));
            }

            m_EditorWindow.Repaint();
        }
コード例 #8
0
        public void Init(
            Rect position,
            EditorWindow owner,
            UnityAction <TreeSelectorData> treeViewNeededCallback,
            UnityAction <TreeViewItem> selectionCallback,
            UnityAction doubleClickedCallback,
            int initialSelectedTreeViewItemID,
            int userData)
        {
            Clear();

            m_Owner = owner;

            m_TreeViewNeededEvent = new TreeViewNeededEvent();
            m_TreeViewNeededEvent.AddPersistentListener(treeViewNeededCallback, UnityEventCallState.EditorAndRuntime);

            m_SelectionEvent = new SelectionEvent();
            m_SelectionEvent.AddPersistentListener(selectionCallback, UnityEventCallState.EditorAndRuntime);

            m_DoubleClickedEvent = new DoubleClickedEvent();
            m_DoubleClickedEvent.AddPersistentListener(doubleClickedCallback, UnityEventCallState.EditorAndRuntime);

            m_OriginalSelectedID = initialSelectedTreeViewItemID;
            m_UserData           = userData;

            m_FocusSearchFilter = true; // start by focusing search field

            // Initial setup
            EnsureTreeViewIsValid(GetTreeViewRect(position));
            if (m_TreeView != null)
            {
                m_TreeView.SetSelection(new[] { m_OriginalSelectedID }, true);
                // If nothing is selected we expand all to better start overview. If we have a selection it has been revealed in SetSelection above
                if (m_OriginalSelectedID == 0)
                {
                    m_TreeView.data.SetExpandedWithChildren(m_TreeView.data.root, true);
                }
            }

            m_Debounce = Delayer.Debounce(context =>
            {
                DoSearchFilter();
                m_Owner.Repaint();
            });
        }
コード例 #9
0
        private static void InitWindow(Rect rect, string label, int selectedIndex, string[] displayedOptions)
        {
            var dataSource = new AdvancedDropdownSimpleDataSource();

            dataSource.DisplayedOptions = displayedOptions;
            dataSource.SelectedIndex    = selectedIndex;
            dataSource.Label            = label;

            s_Instance.dataSource = dataSource;

            s_Instance.onSelected += (w) =>
            {
                if (s_ParentWindow != null)
                {
                    s_ParentWindow.Repaint();
                }
            };

            s_Instance.Init(rect);
        }