Exemplo n.º 1
0
        private void RefreshLabel(bool multipleVersionsVisible, bool isLatestVersion, bool isUnityPackage)
        {
            versionLabel.text = version.version?.ToString() ?? version.versionString;
            versionLabel.ShowTextTooltipOnSizeChange();

            var primary           = package.versions.primary;
            var recommended       = package.versions.recommended;
            var versionInManifest = primary?.packageInfo?.projectDependenciesEntry;
            var stateText         = string.Empty;

            if (version == primary)
            {
                if (version.isInstalled)
                {
                    stateText = L10n.Tr(version.isDirectDependency ? "Currently installed" : "Installed as dependency");
                }
                else if (version.HasTag(PackageTag.Downloadable) && version.isAvailableOnDisk)
                {
                    stateText = L10n.Tr("Currently downloaded");
                }
                // with keyVersions being potentially larger now, we want to
                //  show 'Recommended' text whether package is installed or not
                //  if more than one version is in keyVersions
                else if (version == recommended && multipleVersionsVisible && isUnityPackage)
                {
                    stateText = L10n.Tr("Recommended");
                }
                else if (!isUnityPackage && multipleVersionsVisible && isLatestVersion)
                {
                    stateText = L10n.Tr("Latest update");
                }
            }
            else if (versionInManifest == version.versionString)
            {
                stateText = L10n.Tr("Requested but overridden");
            }
            else if (version == recommended && isUnityPackage)
            {
                stateText = L10n.Tr("Recommended");
            }
            else if ((primary.isInstalled || !isUnityPackage) && isLatestVersion)
            {
                stateText = L10n.Tr("Latest update");
            }

            stateLabel.text = stateText;

            var tagLabel = PackageTagLabel.CreateTagLabel(version, true);

            if (tagLabel != null)
            {
                stateContainer.Add(tagLabel);
            }
        }
Exemplo n.º 2
0
        private void RefreshTags()
        {
            m_TagContainer.Clear();
            var showTags = !package.Is(PackageType.AssetStore) && !package.Is(PackageType.BuiltIn);

            if (showTags)
            {
                var tagLabel = PackageTagLabel.CreateTagLabel(targetVersion);
                if (tagLabel != null)
                {
                    m_TagContainer.Add(tagLabel);
                }
            }
        }