Ejemplo n.º 1
0
        private void SwitchToRegularSampleList()
        {
            UIUtils.SetElementDisplay(samplesListLowWidth, false);
            UIUtils.SetElementDisplay(samplesContainer, true);

            samplesContainer.Clear();

            foreach (var sample in m_Samples.Where(s => !string.IsNullOrEmpty(s.displayName)))
            {
                var sampleItem      = new PackageDetailsSampleItem(m_Version, sample, m_Selection, m_AssetDatabase, m_Application, m_IOProxy);
                var sampleContainer = new VisualElement();
                sampleContainer.AddClasses("sampleContainer");

                var importStatus = new VisualElement();
                importStatus.name = "importStatusContainer";
                importStatus.Add(sampleItem.importStatus);

                var nameAndSizeLabel = new VisualElement();
                nameAndSizeLabel.name = "nameAndSizeLabelContainer";
                nameAndSizeLabel.Add(sampleItem.nameLabel);
                nameAndSizeLabel.Add(sampleItem.sizeLabel);
                nameAndSizeLabel.Add(importStatus);
                sampleContainer.Add(nameAndSizeLabel);

                var importButton = new VisualElement();
                importButton.name = "importButtonContainer";
                importButton.Add(sampleItem.importButton);
                sampleContainer.Add(importButton);

                if (!string.IsNullOrEmpty(sample.description))
                {
                    var description = new VisualElement();
                    description.name = "descriptionContainer";
                    description.Add(sampleItem.descriptionLabel);
                    sampleContainer.Add(description);
                }

                samplesContainer.Add(sampleContainer);
                sampleItem.importButton.SetEnabled(m_Version.isInstalled);
            }
        }
        public PackageDependencySampleItemLowWidth(ResourceLoader resourceLoader, IPackageVersion version, Sample sample, SelectionProxy selection, AssetDatabaseProxy assetDatabase, ApplicationProxy application, IOProxy iOProxy)
        {
            var root = resourceLoader.GetTemplate("PackageDependencySampleItemLowWidth.uxml");

            Add(root);

            cache = new VisualElementCache(root);

            var sampleItem = new PackageDetailsSampleItem(version, sample, selection, assetDatabase, application, iOProxy);

            sampleItem.importButton.SetEnabled(version.isInstalled);

            var name        = sampleItem.nameLabel.text;
            var size        = sampleItem.sizeLabel.text;
            var description = sampleItem.descriptionLabel.text;

            itemName.text    = name;
            itemName.tooltip = name;

            sampleStatus.Add(sampleItem.importStatus);

            itemSizeOrVersion.value   = size;
            itemSizeOrVersion.tooltip = size;

            importButtonContainer.Add(sampleItem.importButton);

            if (!string.IsNullOrEmpty(description))
            {
                UIUtils.SetElementDisplay(sampleDescription, true);
                sampleDescription.SetValueWithoutNotify(description);
            }
            else
            {
                UIUtils.SetElementDisplay(sampleDescription, false);
            }
        }