예제 #1
0
        public PackageGroup(ResourceLoader resourceLoader, PageManager pageManager, PackageManagerProjectSettingsProxy settingsProxy, PackageDatabase packageDatabase, string groupName, string displayName, bool expanded = true, bool hidden = false)
        {
            ResolveDependencies(resourceLoader, pageManager, settingsProxy, packageDatabase);

            name = groupName;
            var root = m_ResourceLoader.GetTemplate("PackageGroup.uxml");

            Add(root);
            m_Cache = new VisualElementCache(root);

            headerCaret.SetValueWithoutNotify(expanded);
            EnableInClassList("collapsed", !expanded);
            headerCaret.RegisterValueChangedCallback((evt) =>
            {
                m_PageManager.SetGroupExpanded(groupName, evt.newValue);
                EnableInClassList("collapsed", !evt.newValue);
                EditorApplication.delayCall += () => onGroupToggle?.Invoke(evt.newValue);
            });

            headerTag.pickingMode = PickingMode.Ignore;
            headerCaret.text      = displayName;

            isHidden = hidden;
            if (isHidden)
            {
                AddToClassList("hidden");
            }
        }
        public PackageReleaseDetailsItem()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageReleaseDetailsItem.uxml");

            Add(root);
            cache = new VisualElementCache(root);
        }
예제 #3
0
        public PackageDetailsDescriptionTab(ResourceLoader resourceLoader)
        {
            m_Id          = k_Id;
            m_DisplayName = L10n.Tr("Description");
            var root = resourceLoader.GetTemplate("DetailsTabs/PackageDetailsDescriptionTab.uxml");

            Add(root);
            m_Cache = new VisualElementCache(root);
        }
예제 #4
0
        public MultiSelectDetails()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("MultiSelectDetails.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            lockedPackagesInfoBox.Q <Button>().clickable.clicked += OnDeselectLockedSelectionsClicked;

            InitializeFoldouts();
        }
예제 #5
0
        public FeatureDependencies()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("FeatureDependencies.uxml");

            Add(root);

            cache = new VisualElementCache(root);
            SetExpanded(m_PackageManagerPrefs.featureDependenciesExpanded);
            dependenciesExpander?.RegisterValueChangedCallback(evt => SetExpanded(evt.newValue));
            dependencyInfoBox.Q <Button>().clickable.clicked += () => m_Application.OpenURL($"{infoBoxUrl}/{m_Link}");
        }
        public AddPackageByNameDropdown(ResourceLoader resourceLoader, PackageFiltering packageFiltering, UpmClient upmClient, PackageDatabase packageDatabase, PageManager packageManager, EditorWindow anchorWindow)
        {
            ResolveDependencies(resourceLoader, packageFiltering, upmClient, packageDatabase, packageManager);

            styleSheets.Add(m_ResourceLoader.inputDropdownStyleSheet);

            var root = m_ResourceLoader.GetTemplate("AddPackageByNameDropdown.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            Init(anchorWindow);
        }
예제 #7
0
        public PackageSampleList()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageSampleList.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            SetExpanded(m_PackageManagerPrefs.samplesExpanded);
            samplesExpander.RegisterValueChangedCallback(evt => SetExpanded(evt.newValue));
            RegisterCallback <GeometryChangedEvent>(OnGeometryChanged);
        }
예제 #8
0
        public PackageDetailsHeader()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageDetailsHeader.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            m_PageManager.onVisualStateChange  += OnVisualStateChange;
            detailAuthorLink.clickable.clicked += AuthorClick;
            scopedRegistryInfoBox.Q <Button>().clickable.clicked += OnInfoBoxClickMore;
        }
        public GenericInputDropdown(ResourceLoader resourceLoader, EditorWindow anchorWindow, InputDropdownArgs args)
        {
            ResolveDependencies(resourceLoader);

            styleSheets.Add(m_ResourceLoader.inputDropdownStyleSheet);

            var root = m_ResourceLoader.GetTemplate("GenericInputDropdown.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            Init(anchorWindow, args);
        }
예제 #10
0
        public PackageDetailsBody()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageDetailsBody.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            detailDescMore.clickable.clicked += DescMoreClick;
            detailDescLess.clickable.clicked += DescLessClick;
            detailDesc.RegisterCallback <GeometryChangedEvent>(DescriptionGeometryChangeEvent);
        }
