Example #1
0
    public static void Show(string searchValue, Action <string> setValueCallBack)
    {
        if (_searchPanel == null)
        {
            _searchPanel = ScriptableObject.CreateInstance <SearchPanel>();
        }
        string str   = searchValue;
        int    index = str.IndexOf(":");

        ShowList.Clear();
        if (index < 0)
        {
            for (int i = 0; i < KeywordArray.Length; i++)
            {
                if (KeywordArray[i].StartsWith(searchValue.ToLower()))
                {
                    ShowList.Add(KeywordArray[i]);
                }
            }
        }

        if (ShowList.Count > 0)
        {
            if (!_isShowPanel)
            {
                _isShowPanel          = true;
                _searchPanel.position = new Rect(GUIUtility.GUIToScreenPoint(new Vector2(40, 40)), new Vector2(150, 25 * ShowList.Count));
                _searchPanel.ShowPopup();
                _searchPanel.CallBack = setValueCallBack;
            }
        }
    }