private static void ResetAndCreateWindow()
 {
     if (s_Instance != null)
     {
         s_Instance.Close();
         s_Instance = null;
     }
     s_ParentWindow = EditorWindow.focusedWindow;
     s_Instance     = ScriptableObject.CreateInstance <AdvancedDropdownWindow>();
     m_WindowClosed = false;
 }
Example #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 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);
        }