예제 #11
0
        public PackagePlatformList()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackagePlatformList.uxml");

            Add(root);

            cache = new VisualElementCache(root);

            buttonPlatformMore.clickable.clicked += PlatformMoreClick;
            buttonPlatformLess.clickable.clicked += PlatformLessClick;
        }
        public PackageDetailsDependenciesTab(ResourceLoader resourceLoader, PackageDatabase packageDatabase)
        {
            m_Id              = k_Id;
            m_DisplayName     = L10n.Tr("Dependencies");
            m_ResourceLoader  = resourceLoader;
            m_PackageDatabase = packageDatabase;

            var root = m_ResourceLoader.GetTemplate("PackageDetailsDependenciesTab.uxml");

            Add(root);
            m_Cache = new VisualElementCache(root);

            RegisterCallback <GeometryChangedEvent>(OnGeometryChanged);
        }
예제 #13
0
        public PackageVersionItem(IPackage package, IPackageVersion version, bool multipleVersionsVisible, bool isLatestVersion)
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageVersionItem.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            this.package = package;
            this.version = version;

            RefreshLabel(multipleVersionsVisible, isLatestVersion, version.isUnityPackage == true);
        }
예제 #14
0
        public Alert()
        {
            ResolveDependencies();

            UIUtils.SetElementDisplay(this, false);

            var root = m_ResourceLoader.GetTemplate("Alert.uxml");

            Add(root);

            cache = new VisualElementCache(root);

            alertReadMoreLink.clicked += ReadMoreLinkClick;
        }
        public PackageDependencySampleItemLowWidth(string name, string version, Label installStatus)
        {
            ResolveDependencies();
            var root = m_ResourceLoader.GetTemplate("PackageDependencySampleItemLowWidth.uxml");

            Add(root);

            cache = new VisualElementCache(root);

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

            itemSizeOrVersion.value   = version;
            itemSizeOrVersion.tooltip = version;
            if (version == "---")
            {
                UIUtils.SetElementDisplay(itemSizeOrVersion, false);
            }

            if (installStatus != null && !string.IsNullOrEmpty(installStatus.text))
            {
                item.Add(installStatus);
            }
        }
예제 #16
0
        public ProgressBar()
        {
            ResolveDependencies();

            UIUtils.SetElementDisplay(this, false);

            var root = m_ResourceLoader.GetTemplate("ProgressBar.uxml");

            Add(root);
            root.StretchToParentSize();

            cache = new VisualElementCache(root);

            currentProgressBar.style.width = Length.Percent(0);
        }
예제 #17
0
        public PackageLoadBar()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageLoadBar.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            var dropDownButton = new DropdownButton();

            dropDownButton.name = "loadAssetsDropdown";
            loadAssetsDropdownContainer.Add(dropDownButton);

            loadMoreLabel.OnLeftClick(LoadItemsClicked);
        }
예제 #18
0
        public PackageStatusBar()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageStatusBar.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            var dropDownButton = new DropdownButton();

            dropDownButton.name = "refreshButton";
            refreshButtonContainer.Add(dropDownButton);

            statusLabel.ShowTextTooltipOnSizeChange();
        }
        public ScopedRegistriesSettings()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("ScopedRegistriesSettings.uxml");

            Add(root);
            cache = new VisualElementCache(root);

            scopedRegistriesInfoBox.Q <Button>().clickable.clicked += () =>
            {
                m_ApplicationProxy.OpenURL($"https://docs.unity3d.com/{m_ApplicationProxy.shortUnityVersion}/Documentation/Manual/upm-scoped.html");
            };
            applyRegistriesButton.clickable.clicked  += ApplyChanges;
            revertRegistriesButton.clickable.clicked += RevertChanges;
            registryNameTextField.RegisterValueChangedCallback(OnRegistryNameChanged);
            registryUrlTextField.RegisterValueChangedCallback(OnRegistryUrlChanged);

            m_NewScopedRegistryLabel = new Label();
            m_NewScopedRegistryLabel.AddToClassList(k_NewRegistryClass);
            m_NewScopedRegistryLabel.OnLeftClick(() => OnRegistryLabelClicked(null));

            addRegistryButton.clickable.clicked    += AddRegistryClicked;
            removeRegistryButton.clickable.clicked += RemoveRegistryClicked;

            addScopeButton.clickable.clicked    += AddScopeClicked;
            removeScopeButton.clickable.clicked += RemoveScopeClicked;

            m_UpmRegistryClient.onRegistriesModified     += OnRegistriesModified;
            m_UpmRegistryClient.onRegistryOperationError += OnRegistryOperationError;
            Undo.undoRedoPerformed -= OnUndoRedoPerformed;
            Undo.undoRedoPerformed += OnUndoRedoPerformed;

            // on domain reload, it's not guaranteed that the settings have
            //  reloaded the draft object yet- need to wait and do this when
            //  initialization has finished
            if (draft.IsReady())
            {
                UpdateRegistryList();
                UpdateRegistryDetails();
            }
            else
            {
                m_SettingsProxy.onInitializationFinished += OnSettingsInitialized;
            }
        }
