From ca34b22c8dbeecda5ac5f66ca24fbe69a617b4dd Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 25 May 2024 10:37:59 -0400 Subject: Added text entry --- AnodyneArchipelago/Menu/MenuState.cs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'AnodyneArchipelago/Menu/MenuState.cs') diff --git a/AnodyneArchipelago/Menu/MenuState.cs b/AnodyneArchipelago/Menu/MenuState.cs index 08aa366..b9ee0dd 100644 --- a/AnodyneArchipelago/Menu/MenuState.cs +++ b/AnodyneArchipelago/Menu/MenuState.cs @@ -1,6 +1,7 @@ using AnodyneSharp.Input; using AnodyneSharp.Registry; using AnodyneSharp.Sounds; +using AnodyneSharp.States; using AnodyneSharp.UI; using AnodyneSharp.UI.PauseMenu; using AnodyneSharp.UI.PauseMenu.Config; @@ -24,6 +25,8 @@ namespace AnodyneArchipelago.Menu private UILabel _settingsLabel; private UILabel _quitLabel; + private State _substate = null; + private string _apServer = ""; private string _apSlot = ""; private string _apPassword = ""; @@ -62,6 +65,18 @@ namespace AnodyneArchipelago.Menu public override void Update() { + if (_substate != null) + { + _substate.Update(); + + if (_substate.Exit) + { + _substate = null; + } + + return; + } + _selector.Update(); _selector.PostUpdate(); @@ -92,6 +107,11 @@ namespace AnodyneArchipelago.Menu _connectLabel.Draw(); _settingsLabel.Draw(); _quitLabel.Draw(); + + if (_substate != null) + { + _substate.DrawUI(); + } } private void SetCursorPosition(int i) @@ -159,7 +179,7 @@ namespace AnodyneArchipelago.Menu { label.SetText(text); } - + label.Color = new Color(184, 32, 0); } } @@ -184,8 +204,19 @@ namespace AnodyneArchipelago.Menu } else if (KeyInput.JustPressedRebindableKey(KeyFunctions.Accept)) { + SoundManager.PlaySoundEffect("menu_select"); + switch (_selectorIndex) { + case 0: + _substate = new TextEntry("Server:", _apServer, (string value) => { _apServer = value; UpdateLabels(); }); + break; + case 1: + _substate = new TextEntry("Slot:", _apSlot, (string value) => { _apSlot = value; UpdateLabels(); }); + break; + case 2: + _substate = new TextEntry("Password:", _apPassword, (string value) => { _apPassword = value; UpdateLabels(); }); + break; case 6: GlobalState.ClosingGame = true; break; -- cgit 1.4.1