[gbrainy] Move GameDifficulty to his own class file



commit 9a18e8fd1400f9b3eb560f85272f5e4a92bf81e6
Author: Jordi Mas <jmas softcatala org>
Date:   Sun Jul 18 09:21:33 2010 +0200

    Move GameDifficulty to his own class file

 sample_extensions/Calculation/CalculationSample.cs |    6 +-
 sample_extensions/Memory/MemorySample.cs           |    6 +-
 src/Clients/Classical/Dialogs/PreferencesDialog.cs |   16 +++---
 src/Clients/Classical/gbrainy.cs                   |    4 +-
 src/Core/Main/Game.cs                              |   21 ++-----
 src/Core/Main/GameDifficulty.cs                    |   59 ++++++++++++++++++++
 src/Core/Main/GameManager.cs                       |    8 +-
 src/Core/Main/GameSession.cs                       |    2 +-
 src/Core/Main/GameSessionHistoryExtended.cs        |    2 +-
 src/Core/Main/Preferences.cs                       |    2 +-
 src/Core/Main/Score.cs                             |   18 +++---
 src/Core/Main/Xml/GameXmlDefinition.cs             |    4 +-
 src/Core/Main/Xml/GameXmlFactory.cs                |   20 +------
 src/Core/Makefile.am                               |    1 +
 src/Games/Calculation/CalculationArithmetical.cs   |    6 +-
 src/Games/Calculation/CalculationAverage.cs        |    6 +-
 src/Games/Calculation/CalculationCloserFraction.cs |    6 +-
 src/Games/Calculation/CalculationFractions.cs      |    6 +-
 .../Calculation/CalculationGreatestDivisor.cs      |    6 +-
 src/Games/Calculation/CalculationPrimes.cs         |    6 +-
 src/Games/Calculation/CalculationProportions.cs    |    6 +-
 src/Games/Calculation/CalculationRatio.cs          |    6 +-
 src/Games/Calculation/CalculationTwoNumbers.cs     |    6 +-
 src/Games/Logic/Puzzle3DCube.cs                    |    6 +-
 src/Games/Logic/PuzzleBuildTriangle.cs             |    6 +-
 src/Games/Logic/PuzzleCountCircles.cs              |    6 +-
 src/Games/Logic/PuzzleDivideCircle.cs              |    2 +-
 src/Games/Logic/PuzzleFourSided.cs                 |    2 +-
 src/Games/Logic/PuzzleHandshakes.cs                |    6 +-
 src/Games/Logic/PuzzleLines.cs                     |    2 +-
 src/Games/Logic/PuzzleMostInCommon.cs              |    4 +-
 src/Games/Logic/PuzzleNumericRelation.cs           |    2 +-
 src/Games/Logic/PuzzleNumericSequence.cs           |    2 +-
 src/Games/Logic/PuzzleSquares.cs                   |    2 +-
 src/Games/Logic/PuzzleTriangles.cs                 |    2 +-
 src/Games/Memory/MemoryColouredFigures.cs          |    6 +-
 src/Games/Memory/MemoryColouredText.cs             |    6 +-
 src/Games/Memory/MemoryCountDots.cs                |    6 +-
 src/Games/Memory/MemoryFacts.cs                    |    6 +-
 src/Games/Memory/MemoryFigures.cs                  |    6 +-
 src/Games/Memory/MemoryFiguresAndText.cs           |    6 +-
 src/Games/Memory/MemoryFiguresNumbers.cs           |    6 +-
 src/Games/Memory/MemoryIndications.cs              |    6 +-
 src/Games/Memory/MemoryNumbers.cs                  |    6 +-
 src/Games/Memory/MemoryWords.cs                    |    6 +-
 45 files changed, 178 insertions(+), 147 deletions(-)