예제 #20
0
        protected virtual void OnEnable()
        {
            hideFlags = HideFlags.DontSave;
            this.SetAntiAliasing(4);

            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageManagerFiltersWindow.uxml");

            root.styleSheets.Add(m_ResourceLoader.filtersDropdownStyleSheet);
            cache = new VisualElementCache(root);

            rootVisualElement.Add(root);
            root.StretchToParentSize();

            m_Container = cache.Get <VisualElement>("mainContainer");
        }
예제 #21
0
        private PackageManagerUserSettingsProvider(string path, IEnumerable <string> keywords = null) : base(path, SettingsScope.User, keywords)
        {
            activateHandler = (text, element) =>
            {
                ResolveDependencies();

                // Create a child to make sure all the style sheets are not added to the root.
                m_RootVisualElement = new ScrollView();
                m_RootVisualElement.StretchToParentSize();
                m_RootVisualElement.AddStyleSheetPath(k_UserSettingsStylesheet);
                m_RootVisualElement.AddStyleSheetPath(EditorGUIUtility.isProSkin ? k_DarkStylesheet : k_LightStylesheet);
                m_RootVisualElement.AddStyleSheetPath(k_CommonStylesheet);
                m_RootVisualElement.styleSheets.Add(m_ResourceLoader.packageManagerCommonStyleSheet);

                element.Add(m_RootVisualElement);

                var root = m_ResourceLoader.GetTemplate(k_PackageManagerUserSettingsTemplate);
                m_RootVisualElement.Add(root);
                m_Cache = new VisualElementCache(root);

                DisplayPackagesCacheSetting();
                DisplayAssetStoreCachePathSetting();

                EditorApplication.focusChanged += OnEditorApplicationFocusChanged;
            };
            deactivateHandler = () =>
            {
                EditorApplication.focusChanged -= OnEditorApplicationFocusChanged;

                if (m_UpmCacheRootClient != null)
                {
                    m_UpmCacheRootClient.onGetCacheRootOperationError    -= OnPackagesGetCacheRootOperationError;
                    m_UpmCacheRootClient.onGetCacheRootOperationResult   -= OnPackagesGetCacheRootOperationResult;
                    m_UpmCacheRootClient.onSetCacheRootOperationError    -= OnPackagesSetCacheRootOperationError;
                    m_UpmCacheRootClient.onSetCacheRootOperationResult   -= OnPackagesSetCacheRootOperationResult;
                    m_UpmCacheRootClient.onClearCacheRootOperationError  -= OnPackagesClearCacheRootOperationError;
                    m_UpmCacheRootClient.onClearCacheRootOperationResult -= OnPackagesClearCacheRootOperationResult;
                }

                if (m_AssetStoreCachePathProxy != null)
                {
                    m_AssetStoreCachePathProxy.onConfigChanged -= RefreshAssetStoreCachePathConfig;
                }
            };
        }
예제 #22
0
        public PackageDetailsSamplesTab(ResourceLoader resourceLoader, PackageDatabase packageDatabase, SelectionProxy selection, AssetDatabaseProxy assetDatabase, ApplicationProxy application, IOProxy iOProxy)
        {
            m_Id              = k_Id;
            m_DisplayName     = L10n.Tr("Samples");
            m_ResourceLoader  = resourceLoader;
            m_PackageDatabase = packageDatabase;
            m_Selection       = selection;
            m_AssetDatabase   = assetDatabase;
            m_Application     = application;
            m_IOProxy         = iOProxy;

            var root = m_ResourceLoader.GetTemplate("PackageDetailsSamplesTab.uxml");

            Add(root);
            m_Cache = new VisualElementCache(root);

            RegisterCallback <GeometryChangedEvent>(OnGeometryChanged);
        }
예제 #23
0
        public PackageList()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageList.uxml");

            Add(root);
            root.StretchToParentSize();
            cache = new VisualElementCache(root);

            emptyAreaButton.clickable.clicked += OnButtonClicked;

            RegisterCallback <GeometryChangedEvent>(OnGeometryChange);
            RegisterCallback <AttachToPanelEvent>(OnEnterPanel);
            RegisterCallback <DetachFromPanelEvent>(OnLeavePanel);

            focusable = true;
        }
