Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 41 additions & 5 deletions UIInfoSuite2/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using UIInfoSuite2.Compatibility.CustomBush;
using UIInfoSuite2.Infrastructure;
using UIInfoSuite2.Options;
using UIInfoSuite2.UIElements;

namespace UIInfoSuite2;

Expand Down Expand Up @@ -173,16 +174,51 @@ private static void HandleCalendarAndQuestKeyBindings(IModHelper helper)
{
if (_modConfig != null)
{
if (Context.IsPlayerFree && _modConfig.OpenCalendarKeybind.JustPressed())
var currentMenu = Game1.activeClickableMenu;

if (_modConfig.OpenCalendarKeybind.JustPressed())
{
helper.Input.SuppressActiveKeybinds(_modConfig.OpenCalendarKeybind);
Game1.activeClickableMenu = new Billboard();

if (currentMenu is QuestBillboard)
{
Game1.exitActiveMenu();
Game1.delayedActions.Add(new DelayedAction(1, () => // open in the next frame
{
Game1.activeClickableMenu = new CalendarBillboard();
}));
}
else if (currentMenu is Billboard) // is CalendarBillboard or Billboard(false)
{
Game1.exitActiveMenu();
}
else if (Context.IsPlayerFree)
{
Game1.activeClickableMenu = new CalendarBillboard();
}
}
else if (Context.IsPlayerFree && _modConfig.OpenQuestBoardKeybind.JustPressed())
else if (_modConfig.OpenQuestBoardKeybind.JustPressed())
{
helper.Input.SuppressActiveKeybinds(_modConfig.OpenQuestBoardKeybind);
Game1.RefreshQuestOfTheDay();
Game1.activeClickableMenu = new Billboard(true);

if (currentMenu is CalendarBillboard)
{
Game1.exitActiveMenu();
Game1.delayedActions.Add(new DelayedAction(1, () => // open in the next frame
{
Game1.RefreshQuestOfTheDay();
Game1.activeClickableMenu = new QuestBillboard();
}));
}
else if (currentMenu is Billboard) // is QuestBillboard or Billboard(true)
{
Game1.exitActiveMenu();
}
else if (Context.IsPlayerFree)
{
Game1.RefreshQuestOfTheDay();
Game1.activeClickableMenu = new QuestBillboard();
}
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions UIInfoSuite2/UIElements/CustomBillboards.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
///<summary>Seperates Billboard class into two, allowing type check.</summary>

namespace UIInfoSuite2.UIElements
{
public class CalendarBillboard : StardewValley.Menus.Billboard
{
public CalendarBillboard() : base(false) { }
}

public class QuestBillboard : StardewValley.Menus.Billboard
{
public QuestBillboard() : base(true) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,15 @@ private void ActivateBillboard()
Game1.questOfTheDay.currentObjective = "wat?";
}

Game1.activeClickableMenu = new Billboard(
!(Utility.ModifyCoordinateForUIScale(Game1.getMouseX()) <
if (Utility.ModifyCoordinateForUIScale(Game1.getMouseX()) <
_showBillboardButton.Value.bounds.X + _showBillboardButton.Value.bounds.Width / 2)
);
{
Game1.activeClickableMenu = new CalendarBillboard();
}
else
{
Game1.activeClickableMenu = new QuestBillboard();
}
}
}
#endregion
Expand Down