private void OnFilterChanged(PackageFilterTab filterTab) { var page = GetPageFromTab(filterTab); page.ResetUserUnlockedState(); if (GetRefreshTimestamp(page.tab) == 0) { Refresh(filterTab); } page.Rebuild(); UpdateSearchTextOnPage(page, m_PackageFiltering.currentSearchText); OnPageSelectionChanged(page.GetSelection()); if (m_PackageFiltering.previousFilterTab != null && m_PackageFiltering.previousFilterTab != PackageFilterTab.AssetStore) { var previousPage = GetPage((PackageFilterTab)m_PackageFiltering.previousFilterTab); var selectedVisualStates = previousPage.GetSelectedVisualStates(); var selectedGroups = new HashSet <string>(selectedVisualStates.Select(v => v.groupName).Where(groupName => !string.IsNullOrEmpty(groupName))); foreach (var group in selectedGroups) { previousPage.SetGroupExpanded(group, true); } } }
public static bool ShowAtPosition(Rect rect, PackageFilterTab tab, PageFilters filters) { if (s_Window != null) { return(false); } var nowMilliSeconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; var justClosed = nowMilliSeconds < s_LastClosedTime + 150; if (!justClosed) { Event.current?.Use(); if (tab != PackageFilterTab.AssetStore) { s_Window = CreateInstance <UpmFiltersWindow>(); } else { s_Window = CreateInstance <AssetStoreFiltersWindow>(); } s_Window.Init(rect, filters); } return(!justClosed); }
private void OnFilterChanged(PackageFilterTab filterTab) { if (m_PackageFiltering.previousFilterTab == PackageFilterTab.AssetStore) { ClearFetchDetails(); } }
private static RefreshOptions GetRefreshOptionsFromFilterTab(PackageFilterTab tab) { var options = RefreshOptions.None; switch (tab) { case PackageFilterTab.All: options |= RefreshOptions.UpmList; options |= RefreshOptions.UpmSearch; break; case PackageFilterTab.Local: options |= RefreshOptions.UpmList; break; case PackageFilterTab.Modules: options |= RefreshOptions.UpmSearchOffline; options |= RefreshOptions.UpmListOffline; break; case PackageFilterTab.AssetStore: options |= RefreshOptions.Purchased; break; case PackageFilterTab.InDevelopment: options |= RefreshOptions.UpmList; break; } return(options); }
private static string GetFilterDisplayName(PackageFilterTab filter, bool translated = true) { var displayName = string.Empty; switch (filter) { case PackageFilterTab.All: displayName = "All"; break; case PackageFilterTab.InProject: displayName = "In Project"; break; case PackageFilterTab.BuiltIn: displayName = "Built-in"; break; case PackageFilterTab.AssetStore: displayName = "My Assets"; break; } return(translated ? ApplicationUtil.instance.GetTranslationForText(displayName) : displayName); }
internal static bool FilterByTab(IPackage package, PackageFilterTab tab) { switch (tab) { case PackageFilterTab.Modules: return(package.versions.Any(v => v.HasTag(PackageTag.BuiltIn) && !v.HasTag(PackageTag.AssetStore))); case PackageFilterTab.All: return(package.versions.Any(v => !v.HasTag(PackageTag.BuiltIn) && !v.HasTag(PackageTag.AssetStore)) && (package.isDiscoverable || (package.installedVersion?.isDirectDependency ?? false))); case PackageFilterTab.Local: return(package.versions.Any(v => !v.HasTag(PackageTag.BuiltIn) && !v.HasTag(PackageTag.AssetStore)) && (package.installedVersion?.isDirectDependency ?? false)); case PackageFilterTab.AssetStore: return(ApplicationUtil.instance.isUserLoggedIn && (package.primaryVersion?.HasTag(PackageTag.AssetStore) ?? false)); case PackageFilterTab.InDevelopment: return(package.installedVersion?.HasTag(PackageTag.InDevelopment) ?? false); default: return(false); } }
private void OnFilterChanged(PackageFilterTab filterTab) { var page = GetPageFromTab(filterTab); if (GetRefreshTimestamp(page.tab) == 0) { Refresh(filterTab); } page.Rebuild(); }
private void DelayRefresh(PackageFilterTab tab) { if (m_PackageManagerPrefs.numItemsPerPage == null) { EditorApplication.delayCall += () => DelayRefresh(tab); return; } m_PageManager.Refresh(tab, (int)m_PackageManagerPrefs.numItemsPerPage); }
private void DelayRefresh(PackageFilterTab tab) { m_NumberOfPackages = packageList.CalculateNumberOfPackagesToDisplay(); if (m_NumberOfPackages == 0) { EditorApplication.delayCall += () => DelayRefresh(tab); return; } PageManager.instance.Refresh(tab, m_NumberOfPackages); }
private void SetFilterFromMenu(PackageFilterTab filter) { if (filter == m_PackageFiltering.currentFilterTab) { return; } SetCurrentSearch(string.Empty); SetFilter(filter); PackageManagerWindowAnalytics.SendEvent("changeFilter"); }
private void OnFilterChanged(PackageFilterTab filterTab) { var page = GetPageFromTab(filterTab); if (GetRefreshTimestamp(page.tab) == 0) { Refresh(filterTab); } page.Rebuild(); UpdateSearchTextOnPage(page, PackageFiltering.instance.currentSearchText); }
private void OnFilterChanged(PackageFilterTab filterTab) { if (!filterTab.Equals(PackageFilterTab.AssetStore)) { UIUtils.SetElementDisplay(packageLoadBar, false); } else { UIUtils.SetElementDisplay(packageLoadBar, true); } }
public SubPage(PackageFilterTab tab, string name, string displayName, string contentType, int priority, Func <IPackage, bool> filter = null, Func <IPackage, string> getGroupName = null, Func <string, string, int> compareGroup = null) { this.tab = tab; this.name = name; this.displayName = displayName; this.contentType = contentType; this.priority = priority; this.filter = filter; this.getGroupName = getGroupName; this.compareGroup = compareGroup; }
private void DelayRefresh(PackageFilterTab tab) { if (m_PackageManagerPrefs.numItemsPerPage == null || tab == PackageFilterTab.AssetStore && !m_UnityConnectProxy.isUserInfoReady) { EditorApplication.delayCall += () => DelayRefresh(tab); return; } m_PageManager.Refresh(tab, (int)m_PackageManagerPrefs.numItemsPerPage); }
private void OnFilterChanged(PackageFilterTab filterTab) { var page = GetPageFromFilterTab(filterTab); if (GetRefreshTimestamp(page.tab) == 0) { Refresh(filterTab); } page.RebuildList(); onPageRebuild?.Invoke(page); }
private void OnFilterChanged(PackageFilterTab filterTab) { var page = GetPageFromFilterTab(filterTab); if (GetRefreshTimestamp(page.tab) == 0) { Refresh(filterTab, PackageManagerWindow.instance?.NumberOfPackages ?? k_DefaultPageSize); } page.RebuildList(); onPageRebuild?.Invoke(page); onSelectionChanged?.Invoke(GetSelectedVersion()); }
private void OnFilterChanged(PackageFilterTab filterTab) { if (filterTab == PackageFilterTab.AssetStore && !HasPageForFilterTab(filterTab)) { AssetStore.AssetStoreClient.instance.List(0, k_DefaultPageSize); } var page = GetPageFromFilterTab(filterTab); page.RebuildList(); onPageRebuild?.Invoke(page); }
private void OnFilterTabChanged(PackageFilterTab filterTab) { if (m_PackageFiltering.previousFilterTab == PackageFilterTab.AssetStore) { m_PageManager.CancelRefresh(); } if (UpdateListVisibility()) { currentView.OnFilterTabChanged(filterTab); } }
private void ViewPackagesOnTab(PackageFilterTab tab, PackageProgress progress, PackageType type = PackageType.None) { var packagesInProgress = m_PackageDatabase.allPackages.Where(p => p.progress == progress && (type == PackageType.None || p.Is(type))).ToArray(); if (packagesInProgress.Any()) { m_PackageFiltering.currentFilterTab = tab; m_PageManager.GetCurrentPage().LoadExtraItems(packagesInProgress); m_PageManager.SetSelected(packagesInProgress.Select(p => new PackageAndVersionIdPair(p.uniqueId))); } Close(); }
private void OnFilterChanged(PackageFilterTab filterTab) { var page = GetPageFromFilterTab(filterTab); if (!page.isAlreadyFetched) { Refresh(filterTab); } page.RebuildList(); onPageRebuild?.Invoke(page); }
protected BasePage(PackageFilterTab tab, PageCapability capability) { m_Tab = tab; m_Capability = capability; if (m_Filters == null) { var defaultOrdering = m_Capability?.orderingValues?.FirstOrDefault(); m_Filters = new PageFilters { orderBy = defaultOrdering?.orderBy, isReverseOrder = false }; } }
private void OnFilterChanged(PackageFilterTab filterTab) { var page = GetPageFromTab(filterTab); if (GetRefreshTimestamp(page.tab) == 0) { Refresh(filterTab); } page.Rebuild(); UpdateSearchTextOnPage(page, m_PackageFiltering.currentSearchText); // When the filter tab is changed, on a page level, the selection hasn't changed because selection is kept for each filter // However, the active selection is still changed if you look at package manager as a whole OnPageSelectionChanged(page.GetSelectedVersion()); }
public static string GetDefaultGroupName(PackageFilterTab tab, IPackage package) { if (package.Is(PackageType.BuiltIn) || package.Is(PackageType.AssetStore)) { return(string.Empty); } if (package.Is(PackageType.Unity)) { return(tab == PackageFilterTab.UnityRegistry ? string.Empty : PageManager.k_UnityPackageGroupName); } return(string.IsNullOrEmpty(package.versions.primary?.author) ? PageManager.k_OtherPackageGroupName : package.versions.primary.author); }
internal void SetFilter(PackageFilterTab filter) { PackageFiltering.instance.currentFilterTab = filter; filterTabsMenu.text = ApplicationUtil.instance.GetTranslationForText(string.Format("Packages: {0}", GetFilterDisplayName(filter, false))); var page = PageManager.instance.GetCurrentPage(); UpdateOrdering(page); var supportFilters = page.capability.supportFilters; UIUtils.SetElementDisplay(filtersMenu, supportFilters); UIUtils.SetElementDisplay(clearFiltersButton, supportFilters); UpdateFiltersMenuText(page.filters); EnableMenuForCapability(page.capability); }
internal void SetFilter(PackageFilterTab filter) { m_PackageFiltering.currentFilterTab = filter; filterTabsMenu.text = L10n.Tr(string.Format("Packages: {0}", GetFilterDisplayName(filter))); var page = m_PageManager.GetCurrentPage(); UpdateOrdering(page); var supportFilters = page.capability.supportFilters; UIUtils.SetElementDisplay(filtersMenu, supportFilters); UIUtils.SetElementDisplay(clearFiltersButton, supportFilters); UpdateFiltersMenuText(page.filters); EnableMenuForCapability(page.capability); }
private void RefreshCheckUpdateMenuOption(PackageFilterTab tab) { if (tab == PackageFilterTab.AssetStore) { var menu = new DropdownMenu(); menu.AppendAction(L10n.Tr("Check for updates"), a => { m_AssetStoreCallQueue.ForceCheckUpdateForAllLocalInfos(); }, action => m_AssetStoreCallQueue.isCheckUpdateInProgress ? DropdownMenuAction.Status.Disabled : DropdownMenuAction.Status.Normal); refreshButton.menu = menu; } else { refreshButton.menu = null; } }
private void UpdateStatusMessage(PackageFilterTab tab) { var errorMessage = m_LastErrorMessages[(int)tab]; if (!ApplicationUtil.instance.isInternetReachable) { errorMessage = L10n.Tr(k_OfflineErrorMessage); } if (!string.IsNullOrEmpty(errorMessage)) { SetStatusMessage(StatusType.Error, errorMessage); } else { SetUpdateTimeLabel(PackageDatabase.instance.lastUpdateTimestamp != 0 ? GetUpdateTimeLabel(PackageDatabase.instance.lastUpdateTimestamp) : string.Empty); } }
private static string GetFilterDisplayName(PackageFilterTab filter) { switch (filter) { case PackageFilterTab.All: return(L10n.Tr("All packages")); case PackageFilterTab.InProject: return(L10n.Tr("In Project")); case PackageFilterTab.BuiltIn: return(L10n.Tr("Built-in packages")); case PackageFilterTab.AssetStore: return(L10n.Tr("My Assets")); default: return(filter.ToString()); } }
private static string GetFilterDisplayName(PackageFilterTab filter) { switch (filter) { case PackageFilterTab.All: return("All packages"); case PackageFilterTab.Local: return("In Project"); case PackageFilterTab.Modules: return("Built-in packages"); case PackageFilterTab.InDevelopment: return("In Development"); default: return(filter.ToString()); } }
public void OnFilterTabChanged(PackageFilterTab filterTab) { // Check if groups have changed only for InProject tab if (filterTab == PackageFilterTab.InProject && m_PageManager.IsInitialFetchingDone(PackageFilterTab.InProject)) { var needGroupsReordering = false; var currentPackageItems = packageItems.ToList(); foreach (var packageItem in currentPackageItems) { // Check if group has changed var package = packageItem.package; var groupName = m_PageManager.GetCurrentPage().GetGroupName(package); if (packageItem.packageGroup.name != groupName) { var oldGroup = GetOrCreateGroup(packageItem.packageGroup.name); var newGroup = GetOrCreateGroup(groupName); var state = m_PageManager.GetVisualState(package); if (state != null) { state.groupName = groupName; } // Move PackageItem from old group to new group oldGroup.RemovePackageItem(packageItem); newGroup.AddPackageItem(packageItem); needGroupsReordering = true; if (!oldGroup.packageItems.Any()) { m_ItemsList.Remove(oldGroup); } } } if (needGroupsReordering) { ReorderGroups(); } } }