예제 #1
0
        public bool ElementVisibleTest(string operations)
        {
            var _element = new VisualElement();

            if (0 < operations.Length)
            {
                foreach (bool flag in operations.Split(',').Select(System.Convert.ToBoolean))
                {
                    Utils.SetElementDisplay(_element, flag);
                }
            }

            return(Utils.IsElementDisplay(_element));
        }
예제 #2
0
        /// <summary>
        /// Called by the Package Manager UI when the package selection changed.
        /// </summary>
        /// <param name="packageInfo">The newly selected package information (can be null)</param>
        public void OnPackageSelectionChange(PackageInfo packageInfo)
        {
            InitializeUI();
            if (!_initialized || packageInfo == null || _packageInfo == packageInfo)
            {
                return;
            }

            _packageInfo = packageInfo;

            var isGit = packageInfo.source == PackageSource.Git;

            Utils.SetElementDisplay(_gitDetailActoins, isGit);
            Utils.SetElementDisplay(_originalDetailActions, !isGit);
            Utils.SetElementDisplay(_detailControls.Q("", "popupField"), !isGit);
            Utils.SetElementDisplay(_updateButton, isGit);
            Utils.SetElementDisplay(_versionPopup, isGit);

            if (isGit)
            {
                Utils.RequestTags(_packageInfo.packageId, _tags);
                Utils.RequestBranches(_packageInfo.packageId, _branches);

                SetVersion(_packageInfo.version);
                EditorApplication.delayCall += () =>
                {
                    Utils.SetElementDisplay(_detailControls.Q("updateCombo"), true);
                    Utils.SetElementDisplay(_detailControls.Q("remove"), true);
                    _detailControls.Q("remove").SetEnabled(true);
                }
                ;
            }

            Utils.SetElementClass(_hostingIcon, "github", true);
            Utils.SetElementClass(_hostingIcon, "dark", EditorGUIUtility.isProSkin);
        }