示例#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);
        }
示例#2
0
        public void Show(Rect rect)
        {
            if (s_Instance != null)
            {
                s_Instance.Close();
                s_Instance = null;
            }

            s_Instance = ScriptableObject.CreateInstance <AdvancedDropdownWindow>();

            var dataSource = new MultiLevelDataSource();

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

            s_Instance.dataSource = dataSource;

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

            s_Instance.Init(rect);
        }