public PackageDetails() { UIUtils.SetElementDisplay(this, false); root = Resources.GetTemplate("PackageDetails.uxml"); Add(root); foreach (var extension in PackageManagerExtensions.Extensions) { CustomContainer.Add(extension.CreateExtensionUI()); } root.StretchToParentSize(); SetUpdateVisibility(false); RemoveButton.visible = false; UpdateBuiltIn.visible = false; UpdateButton.clickable.clicked += UpdateClick; UpdateBuiltIn.clickable.clicked += UpdateClick; RemoveButton.clickable.clicked += RemoveClick; ViewDocButton.clickable.clicked += ViewDocClick; ViewChangelogButton.clickable.clicked += ViewChangelogClick; ViewLicenses.clickable.clicked += ViewLicensesClick; VersionItems = new List <VersionItem> { EmptyVersion }; VersionPopup = new PopupField <VersionItem>(VersionItems, 0); VersionPopup.SetLabelCallback(VersionSelectionSetLabel); VersionPopup.AddToClassList("popup"); VersionPopup.OnValueChanged(VersionSelectionChanged); if (VersionItems.Count == 1) { VersionPopup.SetEnabled(false); } UpdateDropdownContainer.Add(VersionPopup); VersionPopup.StretchToParentSize(); // Fix button on dark skin but overlapping edge pixel perfectly if (EditorGUIUtility.isProSkin) { VersionPopup.style.positionLeft = -1; UpdateDropdownContainer.style.sliceLeft = 4; } // We add a null check to avoid the null exception error when updating Package Manager UI to the new version if (DetailWarningLink != null) { DetailWarningLink.clickable.clicked += () => Application.OpenURL("https://docs.unity3d.com/Manual/upm-scoped.html"); } }
public PackageDetails() { root = Resources.GetTemplate("PackageDetails.uxml"); Add(root); foreach (var extension in PackageManagerExtensions.Extensions) { CustomContainer.Add(extension.CreateExtensionUI()); } root.StretchToParentSize(); SetUpdateVisibility(false); RemoveButton.visible = false; UpdateBuiltIn.visible = false; root.Q <VisualElement>(emptyId).visible = false; UpdateButton.clickable.clicked += UpdateClick; UpdateBuiltIn.clickable.clicked += UpdateClick; RemoveButton.clickable.clicked += RemoveClick; ViewDocButton.clickable.clicked += ViewDocClick; ViewChangelogButton.clickable.clicked += ViewChangelogClick; ViewLicenses.clickable.clicked += ViewLicensesClick; UpdateButton.parent.clippingOptions = ClippingOptions.NoClipping; UpdateButton.parent.parent.clippingOptions = ClippingOptions.NoClipping; UpdateButton.parent.parent.parent.clippingOptions = ClippingOptions.NoClipping; VersionItems = new List <VersionItem> { EmptyVersion }; VersionPopup = new PopupField <VersionItem>(VersionItems, 0); VersionPopup.SetLabelCallback(VersionSelectionSetLabel); VersionPopup.AddToClassList("popup"); VersionPopup.OnValueChanged(VersionSelectionChanged); if (VersionItems.Count == 1) { VersionPopup.SetEnabled(false); } UpdateDropdownContainer.Add(VersionPopup); VersionPopup.StretchToParentSize(); PackageCollection.Instance.OnFilterChanged += OnFilterChanged; PackageCollection.Instance.OnPackageUpdated += OnPackageUpdated; // Fix button on dark skin but overlapping edge pixel perfectly if (EditorGUIUtility.isProSkin) { VersionPopup.style.positionLeft = -1; UpdateDropdownContainer.style.sliceLeft = 4; } }