コード例 #1
0
        private ISelectableItem GetFirstSelectedItem()
        {
            m_PackageDatabase.GetPackageAndVersion(m_PageManager.GetSelection().firstSelection, out var package, out var version);
            var selectedVersion = version ?? package?.versions.primary;

            return(GetPackageItem(selectedVersion?.packageUniqueId));
        }
コード例 #2
0
        private void OnUpdateChecked(IEnumerable <string> productIds)
        {
            var selection = m_PageManager.GetSelection();

            if (productIds.Any(id => selection.Contains(id)))
            {
                Refresh(selection);
            }
        }
コード例 #3
0
        public void ScrollToSelection()
        {
            if (m_PackageItemsLookup.Count == 0 || float.IsNaN(layout.height) || layout.height == 0)
            {
                EditorApplication.delayCall -= ScrollToSelection;
                EditorApplication.delayCall += ScrollToSelection;
                return;
            }

            // For now we want to just scroll to any of the selections, this behaviour might change in the future depending on how users react
            var firstSelectedPackageUniqueId = m_PageManager.GetSelection().firstSelection?.packageUniqueId;

            if (string.IsNullOrEmpty(firstSelectedPackageUniqueId))
            {
                return;
            }

            EditorApplication.delayCall -= ScrollToSelection;

            var visualStates = itemsSource as List <VisualState>;
            var index        = visualStates?.FindIndex(v => v.packageUniqueId == firstSelectedPackageUniqueId) ?? -1;

            if (index >= 0)
            {
                ScrollToItem(index);
            }
        }
コード例 #4
0
        protected override string GetText(IPackageVersion version, bool isInProgress)
        {
            if (m_PageManager.GetSelection().Count > 1)
            {
                return(isInProgress ? k_MultiSelectUpdatingButtonText : k_MultiSelectUpdateButtonText);
            }

            return(string.Format(isInProgress ? k_UpdatingToButtonTextFormat : k_UpdateToButtonTextFormat, GetTargetVersion(version).version));
        }
コード例 #5
0
        private void RefreshVersionsHistory(IEnumerable <VisualState> states)
        {
            var newVisualState = states.FirstOrDefault(state => state.packageUniqueId == m_Version?.packageUniqueId);

            if (newVisualState?.userUnlocked == true && m_PageManager.GetSelection()?.Count == 1)
            {
                m_TabView.RefreshTab(PackageDetailsVersionsTab.k_Id, m_Version);
            }
        }
コード例 #6
0
        public void OnEnable()
        {
            body.OnEnable();
            toolbar.OnEnable();
            multiSelectDetails.OnEnable();

            m_Application.onInternetReachabilityChange += OnInternetReachabilityChange;

            m_PackageDatabase.onPackagesChanged                    += OnPackagesChanged;
            m_PackageDatabase.onVerifiedGitPackageUpToDate         += OnVerifiedGitPackageUpToDate;
            m_PackageDatabase.onTermOfServiceAgreementStatusChange += OnTermOfServiceAgreementStatusChange;

            m_PageManager.onSelectionChanged += OnSelectionChanged;

            m_UnityConnectProxy.onUserLoginStateChange += OnUserLoginStateChange;

            Refresh(m_PageManager.GetSelection());
        }
コード例 #7
0
        private ISelectableItem GetFirstSelectedItem()
        {
            m_PackageDatabase.GetPackageAndVersion(m_PageManager.GetSelection().firstSelection, out var package, out var version);
            var selectedVersion = version ?? package?.versions.primary;
            var packageItem     = GetPackageItem(selectedVersion?.packageUniqueId);

            if (packageItem == null)
            {
                return(null);
            }

            if (!packageItem.visualState.expanded)
            {
                return(packageItem);
            }

            return(packageItem.versionItems.FirstOrDefault(v => v.targetVersion == selectedVersion));
        }
コード例 #8
0
        protected override string GetText(IPackageVersion version, bool isInProgress)
        {
            if (!m_ShowVersion || m_PageManager.GetSelection().Count > 1)
            {
                return(isInProgress ? k_UpdatingToWithoutVersionButtonText : k_UpdateToWithoutVersionButtonText);
            }

            return(string.Format(isInProgress ? k_UpdatingToButtonTextFormat : k_UpdateToButtonTextFormat,
                                 version?.package?.versions.GetUpdateTarget(version).version));
        }