Пример #1
0
        internal static MenuOption Show(System.Action onSettingsGUI, System.Action onSettingsEnable, System.Action onSettingsDisable)
        {
            MenuOption win = EditorWindow.GetWindow <MenuOption>(true, "Options", true);

            win.hideFlags = HideFlags.HideAndDontSave;

            if (win.onSettingsDisable != null)
            {
                win.onSettingsDisable();
            }

            if (onSettingsEnable != null)
            {
                onSettingsEnable();
            }

            win.onSettingsDisable = onSettingsDisable;

            win.onSettingsGUI = onSettingsGUI;

            // don't let window hang around after a script reload nukes the pb_MenuAction instances
            object parent = ReflectionUtility.GetValue(win, typeof(EditorWindow), "m_Parent");
            object window = ReflectionUtility.GetValue(parent, typeof(EditorWindow), "window");

            ReflectionUtility.SetValue(parent, "mouseRayInvisible", true);
            ReflectionUtility.SetValue(window, "m_DontSaveToLayout", true);

            win.Show();

            return(win);
        }
Пример #2
0
        internal static MenuOption Show(System.Action onSettingsGUI, System.Action onSettingsEnable, System.Action onSettingsDisable)
        {
            MenuOption win = EditorWindow.GetWindow <MenuOption>(true, "Options", true);

            win.hideFlags = HideFlags.HideAndDontSave;

            if (win.onSettingsDisable != null)
            {
                win.onSettingsDisable();
            }

            if (onSettingsEnable != null)
            {
                onSettingsEnable();
            }

            win.onSettingsDisable = onSettingsDisable;

            win.onSettingsGUI = onSettingsGUI;

            win.Show();

            return(win);
        }