diff --git a/StoneRed.LogicSimulator/Content/InfoDialog.xmmp b/StoneRed.LogicSimulator/Content/InfoDialog.xmmp new file mode 100644 index 0000000..a5437f8 --- /dev/null +++ b/StoneRed.LogicSimulator/Content/InfoDialog.xmmp @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/StoneRed.LogicSimulator/Content/InputDialog.xmmp b/StoneRed.LogicSimulator/Content/InputDialog.xmmp new file mode 100644 index 0000000..a3aea57 --- /dev/null +++ b/StoneRed.LogicSimulator/Content/InputDialog.xmmp @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/StoneRed.LogicSimulator/Content/OkCancelDialog.xmmp b/StoneRed.LogicSimulator/Content/OkCancelDialog.xmmp new file mode 100644 index 0000000..b62b81b --- /dev/null +++ b/StoneRed.LogicSimulator/Content/OkCancelDialog.xmmp @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/StoneRed.LogicSimulator/StoneRed.LogicSimulator.csproj b/StoneRed.LogicSimulator/StoneRed.LogicSimulator.csproj index b66b26d..ec27b9b 100644 --- a/StoneRed.LogicSimulator/StoneRed.LogicSimulator.csproj +++ b/StoneRed.LogicSimulator/StoneRed.LogicSimulator.csproj @@ -38,9 +38,18 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/StoneRed.LogicSimulator/UserInterface/Screens/LoadingScreen.cs b/StoneRed.LogicSimulator/UserInterface/Screens/LoadingScreen.cs index 1b6f124..565428b 100644 --- a/StoneRed.LogicSimulator/UserInterface/Screens/LoadingScreen.cs +++ b/StoneRed.LogicSimulator/UserInterface/Screens/LoadingScreen.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Myra.Graphics2D.UI; +using StoneRed.LogicSimulator.UserInterface.Windows; using StoneRed.LogicSimulator.WorldSaveSystem; using System; @@ -48,7 +49,8 @@ internal class LoadingScreen : SrlsScreen } else { - Dialog.CreateMessageBox("Error", string.Join(',', result.Errors.Select(e => e.Message))).Show(srls.Desktop); + srls.ShowWindow(new InfoDialog(string.Join(',', result.Errors.Select(e => e.Message)))); + srls.LoadScreen(); } }); } diff --git a/StoneRed.LogicSimulator/UserInterface/Screens/StartScreen.cs b/StoneRed.LogicSimulator/UserInterface/Screens/StartScreen.cs index 4e24671..50749ec 100644 --- a/StoneRed.LogicSimulator/UserInterface/Screens/StartScreen.cs +++ b/StoneRed.LogicSimulator/UserInterface/Screens/StartScreen.cs @@ -13,10 +13,10 @@ internal class StartScreen : SrlsScreen protected override void Initialize() { VerticalMenu menu = Root.FindChildById("menu"); - menu.FindMenuItemById("menuQuit").Selected += (s, a) => srls.Exit(); - menu.FindMenuItemById("menuSettings").Selected += (s, a) => srls.ShowWindow(); - menu.FindMenuItemById("menuStartNew").Selected += (s, a) => srls.LoadScreen(); - menu.FindMenuItemById("menuLoad").Selected += MenuLoad_Selected; + menu.FindMenuItemById("menuQuit").Selected += (s, e) => srls.Exit(); + menu.FindMenuItemById("menuSettings").Selected += (s, e) => srls.ShowWindow(); + menu.FindMenuItemById("menuStartNew").Selected += (s, e) => srls.LoadScreen(); + menu.FindMenuItemById("menuLoad").Selected += (s, e) => srls.ShowWindow(); } protected override void Draw(GameTime gameTime) @@ -26,9 +26,4 @@ internal class StartScreen : SrlsScreen protected override void Update(GameTime gameTime) { } - - private void MenuLoad_Selected(object? sender, System.EventArgs e) - { - srls.ShowWindow(); - } } \ No newline at end of file diff --git a/StoneRed.LogicSimulator/UserInterface/Windows/InfoDialog.cs b/StoneRed.LogicSimulator/UserInterface/Windows/InfoDialog.cs new file mode 100644 index 0000000..e626fa7 --- /dev/null +++ b/StoneRed.LogicSimulator/UserInterface/Windows/InfoDialog.cs @@ -0,0 +1,34 @@ +using Myra.Graphics2D.UI; + +using System; + +namespace StoneRed.LogicSimulator.UserInterface.Windows; + +internal class InfoDialog : SrlsWindow +{ + public event EventHandler? Ok; + + private readonly string infoText; + protected override string XmmpPath => "InfoDialog.xmmp"; + + public InfoDialog(string infoText) + { + this.infoText = infoText; + } + + public override void Initialize() + { + Label label = window.FindChildById