private void SetupUI() { var containers = Resources.FindObjectsOfTypeAll(typeof(ContainerWindow)); minSize = new Vector2(Styles.window.GetFloat("min-width"), Styles.window.GetFloat("min-height")); foreach (ContainerWindow window in containers) { if (window.showMode == ShowMode.MainWindow) { position = new Rect( window.position.center - (minSize / 2), minSize); break; } } var root = rootVisualElement; root.AddStyleSheetPath("StyleSheets/SettingsWindowCommon.uss"); root.AddStyleSheetPath($"StyleSheets/SettingsWindow{(EditorGUIUtility.isProSkin ? "Dark" : "Light")}.uss"); root.style.flexDirection = FlexDirection.Column; var toolbar = new IMGUIContainer(DrawToolbar); root.Add(toolbar); m_Splitter = new VisualSplitter { splitSize = Styles.window.GetInt("-unity-splitter-size") }; m_Splitter.AddToClassList("settings-splitter"); root.Add(m_Splitter); var settingsTree = new IMGUIContainer(DrawTreeView) { style = { flexGrow = m_SplitterFlex, flexBasis = 0f }, focusOnlyIfHasFocusableControls = false, }; settingsTree.AddToClassList("settings-tree-imgui-container"); m_Splitter.Add(settingsTree); m_SettingsPanel = new VisualElement() { style = { flexGrow = 1.0f - m_SplitterFlex, flexBasis = 0f } }; m_SettingsPanel.AddToClassList("settings-panel"); m_Splitter.Add(m_SettingsPanel); }
private void SetupUI() { minSize = new Vector2(Styles.window.GetFloat("min-width"), Styles.window.GetFloat("min-height")); var root = rootVisualElement; root.AddStyleSheetPath("StyleSheets/SettingsWindowCommon.uss"); root.AddStyleSheetPath($"StyleSheets/SettingsWindow{(EditorGUIUtility.isProSkin ? "Dark" : "Light")}.uss"); root.style.flexDirection = FlexDirection.Column; var toolbar = new IMGUIContainer(DrawToolbar); root.Add(toolbar); m_Splitter = new VisualSplitter { splitSize = Styles.window.GetInt("-unity-splitter-size") }; m_Splitter.AddToClassList("settings-splitter"); root.Add(m_Splitter); var settingsTree = new IMGUIContainer(DrawTreeView) { style = { flexGrow = m_SplitterFlex, flexBasis = 0f }, focusOnlyIfHasFocusableControls = false, }; settingsTree.AddToClassList("settings-tree-imgui-container"); m_Splitter.Add(settingsTree); m_SettingsPanel = new VisualElement() { style = { flexGrow = 1.0f - m_SplitterFlex, flexBasis = 0f } }; m_SettingsPanel.AddToClassList("settings-panel"); m_Splitter.Add(m_SettingsPanel); }
private void SetupUI() { SetupWindowPosition(); var root = rootVisualElement; root.AddStyleSheetPath("StyleSheets/SettingsWindowCommon.uss"); root.AddStyleSheetPath($"StyleSheets/SettingsWindow{(EditorGUIUtility.isProSkin ? "Dark" : "Light")}.uss"); root.style.flexDirection = FlexDirection.Column; m_Toolbar = new IMGUIContainer(DrawToolbar); root.Add(m_Toolbar); m_SplitterFlex = EditorPrefs.GetFloat(GetPrefKeyName(nameof(m_Splitter)), m_SplitterFlex); m_Splitter = new VisualSplitter { splitSize = Styles.window.GetInt("-unity-splitter-size") }; m_Splitter.AddToClassList("settings-splitter"); root.Add(m_Splitter); m_TreeViewContainer = new IMGUIContainer(DrawTreeView) { style = { flexGrow = m_SplitterFlex, flexBasis = 0f }, focusOnlyIfHasFocusableControls = false, }; m_TreeViewContainer.AddToClassList("settings-tree-imgui-container"); m_Splitter.Add(m_TreeViewContainer); m_SettingsPanel = new VisualElement() { style = { flexGrow = 1.0f - m_SplitterFlex, flexBasis = 0f } }; m_SettingsPanel.AddToClassList("settings-panel"); m_Splitter.Add(m_SettingsPanel); }
private void SetupUI() { minSize = new Vector2(Styles.window.GetFloat("min-width"), Styles.window.GetFloat("min-height")); var root = this.GetRootVisualContainer(); root.style.flexDirection = FlexDirection.Column; var toolbar = new IMGUIContainer(DrawToolbar); root.Add(toolbar); m_Splitter = new VisualSplitter { splitSize = Styles.window.GetInt("-unity-splitter-size") }; m_Splitter.AddToClassList("settings-splitter"); root.Add(m_Splitter); var settingsTree = new IMGUIContainer(DrawTreeView) { style = { flex = new Flex(m_SplitterFlex) } }; settingsTree.AddToClassList("settings-tree-imgui-container"); m_Splitter.Add(settingsTree); m_SettingsPanel = new VisualElement() { style = { flex = new Flex(1.0f - m_SplitterFlex) } }; m_SettingsPanel.AddToClassList("settings-panel"); m_Splitter.Add(m_SettingsPanel); }