//---------------------------------------------------------------------------------------------------------------------- MeshSyncSettingsProvider() : base(PROJECT_SETTINGS_MENU_PATH, SettingsScope.Project) { m_tabs = new IMeshSyncSettingsTab[MeshSyncEditorConstants.MAX_SETTINGS_TAB]; Button[] tabButtons = new Button[MeshSyncEditorConstants.MAX_SETTINGS_TAB]; m_tabs[MeshSyncEditorConstants.GENERAL_SETTINGS_TAB] = new GeneralSettingsTab(); m_tabs[MeshSyncEditorConstants.DCC_TOOLS_SETTINGS_TAB] = new DCCToolsSettingsTab(); //activateHandler is called when the user clicks on the Settings item in the Settings window. activateHandler = (string searchContext, VisualElement root) => { //Main Tree VisualTreeAsset main = UIElementsEditorUtility.LoadVisualTreeAsset( Path.Combine(MeshSyncEditorConstants.PROJECT_SETTINGS_UIELEMENTS_PATH, "ProjectSettings_Main") ); main.CloneTree(root); //Tab Buttons VisualElement tabsContainer = root.Query <VisualElement>("TabsContainer"); VisualTreeAsset tabButtonTemplate = UIElementsEditorUtility.LoadVisualTreeAsset( Path.Combine(MeshSyncEditorConstants.PROJECT_SETTINGS_UIELEMENTS_PATH, "TabButtonTemplate") ); tabButtons[0] = CreateButton(tabButtonTemplate, Contents.GeneralSettings, OnGeneralSettingsTabClicked); tabButtons[1] = CreateButton(tabButtonTemplate, Contents.DCCTools, OnDCCToolsTabClicked); foreach (Button tabButton in tabButtons) { tabsContainer.Add(tabButton); } //Style UIElementsEditorUtility.LoadAndAddStyle( root.styleSheets, Path.Combine(MeshSyncEditorConstants.PROJECT_SETTINGS_UIELEMENTS_PATH, "ProjectSettings_Style") ); m_content = root.Query <VisualElement>("Content"); UpdateSelectedTabButton(tabButtons[0]); SetupTab(MeshSyncEditorConstants.GENERAL_SETTINGS_TAB); }; deactivateHandler = () => { SetupTab(MeshSyncEditorConstants.UNINITIALIZED_TAB); }; //keywords HashSet <string> meshSyncKeywords = new HashSet <string>(new[] { "MeshSync", }); meshSyncKeywords.UnionWith(GetSearchKeywordsFromGUIContentProperties <MeshSyncSettingsProvider.Contents>()); meshSyncKeywords.UnionWith(GetSearchKeywordsFromGUIContentProperties <GeneralSettingsTab.Contents>()); keywords = meshSyncKeywords; }
//---------------------------------------------------------------------------------------------------------------------- MeshSyncProjectSettingsProvider() : base(PROJECT_SETTINGS_MENU_PATH, SettingsScope.Project) { m_tabs = new IMeshSyncSettingsTab[MeshSyncEditorConstants.MAX_SETTINGS_TAB]; Button[] tabButtons = new Button[MeshSyncEditorConstants.MAX_SETTINGS_TAB]; m_tabs[MeshSyncEditorConstants.SERVER_SETTINGS_TAB] = new ServerSettingsTab(); m_tabs[MeshSyncEditorConstants.SCENE_CACHE_PLAYER_SETTINGS_TAB] = new SceneCachePlayerSettingsTab(); //activateHandler is called when the user clicks on the Settings item in the Settings window. activateHandler = (string searchContext, VisualElement root) => { //Main Tree VisualTreeAsset main = UIElementsEditorUtility.LoadVisualTreeAsset(Constants.MAIN_PROJECT_SETTINGS_PATH); main.CloneTree(root); //Tab Buttons VisualElement tabsContainer = root.Query <VisualElement>("TabsContainer"); VisualTreeAsset btnTemplate = UIElementsEditorUtility.LoadVisualTreeAsset(Constants.TAB_BUTTON_TEMPLATE_PATH); tabButtons[0] = CreateButton(btnTemplate, Contents.Server, OnServerSettingsTabClicked); tabButtons[1] = CreateButton(btnTemplate, Contents.SceneCachePlayer, OnSceneCachePlayerTabClicked); foreach (Button tabButton in tabButtons) { tabsContainer.Add(tabButton); } //Style UIElementsEditorUtility.LoadAndAddStyle(root.styleSheets, Constants.PROJECT_SETTINGS_STYLE_PATH); m_content = root.Query <VisualElement>("Content"); UpdateSelectedTabButton(tabButtons[0]); SetupTab(MeshSyncEditorConstants.SERVER_SETTINGS_TAB); }; deactivateHandler = () => { SetupTab(MeshSyncEditorConstants.UNINITIALIZED_TAB); }; //keywords HashSet <string> meshSyncKeywords = new HashSet <string>(new[] { "MeshSync", }); meshSyncKeywords.UnionWith(GetSearchKeywordsFromGUIContentProperties <MeshSyncProjectSettingsProvider.Contents>()); meshSyncKeywords.UnionWith(GetSearchKeywordsFromGUIContentProperties <ServerSettingsTab.Contents>()); meshSyncKeywords.UnionWith(GetSearchKeywordsFromGUIContentProperties <SceneCachePlayerSettingsTab.Contents>()); meshSyncKeywords.UnionWith(GetSearchKeywordsFromGUIContentProperties <MeshSyncPlayerConfigSection.Contents>()); keywords = meshSyncKeywords; }