예제 #1
0
        public void CreatePauseMenuButtons(Level level, TextMenu menu, bool minimal)
        {
            List <TextMenu.Item> items = menu.GetItems();
            int index;

            // Find the options button and place our button below it.
            string cleanedOptions = Dialog.Clean("menu_pause_options");

            index = items.FindIndex(_ => {
                TextMenu.Button other = (_ as TextMenu.Button);
                if (other == null)
                {
                    return(false);
                }
                return(other.Label == cleanedOptions);
            });
            if (index != -1)
            {
                index++;
            }
            // Otherwise, place it below the last button.
            else
            {
                index = items.Count;
            }

            TextMenu.Item itemModOptions = null;
            menu.Insert(index, itemModOptions = new TextMenu.Button(Dialog.Clean("menu_pause_modoptions")).Pressed(() => {
                int returnIndex = menu.IndexOf(itemModOptions);
                menu.RemoveSelf();

                level.Paused = true;

                TextMenu options = OuiModOptions.CreateMenu(true, LevelExt.PauseSnapshot);

                options.OnESC = options.OnCancel = () => {
                    Audio.Play("event:/ui/main/button_back");
                    options.CloseAndRun(Everest.SaveSettings(), () => level.Pause(returnIndex, minimal, false));
                };

                options.OnPause = () => {
                    Audio.Play("event:/ui/main/button_back");
                    options.CloseAndRun(Everest.SaveSettings(), () => {
                        level.Paused       = false;
                        Engine.FreezeTimer = 0.15f;
                    });
                };

                level.Add(options);
            }));
        }
예제 #2
0
        public override IEnumerator Leave(Oui next)
        {
            Audio.Play("event:/ui/main/whoosh_large_out");
            menu.Focused = false;

            yield return(Everest.SaveSettings());

            for (float p = 0f; p < 1f; p += Engine.DeltaTime * 4f)
            {
                menu.X = onScreenX + 1920f * Ease.CubeIn(p);
                alpha  = 1f - Ease.CubeIn(p);
                yield return(null);
            }

            menu.Visible = Visible = false;
            menu.RemoveSelf();
            menu = null;
        }