示例#1
0
        public override void DrawAutoCompleteMember(int id, string searchTerms, bool selected)
        {
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label("",
                            new GUIStyle()
            {
                fixedWidth  = 20,
                fixedHeight = 20,
                normal      = { background =
                                    MonkeyStyle.GetIconForFile("fake.unity") }
            });

            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            GUILayout.Label(GetStringValue(id).Highlight(searchTerms, true,
                                                         StringExt.ColorTag(MonkeyStyle.Instance.SearchResultTextColor),
                                                         StringExt.ColorTagClosing,
                                                         StringExt.ColorTag(MonkeyStyle.Instance.HighlightOnSelectedTextColor),
                                                         StringExt.ColorTagClosing), MonkeyStyle.Instance.CommandNameStyle,
                            GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();

            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
示例#2
0
 public override void DrawAutoCompleteMember(int id, string searchTerms, bool selected)
 {
     GUILayout.BeginHorizontal(new GUIStyle()
     {
         margin = new RectOffset(2, 2, 0, 0)
     });
     GUILayout.Label(GetStringValue(id).Highlight(searchTerms, true,
                                                  StringExt.ColorTag(MonkeyStyle.Instance.SearchResultTextColor),
                                                  StringExt.ColorTagClosing,
                                                  StringExt.ColorTag(MonkeyStyle.Instance.HighlightOnSelectedTextColor),
                                                  StringExt.ColorTagClosing),
                     MonkeyStyle.Instance.CommandNameStyle, GUILayout.ExpandWidth(true));
     GUILayout.EndHorizontal();
 }
示例#3
0
 internal static string AppendQuickName(CommandInfo x, string commandTitle, bool selected, string searchTerms)
 {
     if (x.HasQuickName)
     {
         string quick = (x.CommandQuickName).ToUpper();
         if (searchTerms != null)
         {
             quick = quick.Highlight(searchTerms, true,
                                     StringExt.ColorTag(MonkeyStyle.Instance.QuickNameTextColor),
                                     StringExt.ColorTagClosing,
                                     StringExt.ColorTag(MonkeyStyle.Instance.HighlightOnSelectedTextColor),
                                     StringExt.ColorTagClosing);
         }
         else
         {
             quick = quick.Colored(MonkeyStyle.Instance.QuickNameTextColor);
         }
         commandTitle = commandTitle.Insert(0, quick + " | ".Colored(MonkeyStyle.Instance.CommandHelpTextColor));
     }
     return(commandTitle);
 }
示例#4
0
        internal static void DisplayCommandTitle(bool selected, CommandInfo x, string searchTerms)
        {
            string commandTitle = x.CommandName;

            if (searchTerms == null)
            {
                commandTitle = commandTitle.Colored(MonkeyStyle.Instance.HighlightOnSelectedTextColor);
            }
            else
            {
                commandTitle = commandTitle.Highlight(searchTerms, true,
                                                      StringExt.ColorTag(MonkeyStyle.Instance.SearchResultTextColor), StringExt.ColorTagClosing,
                                                      StringExt.ColorTag(MonkeyStyle.Instance.HighlightOnSelectedTextColor),
                                                      StringExt.ColorTagClosing);
            }

            commandTitle = AppendQuickName(x, commandTitle, selected, searchTerms);

            GUILayout.Label(commandTitle.Bold(),
                            MonkeyStyle.Instance.CommandNameStyle);
        }
示例#5
0
        public override void DrawAutoCompleteMember(int id, string searchTerms, bool selected)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("",
                            new GUIStyle()
            {
                fixedWidth  = 20,
                fixedHeight = 20,
                margin      = new RectOffset(0, 2, 0, 0),
                normal      = { background =
                                    EditorGUIUtility.FindTexture("PrefabNormal Icon") }
            });

            GUILayout.Label(GetStringValue(id).Highlight(searchTerms, true,
                                                         StringExt.ColorTag(MonkeyStyle.Instance.SearchResultTextColor),
                                                         StringExt.ColorTagClosing,
                                                         StringExt.ColorTag(MonkeyStyle.Instance.HighlightOnSelectedTextColor),
                                                         StringExt.ColorTagClosing),
                            MonkeyStyle.Instance.AssetNameStyle, GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();
        }
示例#6
0
        public override void DrawAutoCompleteMember(int id, string searchTerms, bool selected)
        {
            GUILayout.BeginHorizontal(new GUIStyle()
            {
                margin = new RectOffset(2, 2, 0, 0)
            });

            GUILayout.Label("", new GUIStyle()
            {
                fixedHeight = 20,
                fixedWidth  = 40,
                margin      = new RectOffset(5, 5, 0, 0),
                normal      = { background = colorTextures[ObjectNamesOrdered[id]] }
            });

            GUILayout.Label(ObjectNamesOrdered[id].Highlight(searchTerms, true,
                                                             StringExt.ColorTag(MonkeyStyle.Instance.SearchResultTextColor),
                                                             StringExt.ColorTagClosing,
                                                             StringExt.ColorTag(MonkeyStyle.Instance.HighlightOnSelectedTextColor),
                                                             StringExt.ColorTagClosing),
                            MonkeyStyle.Instance.CommandNameStyle, GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();
        }
示例#7
0
        public override void DrawAutoCompleteMember(int id, string searchTerms, bool selected)
        {
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();

            Texture2D icon = (Texture2D)(IsDirectory((string)GetValue(id))
                ? EditorGUIUtility.IconContent("Folder Icon").image
                : MonkeyStyle.GetIconForFile((string)GetValue(id)));

            if (showAssetPreview)
            {
                Texture2D prev = PreviewTextures.ContainsKey(id) ? PreviewTextures[id] : null;
                if (prev)
                {
                    GUILayout.Label("",
                                    new GUIStyle()
                    {
                        fixedHeight = 50,
                        fixedWidth  = 50,
                        margin      = new RectOffset(5, 5, 0, 0),
                    });
                    GUI.DrawTexture(GUILayoutUtility.GetLastRect(), prev, ScaleMode.ScaleToFit);
                }
                else
                {
                    GUILayout.Label("",
                                    new GUIStyle()
                    {
                        fixedWidth  = 20,
                        fixedHeight = 20,
                        margin      = new RectOffset(0, 2, 0, 0),
                        normal      = { background = icon }
                    });
                }
            }
            else
            {
                GUILayout.Label("",
                                new GUIStyle()
                {
                    fixedWidth  = 20,
                    fixedHeight = 20,
                    margin      = new RectOffset(0, 2, 0, 0),
                    normal      = { background = icon }
                });
            }

            GUILayout.BeginHorizontal(new GUIStyle()
            {
                margin = new RectOffset(0, 2, 0, 0)
            });
            GUILayout.Label(GetStringValue(id).Highlight(searchTerms, true,
                                                         StringExt.ColorTag(MonkeyStyle.Instance.SearchResultTextColor),
                                                         StringExt.ColorTagClosing,
                                                         StringExt.ColorTag(MonkeyStyle.Instance.HighlightOnSelectedTextColor),
                                                         StringExt.ColorTagClosing), MonkeyStyle.Instance.AssetNameStyle);
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();

            string path = (string)GetValue(id);

            path = path.Replace("Assets/", "");

            int idName = path.LastIndexOf(path.GetAssetNameFromPath(), StringComparison.Ordinal);

            if (idName > 0)
            {
                path = path.Substring(0, idName - 1);
            }

            if (path.Length > MaxPathLength)
            {
                path = path.Substring(0, Mathf.Min(MaxPathLength, path.Length)) + "...";
            }
            GUILayout.Label(path, MonkeyStyle.Instance.PathStyle /*, GUILayout.MaxWidth(150)*/);

            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }