Skip to content

Hotkeys with custom category not working? #276

Description

@welles

Hi, I'm working on converting all my cheat hotkeys to ButterLib's hotkey implementation.
Unfortunately I am unable to create a custom hotkey category. Whenever I try to set a custom category, the hotkeys do not show up or the game freezes on opening the options menu.
I was trying to do something like this:

public class SubModule : MBSubModuleBase
{
    protected override void OnBeforeInitialModuleScreenSetAsRoot()
    {
        base.OnBeforeInitialModuleScreenSetAsRoot();

        var manager = HotKeyManager.CreateWithOwnCategory("BannerlordCheats", "Cheats");
        manager.Add<AddMoneyHotkey>();
        manager.Build();
    }

    ...
}
public class AddMoneyHotkey : HotKeyBase
{
    public AddMoneyHotkey() : base(nameof(AddMoneyHotkey))
    {
        this.Category = "Cheats";
        this.DisplayName = "Add 1.000 Gold";
        this.DefaultKey = InputKey.F10;
        this.Description = "...";
        this.Predicate = () => ScreenManager.TopScreen is GauntletInventoryScreen;
    }

    protected override string DisplayName { get; }

    protected override string Description { get; }

    protected override InputKey DefaultKey { get; }

    protected override string Category { get; }

    ...
}

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions