Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: handle F2-F5 #283

Merged
merged 1 commit into from
Jan 25, 2024
Merged
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
10 changes: 10 additions & 0 deletions zzre/game/systems/player/PlayerControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ public class PlayerControls : AComponentSystem<float, components.PlayerControls>
private const Key RightKey = Key.D;
private const Key JumpKey = Key.Space;
private const Key MenuKey = Key.Enter;
// private const Key PauseKey = Key.F1;
private const Key RuneMenuKey = Key.F2;
// private const Key BookMenuKey = Key.F3;
// private const Key MapMenuKey = Key.F4;
private const Key DeckMenuKey = Key.F5;
// private const Key EscapeKey = Key.Escape;
private readonly IZanzarahContainer zzContainer;
private readonly UI ui;
private readonly IDisposable lockMessageSubscription;
Expand Down Expand Up @@ -98,6 +104,10 @@ private void HandleKey(Key key, bool isDown)
switch (key)
{
case MenuKey: ui.Publish<messages.ui.OpenDeck>(); break;
case RuneMenuKey: ui.Publish<messages.ui.OpenRuneMenu>(); break;
// case BookMenuKey: ui.Publish<messages.ui.OpenBookMenu>(); break;
// case MapMenuKey: ui.Publish<messages.ui.OpenMapMenu>(); break;
case DeckMenuKey: ui.Publish<messages.ui.OpenDeck>(); break;
}
}
}
Expand Down
16 changes: 14 additions & 2 deletions zzre/game/systems/ui/ScrDeck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,21 @@ protected override void Update(

protected override void HandleKeyDown(Key key)
{
var deckEntity = Set.GetEntities()[0];
base.HandleKeyDown(key);

if (key == Key.Enter)
if (key == Key.F2) {
deckEntity.Dispose();
zanzarah.UI.Publish<messages.ui.OpenRuneMenu>();
}
// if (key == Key.F3) {
// deckEntity.Dispose();
// zanzarah.UI.Publish<messages.ui.OpenBookMenu>();
// }
// if (key == Key.F4) {
// deckEntity.Dispose();
// zanzarah.UI.Publish<messages.ui.OpenMapMenu>();
// }
if (key == Key.Enter || key == Key.Escape || key == Key.F5)
Set.DisposeAll();
}
}
16 changes: 15 additions & 1 deletion zzre/game/systems/ui/ScrRuneMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,21 @@ private void HandleElementDown(DefaultEcs.Entity entity, components.ui.ElementId

protected override void HandleKeyDown(Key key)
{
if (key == Key.Enter)
var runeMenuEntity = Set.GetEntities()[0];
base.HandleKeyDown(key);
// if (key == Key.F3) {
// runeMenuEntity.Dispose();
// zanzarah.UI.Publish<messages.ui.OpenBookMenu>();
// }
// if (key == Key.F4) {
// runeMenuEntity.Dispose();
// zanzarah.UI.Publish<messages.ui.OpenMapMenu>();
// }
if (key == Key.F5) {
runeMenuEntity.Dispose();
zanzarah.UI.Publish<messages.ui.OpenDeck>();
}
if (key == Key.Enter || key == Key.Escape || key == Key.F2)
Set.DisposeAll();
}
}