Ejemplo n.º 1
0
        public static PackageTagLabel CreateTagLabel(IPackageVersion version, bool isVersionItem = false)
        {
            var tagLabel = new PackageTagLabel();

            tagLabel.Refresh(version, isVersionItem);
            return(tagLabel.m_Tag != PackageTag.None ? tagLabel : null);
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
                }
            }
        }
Ejemplo n.º 4
0
        private void DisplaySupportedPlatforms(IEnumerable <string> platformNames)
        {
            foreach (var platformName in platformNames)
            {
                var packageTagPlatform = new PackageTagLabel {
                    classList = { "platform" }
                };
                packageTagPlatform.text = platformName;
                platformList.Add(packageTagPlatform);
            }

            if (platformNames.Count() < 5)
            {
                return;
            }

            platformList.Add(buttonPlatformMore);
            platformList.Add(buttonPlatformLess);
            PlatformLessClick();
        }