Skip to content

Commit

Permalink
Path to MainMenu from Medicals screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
hovi committed Dec 15, 2022
1 parent 58e9c63 commit 34679bb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ interface Medicals {
fun selectFaction(factionIndex: Int)
fun refresh()
fun showMessageOfTheDay()
fun showMainMenu()
}

interface Terminal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import spaceEngineers.model.ScreenName.Companion.GamePlay
import spaceEngineers.model.ScreenName.Companion.JoinGame
import spaceEngineers.model.ScreenName.Companion.LoadGame
import spaceEngineers.model.ScreenName.Companion.MainMenu
import spaceEngineers.model.ScreenName.Companion.Medicals
import spaceEngineers.model.ScreenName.Companion.MessageBox
import spaceEngineers.model.ScreenName.Companion.NewGame
import spaceEngineers.model.ScreenName.Companion.SaveAs
Expand Down Expand Up @@ -115,6 +116,9 @@ val DEFAULT_TRANSITIONS = listOf(
ScreenTransition(GamePlay, ToolbarConfig) {
gamePlay.showToolbarConfig()
},
ScreenTransition(Medicals, MainMenu) {
medicals.showMainMenu()
},
)

fun ScreenName.toNode(): spaceEngineers.graph.Node<ScreenName, Unit> {
Expand Down
9 changes: 9 additions & 0 deletions Source/Ivxr.SePlugin/Control/Screen/MedicalsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Iv4xr.SpaceEngineers;
using Iv4xr.SpaceEngineers.WorldModel;
using Iv4xr.SpaceEngineers.WorldModel.Screen;
using Sandbox;
using Sandbox.Game;
using Sandbox.Graphics.GUI;
using SpaceEngineers.Game.GUI;

Expand Down Expand Up @@ -80,5 +82,12 @@ public void Refresh()
{
return Screen.TableOrNull("m_factionsTable")?.RowsAsList() ?? new List<MyGuiControlTable.Row>();
}

public void ShowMainMenu()
{
CheckScreen();
MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.MainMenu,
MySandboxGame.IsPaused == false));
}
}
}
1 change: 1 addition & 0 deletions Source/Ivxr.SpaceEngineers/IScreens.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public interface IMedicals
void Join();
void Refresh();
void ShowMessageOfTheDay();
void ShowMainMenu();
}

public interface ITerminal
Expand Down

0 comments on commit 34679bb

Please sign in to comment.