/// <summary>
        ///     Method getting called on the Oui instance when the method just above is called.
        /// </summary>
        ///
        private TextMenuButtonExt buildOpenMenuButton(TextMenu parentMenu, bool inGame)
        {
            if (inGame)
            {
                // this is how it works in-game
                return((TextMenuButtonExt) new TextMenuButtonExt(getButtonName()).Pressed(() => {
                    Level level = Engine.Scene as Level;
                    // close the parent menu
                    parentMenu.RemoveSelf();

                    // create our menu and prepare it
                    TextMenu thisMenu = buildMenu(true);

                    // notify the pause menu that we aren't in the main menu anymore (hides the strawberry tracker)
                    bool comesFromPauseMainMenu = level.PauseMainMenuOpen;
                    level.PauseMainMenuOpen = false;

                    thisMenu.OnESC = thisMenu.OnCancel = () => {
                        // close this menu
                        Audio.Play(SFX.ui_main_button_back);

                        StrawberryToolModule.Instance.SaveSettings();
                        thisMenu.Close();

                        // and open the parent menu back (this should work, right? we only removed it from the scene earlier, but it still exists and is intact)
                        // "what could possibly go wrong?" ~ famous last words
                        level.Add(parentMenu);

                        // restore the pause "main menu" flag to make strawberry tracker appear again if required.
                        level.PauseMainMenuOpen = comesFromPauseMainMenu;
                    };

                    thisMenu.OnPause = () => {
                        // we're unpausing, so close that menu, and save the mod Settings because the Mod Options menu won't do that for us
                        Audio.Play(SFX.ui_main_button_back);

                        StrawberryToolModule.Instance.SaveSettings();
                        thisMenu.Close();

                        level.Paused = false;
                        Engine.FreezeTimer = 0.15f;
                    };

                    // finally, add the menu to the scene
                    level.Add(thisMenu);
                }));
            }

            // this is how it works in the main menu: way more simply than the in-game mess.
            return((TextMenuButtonExt) new TextMenuButtonExt(getButtonName()).Pressed(() => {
                gotoMenu(OuiModOptions.Instance.Overworld);
            }));
        }
        private static void addOpenHeartGateToMenu(Level self)
        {
            // check if the player is inside an unlock cutscene trigger.
            Player player = self.Tracker.GetEntity <Player>();
            MiniHeartDoorUnlockCutsceneTrigger trigger = player?.CollideFirst <MiniHeartDoorUnlockCutsceneTrigger>();

            if (trigger != null)
            {
                MiniHeartDoor gate = trigger.findHeartGate();
                TextMenu      menu = self.Entities.GetToAdd().OfType <TextMenu>().FirstOrDefault();

                // check that we have what we need, and that the gate can't open yet.
                if (menu != null && gate != null && !gate.Opened && gate.HeartGems < gate.Requires)
                {
                    // add an assist option to allow opening the door.
                    menu.Add(new TextMenu.Button(Dialog.Clean("collabutils2_assist_skip"))
                    {
                        ConfirmSfx = "event:/ui/main/message_confirm"
                    }.Pressed(() => {
                        // show a confirm dialog, and focus this one instead of the assist menu.
                        menu.Focused = false;
                        self.Add(new AssistSkipConfirmUI(
                                     onConfirm: () => {
                            // open the gate!
                            gate.ForceAllHearts = true;
                            trigger.openHeartGate(player);

                            // usual "close pause menu" stuff (minus the sound).
                            self.Paused = false;
                            new DynData <Level>(self)["unpauseTimer"] = 0.15f;
                            menu.Close();
                        },

                                     onCancel: () => {
                            // give focus back to the menu.
                            menu.Focused = true;
                        }));
                    }));
                }
            }
        }