diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-25 13:11:17 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-25 13:11:17 -0400 |
| commit | 189fcfc1087764961e61c470ffea642ff46d164d (patch) | |
| tree | 77890701aeb8e8e89b1dffb7084559dc6c8e7364 /AnodyneArchipelago/Menu/MenuState.cs | |
| parent | ca34b22c8dbeecda5ac5f66ca24fbe69a617b4dd (diff) | |
| download | anodyne-archipelago-189fcfc1087764961e61c470ffea642ff46d164d.tar.gz anodyne-archipelago-189fcfc1087764961e61c470ffea642ff46d164d.tar.bz2 anodyne-archipelago-189fcfc1087764961e61c470ffea642ff46d164d.zip | |
You can connect now!
Diffstat (limited to 'AnodyneArchipelago/Menu/MenuState.cs')
| -rw-r--r-- | AnodyneArchipelago/Menu/MenuState.cs | 38 |
1 files changed, 38 insertions, 0 deletions
| diff --git a/AnodyneArchipelago/Menu/MenuState.cs b/AnodyneArchipelago/Menu/MenuState.cs index b9ee0dd..cabb94b 100644 --- a/AnodyneArchipelago/Menu/MenuState.cs +++ b/AnodyneArchipelago/Menu/MenuState.cs | |||
| @@ -33,6 +33,9 @@ namespace AnodyneArchipelago.Menu | |||
| 33 | 33 | ||
| 34 | private int _selectorIndex = 0; | 34 | private int _selectorIndex = 0; |
| 35 | 35 | ||
| 36 | private bool _fadingOut = false; | ||
| 37 | private bool _isNewGame; | ||
| 38 | |||
| 36 | public override void Create() | 39 | public override void Create() |
| 37 | { | 40 | { |
| 38 | _selector = new(); | 41 | _selector = new(); |
| @@ -65,6 +68,18 @@ namespace AnodyneArchipelago.Menu | |||
| 65 | 68 | ||
| 66 | public override void Update() | 69 | public override void Update() |
| 67 | { | 70 | { |
| 71 | if (_fadingOut) | ||
| 72 | { | ||
| 73 | GlobalState.black_overlay.ChangeAlpha(0.72f); | ||
| 74 | |||
| 75 | if (GlobalState.black_overlay.alpha == 1.0) | ||
| 76 | { | ||
| 77 | ChangeStateEvent(_isNewGame ? AnodyneSharp.AnodyneGame.GameState.Intro : AnodyneSharp.AnodyneGame.GameState.Game); | ||
| 78 | } | ||
| 79 | |||
| 80 | return; | ||
| 81 | } | ||
| 82 | |||
| 68 | if (_substate != null) | 83 | if (_substate != null) |
| 69 | { | 84 | { |
| 70 | _substate.Update(); | 85 | _substate.Update(); |
| @@ -217,6 +232,9 @@ namespace AnodyneArchipelago.Menu | |||
| 217 | case 2: | 232 | case 2: |
| 218 | _substate = new TextEntry("Password:", _apPassword, (string value) => { _apPassword = value; UpdateLabels(); }); | 233 | _substate = new TextEntry("Password:", _apPassword, (string value) => { _apPassword = value; UpdateLabels(); }); |
| 219 | break; | 234 | break; |
| 235 | case 4: | ||
| 236 | _substate = new ConnectionState(_apServer, _apSlot, _apPassword, OnConnected); | ||
| 237 | break; | ||
| 220 | case 6: | 238 | case 6: |
| 221 | GlobalState.ClosingGame = true; | 239 | GlobalState.ClosingGame = true; |
| 222 | break; | 240 | break; |
| @@ -231,5 +249,25 @@ namespace AnodyneArchipelago.Menu | |||
| 231 | { | 249 | { |
| 232 | 250 | ||
| 233 | } | 251 | } |
| 252 | |||
| 253 | private void OnConnected(ArchipelagoManager archipelagoManager) | ||
| 254 | { | ||
| 255 | Plugin.ArchipelagoManager = archipelagoManager; | ||
| 256 | |||
| 257 | GlobalState.Save saveFile = GlobalState.Save.GetSave(string.Format("{0}Saves/Save_zzAP{1}_{2}.dat", GameConstants.SavePath, Plugin.ArchipelagoManager.GetSeed(), Plugin.ArchipelagoManager.GetPlayer())); | ||
| 258 | |||
| 259 | GlobalState.ResetValues(); | ||
| 260 | if (saveFile != null) | ||
| 261 | { | ||
| 262 | GlobalState.LoadSave(saveFile); | ||
| 263 | _isNewGame = false; | ||
| 264 | } | ||
| 265 | else | ||
| 266 | { | ||
| 267 | _isNewGame = true; | ||
| 268 | } | ||
| 269 | |||
| 270 | _fadingOut = true; | ||
| 271 | } | ||
| 234 | } | 272 | } |
| 235 | } | 273 | } |
