[gbrainy/gbrainy_15x] Refactor GameType in its own class
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy/gbrainy_15x] Refactor GameType in its own class
- Date: Fri, 21 May 2010 19:30:22 +0000 (UTC)
commit 63b6cbdb095fa321e31c06cef1b42310d0aa504c
Author: Jordi Mas <jmas softcatala org>
Date: Fri May 21 21:31:10 2010 +0200
Refactor GameType in its own class
po/POTFILES.in | 1 +
src/Clients/Classical/Dialogs/CustomGameDialog.cs | 2 +-
.../Classical/Dialogs/PlayerHistoryDialog.cs | 8 ++--
src/Clients/Classical/gbrainy.cs | 12 ++--
src/Core/Main/Game.cs | 46 ++--------------
src/Core/Main/GameManager.cs | 12 ++--
src/Core/Main/GameSession.cs | 2 +-
src/Core/Main/GameSessionHistoryExtended.cs | 2 +-
src/Core/Main/GameTypes.cs | 56 ++++++++++++++++++++
src/Core/Main/Memory.cs | 4 +-
src/Core/Main/PlayerPersonalRecord.cs | 12 ++--
src/Core/Main/Score.cs | 20 ++++----
src/Core/Main/Verbal/Analogies.cs | 4 +-
src/Core/Makefile.am | 1 +
src/Core/Views/FinishView.cs | 8 ++--
src/Core/Views/PlayerHistoryView.cs | 8 ++--
src/Games/Calculation/CalculationArithmetical.cs | 4 +-
src/Games/Calculation/CalculationAverage.cs | 4 +-
src/Games/Calculation/CalculationCloserFraction.cs | 4 +-
src/Games/Calculation/CalculationFractions.cs | 4 +-
.../Calculation/CalculationGreatestDivisor.cs | 4 +-
src/Games/Calculation/CalculationOperator.cs | 4 +-
src/Games/Calculation/CalculationPrimes.cs | 4 +-
src/Games/Calculation/CalculationProportions.cs | 4 +-
src/Games/Calculation/CalculationRatio.cs | 4 +-
src/Games/Calculation/CalculationTwoNumbers.cs | 22 ++++----
26 files changed, 139 insertions(+), 117 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 340b6d6..0674540 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -11,6 +11,7 @@ src/Core/Main/Game.cs
src/Core/Main/GameManager.cs
src/Core/Main/GameSession.cs
src/Core/Main/GameTips.cs
+src/Core/Main/GameTypes.cs
src/Core/Main/PlayerHistory.cs
src/Core/Main/Preferences.cs
src/Core/Main/Memory.cs
diff --git a/src/Clients/Classical/Dialogs/CustomGameDialog.cs b/src/Clients/Classical/Dialogs/CustomGameDialog.cs
index 05adeda..fd759f0 100644
--- a/src/Clients/Classical/Dialogs/CustomGameDialog.cs
+++ b/src/Clients/Classical/Dialogs/CustomGameDialog.cs
@@ -92,7 +92,7 @@ namespace gbrainy.Clients.Classical
for (int i = 0; i < games.Length; i++)
{
game = (Game) Activator.CreateInstance (games [i], true);
- type = Game.GetGameTypeDescription (game.Type);
+ type = GameTypesDescription.Get (game.Type);
games_store.AppendValues (game.Name, type, true, game);
}
}
diff --git a/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs b/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
index c41cd36..db0e926 100644
--- a/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
+++ b/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
@@ -56,10 +56,10 @@ namespace gbrainy.Clients.Classical
drawing_area.Visible = true;
checkbutton_total.Label = Catalog.GetString ("Total");
- checkbutton_logic.Label = Game.GetGameTypeDescription (Game.Types.LogicPuzzle);
- checkbutton_calculation.Label = Game.GetGameTypeDescription (Game.Types.MathTrainer);
- checkbutton_memory.Label = Game.GetGameTypeDescription (Game.Types.MemoryTrainer);
- checkbutton_verbal.Label = Game.GetGameTypeDescription (Game.Types.VerbalAnalogy);
+ checkbutton_logic.Label = GameTypesDescription.Get (GameTypes.LogicPuzzle);
+ checkbutton_calculation.Label = GameTypesDescription.Get (GameTypes.MathTrainer);
+ checkbutton_memory.Label = GameTypesDescription.Get (GameTypes.MemoryTrainer);
+ checkbutton_verbal.Label = GameTypesDescription.Get (GameTypes.VerbalAnalogy);
checkbutton_total.Active = checkbutton_memory.Active = checkbutton_logic.Active = checkbutton_calculation.Active = checkbutton_verbal.Active = true;
}
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index 95d9d63..f953bda 100644
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -348,34 +348,34 @@ namespace gbrainy.Clients.Classical
{
//Toolbar buttons and menu items that are sensitive when the user is playing
bool playing;
- Game.Types available;
+ GameTypes available;
playing = (session.Status == GameSession.SessionStatus.Playing);
finish_tbbutton.Sensitive = pause_tbbutton.Sensitive = playing;
available = session.AvailableGames;
- if (playing == false && ((available & Game.Types.LogicPuzzle) == Game.Types.LogicPuzzle))
+ if (playing == false && ((available & GameTypes.LogicPuzzle) == GameTypes.LogicPuzzle))
logic_menuitem.Sensitive = logic_tbbutton.Sensitive = true;
else
logic_menuitem.Sensitive = logic_tbbutton.Sensitive = false;
- if (playing == false && ((available & Game.Types.MemoryTrainer) == Game.Types.MemoryTrainer))
+ if (playing == false && ((available & GameTypes.MemoryTrainer) == GameTypes.MemoryTrainer))
memory_menuitem.Sensitive = memory_tbbutton.Sensitive = true;
else
memory_menuitem.Sensitive = memory_tbbutton.Sensitive = false;
- if (playing == false && ((available & Game.Types.MathTrainer) == Game.Types.MathTrainer))
+ if (playing == false && ((available & GameTypes.MathTrainer) == GameTypes.MathTrainer))
calculation_menuitem.Sensitive = calculation_tbbutton.Sensitive = true;
else
calculation_menuitem.Sensitive = calculation_tbbutton.Sensitive = false;
- if (playing == false && ((available & Game.Types.VerbalAnalogy) == Game.Types.VerbalAnalogy))
+ if (playing == false && ((available & GameTypes.VerbalAnalogy) == GameTypes.VerbalAnalogy))
verbal_menuitem.Sensitive = verbal_tbbutton.Sensitive = true;
else
verbal_menuitem.Sensitive = verbal_tbbutton.Sensitive = false;
- if (playing == false && (available != Game.Types.None))
+ if (playing == false && (available != GameTypes.None))
allgames_menuitem.Sensitive = all_tbbutton.Sensitive = true;
else
allgames_menuitem.Sensitive = all_tbbutton.Sensitive = false;
diff --git a/src/Core/Main/Game.cs b/src/Core/Main/Game.cs
index 439fd25..54e2b1a 100644
--- a/src/Core/Main/Game.cs
+++ b/src/Core/Main/Game.cs
@@ -32,16 +32,6 @@ namespace gbrainy.Core.Main
{
abstract public class Game : IDrawable, IDrawRequest, IMouseEvent
{
- // See: GetGameTypeDescription
- public enum Types
- {
- None = 0,
- LogicPuzzle = 2,
- MemoryTrainer = 4,
- MathTrainer = 8,
- VerbalAnalogy = 16,
- }
-
public enum Difficulty
{
None = 0,
@@ -207,8 +197,8 @@ namespace gbrainy.Core.Main
get { return true;}
}
- public virtual Types Type {
- get { return Types.LogicPuzzle;}
+ public virtual GameTypes Type {
+ get { return GameTypes.LogicPuzzle;}
}
public bool DrawAnswer {
@@ -273,11 +263,11 @@ namespace gbrainy.Core.Main
}
switch (Type) {
- case Types.MemoryTrainer:
+ case GameTypes.MemoryTrainer:
return (int) (30 * factor);
- case Types.MathTrainer:
+ case GameTypes.MathTrainer:
return (int) (60 * factor);
- case Types.VerbalAnalogy:
+ case GameTypes.VerbalAnalogy:
return (int) (30 * factor);
}
return (int) (120 * factor); // Default for all games (logic)
@@ -512,32 +502,6 @@ namespace gbrainy.Core.Main
return str;
}
- // Type enum to string representation
- static public string GetGameTypeDescription (Types type)
- {
- string str;
-
- switch (type)
- {
- case Game.Types.LogicPuzzle:
- str = Catalog.GetString ("Logic");
- break;
- case Game.Types.MemoryTrainer:
- str = Catalog.GetString ("Memory");
- break;
- case Game.Types.MathTrainer:
- str = Catalog.GetString ("Calculation");
- break;
- case Game.Types.VerbalAnalogy:
- str = Catalog.GetString ("Verbal");
- break;
- default:
- str = string.Empty;
- break;
- }
- return str;
- }
-
public void DisableMouseEvents ()
{
foreach (Toolkit.Container container in containers)
diff --git a/src/Core/Main/GameManager.cs b/src/Core/Main/GameManager.cs
index f7be5ad..da76d76 100644
--- a/src/Core/Main/GameManager.cs
+++ b/src/Core/Main/GameManager.cs
@@ -147,21 +147,21 @@ namespace gbrainy.Core.Main
#endif
}
- public Game.Types AvailableGames {
+ public GameTypes AvailableGames {
get {
- Game.Types types = Game.Types.None;
+ GameTypes types = GameTypes.None;
if (LogicPuzzles.Count > 0)
- types |= Game.Types.LogicPuzzle;
+ types |= GameTypes.LogicPuzzle;
if (CalculationTrainers.Count > 0)
- types |= Game.Types.MathTrainer;
+ types |= GameTypes.MathTrainer;
if (MemoryTrainers.Count > 0)
- types |= Game.Types.MemoryTrainer;
+ types |= GameTypes.MemoryTrainer;
if (analogies_manager.AvailableTypes.Length > 0)
- types |= Game.Types.VerbalAnalogy;
+ types |= GameTypes.VerbalAnalogy;
return types;
}
diff --git a/src/Core/Main/GameSession.cs b/src/Core/Main/GameSession.cs
index a3fd368..e09ce73 100644
--- a/src/Core/Main/GameSession.cs
+++ b/src/Core/Main/GameSession.cs
@@ -90,7 +90,7 @@ namespace gbrainy.Core.Main
get {return history;}
}
- public Game.Types AvailableGames {
+ public GameTypes AvailableGames {
get { return game_manager.AvailableGames; }
}
diff --git a/src/Core/Main/GameSessionHistoryExtended.cs b/src/Core/Main/GameSessionHistoryExtended.cs
index cec9727..c827979 100644
--- a/src/Core/Main/GameSessionHistoryExtended.cs
+++ b/src/Core/Main/GameSessionHistoryExtended.cs
@@ -55,7 +55,7 @@ namespace gbrainy.Core.Main
VerbalPlayed = VerbalWon = VerbalRawScore = 0;
}
- public void UpdateScore (Game.Types type, Game.Difficulty difficulty, int game_score)
+ public void UpdateScore (GameTypes type, Game.Difficulty difficulty, int game_score)
{
GameSessionHistoryExtended history = this;
Score.UpdateSessionHistorycore (ref history, type, difficulty, game_score);
diff --git a/src/Core/Main/GameTypes.cs b/src/Core/Main/GameTypes.cs
new file mode 100644
index 0000000..e380771
--- /dev/null
+++ b/src/Core/Main/GameTypes.cs
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2007-2010 Jordi Mas i Hernà ndez <jmas softcatala org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+using Mono.Unix;
+
+namespace gbrainy.Core.Main
+{
+ // See: GameTypesDescription.Get
+ public enum GameTypes
+ {
+ None = 0,
+ LogicPuzzle = 2,
+ MemoryTrainer = 4,
+ MathTrainer = 8,
+ VerbalAnalogy = 16,
+ }
+
+ // Since we cannot override ToString in an enum type we use a helper class
+ public static class GameTypesDescription
+ {
+ // Type enum to string representation
+ static public string Get (GameTypes type)
+ {
+ switch (type)
+ {
+ case GameTypes.LogicPuzzle:
+ return Catalog.GetString ("Logic");
+ case GameTypes.MemoryTrainer:
+ return Catalog.GetString ("Memory");
+ case GameTypes.MathTrainer:
+ return Catalog.GetString ("Calculation");
+ case GameTypes.VerbalAnalogy:
+ return Catalog.GetString ("Verbal");
+ default:
+ throw new InvalidOperationException ("Unknown game type");
+ }
+ }
+ }
+}
diff --git a/src/Core/Main/Memory.cs b/src/Core/Main/Memory.cs
index 0a877ca..6837751 100644
--- a/src/Core/Main/Memory.cs
+++ b/src/Core/Main/Memory.cs
@@ -55,8 +55,8 @@ namespace gbrainy.Core.Main
}
}
- public override Types Type {
- get { return Game.Types.MemoryTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MemoryTrainer;}
}
public int TotalTime {
diff --git a/src/Core/Main/PlayerPersonalRecord.cs b/src/Core/Main/PlayerPersonalRecord.cs
index c14d00c..23f39fe 100644
--- a/src/Core/Main/PlayerPersonalRecord.cs
+++ b/src/Core/Main/PlayerPersonalRecord.cs
@@ -29,11 +29,11 @@ namespace gbrainy.Core.Main
{
public const int MIN_GAMES_RECORD = 5;
- public Game.Types GameType { get; set; }
+ public GameTypes GameType { get; set; }
public int PreviousScore { get; set; }
public int NewScore { get; set; }
- public PlayerPersonalRecord (Game.Types type, int previous_score, int new_score)
+ public PlayerPersonalRecord (GameTypes type, int previous_score, int new_score)
{
GameType = type;
PreviousScore = previous_score;
@@ -70,16 +70,16 @@ namespace gbrainy.Core.Main
// It is a record?
if (games[last_game].LogicScore > higher.LogicScore)
- records.Add (new PlayerPersonalRecord (Game.Types.LogicPuzzle, higher.LogicScore, games[last_game].LogicScore));
+ records.Add (new PlayerPersonalRecord (GameTypes.LogicPuzzle, higher.LogicScore, games[last_game].LogicScore));
if (games[last_game].MathScore > higher.MathScore)
- records.Add (new PlayerPersonalRecord (Game.Types.MathTrainer, higher.MathScore, games[last_game].MathScore));
+ records.Add (new PlayerPersonalRecord (GameTypes.MathTrainer, higher.MathScore, games[last_game].MathScore));
if (games[last_game].MemoryScore > higher.MemoryScore)
- records.Add (new PlayerPersonalRecord (Game.Types.MemoryTrainer, higher.MemoryScore, games[last_game].MemoryScore));
+ records.Add (new PlayerPersonalRecord (GameTypes.MemoryTrainer, higher.MemoryScore, games[last_game].MemoryScore));
if (games[last_game].VerbalScore > higher.VerbalScore)
- records.Add (new PlayerPersonalRecord (Game.Types.VerbalAnalogy, higher.VerbalScore, games[last_game].VerbalScore));
+ records.Add (new PlayerPersonalRecord (GameTypes.VerbalAnalogy, higher.VerbalScore, games[last_game].VerbalScore));
return records;
}
diff --git a/src/Core/Main/Score.cs b/src/Core/Main/Score.cs
index 556abc9..26f44d9 100644
--- a/src/Core/Main/Score.cs
+++ b/src/Core/Main/Score.cs
@@ -42,7 +42,7 @@ namespace gbrainy.Core.Main
The final result is a number from 0 to 100
*/
- static public void UpdateSessionHistorycore (ref GameSessionHistoryExtended history, Game.Types type, Game.Difficulty difficulty, int game_score)
+ static public void UpdateSessionHistorycore (ref GameSessionHistoryExtended history, GameTypes type, Game.Difficulty difficulty, int game_score)
{
bool won;
int components = 0;
@@ -54,25 +54,25 @@ namespace gbrainy.Core.Main
}
switch (type) {
- case Game.Types.LogicPuzzle:
+ case GameTypes.LogicPuzzle:
history.LogicRawScore += game_score;
history.LogicPlayed++;
if (won) history.LogicWon++;
history.LogicScore = ScoreFormula (ref history, type, difficulty);
break;
- case Game.Types.MemoryTrainer:
+ case GameTypes.MemoryTrainer:
history.MemoryRawScore += game_score;
history.MemoryPlayed++;
if (won) history.MemoryWon++;
history.MemoryScore = ScoreFormula (ref history, type, difficulty);
break;
- case Game.Types.MathTrainer:
+ case GameTypes.MathTrainer:
history.MathRawScore += game_score;
history.MathPlayed++;
if (won) history.MathWon++;
history.MathScore = ScoreFormula (ref history, type, difficulty);
break;
- case Game.Types.VerbalAnalogy:
+ case GameTypes.VerbalAnalogy:
history.VerbalRawScore += game_score;
history.VerbalPlayed++;
if (won) history.VerbalWon++;
@@ -111,7 +111,7 @@ namespace gbrainy.Core.Main
//
// Applies scoring formula to the session
//
- static int ScoreFormula (ref GameSessionHistoryExtended history, Game.Types type, Game.Difficulty difficulty)
+ static int ScoreFormula (ref GameSessionHistoryExtended history, GameTypes type, Game.Difficulty difficulty)
{
int logbase, scored, played, won;
double score, factor;
@@ -131,22 +131,22 @@ namespace gbrainy.Core.Main
}
switch (type) {
- case Game.Types.LogicPuzzle:
+ case GameTypes.LogicPuzzle:
scored = history.LogicRawScore;
played = history.LogicPlayed;
won = history.LogicWon;
break;
- case Game.Types.MemoryTrainer:
+ case GameTypes.MemoryTrainer:
scored = history.MemoryRawScore;
played = history.MemoryPlayed;
won = history.MemoryWon;
break;
- case Game.Types.MathTrainer:
+ case GameTypes.MathTrainer:
scored = history.MathRawScore;
played = history.MathPlayed;
won = history.MathWon;
break;
- case Game.Types.VerbalAnalogy:
+ case GameTypes.VerbalAnalogy:
scored = history.VerbalRawScore;
played = history.VerbalPlayed;
won = history.VerbalWon;
diff --git a/src/Core/Main/Verbal/Analogies.cs b/src/Core/Main/Verbal/Analogies.cs
index 62518c3..a4df6c7 100644
--- a/src/Core/Main/Verbal/Analogies.cs
+++ b/src/Core/Main/Verbal/Analogies.cs
@@ -102,8 +102,8 @@ namespace gbrainy.Core.Main.Verbal
}
}
- public override Types Type {
- get { return Game.Types.VerbalAnalogy;}
+ public override GameTypes Type {
+ get { return GameTypes.VerbalAnalogy;}
}
public abstract ArrayListIndicesRandom Indices {
diff --git a/src/Core/Makefile.am b/src/Core/Makefile.am
index ad9110b..078e50e 100644
--- a/src/Core/Makefile.am
+++ b/src/Core/Makefile.am
@@ -15,6 +15,7 @@ CSDISTFILES = \
$(srcdir)/Main/GameSession.cs \
$(srcdir)/Main/GameSessionHistory.cs \
$(srcdir)/Main/GameSessionHistoryExtended.cs \
+ $(srcdir)/Main/GameTypes.cs \
$(srcdir)/Main/GameTips.cs \
$(srcdir)/Main/Memory.cs \
$(srcdir)/Main/PlayerHistory.cs \
diff --git a/src/Core/Views/FinishView.cs b/src/Core/Views/FinishView.cs
index 0a5a581..949f4de 100644
--- a/src/Core/Views/FinishView.cs
+++ b/src/Core/Views/FinishView.cs
@@ -197,25 +197,25 @@ namespace gbrainy.Core.Views
for (int i = 0; i < records.Count; i++)
{
switch (records[i].GameType) {
- case Game.Types.LogicPuzzle:
+ case GameTypes.LogicPuzzle:
s = String.Format (Catalog.
GetString ("By scoring {0}% in logic puzzle games you have established a new personal record. Your previous record was {1}%."),
records[i].NewScore,
records[i].PreviousScore);
break;
- case Game.Types.MathTrainer:
+ case GameTypes.MathTrainer:
s = String.Format (Catalog.
GetString ("By scoring {0}% in calculation games you have established a new personal record. Your previous record was {1}%."),
records[i].NewScore,
records[i].PreviousScore);
break;
- case Game.Types.MemoryTrainer:
+ case GameTypes.MemoryTrainer:
s = String.Format (Catalog.
GetString ("By scoring {0}% in memory games you have established a new personal record. Your previous record was {1}%."),
records[i].NewScore,
records[i].PreviousScore);
break;
- case Game.Types.VerbalAnalogy:
+ case GameTypes.VerbalAnalogy:
s = String.Format (Catalog.
GetString ("By scoring {0}% in verbal analogies you have established a new personal record. Your previous record was {1}%."),
records[i].NewScore,
diff --git a/src/Core/Views/PlayerHistoryView.cs b/src/Core/Views/PlayerHistoryView.cs
index 9882aa3..afaff17 100644
--- a/src/Core/Views/PlayerHistoryView.cs
+++ b/src/Core/Views/PlayerHistoryView.cs
@@ -74,7 +74,7 @@ namespace gbrainy.Core.Views
cr.Stroke ();
cr.Color = text_color;
cr.MoveTo (x + line_size + offset_x, y - 0.01 + second_row);
- cr.ShowPangoText (Game.GetGameTypeDescription (Game.Types.LogicPuzzle));
+ cr.ShowPangoText (GameTypesDescription.Get (GameTypes.LogicPuzzle));
cr.Stroke ();
x += space_hor;
@@ -84,7 +84,7 @@ namespace gbrainy.Core.Views
cr.Stroke ();
cr.Color = text_color;
cr.MoveTo (x + line_size + offset_x, y - 0.01);
- cr.ShowPangoText (Game.GetGameTypeDescription (Game.Types.MemoryTrainer));
+ cr.ShowPangoText (GameTypesDescription.Get (GameTypes.MemoryTrainer));
cr.Stroke ();
cr.Color = math_color;
@@ -93,7 +93,7 @@ namespace gbrainy.Core.Views
cr.Stroke ();
cr.Color = text_color;
cr.MoveTo (x + line_size + offset_x, y - 0.01 + second_row);
- cr.ShowPangoText (Game.GetGameTypeDescription (Game.Types.MathTrainer));
+ cr.ShowPangoText (GameTypesDescription.Get (GameTypes.MathTrainer));
cr.Stroke ();
x += space_hor;
@@ -103,7 +103,7 @@ namespace gbrainy.Core.Views
cr.Stroke ();
cr.Color = text_color;
cr.MoveTo (x + line_size + offset_x, y - 0.01);
- cr.ShowPangoText (Game.GetGameTypeDescription (Game.Types.VerbalAnalogy));
+ cr.ShowPangoText (GameTypesDescription.Get (GameTypes.VerbalAnalogy));
cr.Stroke ();
cr.LineWidth = old_width;
diff --git a/src/Games/Calculation/CalculationArithmetical.cs b/src/Games/Calculation/CalculationArithmetical.cs
index 184b48f..c5426d2 100644
--- a/src/Games/Calculation/CalculationArithmetical.cs
+++ b/src/Games/Calculation/CalculationArithmetical.cs
@@ -45,8 +45,8 @@ namespace gbrainy.Games.Calculation
get {return Catalog.GetString ("Arithmetical");}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
diff --git a/src/Games/Calculation/CalculationAverage.cs b/src/Games/Calculation/CalculationAverage.cs
index e7f4d41..cef4433 100644
--- a/src/Games/Calculation/CalculationAverage.cs
+++ b/src/Games/Calculation/CalculationAverage.cs
@@ -40,8 +40,8 @@ namespace gbrainy.Games.Calculation
get {return Catalog.GetString ("Average");}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
diff --git a/src/Games/Calculation/CalculationCloserFraction.cs b/src/Games/Calculation/CalculationCloserFraction.cs
index 41b1171..20bda57 100644
--- a/src/Games/Calculation/CalculationCloserFraction.cs
+++ b/src/Games/Calculation/CalculationCloserFraction.cs
@@ -39,8 +39,8 @@ namespace gbrainy.Games.Calculation
get {return Catalog.GetString ("Closer fraction");}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
diff --git a/src/Games/Calculation/CalculationFractions.cs b/src/Games/Calculation/CalculationFractions.cs
index 6fc7b19..a4e2851 100644
--- a/src/Games/Calculation/CalculationFractions.cs
+++ b/src/Games/Calculation/CalculationFractions.cs
@@ -62,8 +62,8 @@ namespace gbrainy.Games.Calculation
get {return Catalog.GetString ("Fractions");}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
diff --git a/src/Games/Calculation/CalculationGreatestDivisor.cs b/src/Games/Calculation/CalculationGreatestDivisor.cs
index 1df853a..41d3c7b 100644
--- a/src/Games/Calculation/CalculationGreatestDivisor.cs
+++ b/src/Games/Calculation/CalculationGreatestDivisor.cs
@@ -39,8 +39,8 @@ namespace gbrainy.Games.Calculation
get {return Catalog.GetString ("Greatest divisor");}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
diff --git a/src/Games/Calculation/CalculationOperator.cs b/src/Games/Calculation/CalculationOperator.cs
index 1aa8aee..9a2c3b5 100644
--- a/src/Games/Calculation/CalculationOperator.cs
+++ b/src/Games/Calculation/CalculationOperator.cs
@@ -41,8 +41,8 @@ namespace gbrainy.Games.Calculation
get {return String.Format( Catalog.GetString ("The first operator is {0}."), oper1);}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
diff --git a/src/Games/Calculation/CalculationPrimes.cs b/src/Games/Calculation/CalculationPrimes.cs
index 0a221c1..75915f3 100644
--- a/src/Games/Calculation/CalculationPrimes.cs
+++ b/src/Games/Calculation/CalculationPrimes.cs
@@ -155,8 +155,8 @@ namespace gbrainy.Games.Calculation
get {return Catalog.GetString ("Primes");}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
diff --git a/src/Games/Calculation/CalculationProportions.cs b/src/Games/Calculation/CalculationProportions.cs
index 5c14996..b1949c7 100644
--- a/src/Games/Calculation/CalculationProportions.cs
+++ b/src/Games/Calculation/CalculationProportions.cs
@@ -39,8 +39,8 @@ namespace gbrainy.Games.Calculation
get {return Catalog.GetString ("Proportions");}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
diff --git a/src/Games/Calculation/CalculationRatio.cs b/src/Games/Calculation/CalculationRatio.cs
index cdb3177..61837f3 100644
--- a/src/Games/Calculation/CalculationRatio.cs
+++ b/src/Games/Calculation/CalculationRatio.cs
@@ -34,8 +34,8 @@ namespace gbrainy.Games.Calculation
get {return Catalog.GetString ("Ratio");}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
diff --git a/src/Games/Calculation/CalculationTwoNumbers.cs b/src/Games/Calculation/CalculationTwoNumbers.cs
index 3096f74..d99229e 100644
--- a/src/Games/Calculation/CalculationTwoNumbers.cs
+++ b/src/Games/Calculation/CalculationTwoNumbers.cs
@@ -30,9 +30,9 @@ namespace gbrainy.Games.Calculation
{
int number_a, number_b;
int op1, op2, max_operand;
- GameTypes type;
+ SubGameTypes type;
- enum GameTypes
+ enum SubGameTypes
{
Addition,
Subtraction,
@@ -43,17 +43,17 @@ namespace gbrainy.Games.Calculation
get {return Catalog.GetString ("Two numbers");}
}
- public override Types Type {
- get { return Game.Types.MathTrainer;}
+ public override GameTypes Type {
+ get { return GameTypes.MathTrainer;}
}
public override string Question {
get {
switch (type) {
- case GameTypes.Addition:
+ case SubGameTypes.Addition:
return String.Format (Catalog.GetString ("Which two numbers when added are {0} and when multiplied are {1}?"), op1, op2);
- case GameTypes.Subtraction:
+ case SubGameTypes.Subtraction:
return String.Format (Catalog.GetString ("Which two numbers when subtracted are {0} and when multiplied are {1}?"), op1, op2);
default:
throw new InvalidOperationException ();
@@ -75,7 +75,7 @@ namespace gbrainy.Games.Calculation
public override void Initialize ()
{
- type = (GameTypes) random.Next ((int) GameTypes.Length);
+ type = (SubGameTypes) random.Next ((int) SubGameTypes.Length);
switch (CurrentDifficulty) {
case Difficulty.Easy:
@@ -93,10 +93,10 @@ namespace gbrainy.Games.Calculation
number_b = 3 + random.Next (max_operand);
switch (type) {
- case GameTypes.Addition:
+ case SubGameTypes.Addition:
op1 = number_a + number_b;
break;
- case GameTypes.Subtraction:
+ case SubGameTypes.Subtraction:
if (number_a < number_b) {
int tmp = number_a;
@@ -124,10 +124,10 @@ namespace gbrainy.Games.Calculation
gr.MoveTo (x, DrawAreaY + 0.22);
switch (type) {
- case GameTypes.Addition:
+ case SubGameTypes.Addition:
gr.ShowPangoText (String.Format (Catalog.GetString ("number1 + number2 = {0}"), op1));
break;
- case GameTypes.Subtraction:
+ case SubGameTypes.Subtraction:
gr.ShowPangoText (String.Format (Catalog.GetString ("number1 - number2 = {0}"), op1));
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]