Skip to content

Commit

Permalink
Add a mod menu entry for toggling if offline items show on connection
Browse files Browse the repository at this point in the history
  • Loading branch information
thislooksfun committed May 10, 2024
1 parent d2b14ee commit 70245c8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Archipelago.HollowKnight/Archipelago.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace Archipelago.HollowKnight
{
public class Archipelago : Mod, IGlobalSettings<ConnectionDetails>, ILocalSettings<ConnectionDetails>
public class Archipelago : Mod, IGlobalSettings<ConnectionDetails>, ILocalSettings<ConnectionDetails>, IMenuMod
{
// Events support
public static event Action OnArchipelagoGameStarted;
Expand Down Expand Up @@ -301,5 +301,19 @@ public ConnectionDetails OnSaveGlobal()
AlwaysShowItems = MenuSettings.AlwaysShowItems,
};
}

public bool ToggleButtonInsideMenu => false;
public List<IMenuMod.MenuEntry> GetMenuData(IMenuMod.MenuEntry? toggleButtonEntry)
{
return [
new IMenuMod.MenuEntry {
Name = "Show offline items",
Description = "Show items received while you were disconnected.",
Values = ["No", "Yes"],
Saver = opt => { MenuSettings.AlwaysShowItems = opt == 1; },
Loader = () => MenuSettings.AlwaysShowItems ? 1 : 0,
},
];
}
}
}

0 comments on commit 70245c8

Please sign in to comment.