Example #1
0
        private static void InitSearchableWindow(Rect rect, string label, int selectedIndex, string[] displayedOptions)
        {
            var dataSource = new MultiLevelDataSource();

            dataSource.displayedOptions = displayedOptions;
            dataSource.selectedIndex    = selectedIndex;
            dataSource.label            = label;

            s_Instance.dataSource = dataSource;

            s_Instance.windowClosed += (w) =>
            {
                if (s_ParentWindow != null)
                {
                    s_ParentWindow.Repaint();
                }
            };

            s_Instance.Init(rect);
        }
        private static void InitWindow(Rect rect, string label, int selectedIndex, string[] displayedOptions)
        {
            var dataSource = new AdvancedDropdownSimpleDataSource();

            dataSource.DisplayedOptions = displayedOptions;
            dataSource.SelectedIndex    = selectedIndex;
            dataSource.Label            = label;

            s_Instance.dataSource = dataSource;

            s_Instance.onSelected += (w) =>
            {
                if (s_ParentWindow != null)
                {
                    s_ParentWindow.Repaint();
                }
            };

            s_Instance.Init(rect);
        }
Example #3
0
        public void Show(Rect rect)
        {
            if (s_Instance != null)
            {
                s_Instance.Close();
                s_Instance = null;
            }

            s_Instance = ScriptableObject.CreateInstance <AdvancedDropdownWindow>();

            var dataSource = new AdvancedDropdownSimpleDataSource();

            dataSource.DisplayedOptions = DisplayedOptions;
            dataSource.SelectedIndex    = SelectedIndex;
            dataSource.Label            = Label;

            s_Instance.dataSource = dataSource;

            s_Instance.onSelected += w => onSelected(w.GetIdOfSelectedItem());

            s_Instance.Init(rect);
        }