Skip to content

Commit

Permalink
Fixes for electrical failure exit
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarroDC committed Dec 14, 2023
1 parent f0eb63d commit db020e0
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions EpicasAlbum/EpicasAlbumMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@ public override void UpdateMode()

if (closeDialog)
{
_currentState = State.Main;
ItemList.Close();
_oneShotSource.PlayOneShot(AudioType.ShipLogDeselectPlanet);
CloseDeletionDialog();
}
break;
case State.Choosing:
Expand All @@ -195,6 +193,11 @@ private string GetSelectedSnapshotName()

public override void ExitMode()
{
// In case of electrical failure (Choosing is not possible here because it wouldn't be the active mode)
if (_currentState == State.Deleting)
{
CloseDeletionDialog();
}
CloseLayout();
if (_currentState != State.Main)
{
Expand Down Expand Up @@ -252,6 +255,13 @@ private void CloseSnapshotChooserDialog(string selectedSnapshotName)
}
_currentState = State.Disabled;
}

private void CloseDeletionDialog()
{
_currentState = State.Main;
ItemList.Close();
_oneShotSource.PlayOneShot(AudioType.ShipLogDeselectPlanet);
}

public bool IsActiveButNotCurrent()
{
Expand All @@ -277,7 +287,11 @@ public override void OnEnterComputer()

public override void OnExitComputer()
{
// No-op
// For unexpected shutdown (electrical failure)
if (_currentState == State.Choosing)
{
CloseSnapshotChooserDialog(null);
}
}

public override string GetFocusedEntryID()
Expand Down

0 comments on commit db020e0

Please sign in to comment.