private void OnButtonPressed(object sender, ButtonPressedEventArgs e) { if ((e.Button == config.changeKey || e.Button == config.menuKey) && Game1.activeClickableMenu is DialogueBox d && d.isPortraitBox() && Game1.currentSpeaker is NPC cs) { if (e.Button == config.changeKey) { if (d.width < 107 * Game1.pixelZoom * 3 / 2 || Helper.Reflection.GetField <bool>(d, "transitioning").GetValue() || Helper.Reflection.GetField <bool>(d, "isQuestion").GetValue()) { return; } TextureLoader.nextFolder(); displayAlpha = 2; } else { MenuLoader.OpenMenu(Game1.activeClickableMenu); } } }
public override void Entry(IModHelper help) { helper = help; instance = this; config = Helper.ReadConfig <PConfig>(); string customContentFolder = Path.Combine(helper.DirectoryPath, "Portraits"); displayAlpha = 0; if (!Directory.Exists(customContentFolder)) { Directory.CreateDirectory(customContentFolder); } help.Events.GameLoop.SaveLoaded += OnSaveLoaded; help.Events.GameLoop.ReturnedToTitle += OnReturnedToTitle; harmonyFix(); Helper.ConsoleCommands.Add("pmenu", "", (s, p) => { MenuLoader.OpenMenu(Game1.activeClickableMenu); }); }