Пример #1
0
        /// <summary>
        /// Initializes UI.
        /// </summary>
        void InitializeUI()
        {
            if (_initialized)
            {
                return;
            }

            var asset = AssetDatabase.LoadAssetAtPath <VisualTreeAsset> (TemplatePath);

            if (!asset)
            {
                return;
            }

#if UNITY_2019_1_OR_NEWER
            gitDetailActoins = asset.CloneTree().Q("detailActions");
            gitDetailActoins.styleSheets.Add(EditorGUIUtility.Load(StylePath) as StyleSheet);
#else
            _gitDetailActoins = asset.CloneTree(null).Q("detailActions");
            _gitDetailActoins.AddStyleSheetPath(StylePath);
#endif

            // Add callbacks
            _hostingIcon.clickable.clicked       += () => Application.OpenURL(Utils.GetRepoURL(_packageInfo));
            _viewDocumentation.clickable.clicked += () => Application.OpenURL(Utils.GetFileURL(_packageInfo, "README.md"));
            _viewChangelog.clickable.clicked     += () => Application.OpenURL(Utils.GetFileURL(_packageInfo, "CHANGELOG.md"));
            _viewLicense.clickable.clicked       += () => Application.OpenURL(Utils.GetFileURL(_packageInfo, "LICENSE.md"));

            // Move element to documentationContainer
            _detailControls         = parent.parent.Q("detailsControls");
            _documentationContainer = parent.parent.Q("documentationContainer");
            _originalDetailActions  = _documentationContainer.Q("detailActions");
            _documentationContainer.Add(_gitDetailActoins);

            _updateButton = new Button(AddOrUpdatePackage)
            {
                name = "update", text = "Up to date"
            };
            _updateButton.AddToClassList("action");
            _versionPopup = new Button(PopupVersions)
            {
                text = "hoge", style = { marginLeft = -4, marginRight = -3, marginTop = -3, marginBottom = -3, },
            };
            _versionPopup.AddToClassList("popup");
            _versionPopup.AddToClassList("popupField");
            _versionPopup.AddToClassList("versions");

            _detailControls.Q("updateCombo").Insert(1, _updateButton);
            _detailControls.Q("updateDropdownContainer").Add(_versionPopup);

            _initialized = true;
        }
Пример #2
0
 public string GetFileURLTest(bool isPackageInfoExist, string fileName)
 {
     return(Utils.GetFileURL(isPackageInfoExist ? pi : null, fileName));
 }