예제 #24
0
        public PackageManagerToolbar()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageManagerToolbar.uxml");

            Add(root);
            root.StretchToParentSize();
            cache = new VisualElementCache(root);

            SetupAddMenu();
            SetupFilterTabsMenu();
            SetupOrdering();
            SetupFilters();
            SetupInProgressSpinner();
            SetupAdvancedMenu();

            m_SearchTextChangeTimestamp = 0;
        }
        public FeatureDependenciesTab(ResourceLoader resourceLoader,
                                      PackageDatabase packageDatabase,
                                      PackageManagerPrefs packageManagerPrefs,
                                      PackageManagerProjectSettingsProxy settingsProxy,
                                      ApplicationProxy applicationProxy)
        {
            m_ResourceLoader      = resourceLoader;
            m_PackageDatabase     = packageDatabase;
            m_PackageManagerPrefs = packageManagerPrefs;
            m_SettingsProxy       = settingsProxy;
            m_Application         = applicationProxy;

            m_Id          = k_Id;
            m_DisplayName = L10n.Tr("Packages Included");

            var root = m_ResourceLoader.GetTemplate("FeatureDependencies.uxml");

            Add(root);

            cache = new VisualElementCache(root);
            dependencyInfoBox.Q <Button>().clickable.clicked += () => m_Application.OpenURL($"{infoBoxUrl}/{m_Link}");
        }
        public PackageDetailsVersionHistoryItem(ResourceLoader resourceLoader,
                                                PackageDatabase packageDatabase,
                                                UpmCache upmCache,
                                                ApplicationProxy applicationProxy,
                                                IOProxy ioProxy,
                                                IPackageVersion version,
                                                bool multipleVersionsVisible,
                                                bool isLatestVersion,
                                                bool expanded,
                                                PackageToolBarRegularButton button)
        {
            m_Version          = version;
            m_PackageDatabase  = packageDatabase;
            m_UpmCache         = upmCache;
            m_ApplicationProxy = applicationProxy;
            m_IOProxy          = ioProxy;

            var root = resourceLoader.GetTemplate("PackageDetailsVersionHistoryItem.uxml");

            Add(root);
            m_Cache = new VisualElementCache(root);

            SetExpanded(expanded);
            versionHistoryItemToggle.RegisterValueChangedCallback(evt =>
            {
                SetExpanded(evt.newValue);
                onToggleChanged?.Invoke(evt.newValue);
            });

            m_Button = button;
            if (m_Button != null)
            {
                versionHistoryItemToggleRightContainer.Add(m_Button.element);
            }

            versionHistoryItemChangeLogLink.clickable.clicked += () => UpmPackageDocs.ViewUrl(UpmPackageDocs.GetChangelogUrl(m_Version), UpmPackageDocs.GetOfflineChangelog(m_IOProxy, m_Version), L10n.Tr("changelog"), "viewChangelog", m_Version, m_Version.package, m_ApplicationProxy);

            Refresh(multipleVersionsVisible, isLatestVersion);
        }
예제 #27
0
        public PackageDetails()
        {
            ResolveDependencies();

            var root = m_ResourceLoader.GetTemplate("PackageDetails.uxml");

            Add(root);
            root.StretchToParentSize();
            cache = new VisualElementCache(root);

            PackageManagerExtensions.ExtensionCallback(() =>
            {
                foreach (var extension in PackageManagerExtensions.Extensions)
                {
                    customContainer.Add(extension.CreateExtensionUI());
                }
            });

            scrollView.verticalScroller.valueChanged += OnDetailScroll;
            scrollView.RegisterCallback <GeometryChangedEvent>(RecalculateFillerHeight);
            detail.RegisterCallback <GeometryChangedEvent>(RecalculateFillerHeight);
        }
예제 #28
0
        public void OnEnable()
        {
            styleSheets.Add(m_ResourceLoader.packageManagerWindowStyleSheet);

            var root = m_ResourceLoader.GetTemplate("PackageManagerWindow.uxml");

            Add(root);
            cache = new VisualElementCache(root);
            var newTab = m_PackageManagerPrefs.lastUsedPackageFilter ?? PackageFiltering.k_DefaultFilterTab;

            // Reset the lock icons when users open a new Package Manager window
            m_PageManager.GetPage(newTab).ResetUserUnlockedState();

            packageDetails.OnEnable();
            packageList.OnEnable();
            packageManagerToolbar.OnEnable();
            packageSubPageFilterBar.OnEnable();
            packageStatusbar.OnEnable();

            leftColumnContainer.style.flexGrow  = m_PackageManagerPrefs.splitterFlexGrow;
            rightColumnContainer.style.flexGrow = 1 - m_PackageManagerPrefs.splitterFlexGrow;

            m_PageManager.onRefreshOperationFinish     += OnRefreshOperationFinish;
            m_UnityConnectProxy.onUserLoginStateChange += OnUserLoginStateChange;

            m_AssetStoreCachePathProxy.onConfigChanged += OnAssetStoreCacheConfigChange;

            PackageManagerWindowAnalytics.Setup();

            EditorApplication.focusChanged += OnFocusChanged;
            m_Selection.onSelectionChanged += RefreshSelectedInInspectorClass;

            focusable = true;
            RegisterCallback <AttachToPanelEvent>(OnAttachToPanel);
            RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel);

            RefreshSelectedInInspectorClass();
        }
        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);
            }
        }