예제 #1
0
    public void ShowFilterView(string title, List <FilterViewOption> options, OnOptionSelectedDelegate onOptionSelectedDelegate)
    {
        DestroyCurrentFilterViewController();

        _currentFilterViewController = Instantiate(FilterViewPrefab, transform);
        _currentFilterViewController.Load(title, options, onOptionSelectedDelegate);
    }
    public static bool ShowAt(int id, Rect rect, List <string> elements, OnOptionSelectedDelegate callback)
    {
        if (!s_LastClosedTime.ContainsKey(id))
        {
            s_LastClosedTime[id] = 0;
        }

        long num = DateTime.Now.Ticks / 10000L;

        if (num >= s_LastClosedTime[id] + 50L)
        {
            if (Event.current != null && Event.current.type != EventType.Repaint && Event.current.type != EventType.Layout)
            {
                Event.current.Use();
            }
            if (!s_Drop.ContainsKey(id) || s_Drop[id] == null)
            {
                s_Drop[id] = ScriptableObject.CreateInstance <Drop>();
            }
            s_Drop[id].id                = id;
            s_Drop[id].position          = new Rect(GUIUtility.GUIToScreenPoint(rect.position + new Vector2(0, rect.height)), new Vector2(rect.width, 200));
            s_Drop[id].OnOptionSelected += callback;
            s_Drop[id].Elements          = elements;
            s_Drop[id].ShowPopup();
            s_showing[id] = true;

            return(true);
        }
        return(false);
    }
예제 #3
0
        public void Load(string title, IEnumerable <FilterViewOption> filterViewOptions, OnOptionSelectedDelegate onOptionSelected)
        {
            TitleText.text    = title;
            _allOptions       = filterViewOptions;
            _onOptionSelected = onOptionSelected;

            PopulateCategories(_allOptions);
            PopulateOptions(_allOptions);

            Show();
        }