---
diff --git a/sample_extensions/Calculation/CalculationSample.cs b/sample_extensions/Calculation/CalculationSample.cs
index 366d626..12197f4 100644
--- a/sample_extensions/Calculation/CalculationSample.cs
+++ b/sample_extensions/Calculation/CalculationSample.cs
@@ -45,13 +45,13 @@ public class CalculationSample : Game
 	protected override void Initialize ()
 	{
 		switch (CurrentDifficulty) {
-		case Difficulty.Easy:
+		case GameDifficulty.Easy:
 			max_operand = 8;
 			break;
-		case Difficulty.Medium:
+		case GameDifficulty.Medium:
 			max_operand = 10;
 			break;
-		case Difficulty.Master:
+		case GameDifficulty.Master:
 			max_operand = 15;
 			break;
 		}
diff --git a/sample_extensions/Memory/MemorySample.cs b/sample_extensions/Memory/MemorySample.cs
index ec0ce48..14ab459 100644
--- a/sample_extensions/Memory/MemorySample.cs
+++ b/sample_extensions/Memory/MemorySample.cs
@@ -58,13 +58,13 @@ public class MemorySample : Memory
 		animals.Add ("salmon");
 
 		switch (CurrentDifficulty) {
-		case Difficulty.Easy:
+		case GameDifficulty.Easy:
 			showed = 4;
 			break;
-		case Difficulty.Medium:
+		case GameDifficulty.Medium:
 			showed = 6;
 			break;
-		case Difficulty.Master:
+		case GameDifficulty.Master:
 			showed = 8;
 			break;
 		}
diff --git a/src/Clients/Classical/Dialogs/PreferencesDialog.cs b/src/Clients/Classical/Dialogs/PreferencesDialog.cs
index d774237..9e1de0c 100644
--- a/src/Clients/Classical/Dialogs/PreferencesDialog.cs
+++ b/src/Clients/Classical/Dialogs/PreferencesDialog.cs
@@ -48,28 +48,28 @@ namespace gbrainy.Clients.Classical
 			minplayedspinbutton.Value = Preferences.GetIntValue (Preferences.MinPlayedGamesKey);
 			colorblindcheckbutton.Active = Preferences.GetBoolValue (Preferences.ColorBlindKey);
 
-			switch ((Game.Difficulty) Preferences.GetIntValue (Preferences.DifficultyKey)) {
-			case Game.Difficulty.Easy:
+			switch ((GameDifficulty) Preferences.GetIntValue (Preferences.DifficultyKey)) {
+			case GameDifficulty.Easy:
 				rb_easy.Active = rb_easy.HasFocus = true;
 				break;
-			case Game.Difficulty.Medium:
+			case GameDifficulty.Medium:
 				rb_medium.Active = rb_medium.HasFocus = true;
 				break;
-			case Game.Difficulty.Master:
+			case GameDifficulty.Master:
 				rb_master.Active = rb_master.HasFocus = true;
 				break;
 			}
 		}
 
-		private Game.Difficulty Difficulty {
+		private GameDifficulty Difficulty {
 			get {
 				if (rb_easy.Active)
-					return Game.Difficulty.Easy;
+					return GameDifficulty.Easy;
 
 				if (rb_master.Active)
-					return Game.Difficulty.Master;
+					return GameDifficulty.Master;
 
-				return Game.Difficulty.Medium;
+				return GameDifficulty.Medium;
 			}
 		}
 
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index f113ca1..ab8a3d9 100644
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -94,7 +94,7 @@ namespace gbrainy.Clients.Classical
 			session.DrawRequest += SessionDrawRequest;
 			session.UpdateUIElement += SessionUpdateUIElement;
 			session.SynchronizingObject = new GtkSynchronize ();
-			session.Difficulty = (Game.Difficulty) Preferences.GetIntValue (Preferences.DifficultyKey);
+			session.Difficulty = (GameDifficulty) Preferences.GetIntValue (Preferences.DifficultyKey);
 
 			BuildUI ();
 		}
@@ -540,7 +540,7 @@ namespace gbrainy.Clients.Classical
 
 			dialog = new PreferencesDialog (session.PlayerHistory);
 			if ((Gtk.ResponseType) dialog.Run () == ResponseType.Ok) {
-				session.Difficulty = (Game.Difficulty) Preferences.GetIntValue (Preferences.DifficultyKey);
+				session.Difficulty = (GameDifficulty) Preferences.GetIntValue (Preferences.DifficultyKey);
 			}
 			dialog.Destroy ();
 		}
