about summary refs log tree commit diff stats
path: root/AnodyneArchipelago/Menu/MenuState.cs
diff options
context:
space:
mode:
Diffstat (limited to 'AnodyneArchipelago/Menu/MenuState.cs')
-rw-r--r--AnodyneArchipelago/Menu/MenuState.cs33
1 files changed, 32 insertions, 1 deletions
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 @@
1using AnodyneSharp.Input; 1using AnodyneSharp.Input;
2using AnodyneSharp.Registry; 2using AnodyneSharp.Registry;
3using AnodyneSharp.Sounds; 3using AnodyneSharp.Sounds;
4using AnodyneSharp.States;
4using AnodyneSharp.UI; 5using AnodyneSharp.UI;
5using AnodyneSharp.UI.PauseMenu; 6using AnodyneSharp.UI.PauseMenu;
6using AnodyneSharp.UI.PauseMenu.Config; 7using AnodyneSharp.UI.PauseMenu.Config;
@@ -24,6 +25,8 @@ namespace AnodyneArchipelago.Menu
24 private UILabel _settingsLabel; 25 private UILabel _settingsLabel;
25 private UILabel _quitLabel; 26 private UILabel _quitLabel;
26 27
28 private State _substate = null;
29
27 private string _apServer = ""; 30 private string _apServer = "";
28 private string _apSlot = ""; 31 private string _apSlot = "";
29 private string _apPassword = ""; 32 private string _apPassword = "";
@@ -62,6 +65,18 @@ namespace AnodyneArchipelago.Menu
62 65
63 public override void Update() 66 public override void Update()
64 { 67 {
68 if (_substate != null)
69 {
70 _substate.Update();
71
72 if (_substate.Exit)
73 {
74 _substate = null;
75 }
76
77 return;
78 }
79
65 _selector.Update(); 80 _selector.Update();
66 _selector.PostUpdate(); 81 _selector.PostUpdate();
67 82
@@ -92,6 +107,11 @@ namespace AnodyneArchipelago.Menu
92 _connectLabel.Draw(); 107 _connectLabel.Draw();
93 _settingsLabel.Draw(); 108 _settingsLabel.Draw();
94 _quitLabel.Draw(); 109 _quitLabel.Draw();
110
111 if (_substate != null)
112 {
113 _substate.DrawUI();
114 }
95 } 115 }
96 116
97 private void SetCursorPosition(int i) 117 private void SetCursorPosition(int i)
@@ -159,7 +179,7 @@ namespace AnodyneArchipelago.Menu
159 { 179 {
160 label.SetText(text); 180 label.SetText(text);
161 } 181 }
162 182
163 label.Color = new Color(184, 32, 0); 183 label.Color = new Color(184, 32, 0);
164 } 184 }
165 } 185 }
@@ -184,8 +204,19 @@ namespace AnodyneArchipelago.Menu
184 } 204 }
185 else if (KeyInput.JustPressedRebindableKey(KeyFunctions.Accept)) 205 else if (KeyInput.JustPressedRebindableKey(KeyFunctions.Accept))
186 { 206 {
207 SoundManager.PlaySoundEffect("menu_select");
208
187 switch (_selectorIndex) 209 switch (_selectorIndex)
188 { 210 {
211 case 0:
212 _substate = new TextEntry("Server:", _apServer, (string value) => { _apServer = value; UpdateLabels(); });
213 break;
214 case 1:
215 _substate = new TextEntry("Slot:", _apSlot, (string value) => { _apSlot = value; UpdateLabels(); });
216 break;
217 case 2:
218 _substate = new TextEntry("Password:", _apPassword, (string value) => { _apPassword = value; UpdateLabels(); });
219 break;
189 case 6: 220 case 6:
190 GlobalState.ClosingGame = true; 221 GlobalState.ClosingGame = true;
191 break; 222 break;