예제 #1
0
 public void OnGUI(DependencyManager mediation)
 {
     HelpStyles.Devider();
     EditorGUILayout.BeginHorizontal();
     GUILayout.Label(name);
     //if (GUILayout.Button( "Select", EditorStyles.miniButton, mediation.columnWidth ))
     //{
     //    var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>( path );
     //    EditorGUIUtility.PingObject( asset );
     //}
     if (GUILayout.Button("Remove", EditorStyles.miniButton, mediation.columnWidth))
     {
         AssetDatabase.MoveAssetToTrash(path);
         for (int i = mediation.other.Count - 1; i >= 0; i--)
         {
             if (mediation.other[i].path == path)
             {
                 mediation.other.RemoveAt(i);
             }
         }
     }
     EditorGUILayout.EndHorizontal();
     EditorGUI.indentLevel++;
     EditorGUILayout.LabelField(path, EditorStyles.wordWrappedMiniLabel, GUILayout.ExpandHeight(false));
     EditorGUI.indentLevel--;
 }
예제 #2
0
        internal void OnGUI(DependencyManager mediation, BuildTarget platform)
        {
            bool installed = !string.IsNullOrEmpty(installedVersion);

            if (notSupported && filter < 0 && !installed)
            {
                return;
            }
            HelpStyles.Devider();
            EditorGUILayout.BeginHorizontal();

            //OnLabelGUI( labels );

            string sdkVersion = null;

            for (int i = 0; i < depsSDK.Count; i++)
            {
                if (depsSDK[i].version != version)
                {
                    sdkVersion = depsSDK[i].version;
                    break;
                }
            }

            if (installed || locked)
            {
                EditorGUI.BeginDisabledGroup((!installed && locked) || (installed && isRequired && !locked));
                if (!GUILayout.Toggle(true, " " + name + altName, GUILayout.ExpandWidth(false)))
                {
                    DisableDependencies(platform, mediation);
                }
                if (sdkVersion != null)
                {
                    GUILayout.Label(sdkVersion, EditorStyles.centeredGreyMiniLabel, GUILayout.ExpandWidth(false));
                }
                GUILayout.FlexibleSpace();

                if (notSupported || (locked && installed))
                {
                    GUILayout.Label(version, mediation.columnWidth);
                    if (GUILayout.Button("Remove", EditorStyles.miniButton, mediation.columnWidth))
                    {
                        DisableDependencies(platform, mediation);
                        GUIUtility.ExitGUI();
                    }
                }
                else if (locked)
                {
                    GUILayout.Label(version, mediation.columnWidth);
                    GUILayout.Label("-", mediation.columnWidth);
                }
                else
                {
                    GUILayout.Label(installedVersion, mediation.columnWidth);
                    if (isNewer)
                    {
                        if (GUILayout.Button(version, EditorStyles.miniButton, mediation.columnWidth))
                        {
                            ActivateDependencies(platform, mediation);
                            GUIUtility.ExitGUI();
                        }
                    }
                    else
                    {
                        GUILayout.Label(isRequired ? "Required" : "-", mediation.columnWidth);
                    }
                }
                EditorGUI.EndDisabledGroup();
            }
            else
            {
                EditorGUI.BeginDisabledGroup(notSupported || (dependencies.Length == 0 && depsSDK.Count == 0));

                if (GUILayout.Toggle(false, " " + name + altName, GUILayout.ExpandWidth(false)))
                {
                    ActivateDependencies(platform, mediation);
                    GUIUtility.ExitGUI();
                }
                if (sdkVersion != null)
                {
                    GUILayout.Label(sdkVersion, EditorStyles.centeredGreyMiniLabel, GUILayout.ExpandWidth(false));
                }
                GUILayout.FlexibleSpace();
                GUILayout.Label("none", mediation.columnWidth);
                if (isRequired)
                {
                    if (GUILayout.Button(version, EditorStyles.miniButton, mediation.columnWidth))
                    {
                        ActivateDependencies(platform, mediation);
                        GUIUtility.ExitGUI();
                    }
                }
                else
                {
                    GUILayout.Label(version, mediation.columnWidth);
                }
                EditorGUI.EndDisabledGroup();
            }

            if ((notSupported && installed) || (installed && locked) || (isRequired && !locked && !installed))
            {
                GUILayout.Label(HelpStyles.errorIconContent, GUILayout.Width(20));
            }
            else if (string.IsNullOrEmpty(url))
            {
                GUILayout.Space(25);
            }
            else if (GUILayout.Button(HelpStyles.helpIconContent, EditorStyles.label, GUILayout.Width(20)))
            {
                Application.OpenURL(url);
            }

            EditorGUILayout.EndHorizontal();
            if (contains.Length > 0)
            {
                var footerText = new StringBuilder();
                for (int i = 0; i < contains.Length; i++)
                {
                    if (contains[i] != adBase)
                    {
                        if (footerText.Length > 0)
                        {
                            footerText.Append(", ");
                        }
                        footerText.Append(contains[i]);
                    }
                }

                if (footerText.Length > 0)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.LabelField(footerText.ToString(), EditorStyles.wordWrappedMiniLabel);
                    //EditorGUILayout.HelpBox( string.Join( ", ", contains ), MessageType.None );
                    EditorGUI.indentLevel--;
                }
            }

            if (!string.IsNullOrEmpty(comment))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.LabelField(comment, EditorStyles.wordWrappedMiniLabel);
                EditorGUI.indentLevel--;
            }
        }