Skip to content

Commit

Permalink
enhancement: press enter key to select character to play (#2328)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arufonsu authored Jul 17, 2024
1 parent a5df1c7 commit 7b524eb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 14 additions & 0 deletions Intersect.Client/Core/Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,20 @@ public static void OnKeyPressed(Keys modifier, Keys key)
break;

case GameStates.Menu:
var selectCharacterWindow = Interface.Interface.MenuUi.MainMenu.mSelectCharacterWindow;

switch (control)
{
case Control.Enter:
if (!selectCharacterWindow.IsHidden && selectCharacterWindow.Characters[selectCharacterWindow.mSelectedChar] != null)
{
selectCharacterWindow.PlayButton_Clicked(null, null);
consumeKey = true;
}

break;
}

break;

case GameStates.InGame:
Expand Down
2 changes: 1 addition & 1 deletion Intersect.Client/Interface/Menu/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void HandleReceivedConfiguration()

private readonly ResetPasswordWindow mResetPasswordWindow;

private readonly SelectCharacterWindow mSelectCharacterWindow;
public readonly SelectCharacterWindow mSelectCharacterWindow;

//Character creation feild check
private bool mHasMadeCharacterCreation;
Expand Down
6 changes: 3 additions & 3 deletions Intersect.Client/Interface/Menu/SelectCharacterWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public partial class SelectCharacterWindow
private Button mPrevCharButton;

//Selected Char
private int mSelectedChar = 0;
public int mSelectedChar = 0;

//Init
public SelectCharacterWindow(Canvas parent, MainMenu mainMenu)
Expand Down Expand Up @@ -88,7 +88,7 @@ public SelectCharacterWindow(Canvas parent, MainMenu mainMenu)
//Play Button
mPlayButton = new Button(mCharacterSelectionPanel, "PlayButton");
mPlayButton.SetText(Strings.CharacterSelection.Play);
mPlayButton.Clicked += _playButton_Clicked;
mPlayButton.Clicked += PlayButton_Clicked;
mPlayButton.Hide();

//Delete Button
Expand Down Expand Up @@ -366,7 +366,7 @@ private void _nextCharButton_Clicked(Base sender, ClickedEventArgs arguments)
UpdateDisplay();
}

private void _playButton_Clicked(Base sender, ClickedEventArgs arguments)
public void PlayButton_Clicked(Base? sender, ClickedEventArgs? arguments)
{
if (Globals.WaitingOnServer)
{
Expand Down

0 comments on commit 7b524eb

Please sign in to comment.