public PackageManagerWindowRoot(ResourceLoader resourceLoader, SelectionProxy selection, PackageFiltering packageFiltering, PackageManagerPrefs packageManagerPrefs, PackageDatabase packageDatabase, PageManager pageManager, PackageManagerProjectSettingsProxy settingsProxy) { ResolveDependencies(resourceLoader, selection, packageFiltering, packageManagerPrefs, packageDatabase, pageManager, settingsProxy); styleSheets.Add(m_ResourceLoader.GetMainWindowStyleSheet()); var root = m_ResourceLoader.GetTemplate("PackageManagerWindow.uxml"); Add(root); cache = new VisualElementCache(root); }
public void OnEnable() { this.SetAntiAliasing(4); if (instance == null) { instance = this; } if (instance != this) { return; } ResolveDependencies(); instance.titleContent = GetLocalizedTitleContent(); var root = m_ResourceLoader.GetTemplate("PackageManagerWindow.uxml"); root.styleSheets.Add(m_ResourceLoader.GetMainWindowStyleSheet()); cache = new VisualElementCache(root); rootVisualElement.Add(root); packageDetails.OnEnable(); packageList.OnEnable(); packageLoadBar.OnEnable(); packageManagerToolbar.OnEnable(); packageStatusbar.OnEnable(); packageManagerToolbar.SetEnabled(!m_PackageDatabase.isEmpty); packageDetails.packageToolbarContainer.SetEnabled(!m_PackageDatabase.isEmpty); m_PageManager.onRefreshOperationFinish += OnRefreshOperationFinish; m_PageManager.onRefreshOperationStart += OnRefreshOperationStart; m_PageManager.onRefreshOperationError += OnRefreshOperationError; m_PackageFiltering.onFilterTabChanged += OnFilterChanged; PackageManagerWindowAnalytics.Setup(); root.StretchToParentSize(); var newTab = m_PackageManagerPrefs.lastUsedPackageFilter ?? m_PackageManagerPrefs.defaultFilterTab; m_PackageFiltering.SetCurrentFilterTabWithoutNotify(newTab); packageManagerToolbar.SetFilter(newTab); if (newTab != PackageFilterTab.AssetStore) { UIUtils.SetElementDisplay(packageLoadBar, false); } if (m_PageManager.GetRefreshTimestamp(newTab) == 0) { DelayRefresh(newTab); } if (newTab != PackageFilterTab.All && m_PageManager.GetRefreshTimestamp(PackageFilterTab.All) == 0) { DelayRefresh(PackageFilterTab.All); } mainContainer.leftWidth = m_SplitPaneLeftWidth; mainContainer.onSizeChanged += width => { m_SplitPaneLeftWidth = width; }; EditorApplication.focusChanged += OnFocusChanged; m_Selection.onSelectionChanged += RefreshSelectedInInspectorClass; rootVisualElement.focusable = true; rootVisualElement.RegisterCallback <AttachToPanelEvent>(OnAttachToPanel); rootVisualElement.RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel); RefreshSelectedInInspectorClass(); }