diff --git a/src/Core/Main/Game.cs b/src/Core/Main/Game.cs
index b72f2c2..eb82edc 100644
--- a/src/Core/Main/Game.cs
+++ b/src/Core/Main/Game.cs
@@ -32,18 +32,7 @@ namespace gbrainy.Core.Main
 {
 	abstract public class Game : IDrawable, IDrawRequest, IMouseEvent
 	{
-		[Flags]
-		public enum Difficulty
-		{
-			None			= 0,
-			Easy			= 2,
-			Medium			= 4,
-			Master			= 8,
-			All			= Easy | Medium | Master,
-		}
-
 	
-
 		public const char AnswerSeparator = '|';
 		const int MAX_POSSIBLE_ANSWER = 7;
 
@@ -64,7 +53,7 @@ namespace gbrainy.Core.Main
 		private TimeSpan game_time;
 		private bool tip_used;
 		private bool preview;
-		private Difficulty difficulty;
+		private GameDifficulty difficulty;
 		private ISynchronizeInvoke synchronize;
 		private List <Toolkit.Container> containers;
 		private int variant;
@@ -75,7 +64,7 @@ namespace gbrainy.Core.Main
 
 		protected Game ()
 		{
-			difficulty = Difficulty.Medium;
+			difficulty = GameDifficulty.Medium;
 		}
 
 #region Methods to override in your own games
@@ -128,8 +117,8 @@ namespace gbrainy.Core.Main
 		}
 
 		// Indicates in which difficulty levels the game should be shown
-		public virtual Difficulty GameDifficulty {
-			get { return Difficulty.Master | Difficulty.Medium | Difficulty.Easy; }
+		public virtual GameDifficulty Difficulty {
+			get { return GameDifficulty.Master | GameDifficulty.Medium | GameDifficulty.Easy; }
 		}
 
 		// Indicates if the game should be excluded for color blind users
@@ -181,7 +170,7 @@ namespace gbrainy.Core.Main
 		}
 
 		// The level of difficulty selected for the current game
-		public Difficulty CurrentDifficulty {
+		public GameDifficulty CurrentDifficulty {
 			set { difficulty = value; }
 			get { return difficulty; }
 		}
diff --git a/src/Core/Main/GameDifficulty.cs b/src/Core/Main/GameDifficulty.cs
new file mode 100644
index 0000000..100754c
--- /dev/null
+++ b/src/Core/Main/GameDifficulty.cs
@@ -0,0 +1,59 @@
+/*
+ * 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
+{
+	[Flags]
+	public enum GameDifficulty
+	{
+		None			= 0,
+		Easy			= 2,
+		Medium			= 4,
+		Master			= 8,
+		All			= Easy | Medium | Master,
+	}
+
+	public static class GameDifficultyDescription
+	{
+		// string (not localized) to enum representation
+		static public GameDifficulty FromString (string type)
+		{
+			GameDifficulty difficulty;
+
+			difficulty = GameDifficulty.None;
+
+			if (type.IndexOf ("Easy", StringComparison.InvariantCultureIgnoreCase) != -1)
+				difficulty |= GameDifficulty.Easy;
+
+			if (type.IndexOf ("Medium", StringComparison.InvariantCultureIgnoreCase) != -1)
+				difficulty |= GameDifficulty.Medium;
+
+			if (type.IndexOf ("Master", StringComparison.InvariantCultureIgnoreCase) != -1)
+				difficulty |= GameDifficulty.Master;
+
+			if (type.IndexOf ("All", StringComparison.InvariantCultureIgnoreCase) != -1)
+				difficulty |= GameDifficulty.All;
+
+			return difficulty;
+		}
+	}
+}
diff --git a/src/Core/Main/GameManager.cs b/src/Core/Main/GameManager.cs
index 2d75295..a461199 100644
--- a/src/Core/Main/GameManager.cs
+++ b/src/Core/Main/GameManager.cs
@@ -69,7 +69,7 @@ namespace gbrainy.Core.Main
 		bool once;
 		GameSession.Types game_type;
 		IEnumerator <int> enumerator;
-		Game.Difficulty difficulty;
+		GameDifficulty difficulty;
 		GamesXmlFactory xml_games;
 
 		List <GameLocator> available_games; 	// List of all available games in the system
@@ -79,7 +79,7 @@ namespace gbrainy.Core.Main
 		public GameManager ()
 		{
 			game_type = GameSession.Types.None;
-			difficulty = Game.Difficulty.Medium;
+			difficulty = GameDifficulty.Medium;
 			available_games = new List <GameLocator> ();
 			play_list = new List <int> ();
 			cnt_logic = cnt_memory = cnt_calculation = cnt_verbal = 0;
@@ -142,7 +142,7 @@ namespace gbrainy.Core.Main
 			}
 		}
 
-		public Game.Difficulty Difficulty {
+		public GameDifficulty Difficulty {
 			set {
 				if (difficulty == value)
 					return;
@@ -463,7 +463,7 @@ namespace gbrainy.Core.Main
 				if (first == null)
 					first = puzzle;
 
-				if ((puzzle.GameDifficulty & difficulty) == difficulty)
+				if ((puzzle.Difficulty & difficulty) == difficulty)
 					break;
 			}
 
diff --git a/src/Core/Main/GameSession.cs b/src/Core/Main/GameSession.cs
index c176560..a73fe3b 100644
--- a/src/Core/Main/GameSession.cs
+++ b/src/Core/Main/GameSession.cs
@@ -109,7 +109,7 @@ namespace gbrainy.Core.Main
 			set {game_manager.GameType = value; }
 		}
 
-		public Game.Difficulty Difficulty {
+		public GameDifficulty Difficulty {
 			get {return game_manager.Difficulty; }
 			set {game_manager.Difficulty = value; }
 		}
diff --git a/src/Core/Main/GameSessionHistoryExtended.cs b/src/Core/Main/GameSessionHistoryExtended.cs
index d4d8f9a..6fbb7aa 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 (GameTypes type, Game.Difficulty difficulty, int game_score)
+		public void UpdateScore (GameTypes type, GameDifficulty difficulty, int game_score)
 		{
 			GameSessionHistoryExtended history = this;
 			Score.SessionUpdateHistoryScore (ref history, type, difficulty, game_score);
diff --git a/src/Core/Main/Preferences.cs b/src/Core/Main/Preferences.cs
index db5e5e9..1cfaadc 100644
--- a/src/Core/Main/Preferences.cs
+++ b/src/Core/Main/Preferences.cs
@@ -159,7 +159,7 @@ namespace gbrainy.Core.Main
 			properties.Clear ();
 			properties.Add (MemQuestionWarnKey, true.ToString ());
 			properties.Add (MemQuestionTimeKey, "4");
-			properties.Add (DifficultyKey, ((int)(Game.Difficulty.Medium)).ToString ());
+			properties.Add (DifficultyKey, ((int)(GameDifficulty.Medium)).ToString ());
 			properties.Add (MinPlayedGamesKey, "5");
 			properties.Add (MaxStoredGamesKey, "20");
 			properties.Add (ToolbarKey, true.ToString ());
diff --git a/src/Core/Main/Score.cs b/src/Core/Main/Score.cs
index 87c7e44..d9c1d8d 100644
--- a/src/Core/Main/Score.cs
+++ b/src/Core/Main/Score.cs
@@ -37,18 +37,18 @@ namespace gbrainy.Core.Main
 		*/
 
 		// Expected time in seconds that a player is expected to complete this game
-		static public int GameExpectedTime (GameTypes type, Game.Difficulty difficulty)
+		static public int GameExpectedTime (GameTypes type, GameDifficulty difficulty)
 		{
 			double factor;
 
 			switch (difficulty) {
-			case Game.Difficulty.Easy:
+			case GameDifficulty.Easy:
 				factor = 1.3;
 				break;
-			case Game.Difficulty.Master:
+			case GameDifficulty.Master:
 				factor = 0.7;
 				break;
-			case Game.Difficulty.Medium:
+			case GameDifficulty.Medium:
 			default:
 				factor = 1.0;
 				break;
@@ -111,7 +111,7 @@ namespace gbrainy.Core.Main
 
 			The final result is a number from 0 to 100
 		*/
-		static public void SessionUpdateHistoryScore (ref GameSessionHistoryExtended history, GameTypes type, Game.Difficulty difficulty, int game_score)
+		static public void SessionUpdateHistoryScore (ref GameSessionHistoryExtended history, GameTypes type, GameDifficulty difficulty, int game_score)
 		{
 			bool won;
 			int components = 0;
@@ -180,19 +180,19 @@ namespace gbrainy.Core.Main
 		//
 		// Applies scoring formula to the session
 		//
-		static int SessionScoreFormula (ref GameSessionHistoryExtended history, GameTypes type, Game.Difficulty difficulty)
+		static int SessionScoreFormula (ref GameSessionHistoryExtended history, GameTypes type, GameDifficulty difficulty)
 		{
 			int logbase, scored, played, won;
 			double score, factor;
 
 			switch (difficulty) {
-			case Game.Difficulty.Easy:
+			case GameDifficulty.Easy:
 				logbase = 10;
 				break;
-			case Game.Difficulty.Medium:
+			case GameDifficulty.Medium:
 				logbase = 20;
 				break;
-			case Game.Difficulty.Master:
+			case GameDifficulty.Master:
 				logbase = 30;
 				break;
 			default:
diff --git a/src/Core/Main/Xml/GameXmlDefinition.cs b/src/Core/Main/Xml/GameXmlDefinition.cs
index a280eea..ed9c6fa 100644
--- a/src/Core/Main/Xml/GameXmlDefinition.cs
+++ b/src/Core/Main/Xml/GameXmlDefinition.cs
@@ -114,14 +114,14 @@ namespace gbrainy.Core.Main.Xml
 	public class GameXmlDefinition : GameXmlDefinitionVariant
 	{
 		public string Name { get; set; }
-		public Game.Difficulty Difficulty { get; set; }
+		public GameDifficulty Difficulty { get; set; }
 		public GameTypes Type { get; set; }
 
 		public List <GameXmlDefinitionVariant> Variants { get; set; }
 
 		public GameXmlDefinition ()
 		{
-			Difficulty = Game.Difficulty.Medium;
+			Difficulty = GameDifficulty.Medium;
 			Type = GameTypes.LogicPuzzle; // TODO: temporary, should be mandatory in games.xml
 			Variants = new List <GameXmlDefinitionVariant> ();
 		}
diff --git a/src/Core/Main/Xml/GameXmlFactory.cs b/src/Core/Main/Xml/GameXmlFactory.cs
index d927df2..a4e8d02 100644
--- a/src/Core/Main/Xml/GameXmlFactory.cs
+++ b/src/Core/Main/Xml/GameXmlFactory.cs
@@ -86,25 +86,7 @@ namespace gbrainy.Core.Main.Xml
 
 						str = reader.ReadElementString ();
 						str.Trim ();
-
-						switch (str) {
-						case "Easy":
-							game.Difficulty = Game.Difficulty.Easy;
-							break;
-						case "Medium":
-							game.Difficulty = Game.Difficulty.Medium;
-							break;
-						case "Master":
-							game.Difficulty = Game.Difficulty.Master;
-							break;
-						case "All":
-							game.Difficulty = Game.Difficulty.All;
-							break;
-						default:
-							Console.WriteLine ("GameXmlFactory. Unknown difficulty level: {0}", str);
-							break;
-						}
-
+						game.Difficulty = GameDifficultyDescription.FromString (str);
 						break;
 					case "svg":
 						if (reader.NodeType != XmlNodeType.Element)
diff --git a/src/Core/Makefile.am b/src/Core/Makefile.am
index 42a7ee5..33b3ba4 100644
--- a/src/Core/Makefile.am
+++ b/src/Core/Makefile.am
@@ -13,6 +13,7 @@ CSDISTFILES =  \
 		$(srcdir)/Main/IMouseEvent.cs		\
 		$(srcdir)/Main/Game.cs			\
 		$(srcdir)/Main/GameAnswerCheckAttributes.cs \
+		$(srcdir)/Main/GameDifficulty.cs 	\
 		$(srcdir)/Main/GameManager.cs		\
 		$(srcdir)/Main/GameSession.cs		\
 		$(srcdir)/Main/GameSessionHistory.cs	\
diff --git a/src/Games/Calculation/CalculationArithmetical.cs b/src/Games/Calculation/CalculationArithmetical.cs
index 5d54676..73deeaa 100644
--- a/src/Games/Calculation/CalculationArithmetical.cs
+++ b/src/Games/Calculation/CalculationArithmetical.cs
@@ -59,15 +59,15 @@ namespace gbrainy.Games.Calculation
 			operation = (Operation) random.Next ((int) Operation.LastOperation);
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				max_operations = 2;
 				max_operand = 50;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				max_operations = 3;
 				max_operand = 100;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				max_operations = 5;
 				max_operand = 500;
 				break;
diff --git a/src/Games/Calculation/CalculationAverage.cs b/src/Games/Calculation/CalculationAverage.cs
index a85f7eb..ae8d92c 100644
--- a/src/Games/Calculation/CalculationAverage.cs
+++ b/src/Games/Calculation/CalculationAverage.cs
@@ -75,18 +75,18 @@ namespace gbrainy.Games.Calculation
 			int nums, options_next, dist, num_size, which = 0;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				nums = 3;
 				dist = nums * 3;
 				num_size = 50;
 				break;
 			default:
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				nums = 5;
 				dist = nums * 3;
 				num_size = 150;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				nums = 7;
 				dist = nums * 3;
 				num_size = 500;
diff --git a/src/Games/Calculation/CalculationCloserFraction.cs b/src/Games/Calculation/CalculationCloserFraction.cs
index c4721fa..2bcbe81 100644
--- a/src/Games/Calculation/CalculationCloserFraction.cs
+++ b/src/Games/Calculation/CalculationCloserFraction.cs
@@ -66,16 +66,16 @@ namespace gbrainy.Games.Calculation
 			int i, ans_idx, basenum, randnum;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				basenum = 5;
 				randnum = 10;
 				break;
 			default:
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				basenum = 5;
 				randnum = 30;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				basenum = 9;
 				randnum = 60;
 				break;
diff --git a/src/Games/Calculation/CalculationFractions.cs b/src/Games/Calculation/CalculationFractions.cs
index 25ce484..db02917 100644
--- a/src/Games/Calculation/CalculationFractions.cs
+++ b/src/Games/Calculation/CalculationFractions.cs
@@ -92,18 +92,18 @@ namespace gbrainy.Games.Calculation
 			int factor = Factor;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				fractions_num = 2;
 				demominator_max = 5;
 				factor_max = 2;
 				break;
 			default:
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				fractions_num = 4;
 				demominator_max = 3;
 				factor_max = 3;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				fractions_num = 4;
 				demominator_max = 5;
 				factor_max = 4;
diff --git a/src/Games/Calculation/CalculationGreatestDivisor.cs b/src/Games/Calculation/CalculationGreatestDivisor.cs
index 53cd3d2..058f768 100644
--- a/src/Games/Calculation/CalculationGreatestDivisor.cs
+++ b/src/Games/Calculation/CalculationGreatestDivisor.cs
@@ -54,15 +54,15 @@ namespace gbrainy.Games.Calculation
 			int []mult = new int [3];
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				max_num = 999;
 				num_answ_ques = 3;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				max_num = 999;
 				num_answ_ques = 4;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				max_num = 9999;
 				num_answ_ques = 4;
 				break;
diff --git a/src/Games/Calculation/CalculationPrimes.cs b/src/Games/Calculation/CalculationPrimes.cs
index 72750a0..fb43727 100644
--- a/src/Games/Calculation/CalculationPrimes.cs
+++ b/src/Games/Calculation/CalculationPrimes.cs
@@ -173,17 +173,17 @@ namespace gbrainy.Games.Calculation
 			int max_primeidx;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				max = 500;
 				div3 = true;
 				max_primeidx = 94;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				max = 10000;
 				div3 = false;
 				max_primeidx = total_primes;
 				break;		
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 			default:
 				max = 1000;
 				div3 = true;
diff --git a/src/Games/Calculation/CalculationProportions.cs b/src/Games/Calculation/CalculationProportions.cs
index ee3479b..e34c000 100644
--- a/src/Games/Calculation/CalculationProportions.cs
+++ b/src/Games/Calculation/CalculationProportions.cs
@@ -55,14 +55,14 @@ namespace gbrainy.Games.Calculation
 			int options_next, random_max, which = 0;
 		
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				random_max = 30;
 				break;
 			default:
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				random_max = 50;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				random_max = 80;
 				break;
 			}
diff --git a/src/Games/Calculation/CalculationRatio.cs b/src/Games/Calculation/CalculationRatio.cs
index 98e7bc2..4b47fb3 100644
--- a/src/Games/Calculation/CalculationRatio.cs
+++ b/src/Games/Calculation/CalculationRatio.cs
@@ -74,14 +74,14 @@ namespace gbrainy.Games.Calculation
 			int random_max;
 		
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				random_max = 5;
 				break;
 			default:
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				random_max = 8;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				random_max = 15;
 				break;
 			}
diff --git a/src/Games/Calculation/CalculationTwoNumbers.cs b/src/Games/Calculation/CalculationTwoNumbers.cs
index 53d44c7..b246664 100644
--- a/src/Games/Calculation/CalculationTwoNumbers.cs
+++ b/src/Games/Calculation/CalculationTwoNumbers.cs
@@ -77,13 +77,13 @@ namespace gbrainy.Games.Calculation
 			type = (SubGameTypes) random.Next ((int) SubGameTypes.Length);
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				max_operand = 8;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				max_operand = 10;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				max_operand = 15;
 				break;
 			}
diff --git a/src/Games/Logic/Puzzle3DCube.cs b/src/Games/Logic/Puzzle3DCube.cs
index 9db9e59..2532b30 100644
--- a/src/Games/Logic/Puzzle3DCube.cs
+++ b/src/Games/Logic/Puzzle3DCube.cs
@@ -47,13 +47,13 @@ namespace gbrainy.Games.Logic
 			int ans, max_random;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				max_random = 1;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				max_random = 5;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 			default:
 				max_random = 3;
 				break;		
diff --git a/src/Games/Logic/PuzzleBuildTriangle.cs b/src/Games/Logic/PuzzleBuildTriangle.cs
index 92c54fd..062e007 100644
--- a/src/Games/Logic/PuzzleBuildTriangle.cs
+++ b/src/Games/Logic/PuzzleBuildTriangle.cs
@@ -78,12 +78,12 @@ namespace gbrainy.Games.Logic
 		protected override void Initialize ()
 		{
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				total_figures = 6;
 				space_figures = 0.26;
 				break;
-			case Difficulty.Medium:
-			case Difficulty.Master:
+			case GameDifficulty.Medium:
+			case GameDifficulty.Master:
 				total_figures = 8;
 				space_figures = 0.2;
 				break;
diff --git a/src/Games/Logic/PuzzleCountCircles.cs b/src/Games/Logic/PuzzleCountCircles.cs
index 091ca4a..69ebba7 100644
--- a/src/Games/Logic/PuzzleCountCircles.cs
+++ b/src/Games/Logic/PuzzleCountCircles.cs
@@ -63,13 +63,13 @@ namespace gbrainy.Games.Logic
 			double x, y, rad;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				n_circles = 7;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				n_circles = 14;
 				break;		
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 			default:
 				n_circles = 10;
 				break;		
diff --git a/src/Games/Logic/PuzzleDivideCircle.cs b/src/Games/Logic/PuzzleDivideCircle.cs
index a551c0a..f8c7e05 100644
--- a/src/Games/Logic/PuzzleDivideCircle.cs
+++ b/src/Games/Logic/PuzzleDivideCircle.cs
@@ -53,7 +53,7 @@ namespace gbrainy.Games.Logic
 
 		protected override void Initialize ()
 		{
-			if (CurrentDifficulty==Difficulty.Easy)
+			if (CurrentDifficulty==GameDifficulty.Easy)
 				dots = 5;
 			else
 				dots = 5 + random.Next (2);
diff --git a/src/Games/Logic/PuzzleFourSided.cs b/src/Games/Logic/PuzzleFourSided.cs
index 70be8b2..498fe22 100644
--- a/src/Games/Logic/PuzzleFourSided.cs
+++ b/src/Games/Logic/PuzzleFourSided.cs
@@ -52,7 +52,7 @@ namespace gbrainy.Games.Logic
 
 		protected override void Initialize ()
 		{
-			if (CurrentDifficulty==Difficulty.Easy)
+			if (CurrentDifficulty==GameDifficulty.Easy)
 				type = 0;
 			else
 				type = random.Next (2);
diff --git a/src/Games/Logic/PuzzleHandshakes.cs b/src/Games/Logic/PuzzleHandshakes.cs
index 3b0c6bf..340062f 100644
--- a/src/Games/Logic/PuzzleHandshakes.cs
+++ b/src/Games/Logic/PuzzleHandshakes.cs
@@ -49,13 +49,13 @@ namespace gbrainy.Games.Logic
 			handshakes = 0;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				people = 4 + random.Next (4);
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				people = 5 + random.Next (8);
 				break;		
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 			default:
 				people = 5 + random.Next (4);
 				break;		
diff --git a/src/Games/Logic/PuzzleLines.cs b/src/Games/Logic/PuzzleLines.cs
index dd60548..cab2078 100644
--- a/src/Games/Logic/PuzzleLines.cs
+++ b/src/Games/Logic/PuzzleLines.cs
@@ -52,7 +52,7 @@ namespace gbrainy.Games.Logic
 
 		protected override void Initialize ()
 		{
-			if (CurrentDifficulty==Difficulty.Easy)
+			if (CurrentDifficulty==GameDifficulty.Easy)
 				type = 0;
 			else
 				type = random.Next (max_types);		
diff --git a/src/Games/Logic/PuzzleMostInCommon.cs b/src/Games/Logic/PuzzleMostInCommon.cs
index acb4493..c710e77 100644
--- a/src/Games/Logic/PuzzleMostInCommon.cs
+++ b/src/Games/Logic/PuzzleMostInCommon.cs
@@ -89,7 +89,7 @@ namespace gbrainy.Games.Logic
 
 		public override string Rationale {
 			get {
-				if (CurrentDifficulty ==  Difficulty.Easy) 
+				if (CurrentDifficulty ==  GameDifficulty.Easy) 
 					return Catalog.GetString ("It has the same number of elements inside the figure as the given figures.");
 				else
 					return Catalog.GetString ("It is the figure with the most elements in common compared to the given figures.");
@@ -121,7 +121,7 @@ namespace gbrainy.Games.Logic
 				}
 			}
 
-			if (CurrentDifficulty ==  Difficulty.Easy) {
+			if (CurrentDifficulty ==  GameDifficulty.Easy) {
 				// Answer 1 (good)
 				array.AddRange (new Element [] {Element.SmallCircle, Element.SmallCircle, Element.SmallCircle, 
 				Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
diff --git a/src/Games/Logic/PuzzleNumericRelation.cs b/src/Games/Logic/PuzzleNumericRelation.cs
index f6e5426..f715e29 100644
--- a/src/Games/Logic/PuzzleNumericRelation.cs
+++ b/src/Games/Logic/PuzzleNumericRelation.cs
@@ -67,7 +67,7 @@ namespace gbrainy.Games.Logic
 		{
 			int group = 0, inc = 0;
 
-			if (CurrentDifficulty == Difficulty.Easy) {
+			if (CurrentDifficulty == GameDifficulty.Easy) {
 				sum_value = 10 + random.Next (10);
 				inc = 5;
 			}
diff --git a/src/Games/Logic/PuzzleNumericSequence.cs b/src/Games/Logic/PuzzleNumericSequence.cs
index eae7a0f..53fe6c5 100644
--- a/src/Games/Logic/PuzzleNumericSequence.cs
+++ b/src/Games/Logic/PuzzleNumericSequence.cs
@@ -64,7 +64,7 @@ namespace gbrainy.Games.Logic
 		{
 			int[] seeds;
 
-			formula = random.Next (CurrentDifficulty == Difficulty.Easy ? 2 : 3);
+			formula = random.Next (CurrentDifficulty == GameDifficulty.Easy ? 2 : 3);
 			numbers =  new int [max_num];
 
 			switch (formula) {
diff --git a/src/Games/Logic/PuzzleSquares.cs b/src/Games/Logic/PuzzleSquares.cs
index f79eed0..f57376d 100644
--- a/src/Games/Logic/PuzzleSquares.cs
+++ b/src/Games/Logic/PuzzleSquares.cs
@@ -57,7 +57,7 @@ namespace gbrainy.Games.Logic
 
 		protected override void Initialize ()
 		{
-			if (CurrentDifficulty==Difficulty.Easy)
+			if (CurrentDifficulty==GameDifficulty.Easy)
 				type = 0;
 			else
 				type = random.Next (2);
diff --git a/src/Games/Logic/PuzzleTriangles.cs b/src/Games/Logic/PuzzleTriangles.cs
index fea24fc..48c59ed 100644
--- a/src/Games/Logic/PuzzleTriangles.cs
+++ b/src/Games/Logic/PuzzleTriangles.cs
@@ -52,7 +52,7 @@ namespace gbrainy.Games.Logic
 
 		protected override void Initialize ()
 		{
-			if (CurrentDifficulty==Difficulty.Easy)
+			if (CurrentDifficulty==GameDifficulty.Easy)
 				type = 1;
 			else
 				type = random.Next (2);
diff --git a/src/Games/Memory/MemoryColouredFigures.cs b/src/Games/Memory/MemoryColouredFigures.cs
index 5490ad4..643850b 100644
--- a/src/Games/Memory/MemoryColouredFigures.cs
+++ b/src/Games/Memory/MemoryColouredFigures.cs
@@ -65,13 +65,13 @@ namespace gbrainy.Games.Memory
 		protected override void Initialize ()
 		{
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				columns = rows = 5;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				columns = rows = 6;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				columns = rows = 7;
 				break;
 			}
diff --git a/src/Games/Memory/MemoryColouredText.cs b/src/Games/Memory/MemoryColouredText.cs
index 4e9c80e..88c9d59 100644
--- a/src/Games/Memory/MemoryColouredText.cs
+++ b/src/Games/Memory/MemoryColouredText.cs
@@ -51,13 +51,13 @@ namespace gbrainy.Games.Memory
 			bool done = false;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				colors_shown = 3;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				colors_shown = 4;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				colors_shown = 6;
 				break;
 			}
diff --git a/src/Games/Memory/MemoryCountDots.cs b/src/Games/Memory/MemoryCountDots.cs
index 86b32a9..a94f9f1 100644
--- a/src/Games/Memory/MemoryCountDots.cs
+++ b/src/Games/Memory/MemoryCountDots.cs
@@ -58,13 +58,13 @@ namespace gbrainy.Games.Memory
 		protected override void Initialize ()
 		{
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				maxdotscolor = 2;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				maxdotscolor = 5;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				maxdotscolor = 8;
 				break;
 			}
diff --git a/src/Games/Memory/MemoryFacts.cs b/src/Games/Memory/MemoryFacts.cs
index c5ae601..3478d6f 100644
--- a/src/Games/Memory/MemoryFacts.cs
+++ b/src/Games/Memory/MemoryFacts.cs
@@ -66,14 +66,14 @@ namespace gbrainy.Games.Memory
 			ArrayListIndicesRandom indices;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				questions = 1;
 				break;
 			default:
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				questions = 2;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				questions = 3;
 				break;
 			}
diff --git a/src/Games/Memory/MemoryFigures.cs b/src/Games/Memory/MemoryFigures.cs
index 04ded32..741f01e 100644
--- a/src/Games/Memory/MemoryFigures.cs
+++ b/src/Games/Memory/MemoryFigures.cs
@@ -66,16 +66,16 @@ namespace gbrainy.Games.Memory
 			int fig1, fig2;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				figures_active = 4;
 				rows = columns = 3;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				figures_active = 6;
 				rows = 3;
 				columns = 4;			
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				figures_active = 8;
 				columns = rows = 4;
 				break;
diff --git a/src/Games/Memory/MemoryFiguresAndText.cs b/src/Games/Memory/MemoryFiguresAndText.cs
index 8f37e87..4a7af46 100644
--- a/src/Games/Memory/MemoryFiguresAndText.cs
+++ b/src/Games/Memory/MemoryFiguresAndText.cs
@@ -76,16 +76,16 @@ namespace gbrainy.Games.Memory
 			int pos = 0;
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				figures_active = 4;
 				rows = columns = 2;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				figures_active = 6;
 				rows = 2;
 				columns = 3;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				figures_active = 9;
 				columns = rows = 3;
 				break;
diff --git a/src/Games/Memory/MemoryFiguresNumbers.cs b/src/Games/Memory/MemoryFiguresNumbers.cs
index 8674abf..3b21428 100644
--- a/src/Games/Memory/MemoryFiguresNumbers.cs
+++ b/src/Games/Memory/MemoryFiguresNumbers.cs
@@ -49,13 +49,13 @@ namespace gbrainy.Games.Memory
 		protected override void Initialize ()
 		{
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				columns = rows = 2;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				columns = rows = 3;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				columns = rows = 4;
 				break;
 			}
diff --git a/src/Games/Memory/MemoryIndications.cs b/src/Games/Memory/MemoryIndications.cs
index 7312b33..86749b4 100644
--- a/src/Games/Memory/MemoryIndications.cs
+++ b/src/Games/Memory/MemoryIndications.cs
@@ -169,7 +169,7 @@ namespace gbrainy.Games.Memory
 
 		protected override void Initialize ()
 		{
-			indications = new Indication [CurrentDifficulty == Difficulty.Easy ? 5 : 7];
+			indications = new Indication [CurrentDifficulty == GameDifficulty.Easy ? 5 : 7];
 			Indication.TurnDirection second_turn = (Indication.TurnDirection) 2 +  random.Next (2);
 		
 			indications[0] = new Indication (Indication.Type.Start, 0);
@@ -177,7 +177,7 @@ namespace gbrainy.Games.Memory
 			indications[2] = new Indication (Indication.Type.Turn, second_turn); // up or down
 			indications[3] = new Indication (Indication.Type.Turn, random.Next (2)); // right or left
 
-			if (CurrentDifficulty==Difficulty.Easy) {
+			if (CurrentDifficulty==GameDifficulty.Easy) {
 				indications[4] = new Indication (Indication.Type.End, 1);		
 			} else {
 				if (second_turn == Indication.TurnDirection.Up)
@@ -200,7 +200,7 @@ namespace gbrainy.Games.Memory
 				indications_wrongA[3] = new Indication (Indication.Type.Turn, Indication.TurnDirection.Right);
 			}
 
-			if (CurrentDifficulty == Difficulty.Easy) {
+			if (CurrentDifficulty == GameDifficulty.Easy) {
 				if ((Indication.TurnDirection) indications[2].obj == Indication.TurnDirection.Up) {
 					indications_wrongB[2] = new Indication (Indication.Type.Turn, Indication.TurnDirection.Down);
 				}
diff --git a/src/Games/Memory/MemoryNumbers.cs b/src/Games/Memory/MemoryNumbers.cs
index d7c0878..0a0c6b8 100644
--- a/src/Games/Memory/MemoryNumbers.cs
+++ b/src/Games/Memory/MemoryNumbers.cs
@@ -126,14 +126,14 @@ namespace gbrainy.Games.Memory
 			int total;
 	
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				total = 5;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 			default:
 				total = 7;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				total = 9;
 				break;
 			}
diff --git a/src/Games/Memory/MemoryWords.cs b/src/Games/Memory/MemoryWords.cs
index 469b93e..2298b18 100644
--- a/src/Games/Memory/MemoryWords.cs
+++ b/src/Games/Memory/MemoryWords.cs
@@ -99,13 +99,13 @@ namespace gbrainy.Games.Memory
 			words.Add (Catalog.GetString ("wolf"));
 
 			switch (CurrentDifficulty) {
-			case Difficulty.Easy:
+			case GameDifficulty.Easy:
 				showed = 6;
 				break;
-			case Difficulty.Medium:
+			case GameDifficulty.Medium:
 				showed = 9;
 				break;
-			case Difficulty.Master:
+			case GameDifficulty.Master:
 				showed = 12;
 				break;
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]