aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2020-05-22 19:35:16 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2020-05-22 19:35:16 +0300
commite9f300ab2052f4132bd92aa4323e7015cec5b521 (patch)
tree14d029ff8724eaea54ca0dde5281e2e77a78ab3c
parent58ab6853d0f16dd8a8688627dd9f7f6cd79a9cfc (diff)
downloadMundus-e9f300ab2052f4132bd92aa4323e7015cec5b521.tar
Mundus-e9f300ab2052f4132bd92aa4323e7015cec5b521.tar.gz
Mundus-e9f300ab2052f4132bd92aa4323e7015cec5b521.zip
Implimented exit dialog for windows. Disabled saving buttons (because saving isn't implimented yet).
-rw-r--r--Mundus/Views/Dialogs/ExitDialog.cs1
-rw-r--r--Mundus/Views/Windows/GameWindows/Large/LargeLogic.cs11
-rw-r--r--Mundus/Views/Windows/GameWindows/Medium/MediumLogic.cs12
-rw-r--r--Mundus/Views/Windows/GameWindows/Small/SmallLogic.cs30
-rw-r--r--Mundus/gtk-gui/Mundus.Views.Dialogs.ExitDialog.cs8
-rw-r--r--Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs1
-rw-r--r--Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs2
-rw-r--r--Mundus/gtk-gui/gui.stetic10
8 files changed, 46 insertions, 29 deletions
diff --git a/Mundus/Views/Dialogs/ExitDialog.cs b/Mundus/Views/Dialogs/ExitDialog.cs
index 698bb10..73aff2e 100644
--- a/Mundus/Views/Dialogs/ExitDialog.cs
+++ b/Mundus/Views/Dialogs/ExitDialog.cs
@@ -9,7 +9,6 @@
protected void OnDeleteEvent(object o, Gtk.DeleteEventArgs args)
{
-
//To keep window instance (it is needed (stored in WindowInstances.cs) until Application.Quit)
args.RetVal = true;
}
diff --git a/Mundus/Views/Windows/GameWindows/Large/LargeLogic.cs b/Mundus/Views/Windows/GameWindows/Large/LargeLogic.cs
index 99806c4..aa456e5 100644
--- a/Mundus/Views/Windows/GameWindows/Large/LargeLogic.cs
+++ b/Mundus/Views/Windows/GameWindows/Large/LargeLogic.cs
@@ -1,6 +1,7 @@
namespace Mundus.Views.Windows.GameWindows.Large
{
using Gtk;
+ using Mundus.Data.Dialogues;
using Mundus.Service.Tiles.Items;
using static Mundus.Service.Tiles.Mobs.Inventory;
@@ -20,7 +21,15 @@
public void OnDeleteEvent(object o, DeleteEventArgs args)
{
- Application.Quit();
+ ResponseType rt = (ResponseType)DI.DExit.Run();
+ DI.DExit.Hide();
+
+ if (rt == ResponseType.Close) {
+ Application.Quit();
+ }
+ else {
+ args.RetVal = true;
+ }
}
public void SetDefaults()
diff --git a/Mundus/Views/Windows/GameWindows/Medium/MediumLogic.cs b/Mundus/Views/Windows/GameWindows/Medium/MediumLogic.cs
index d283ee6..96bdcf3 100644
--- a/Mundus/Views/Windows/GameWindows/Medium/MediumLogic.cs
+++ b/Mundus/Views/Windows/GameWindows/Medium/MediumLogic.cs
@@ -1,6 +1,7 @@
namespace Mundus.Views.Windows.GameWindows.Medium
{
using Gtk;
+ using Mundus.Data.Dialogues;
using Mundus.Service.Tiles.Items;
using static Mundus.Service.Tiles.Mobs.Inventory;
@@ -19,8 +20,15 @@
public void OnDeleteEvent(object o, DeleteEventArgs args)
{
- //Open exit dialogue if you haven't saved in a while
- Application.Quit();
+ ResponseType rt = (ResponseType)DI.DExit.Run();
+ DI.DExit.Hide();
+
+ if (rt == ResponseType.Close) {
+ Application.Quit();
+ }
+ else {
+ args.RetVal = true;
+ }
}
public void SetDefaults()
diff --git a/Mundus/Views/Windows/GameWindows/Small/SmallLogic.cs b/Mundus/Views/Windows/GameWindows/Small/SmallLogic.cs
index a7ae6af..3948360 100644
--- a/Mundus/Views/Windows/GameWindows/Small/SmallLogic.cs
+++ b/Mundus/Views/Windows/GameWindows/Small/SmallLogic.cs
@@ -1,6 +1,7 @@
namespace Mundus.Views.Windows.GameWindows.Small
{
using Gtk;
+ using Mundus.Data.Dialogues;
using Mundus.Service.Tiles.Items;
using static Mundus.Service.Tiles.Mobs.Inventory;
@@ -19,24 +20,17 @@
public void OnDeleteEvent(object o, Gtk.DeleteEventArgs args)
{
- /*Open exit dialogue if you haven't saved in a while
- * if () { //TODO: check if you have saved
- TODO: pause game cycle
-
- ResponseType rt = (ResponseType)DI.DExit.Run();
- DI.DExit.Hide();
-
- if(rt == ResponseType.Cancel || rt == ResponseType.DeleteEvent) {
- //cancel the exit procedure and keep the window open
- args.RetVal = true;
- return;
- }
- else if (rt == ResponseType.Accept) {
- //TODO: call code for saving the game
- }
- }*/
-
- Application.Quit();
+ ResponseType rt = (ResponseType)DI.DExit.Run();
+ DI.DExit.Hide();
+
+ if(rt == ResponseType.Close)
+ {
+ Application.Quit();
+ }
+ else
+ {
+ args.RetVal = true;
+ }
}
public void SetDefaults()
diff --git a/Mundus/gtk-gui/Mundus.Views.Dialogs.ExitDialog.cs b/Mundus/gtk-gui/Mundus.Views.Dialogs.ExitDialog.cs
index d41fb25..afce8b9 100644
--- a/Mundus/gtk-gui/Mundus.Views.Dialogs.ExitDialog.cs
+++ b/Mundus/gtk-gui/Mundus.Views.Dialogs.ExitDialog.cs
@@ -27,8 +27,7 @@ namespace Mundus.Views.Dialogs
this.lblMessage = new global::Gtk.Label();
this.lblMessage.HeightRequest = 50;
this.lblMessage.Name = "lblMessage";
- this.lblMessage.LabelProp = "You haven\'t saved for {number} of seconds. Are you sure you want to exit without " +
- "saving?";
+ this.lblMessage.LabelProp = "Are you sure you want to exit without saving?";
w1.Add(this.lblMessage);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(w1[this.lblMessage]));
w2.Position = 0;
@@ -53,6 +52,7 @@ namespace Mundus.Views.Dialogs
w4.Fill = false;
// Container child DExit_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.btnSave = new global::Gtk.Button();
+ this.btnSave.Sensitive = false;
this.btnSave.CanDefault = true;
this.btnSave.CanFocus = true;
this.btnSave.Name = "btnSave";
@@ -69,7 +69,7 @@ namespace Mundus.Views.Dialogs
this.btnExit.Name = "btnExit";
this.btnExit.UseUnderline = true;
this.btnExit.Label = "Exit without saving";
- this.AddActionWidget(this.btnExit, -2);
+ this.AddActionWidget(this.btnExit, -7);
global::Gtk.ButtonBox.ButtonBoxChild w6 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w3[this.btnExit]));
w6.Position = 2;
w6.Expand = false;
@@ -78,7 +78,7 @@ namespace Mundus.Views.Dialogs
{
this.Child.ShowAll();
}
- this.DefaultWidth = 563;
+ this.DefaultWidth = 445;
this.DefaultHeight = 95;
this.Show();
this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent);
diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs
index 2121a53..3f8e3b9 100644
--- a/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs
+++ b/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs
@@ -66,6 +66,7 @@ namespace Mundus.Views.Windows
this.btnLoadGame = new global::Gtk.Button();
this.btnLoadGame.WidthRequest = 300;
this.btnLoadGame.HeightRequest = 90;
+ this.btnLoadGame.Sensitive = false;
this.btnLoadGame.CanFocus = true;
this.btnLoadGame.Name = "btnLoadGame";
this.btnLoadGame.UseUnderline = true;
diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs
index e6adc7f..8e31048 100644
--- a/Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs
+++ b/Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs
@@ -90,6 +90,7 @@ namespace Mundus.Views.Windows
// Container child vbox1.Gtk.Box+BoxChild
this.btnSave = new global::Gtk.Button();
this.btnSave.HeightRequest = 50;
+ this.btnSave.Sensitive = false;
this.btnSave.CanFocus = true;
this.btnSave.Name = "btnSave";
this.btnSave.UseUnderline = true;
@@ -103,6 +104,7 @@ namespace Mundus.Views.Windows
// Container child vbox1.Gtk.Box+BoxChild
this.btnSaveExit = new global::Gtk.Button();
this.btnSaveExit.HeightRequest = 50;
+ this.btnSaveExit.Sensitive = false;
this.btnSaveExit.CanFocus = true;
this.btnSaveExit.Name = "btnSaveExit";
this.btnSaveExit.UseUnderline = true;
diff --git a/Mundus/gtk-gui/gui.stetic b/Mundus/gtk-gui/gui.stetic
index b14a1c6..9232005 100644
--- a/Mundus/gtk-gui/gui.stetic
+++ b/Mundus/gtk-gui/gui.stetic
@@ -23997,6 +23997,7 @@
<widget class="Gtk.Button" id="btnSave">
<property name="MemberName" />
<property name="HeightRequest">50</property>
+ <property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
<property name="Label">Save</property>
@@ -24015,6 +24016,7 @@
<widget class="Gtk.Button" id="btnSaveExit">
<property name="MemberName" />
<property name="HeightRequest">50</property>
+ <property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
<property name="Label">Save &amp; Exit</property>
@@ -25180,6 +25182,7 @@
<property name="MemberName" />
<property name="WidthRequest">300</property>
<property name="HeightRequest">90</property>
+ <property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
<property name="Label">Load Game</property>
@@ -25251,7 +25254,7 @@
</widget>
</child>
</widget>
- <widget class="Gtk.Dialog" id="Mundus.Views.Dialogs.ExitDialog" design-size="563 95">
+ <widget class="Gtk.Dialog" id="Mundus.Views.Dialogs.ExitDialog" design-size="445 95">
<property name="MemberName" />
<property name="Title" />
<property name="WindowPosition">CenterOnParent</property>
@@ -25266,7 +25269,7 @@
<widget class="Gtk.Label" id="lblMessage">
<property name="MemberName" />
<property name="HeightRequest">50</property>
- <property name="LabelProp">You haven't saved for {number} of seconds. Are you sure you want to exit without saving?</property>
+ <property name="LabelProp">Are you sure you want to exit without saving?</property>
</widget>
<packing>
<property name="Position">0</property>
@@ -25302,6 +25305,7 @@
<child>
<widget class="Gtk.Button" id="btnSave">
<property name="MemberName" />
+ <property name="Sensitive">False</property>
<property name="CanDefault">True</property>
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
@@ -25322,7 +25326,7 @@
<property name="Type">TextOnly</property>
<property name="Label">Exit without saving</property>
<property name="UseUnderline">True</property>
- <property name="ResponseId">-2</property>
+ <property name="ResponseId">-7</property>
</widget>
<packing>
<property name="Position">2</property>