From 955399d1d873a68fafd703c878533d330a720e5b Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 25 May 2024 14:09:54 -0400 Subject: Enabled settings screen from main menu --- AnodyneArchipelago/Menu/BoxedConfigState.cs | 31 +++++++++++++++++++++++++ AnodyneArchipelago/Menu/MenuState.cs | 35 ++++++++++++++++++----------- 2 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 AnodyneArchipelago/Menu/BoxedConfigState.cs diff --git a/AnodyneArchipelago/Menu/BoxedConfigState.cs b/AnodyneArchipelago/Menu/BoxedConfigState.cs new file mode 100644 index 0000000..229b82c --- /dev/null +++ b/AnodyneArchipelago/Menu/BoxedConfigState.cs @@ -0,0 +1,31 @@ +using AnodyneSharp.States; +using AnodyneSharp.States.MenuSubstates; + +namespace AnodyneArchipelago.Menu +{ + internal class BoxedConfigState : State + { + private ConfigSubstate _substate = new(true); + + public BoxedConfigState() + { + _substate.GetControl(); + } + + public override void Update() + { + if (_substate.Exit) + { + Exit = true; + } + + _substate.Update(); + _substate.HandleInput(); + } + + public override void DrawUI() + { + _substate.DrawUI(); + } + } +} diff --git a/AnodyneArchipelago/Menu/MenuState.cs b/AnodyneArchipelago/Menu/MenuState.cs index 59a4fdf..c7be02a 100644 --- a/AnodyneArchipelago/Menu/MenuState.cs +++ b/AnodyneArchipelago/Menu/MenuState.cs @@ -26,6 +26,7 @@ namespace AnodyneArchipelago.Menu private UILabel _quitLabel; private State _substate = null; + private bool _hide = false; private string _apServer = ""; private string _apSlot = ""; @@ -109,6 +110,7 @@ namespace AnodyneArchipelago.Menu if (_substate.Exit) { _substate = null; + _hide = false; } return; @@ -131,19 +133,22 @@ namespace AnodyneArchipelago.Menu public override void DrawUI() { - _selector.Draw(); - _versionLabel1.Draw(); - _versionLabel2.Draw(); - _serverLabel.Draw(); - _serverValue.Draw(); - _slotLabel.Draw(); - _slotValue.Draw(); - _passwordLabel.Draw(); - _passwordValue.Draw(); - _connectionSwitcher.Draw(); - _connectLabel.Draw(); - _settingsLabel.Draw(); - _quitLabel.Draw(); + if (!_hide) + { + _selector.Draw(); + _versionLabel1.Draw(); + _versionLabel2.Draw(); + _serverLabel.Draw(); + _serverValue.Draw(); + _slotLabel.Draw(); + _slotValue.Draw(); + _passwordLabel.Draw(); + _passwordValue.Draw(); + _connectionSwitcher.Draw(); + _connectLabel.Draw(); + _settingsLabel.Draw(); + _quitLabel.Draw(); + } if (_substate != null) { @@ -257,6 +262,10 @@ namespace AnodyneArchipelago.Menu case 4: _substate = new ConnectionState(_apServer, _apSlot, _apPassword, OnConnected); break; + case 5: + _substate = new BoxedConfigState(); + _hide = true; + break; case 6: GlobalState.ClosingGame = true; break; -- cgit 1.4.1