示例#1
0
        public PackageList()
        {
            ResolveDependencies();

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

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

            viewDataKey            = "package-list-key";
            scrollView.viewDataKey = "package-list-scrollview-key";

            HidePackagesShowMessage(false, false);

            loginButton.clickable.clicked += OnLoginClicked;

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

            RegisterCallback <GeometryChangedEvent>(OnGeometryChange);

            m_PackageItemsLookup = new Dictionary <string, PackageItem>();

            focusable = true;
        }
示例#2
0
        public PackageToolbar()
        {
            ResolveDependencies();

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

            Add(root);
        }
        public PackageStatusBar()
        {
            ResolveDependencies();

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

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

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

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

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

            RegisterCallback <GeometryChangedEvent>(OnGeometryChanged);
        }
示例#5
0
        public PackageLoadBar()
        {
            ResolveDependencies();

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

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

            loadMinLabel.OnLeftClick(LoadMinItemsClicked);
            loadMaxLabel.OnLeftClick(LoadMaxItemsClicked);
        }
        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;
            itemSizeOrVersion.isReadOnly = true;

            if (installStatus != null && !string.IsNullOrEmpty(installStatus.text))
            {
                item.Add(installStatus);
            }
        }
示例#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 PackageReleaseDetailsItem()
        {
            ResolveDependencies();

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

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

            root.Query <TextField>().ForEach(t =>
            {
                t.isReadOnly = true;
            });
        }
示例#9
0
        public PackageVersionItem(IPackage package, IPackageVersion version)
        {
            ResolveDependencies();

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

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

            this.package = package;
            this.version = version;
            RefreshLabel();
            this.OnLeftClick(() => m_PageManager.SetSelected(package, version, true));
        }
示例#10
0
        public ProgressBar()
        {
            ResolveDependencies();

            UIUtils.SetElementDisplay(this, false);

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

            Add(root);
            root.StretchToParentSize();

            cache = new VisualElementCache(root);

            currentProgressText.text       = string.Empty;
            currentProgressBar.style.width = Length.Percent(0);
        }
示例#11
0
        public PackageManagerWindowRoot(ResourceLoader resourceLoader,
                                        SelectionProxy selection,
                                        PackageFiltering packageFiltering,
                                        PackageManagerPrefs packageManagerPrefs,
                                        PackageDatabase packageDatabase,
                                        PageManager pageManager,
                                        PackageManagerProjectSettingsProxy settingsProxy)
        {
            ResolveDependencies(resourceLoader, selection, packageFiltering, packageManagerPrefs, packageDatabase, pageManager, settingsProxy);

            styleSheets.Add(m_ResourceLoader.GetMainWindowStyleSheet());

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

            Add(root);
            cache = new VisualElementCache(root);
        }
        protected virtual void OnEnable()
        {
            hideFlags = HideFlags.DontSave;
            this.SetAntiAliasing(4);

            ResolveDependencies();

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

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

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

            m_Container = cache.Get <VisualElement>("mainContainer");
        }
示例#13
0
        public Alert()
        {
            ResolveDependencies();

            UIUtils.SetElementDisplay(this, false);

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

            Add(root);

            cache = new VisualElementCache(root);

            closeButton.clickable.clicked += () =>
            {
                onCloseError?.Invoke();
                ClearError();
            };
        }
示例#14
0
        public PackageManagerToolbar()
        {
            ResolveDependencies();

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

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

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

            m_SearchTextChangeTimestamp = 0;
        }
示例#15
0
        public PackageItem(ResourceLoader resourceLoader, PageManager pageManager, IPackage package)
        {
            ResolveDependencies(resourceLoader, pageManager);

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

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

            itemLabel.OnLeftClick(SelectMainItem);
            seeAllVersionsLabel.OnLeftClick(SeeAllVersionsClick);
            arrowExpander.RegisterValueChangedCallback(ToggleExpansion);
            nameLabel.ShowTextTooltipOnSizeChange();

            UpdateExpanderUI(false);

            SetPackage(package);
            UpdateVisualState();
        }
示例#16
0
        public PackagesAction(string actionButtonText, string defaultText = "")
        {
            ResolveDependencies();

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

            Add(root);

            m_PlaceHolderText = defaultText;

            Cache = new VisualElementCache(root);

            ActionButton.clickable.clicked += ActionClick;

            RegisterCallback <MouseDownEvent>(evt => Hide());
            PackagesActionContainer.RegisterCallback <MouseDownEvent>(evt =>
            {
                EditorApplication.delayCall += () => { ParamTextField.visualInput.Focus(); };
                evt.StopPropagation();
            });

            ParamTextField.RegisterCallback <ChangeEvent <string> >(OnTextFieldChange);
            ActionButton.text = actionButtonText;
        }
        public void OnEnable()
        {
            this.SetAntiAliasing(4);
            if (instance == null)
            {
                instance = this;
            }
            if (instance != this)
            {
                return;
            }

            ResolveDependencies();

            instance.titleContent = GetLocalizedTitleContent();

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

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

            rootVisualElement.Add(root);

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

            packageManagerToolbar.SetEnabled(!m_PackageDatabase.isEmpty);
            packageDetails.packageToolbarContainer.SetEnabled(!m_PackageDatabase.isEmpty);

            m_PageManager.onRefreshOperationFinish += OnRefreshOperationFinish;
            m_PageManager.onRefreshOperationStart  += OnRefreshOperationStart;
            m_PageManager.onRefreshOperationError  += OnRefreshOperationError;
            m_PackageFiltering.onFilterTabChanged  += OnFilterChanged;

            PackageManagerWindowAnalytics.Setup();

            root.StretchToParentSize();

            var newTab = m_PackageManagerPrefs.lastUsedPackageFilter ?? m_PackageManagerPrefs.defaultFilterTab;

            m_PackageFiltering.SetCurrentFilterTabWithoutNotify(newTab);
            packageManagerToolbar.SetFilter(newTab);

            if (newTab != PackageFilterTab.AssetStore)
            {
                UIUtils.SetElementDisplay(packageLoadBar, false);
            }

            if (m_PageManager.GetRefreshTimestamp(newTab) == 0)
            {
                DelayRefresh(newTab);
            }

            if (newTab != PackageFilterTab.All && m_PageManager.GetRefreshTimestamp(PackageFilterTab.All) == 0)
            {
                DelayRefresh(PackageFilterTab.All);
            }

            mainContainer.leftWidth      = m_SplitPaneLeftWidth;
            mainContainer.onSizeChanged += width => { m_SplitPaneLeftWidth = width; };

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

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

            RefreshSelectedInInspectorClass();
        }