[gbrainy] Move logic out of the FinishView
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Move logic out of the FinishView
- Date: Mon, 29 Mar 2010 18:36:10 +0000 (UTC)
commit d9ee7988790683b2ccd3d5b892ea64f54595b15a
Author: Jordi Mas <jmas softcatala org>
Date: Mon Mar 29 20:36:48 2010 +0200
Move logic out of the FinishView
src/Core/Main/GameSession.cs | 22 ++++++++++++++++++++++
src/Core/Views/FinishView.cs | 24 ++++++------------------
2 files changed, 28 insertions(+), 18 deletions(-)
---
diff --git a/src/Core/Main/GameSession.cs b/src/Core/Main/GameSession.cs
index e4113b8..0b52f35 100644
--- a/src/Core/Main/GameSession.cs
+++ b/src/Core/Main/GameSession.cs
@@ -253,6 +253,28 @@ namespace gbrainy.Core.Main
return text;
}
}
+
+ // Summarizes how the game did go
+ public string Result {
+ get {
+ string s;
+
+ if (GamesPlayed >= 10) {
+ if (TotalScore >= 70)
+ s = String.Format (Catalog.GetString ("Outstanding results"));
+ else if (TotalScore >= 50)
+ s = String.Format (Catalog.GetString ("Excellent results"));
+ else if (TotalScore >= 30)
+ s = String.Format (Catalog.GetString ("Good results"));
+ else if (TotalScore >= 20)
+ s = String.Format (Catalog.GetString ("Poor results"));
+ else s = String.Format (Catalog.GetString ("Disappointing results"));
+ } else
+ s = string.Empty;
+
+ return s;
+ }
+ }
public void NewSession ()
{
diff --git a/src/Core/Views/FinishView.cs b/src/Core/Views/FinishView.cs
index bd3013c..ef127b0 100644
--- a/src/Core/Views/FinishView.cs
+++ b/src/Core/Views/FinishView.cs
@@ -139,25 +139,13 @@ namespace gbrainy.Core.Views
y += 0.08;
gr.MoveTo (x, y);
- if (session.GamesPlayed >= 10) {
- if (session.TotalScore >= 70)
- s = String.Format (Catalog.GetString ("Outstanding results"));
- else if (session.TotalScore >= 50)
- s = String.Format (Catalog.GetString ("Excellent results"));
- else if (session.TotalScore >= 30)
- s = String.Format (Catalog.GetString ("Good results"));
- else if (session.TotalScore >= 20)
- s = String.Format (Catalog.GetString ("Poor results"));
- else s = String.Format (Catalog.GetString ("Disappointing results"));
- } else
- s = String.Empty;
-
gr.MoveTo (x, y);
-
- if (s == String.Empty)
- gr.ShowPangoText (String.Format (Catalog.GetString ("Games won: {0} ({1} played)"), session.GamesWon, session.GamesPlayed));
- else
- gr.ShowPangoText (String.Format (Catalog.GetString ("{0}. Games won: {1} ({2} played)"), s, session.GamesWon, session.GamesPlayed));
+
+ s = session.Result;
+ if (s == string.Empty)
+ gr.ShowPangoText (String.Format (Catalog.GetString ("Games won: {0} ({1} played)"), session.GamesWon, session.GamesPlayed));
+ else
+ gr.ShowPangoText (String.Format (Catalog.GetString ("{0}. Games won: {1} ({2} played)"), s, session.GamesWon, session.GamesPlayed));
y += 0.06;
gr.MoveTo (x, y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]