[gbrainy] Bug #643401. Accept the words as valid answers in multioptions answers
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Bug #643401. Accept the words as valid answers in multioptions answers
- Date: Thu, 10 Mar 2011 20:20:13 +0000 (UTC)
commit da425ea7e38504821e5d66c0c465c228178d3a33
Author: Jordi Mas <jmas softcatala org>
Date: Thu Mar 10 21:21:05 2011 +0100
Bug #643401. Accept the words as valid answers in multioptions answers
data/games.xml | 15 ++-
src/Clients/Classical/gbrainy.cs | 1 -
src/Core/Main/Game.cs | 3 +
src/Core/Main/GameAnswer.cs | 32 ++++-
src/Core/Main/GameAnswerCheckAttributes.cs | 4 +
src/Core/Main/Verbal/AnalogiesMultipleOptions.cs | 11 +-
.../Main/Verbal/AnalogiesPairOfWordsOptions.cs | 9 +-
src/Core/Main/Xml/GameXml.cs | 26 ++--
src/Core/Main/Xml/GameXmlFactory.cs | 2 +-
src/Games/Calculation/CalculationArithmetical.cs | 1 -
src/Games/Calculation/CalculationAverage.cs | 9 +-
src/Games/Calculation/CalculationCloserFraction.cs | 12 +-
.../Calculation/CalculationGreatestDivisor.cs | 20 +--
src/Games/Calculation/CalculationPrimes.cs | 20 +--
src/Games/Calculation/CalculationProportions.cs | 9 +-
src/Games/Logic/Puzzle3DCube.cs | 2 +-
src/Games/Logic/PuzzleBuildTriangle.cs | 14 +-
src/Games/Logic/PuzzleClocks.cs | 12 +-
src/Games/Logic/PuzzleCube.cs | 4 +-
src/Games/Logic/PuzzleExtraCircle.cs | 10 +-
src/Games/Logic/PuzzleFigurePattern.cs | 9 +-
src/Games/Logic/PuzzleFigures.cs | 16 +-
src/Games/Logic/PuzzleLargerShape.cs | 15 +-
src/Games/Logic/PuzzleMissingPiece.cs | 9 +-
src/Games/Logic/PuzzleMissingSlice.cs | 44 +++---
src/Games/Logic/PuzzleMostInCommon.cs | 10 +-
src/Games/Logic/PuzzleNextFigure.cs | 11 +-
src/Games/Logic/PuzzleOstracism.cs | 10 +-
src/Games/Logic/PuzzlePencil.cs | 19 ++-
src/Games/Logic/PuzzlePredicateLogic.cs | 158 ++++++++++----------
src/Games/Logic/PuzzleQuadrilaterals.cs | 9 +-
src/Games/Logic/PuzzleSquareDots.cs | 9 +-
src/Games/Logic/PuzzleTetris.cs | 9 +-
src/Games/Memory/MemoryColouredFigures.cs | 10 +-
src/Games/Memory/MemoryFiguresNumbers.cs | 10 +-
src/Games/Memory/MemoryIndications.cs | 16 +-
36 files changed, 317 insertions(+), 263 deletions(-)
---
diff --git a/data/games.xml b/data/games.xml
index 7353801..ea09adc 100644
--- a/data/games.xml
+++ b/data/games.xml
@@ -251,7 +251,7 @@
<answer>[rslt_a] | [rslt_b]</answer>
<_answer_show>[rslt_a] and [rslt_b]</_answer_show>
<answer_expression>[0-9]+</answer_expression>
- <answer_checkattributes>Trim | MatchAll </answer_checkattributes>
+ <answer_checkattributes>Trim | MatchAll</answer_checkattributes>
<_rationale>From year 1000 to year 10000, palindrome years occur at 110 year intervals except for the end of each millennium that occur at a 11 years interval.</_rationale>
</variant>
</game>
@@ -310,7 +310,7 @@
<answer_show>[answer_a], [answer_b], [answer_c], [answer_d], [answer_e]</answer_show>
<answer>[answer_a] | [answer_b] | [answer_c] | [answer_d] | [answer_e]</answer>
<answer_expression>[0-9]+</answer_expression>
- <answer_checkattributes>Trim | MatchAll </answer_checkattributes>
+ <answer_checkattributes>Trim | MatchAll</answer_checkattributes>
</variant>
</game>
@@ -373,6 +373,7 @@
<_name>Multiple number</_name>
<type>Calculation</type>
<difficulty>All</difficulty>
+ <answer_checkattributes>MultiOption | IgnoreSpaces</answer_checkattributes>
<variant>
<variables>
int [] indexes_a = new int [] {2, 4, 8};
@@ -408,8 +409,8 @@
<string _text = "[option_prefix] [option_c] and [option_d]" x = "0.05" y = "0.02" size = "large"/>
</option>
+ <_answer>[option_a] and [option_b]</_answer>
<_rationale>[option_a] and [option_b] are both multiples of [product].</_rationale>
-
</variant>
</game>
@@ -417,6 +418,7 @@
<_name>Cars in town</_name>
<type>Logic</type>
<difficulty>All</difficulty>
+ <answer_checkattributes>MultiOption | IgnoreSpaces</answer_checkattributes>
<variant>
<variables>
double all_cars = 30 + random.Next (4) * 10;
@@ -447,6 +449,7 @@
<string _text = "[option_prefix] [option_d]%" x = "0.05" y = "0.02" size = "large"/>
</option>
+ <answer>[option_c]%</answer>
<_rationale>[female_cars]% ([all_cars] - [males_cars]) of the inhabitants are women and have a car.</_rationale>
</variant>
</game>
@@ -455,6 +458,7 @@
<_name>Compare variables</_name>
<type>Logic</type>
<difficulty>All</difficulty>
+ <answer_checkattributes>MultiOption | IgnoreSpaces</answer_checkattributes>
<variant>
<_question>If p < x < q and r < y < s. Which of the following options makes x < y true? [option_answers]</_question>
@@ -478,6 +482,7 @@
</option>
<_rationale>The variable q is bigger than x and y bigger than r, if q is bigger than r then the condition x < y is true.</_rationale>
+ <answer>q < r</answer>
</variant>
<variant>
@@ -502,6 +507,7 @@
</option>
<_rationale>The variable q is bigger than x and s is bigger than y, if q is bigger than s then the condition x > y is true.</_rationale>
+ <answer>q > s</answer>
</variant>
</game>
@@ -509,6 +515,8 @@
<_name>Odd number</_name>
<type>Logic</type>
<difficulty>All</difficulty>
+ <answer_checkattributes>MultiOption | IgnoreSpaces</answer_checkattributes>
+
<variant>
<_question>Given two integer numbers x and y, if x is even and y odd, which of the following expressions gives always an odd result? [option_answers]</_question>
@@ -531,6 +539,7 @@
</option>
<_rationale>Since x is always an even number, multiplying it by 2 always produces an even number. Adding an even number to an odd number (y) always produces an odd number.</_rationale>
+ <answer>2x + y</answer>
</variant>
</game>
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index e08ad2a..e4a69ce 100644
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -120,7 +120,6 @@ namespace gbrainy.Clients.Classical
gm.LoadPlugins ();
}
-
void BuildUI ()
{
bool show_toolbar;
diff --git a/src/Core/Main/Game.cs b/src/Core/Main/Game.cs
index 996bd6b..bdab835 100644
--- a/src/Core/Main/Game.cs
+++ b/src/Core/Main/Game.cs
@@ -108,6 +108,9 @@ namespace gbrainy.Core.Main
random = new Random ();
default_color = new Cairo.Color (0, 0, 0);
Initialize ();
+
+ if (String.IsNullOrEmpty (Answer.Correct))
+ throw new InvalidOperationException ("Answer cannot be empty");
}
public virtual int Variant {
diff --git a/src/Core/Main/GameAnswer.cs b/src/Core/Main/GameAnswer.cs
index b6bf1fc..722e2fa 100644
--- a/src/Core/Main/GameAnswer.cs
+++ b/src/Core/Main/GameAnswer.cs
@@ -69,14 +69,38 @@ namespace gbrainy.Core.Main
StringBuilder str = new StringBuilder ();
str.Append ("[");
for (int i = 0; i < MAX_POSSIBLE_ANSWER; i++)
- str.Append (GetMultiOption (i));
+ str.Append (GetMultiOptionInternal (i));
str.Append ("]");
return str.ToString ();
}
+
+ // Index of the option (A, B) and answer (dog, cat)
+ public void SetMultiOptionAnswer (int multioption, string answer)
+ {
+ if (String.IsNullOrEmpty (answer) == true)
+ throw new InvalidOperationException ("Both options should be defined");
+
+ string option = GetMultiOption (multioption);
+
+ Correct = option + Separator + answer;
+ CorrectShow = option;
+ }
- static public string GetMultiOption (int answer)
+ public string GetMultiOption (int answer)
{
+ bool multioption;
+
+ multioption = (CheckAttributes & GameAnswerCheckAttributes.MultiOption) == GameAnswerCheckAttributes.MultiOption;
+
+ if (multioption == false)
+ throw new InvalidOperationException ("Cannot call Multioption API if the game does not have the multioption attribute");
+
+ return GetMultiOptionInternal (answer);
+ }
+
+ string GetMultiOptionInternal (int answer)
+ {
switch (answer) {
// Translators Note
// The following series of answers may need to be adapted
@@ -105,10 +129,10 @@ namespace gbrainy.Core.Main
}
}
- public string GetMultiOptionFigureName (int answer)
+ public string GetFigureName (int answer)
{
return String.Format (ServiceLocator.Instance.GetService <ITranslations> ()
- .GetString ("Figure {0}"), GetMultiOption (answer));
+ .GetString ("Figure {0}"), GetMultiOptionInternal (answer));
}
public bool CheckAnswer (string answer)
diff --git a/src/Core/Main/GameAnswerCheckAttributes.cs b/src/Core/Main/GameAnswerCheckAttributes.cs
index d41f344..2f87d09 100644
--- a/src/Core/Main/GameAnswerCheckAttributes.cs
+++ b/src/Core/Main/GameAnswerCheckAttributes.cs
@@ -30,6 +30,7 @@ namespace gbrainy.Core.Main
IgnoreSpaces = 8,
MatchAll = 16,
MatchAllInOrder = 32,
+ MultiOption = 64, // Allows calling GameAnswer.GetMultiOption
}
// Since we cannot override ToString in an enum type we use a helper class
@@ -57,6 +58,9 @@ namespace gbrainy.Core.Main
if (type.IndexOf ("MatchAllInOrder", StringComparison.InvariantCultureIgnoreCase) != -1)
attributes |= GameAnswerCheckAttributes.MatchAllInOrder;
+ if (type.IndexOf ("MultiOption", StringComparison.InvariantCultureIgnoreCase) != -1)
+ attributes |= GameAnswerCheckAttributes.MultiOption;
+
return attributes;
}
}
diff --git a/src/Core/Main/Verbal/AnalogiesMultipleOptions.cs b/src/Core/Main/Verbal/AnalogiesMultipleOptions.cs
index 8c650e4..5e6cce5 100644
--- a/src/Core/Main/Verbal/AnalogiesMultipleOptions.cs
+++ b/src/Core/Main/Verbal/AnalogiesMultipleOptions.cs
@@ -55,7 +55,7 @@ namespace gbrainy.Core.Main.Verbal
for (int n = 0; n < Current.answers.Length; n++)
{
- str+= GameAnswer.GetMultiOption (n);
+ str+= Answer.GetMultiOption (n);
if (n +1 < Current.answers.Length) {
// Translators: this the separator used when concatenating possible options for answering verbal analogies
@@ -82,8 +82,9 @@ namespace gbrainy.Core.Main.Verbal
if (Current == null || Current.answers == null)
return;
-
- Answer.Correct = GameAnswer.GetMultiOption (Current.right);
+
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+ Answer.SetMultiOptionAnswer (Current.right, Current.answers[Current.right]);
Container container = new Container (DrawAreaX + 0.1, 0.50, 0.5, Current.answers.Length * 0.15);
AddWidget (container);
@@ -95,14 +96,14 @@ namespace gbrainy.Core.Main.Verbal
drawable_area.Y = DrawAreaY + 0.2 + i * 0.15;
container.AddChild (drawable_area);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
int n = (int) e.Data;
e.Context.MoveTo (0.05, 0.02);
- e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), GameAnswer.GetMultiOption (n), Current.answers[n].ToString ()));
+ e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), Answer.GetMultiOption (n), Current.answers[n].ToString ()));
};
}
SetAnswerCorrectShow ();
diff --git a/src/Core/Main/Verbal/AnalogiesPairOfWordsOptions.cs b/src/Core/Main/Verbal/AnalogiesPairOfWordsOptions.cs
index 78f6c83..2551b1b 100644
--- a/src/Core/Main/Verbal/AnalogiesPairOfWordsOptions.cs
+++ b/src/Core/Main/Verbal/AnalogiesPairOfWordsOptions.cs
@@ -56,7 +56,7 @@ namespace gbrainy.Core.Main.Verbal
for (int n = 0; n < Current.answers.Length; n++)
{
- str+= GameAnswer.GetMultiOption (n);
+ str+= Answer.GetMultiOption (n);
if (n +1 < Current.answers.Length) {
// Translators: this the separator used when concatenating possible options for answering verbal analogies
@@ -89,7 +89,8 @@ namespace gbrainy.Core.Main.Verbal
samples = items [0].Trim ();
- Answer.Correct = GameAnswer.GetMultiOption (Current.right);
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+ Answer.Correct = Answer.GetMultiOption (Current.right);
Container container = new Container (DrawAreaX + 0.1, 0.50, 0.5, Current.answers.Length * 0.15);
AddWidget (container);
@@ -101,14 +102,14 @@ namespace gbrainy.Core.Main.Verbal
drawable_area.Y = DrawAreaY + 0.25 + i * 0.15;
container.AddChild (drawable_area);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
int n = (int) e.Data;
e.Context.MoveTo (0.05, 0.02);
- e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), GameAnswer.GetMultiOption (n), Current.answers[n].ToString ()));
+ e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), Answer.GetMultiOption (n), Current.answers[n].ToString ()));
};
}
SetAnswerCorrectShow ();
diff --git a/src/Core/Main/Xml/GameXml.cs b/src/Core/Main/Xml/GameXml.cs
index 2e4d482..1c0ae29 100644
--- a/src/Core/Main/Xml/GameXml.cs
+++ b/src/Core/Main/Xml/GameXml.cs
@@ -122,7 +122,7 @@ namespace gbrainy.Core.Main.Xml
if (game.Variants.Count > 0 && game.Variants[current.Variant].CheckAttributes != GameAnswerCheckAttributes.None)
attrib = game.Variants[current.Variant].CheckAttributes;
else
- attrib = game.CheckAttributes;
+ attrib = game.CheckAttributes;
if (attrib == GameAnswerCheckAttributes.None)
return;
@@ -137,6 +137,7 @@ namespace gbrainy.Core.Main.Xml
LocalizableString localizable_question, localizable_rationale;
variants = game.Variants.Count > 0;
+ SetCheckAttributes ();
if (variants && game.Variants[current.Variant].Variables != null)
variables = game.Variants[current.Variant].Variables;
@@ -204,19 +205,20 @@ namespace gbrainy.Core.Main.Xml
{
string answers = string.Empty;
- foreach (OptionDrawingObject option in options)
+ for (int i = 0; i < options.Count; i++)
{
+ OptionDrawingObject option = options [i];
if (option.Correct == true)
{
- Answer.Correct = option.AnswerText;
+ Answer.SetMultiOptionAnswer (i, answer);
break;
}
}
for (int i = 0; i < options.Count - 1; i++)
- answers += String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}, "), GameAnswer.GetMultiOption (i));
+ answers += String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}, "), Answer.GetMultiOption (i));
- answers += String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}."), GameAnswer.GetMultiOption (options.Count - 1));
+ answers += String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}."), Answer.GetMultiOption (options.Count - 1));
// Translators {0}: list of options (A, B, C)
answers = String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Answer {0}"), answers);
@@ -228,7 +230,6 @@ namespace gbrainy.Core.Main.Xml
}
SetCheckExpression ();
- SetCheckAttributes ();
SetAnswerCorrectShow ();
}
@@ -312,9 +313,6 @@ namespace gbrainy.Core.Main.Xml
continue;
option.CopyRandomizedProperties (originals [random_indices [index]]);
-
- // For randomized options the answer is always the option letter
- option.AnswerText = GameAnswer.GetMultiOption (index);
index++;
}
}
@@ -341,7 +339,7 @@ namespace gbrainy.Core.Main.Xml
container.AddChild (drawable_area);
drawable_area.Data = idx;
- drawable_area.DataEx = GameAnswer.GetMultiOption (idx);
+ drawable_area.DataEx = Answer.GetMultiOption (idx);
options.Add (option);
idx++;
@@ -381,6 +379,7 @@ namespace gbrainy.Core.Main.Xml
current.Game = locator.Game;
current.Variant = locator.Variant;
game = games [locator.Game];
+ SetCheckAttributes ();
CreateDrawingObjects (game); // Draw objects shared by all variants
@@ -388,7 +387,6 @@ namespace gbrainy.Core.Main.Xml
CreateDrawingObjects (game.Variants[current.Variant]); // Draw variant specific objects
SetCheckExpression ();
- SetCheckAttributes ();
SetAnswerCorrectShow ();
}
}
@@ -403,7 +401,7 @@ namespace gbrainy.Core.Main.Xml
DrawObjects (gr, game.Variants[current.Variant].DrawingObjects, null); // Draw variant specific objects
}
- static void DrawObjects (CairoContextEx gr, DrawingObject [] drawing_objects, int? option)
+ void DrawObjects (CairoContextEx gr, DrawingObject [] drawing_objects, int? option)
{
if (drawing_objects == null)
return;
@@ -472,11 +470,11 @@ namespace gbrainy.Core.Main.Xml
}
}
- static string GetOptionPrefix (string str, int option)
+ string GetOptionPrefix (string str, int option)
{
string answer;
- answer = String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) "), GameAnswer.GetMultiOption (option));
+ answer = String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) "), Answer.GetMultiOption (option));
return str.Replace (option_prefix, answer);
}
diff --git a/src/Core/Main/Xml/GameXmlFactory.cs b/src/Core/Main/Xml/GameXmlFactory.cs
index 6cb502a..2b0253c 100644
--- a/src/Core/Main/Xml/GameXmlFactory.cs
+++ b/src/Core/Main/Xml/GameXmlFactory.cs
@@ -345,7 +345,7 @@ namespace gbrainy.Core.Main.Xml
option = null;
break;
- default: // Do do any processing
+ default: // Do any processing
break;
}
diff --git a/src/Games/Calculation/CalculationArithmetical.cs b/src/Games/Calculation/CalculationArithmetical.cs
index cd57bf8..27c45d1 100644
--- a/src/Games/Calculation/CalculationArithmetical.cs
+++ b/src/Games/Calculation/CalculationArithmetical.cs
@@ -140,6 +140,5 @@ namespace gbrainy.Games.Calculation
gr.DrawTextAlignedRight (aligned_pos, operand_y + 0.03, Answer.Correct);
}
}
-
}
}
diff --git a/src/Games/Calculation/CalculationAverage.cs b/src/Games/Calculation/CalculationAverage.cs
index 0d08a43..07198b3 100644
--- a/src/Games/Calculation/CalculationAverage.cs
+++ b/src/Games/Calculation/CalculationAverage.cs
@@ -53,7 +53,7 @@ namespace gbrainy.Games.Calculation
return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Given the numbers: {0}. Which of the following numbers is the nearest to the average? Answer {1}, {2}, {3} or {4}."), nums,
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
public override string Tip {
@@ -72,6 +72,7 @@ namespace gbrainy.Games.Calculation
bool duplicated;
int nums, options_next, dist, num_size, which = 0;
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
nums = 3;
@@ -146,7 +147,7 @@ namespace gbrainy.Games.Calculation
}
}
- Answer.Correct += GameAnswer.GetMultiOption (which);
+ Answer.SetMultiOptionAnswer (which, options [correct_pos].ToString ());
// Options
double x = DrawAreaX + 0.25, y = DrawAreaY + 0.16;
@@ -160,7 +161,7 @@ namespace gbrainy.Games.Calculation
drawable_area.Y = y + i * 0.15;
container.AddChild (drawable_area);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -169,7 +170,7 @@ namespace gbrainy.Games.Calculation
e.Context.SetPangoLargeFontSize ();
e.Context.MoveTo (0.02, 0.02);
- e.Context.ShowPangoText (String.Format ("{0}) {1:##0.###}", GameAnswer.GetMultiOption (n) , options [indx]));
+ e.Context.ShowPangoText (String.Format ("{0}) {1:##0.###}", Answer.GetMultiOption (n) , options [indx]));
};
}
}
diff --git a/src/Games/Calculation/CalculationCloserFraction.cs b/src/Games/Calculation/CalculationCloserFraction.cs
index a837bd6..95467bd 100644
--- a/src/Games/Calculation/CalculationCloserFraction.cs
+++ b/src/Games/Calculation/CalculationCloserFraction.cs
@@ -44,7 +44,7 @@ namespace gbrainy.Games.Calculation
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which of the following numbers is closer to {0:##0.###}? Answer {1}, {2}, {3} or {4}."), question_num,
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
public override string Rationale {
@@ -57,7 +57,8 @@ namespace gbrainy.Games.Calculation
}
protected override void Initialize ()
- {
+ {
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
options = new double [options_cnt * 2];
bool duplicated;
bool done = false;
@@ -135,7 +136,8 @@ namespace gbrainy.Games.Calculation
which = random.Next (options_cnt);
ans_idx = random_indices[which];
question_num = options[ans_idx * 2] / options[(ans_idx * 2) + 1];
- Answer.Correct += GameAnswer.GetMultiOption (which);
+
+ Answer.SetMultiOptionAnswer (which, options [ans_idx * 2] + " / " + options [(ans_idx * 2) +1]);
// Options
double x = DrawAreaX + 0.25, y = DrawAreaY + 0.16;
@@ -149,7 +151,7 @@ namespace gbrainy.Games.Calculation
drawable_area.Y = y + i * 0.15;
container.AddChild (drawable_area);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -158,7 +160,7 @@ namespace gbrainy.Games.Calculation
e.Context.SetPangoLargeFontSize ();
e.Context.MoveTo (0.02, 0.02);
- e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), GameAnswer.GetMultiOption (n) ,
+ e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), Answer.GetMultiOption (n) ,
options [indx * 2] + " / " + options [(indx * 2) +1]));
};
}
diff --git a/src/Games/Calculation/CalculationGreatestDivisor.cs b/src/Games/Calculation/CalculationGreatestDivisor.cs
index dcc0bf1..aa2e6d2 100644
--- a/src/Games/Calculation/CalculationGreatestDivisor.cs
+++ b/src/Games/Calculation/CalculationGreatestDivisor.cs
@@ -44,7 +44,7 @@ namespace gbrainy.Games.Calculation
public override string Question {
get { return String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString (
"Which of the possible divisors is the greatest that divides all numbers? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));
}
}
@@ -54,6 +54,7 @@ namespace gbrainy.Games.Calculation
int n, m;
int []mult = new int [3];
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
max_num = 999;
@@ -129,7 +130,7 @@ namespace gbrainy.Games.Calculation
}
}
- Answer.Correct = answer.ToString ();
+ Answer.SetMultiOptionAnswer (answer_idx, answer.ToString ());
// Drawing objects
Container container = new Container (DrawAreaX + 0.2, DrawAreaY + 0.25, 0.4, answers.Length * 0.15);
@@ -142,14 +143,14 @@ namespace gbrainy.Games.Calculation
drawable_area.Y = DrawAreaY + 0.27 + i * 0.15;
container.AddChild (drawable_area);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
int d = (int) e.Data;
e.Context.SetPangoLargeFontSize ();
e.Context.MoveTo (0.07, 0.02);
- e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), GameAnswer.GetMultiOption (d),
+ e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), Answer.GetMultiOption (d),
answers[d].ToString ()));
};
}
@@ -256,16 +257,5 @@ namespace gbrainy.Games.Calculation
gr.MoveTo (0.05, y);
gr.ShowPangoText (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Possible divisors"));
}
-
- public override bool CheckAnswer (string answer)
- {
- if (base.CheckAnswer (answer) == true)
- return true;
-
- if (String.Compare (answer, GameAnswer.GetMultiOption (answer_idx), true) == 0)
- return true;
-
- return false;
- }
}
}
diff --git a/src/Games/Calculation/CalculationPrimes.cs b/src/Games/Calculation/CalculationPrimes.cs
index 800f953..2a54f78 100644
--- a/src/Games/Calculation/CalculationPrimes.cs
+++ b/src/Games/Calculation/CalculationPrimes.cs
@@ -75,7 +75,7 @@ namespace gbrainy.Games.Calculation
public override string Question {
get { return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which of the following numbers is a prime? A prime number is a positive integer that has exactly two different positive divisors, 1 and itself. Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
public override string Tip {
@@ -90,6 +90,7 @@ namespace gbrainy.Games.Calculation
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
div3 = true;
@@ -114,7 +115,7 @@ namespace gbrainy.Games.Calculation
answer_idx = random.Next (numbers.Length);
answer = primes [random.Next (max_primeidx + 1)];
numbers [answer_idx] = answer;
- Answer.Correct = answer.ToString ();
+ Answer.SetMultiOptionAnswer (answer_idx, answer.ToString ());
// Drawing objects
double x = DrawAreaX + 0.25, y = DrawAreaY + 0.16;
@@ -128,7 +129,7 @@ namespace gbrainy.Games.Calculation
drawable_area.Y = y + i * 0.15;
container.AddChild (drawable_area);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -136,7 +137,7 @@ namespace gbrainy.Games.Calculation
e.Context.SetPangoLargeFontSize ();
e.Context.MoveTo (0.02, 0.02);
- e.Context.ShowPangoText (String.Format ("{0}) {1:##0.###}", GameAnswer.GetMultiOption (n) , numbers [n]));
+ e.Context.ShowPangoText (String.Format ("{0}) {1:##0.###}", Answer.GetMultiOption (n) , numbers [n]));
};
}
}
@@ -169,16 +170,5 @@ namespace gbrainy.Games.Calculation
}
return num;
}
-
- public override bool CheckAnswer (string answer)
- {
- if (base.CheckAnswer (answer) == true)
- return true;
-
- if (String.Compare (answer, GameAnswer.GetMultiOption (answer_idx), true) == 0)
- return true;
-
- return false;
- }
}
}
diff --git a/src/Games/Calculation/CalculationProportions.cs b/src/Games/Calculation/CalculationProportions.cs
index f84220e..4a72fa9 100644
--- a/src/Games/Calculation/CalculationProportions.cs
+++ b/src/Games/Calculation/CalculationProportions.cs
@@ -45,13 +45,14 @@ namespace gbrainy.Games.Calculation
get {
return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("What is {0}% of {1}/{2}? Answer {3}, {4}, {5} or {6}."),
- percentage, num, den, GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ percentage, num, den, Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
protected override void Initialize ()
{
int options_next, random_max, which = 0;
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
random_max = 30;
@@ -92,7 +93,7 @@ namespace gbrainy.Games.Calculation
}
}
- Answer.Correct += GameAnswer.GetMultiOption (which);
+ Answer.SetMultiOptionAnswer (which, options[correct_pos].ToString ());
// Options
double x = DrawAreaX + 0.25, y = DrawAreaY + 0.16;
@@ -106,7 +107,7 @@ namespace gbrainy.Games.Calculation
drawable_area.Y = y + i * 0.15;
container.AddChild (drawable_area);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -115,7 +116,7 @@ namespace gbrainy.Games.Calculation
e.Context.SetPangoLargeFontSize ();
e.Context.MoveTo (0.02, 0.02);
- e.Context.ShowPangoText (String.Format ("{0}) {1:##0.##}", GameAnswer.GetMultiOption (n), options [indx]));
+ e.Context.ShowPangoText (String.Format ("{0}) {1:##0.##}", Answer.GetMultiOption (n), options [indx]));
};
}
}
diff --git a/src/Games/Logic/Puzzle3DCube.cs b/src/Games/Logic/Puzzle3DCube.cs
index 459a4a7..1d0fefa 100644
--- a/src/Games/Logic/Puzzle3DCube.cs
+++ b/src/Games/Logic/Puzzle3DCube.cs
@@ -59,7 +59,7 @@ namespace gbrainy.Games.Logic
rows = columns = depth = 4 + random.Next (max_random);
ans = rows * columns * depth;
- Answer.Correct += ans.ToString ();
+ Answer.Correct = ans.ToString ();
}
public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
diff --git a/src/Games/Logic/PuzzleBuildTriangle.cs b/src/Games/Logic/PuzzleBuildTriangle.cs
index 1cffb00..f2cadba 100644
--- a/src/Games/Logic/PuzzleBuildTriangle.cs
+++ b/src/Games/Logic/PuzzleBuildTriangle.cs
@@ -54,7 +54,7 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which three pieces can you use together to build a triangle? Answer using the three figure names, e.g.: {0}{1}{2}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2));}
}
public override string Tip {
@@ -63,6 +63,9 @@ namespace gbrainy.Games.Logic
protected override void Initialize ()
{
+ Answer.CheckAttributes = GameAnswerCheckAttributes.Trim | GameAnswerCheckAttributes.IgnoreCase
+ | GameAnswerCheckAttributes.MatchAll | GameAnswerCheckAttributes.MultiOption;
+
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
total_figures = 6;
@@ -83,20 +86,19 @@ namespace gbrainy.Games.Logic
{
switch ((Figures) random_indices_answers[i]) {
case Figures.TriangleB:
- answers[0] = GameAnswer.GetMultiOption (i);
+ answers[0] = Answer.GetMultiOption (i);
break;
case Figures.TriangleC:
- answers[1] = GameAnswer.GetMultiOption (i);
+ answers[1] = Answer.GetMultiOption (i);
break;
case Figures.Square:
- answers[2] = GameAnswer.GetMultiOption (i);
+ answers[2] = Answer.GetMultiOption (i);
break;
}
}
Answer.Correct = answers[0] + " | " + answers[1] + " | " + answers[2];
Answer.CheckExpression = Answer.GetMultiOptionsExpression ();
- Answer.CheckAttributes = GameAnswerCheckAttributes.Trim | GameAnswerCheckAttributes.IgnoreCase | GameAnswerCheckAttributes.MatchAll;
Answer.CorrectShow = answers[0] + answers[1] + answers[2];
}
@@ -156,7 +158,7 @@ namespace gbrainy.Games.Logic
{
DrawFigure (gr, x, y, (Figures) random_indices_answers[i]);
gr.MoveTo (x, y + 0.13);
- gr.ShowPangoText (Answer.GetMultiOptionFigureName (i));
+ gr.ShowPangoText (Answer.GetFigureName (i));
if (i == (total_figures / 2) - 1) {
y+= 0.30;
diff --git a/src/Games/Logic/PuzzleClocks.cs b/src/Games/Logic/PuzzleClocks.cs
index 3e5ac70..e3c9a0f 100644
--- a/src/Games/Logic/PuzzleClocks.cs
+++ b/src/Games/Logic/PuzzleClocks.cs
@@ -42,7 +42,7 @@ namespace gbrainy.Games.Logic
get {return (String.Format (
// Translators: {0} is replaced by 'Figure X'
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("To what number should the large handle of the '{0}' clock point? Answer using numbers."),
- Answer.GetMultiOptionFigureName (3)));}
+ Answer.GetFigureName (3)));}
}
public override string Rationale {
@@ -84,7 +84,7 @@ namespace gbrainy.Games.Logic
handles [i + 1] = position - ((position / 10) * 10);
position += addition;
}
-
+
Answer.Correct = handles[7].ToString ();
// First row
@@ -99,7 +99,7 @@ namespace gbrainy.Games.Logic
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
DrawClock (e.Context, 0.2, 0.16, handles[0], handles[1], true);
- e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetMultiOptionFigureName (0));
+ e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetFigureName (0));
e.Context.Stroke ();
};
@@ -111,7 +111,7 @@ namespace gbrainy.Games.Logic
{
DrawClock (e.Context, 0.2, 0.16, handles[2], handles[3], true);
e.Context.MoveTo (0.03, 0.29);
- e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetMultiOptionFigureName (1));
+ e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetFigureName (1));
e.Context.Stroke ();
};
@@ -126,7 +126,7 @@ namespace gbrainy.Games.Logic
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
DrawClock (e.Context, 0.2, 0.16, handles[4], handles[5], true);
- e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetMultiOptionFigureName (2));
+ e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetFigureName (2));
e.Context.Stroke ();
};
@@ -138,7 +138,7 @@ namespace gbrainy.Games.Logic
{
DrawClock (e.Context, 0.2, 0.16, handles[6], handles[7], Answer.Draw == true);
e.Context.MoveTo (0.03, 0.29);
- e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetMultiOptionFigureName (3));
+ e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetFigureName (3));
e.Context.Stroke ();
};
diff --git a/src/Games/Logic/PuzzleCube.cs b/src/Games/Logic/PuzzleCube.cs
index 5de1999..fa8f2d6 100755
--- a/src/Games/Logic/PuzzleCube.cs
+++ b/src/Games/Logic/PuzzleCube.cs
@@ -53,7 +53,9 @@ namespace gbrainy.Games.Logic
{
int pair = random.Next (pairs);
question = (char) (48 + question_answer[pair * 2]);
- Answer.Correct += (char) (48 + question_answer[(pair * 2) + 1]);
+
+ char num = (char) (48 + question_answer[(pair * 2) + 1]);
+ Answer.Correct = num.ToString ();
Container container;
DrawableArea drawable_area;
diff --git a/src/Games/Logic/PuzzleExtraCircle.cs b/src/Games/Logic/PuzzleExtraCircle.cs
index 78adcc4..69502ec 100644
--- a/src/Games/Logic/PuzzleExtraCircle.cs
+++ b/src/Games/Logic/PuzzleExtraCircle.cs
@@ -60,7 +60,7 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which circle does not belong to the group? It is not a sequence of elements. Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
public override string Tip {
@@ -80,6 +80,8 @@ namespace gbrainy.Games.Logic
cp = new ColorPalette ();
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+
cercle_colors = new Color [total_slices];
badcercle_colors = new Color [total_slices];
for (int i = 0; i < total_slices; i++) {
@@ -99,7 +101,7 @@ namespace gbrainy.Games.Logic
start_indices[i] = (random_indices[i]);
ans_pos = random.Next (circles);
- Answer.Correct = GameAnswer.GetMultiOption (ans_pos);
+ Answer.SetMultiOptionAnswer (ans_pos, Answer.GetFigureName (ans_pos));
const double text_offset = 0.04;
const double witdh_used = 0.9; // Total width used for drawing all the figures
@@ -127,7 +129,7 @@ namespace gbrainy.Games.Logic
drawable_area = new DrawableArea (box_size, box_size);
drawable_area.SelectedArea = new Rectangle ((box_size - box_size) / 2, 0, box_size, box_size);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -139,7 +141,7 @@ namespace gbrainy.Games.Logic
DrawCircle (e.Context, x1, y1, circle.Colors, start_indices [idx]);
e.Context.DrawTextCentered (e.Width / 2, box_size + text_offset,
- Answer.GetMultiOptionFigureName (idx));
+ Answer.GetFigureName (idx));
e.Context.Stroke ();
};
container.AddChild (drawable_area);
diff --git a/src/Games/Logic/PuzzleFigurePattern.cs b/src/Games/Logic/PuzzleFigurePattern.cs
index 87fe32e..a48376e 100644
--- a/src/Games/Logic/PuzzleFigurePattern.cs
+++ b/src/Games/Logic/PuzzleFigurePattern.cs
@@ -43,7 +43,7 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("What figure should replace the question mark? Answer {0}, {1} or {2}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2));}
}
public override string Tip {
@@ -58,13 +58,14 @@ namespace gbrainy.Games.Logic
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
random_indices = new ArrayListIndicesRandom ((int) Figures.Last);
random_indices.Initialize ();
for (int i = 0; i < (int) Figures.Last; i++)
{
if (random_indices[i] == (int) Figures.Cross) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
@@ -101,7 +102,7 @@ namespace gbrainy.Games.Logic
{
double org_x = DrawAreaX + 0.1;
double x = org_x, y = 0.08;
- const double figure_size = 0.13, space_x = 0.1, space_y = 0.2;
+ const double figure_size = 0.13, space_x = 0.1, space_y = 0.18;
double x45, y45, x135, y135, offset;
base.Draw (gr, area_width, area_height, rtl);
@@ -208,7 +209,7 @@ namespace gbrainy.Games.Logic
}
gr.MoveTo (x, y + 0.18);
- gr.ShowPangoText (Answer.GetMultiOptionFigureName (i));
+ gr.ShowPangoText (Answer.GetFigureName (i));
x += figure_size + space_x;
}
diff --git a/src/Games/Logic/PuzzleFigures.cs b/src/Games/Logic/PuzzleFigures.cs
index dd8842b..2bee3d0 100644
--- a/src/Games/Logic/PuzzleFigures.cs
+++ b/src/Games/Logic/PuzzleFigures.cs
@@ -57,11 +57,13 @@ namespace gbrainy.Games.Logic
random_indices = new ArrayListIndicesRandom (6);
random_indices.Initialize ();
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+
StringBuilder sb = new StringBuilder (3);
- sb.Append (GameAnswer.GetMultiOption (figures[random_indices [5]]));
- sb.Append (GameAnswer.GetMultiOption (figures[6 + random_indices [5]]));
- sb.Append (GameAnswer.GetMultiOption (figures[(2 * 6) + random_indices [5]]));
+ sb.Append (Answer.GetMultiOption (figures[random_indices [5]]));
+ sb.Append (Answer.GetMultiOption (figures[6 + random_indices [5]]));
+ sb.Append (Answer.GetMultiOption (figures[(2 * 6) + random_indices [5]]));
Answer.Correct = sb.ToString ();
@@ -75,7 +77,7 @@ namespace gbrainy.Games.Logic
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
e.Context.MoveTo (0, 0.05);
- e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0} ->"), GameAnswer.GetMultiOption (0)));
+ e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0} ->"), Answer.GetMultiOption (0)));
e.Context.DrawPentagon (0.1, 0, 0.1);
e.Context.Stroke ();
};
@@ -87,7 +89,7 @@ namespace gbrainy.Games.Logic
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
e.Context.MoveTo (0, 0.05);
- e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0} ->"), GameAnswer.GetMultiOption (1)));
+ e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0} ->"), Answer.GetMultiOption (1)));
e.Context.Stroke ();
e.Context.Arc (0.15, 0.05, 0.05, 0, 2 * Math.PI);
e.Context.Stroke ();
@@ -100,7 +102,7 @@ namespace gbrainy.Games.Logic
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
e.Context.MoveTo (0, 0.05);
- e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0} ->"), GameAnswer.GetMultiOption (2)));
+ e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0} ->"), Answer.GetMultiOption (2)));
e.Context.DrawEquilateralTriangle (0.1, 0, 0.1);
};
}
@@ -161,7 +163,7 @@ namespace gbrainy.Games.Logic
y += 0.16;
gr.MoveTo (x, y);
gr.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("E.g: {0}{1}{2} (pentagon, triangle, circle)"),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (1)));
+ Answer.GetMultiOption (0), Answer.GetMultiOption (2), Answer.GetMultiOption (1)));
}
}
}
diff --git a/src/Games/Logic/PuzzleLargerShape.cs b/src/Games/Logic/PuzzleLargerShape.cs
index 514ba7b..ede0afa 100644
--- a/src/Games/Logic/PuzzleLargerShape.cs
+++ b/src/Games/Logic/PuzzleLargerShape.cs
@@ -120,11 +120,12 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which larger shape can you make combining the first two figures? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
palette = new ColorPalette ();
switch (random.Next (2)) {
@@ -148,7 +149,7 @@ namespace gbrainy.Games.Logic
for (int i = 0; i < answers; i++)
{
if (random_indices[i] == ranswer) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
@@ -179,7 +180,7 @@ namespace gbrainy.Games.Logic
};
// Answers
- y += 0.3;
+ y += 0.28;
container = new HorizontalContainer (x, y, 0.8, 0.3);
AddWidget (container);
@@ -187,7 +188,7 @@ namespace gbrainy.Games.Logic
{
drawable_area = new DrawableArea (container.Width / 2, 0.25);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
container.AddChild (drawable_area);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
@@ -195,7 +196,7 @@ namespace gbrainy.Games.Logic
int n = (int) e.Data;
DrawPossibleAnswer (e.Context, 0.12, 0.03, answer, random_indices [n], n);
- e.Context.DrawTextCentered (drawable_area.Width / 2, 0.22, Answer.GetMultiOptionFigureName (n));
+ e.Context.DrawTextCentered (drawable_area.Width / 2, 0.22, Answer.GetFigureName (n));
e.Context.Stroke ();
};
}
@@ -207,7 +208,7 @@ namespace gbrainy.Games.Logic
{
drawable_area = new DrawableArea (container.Width / 2, 0.25);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
container.AddChild (drawable_area);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
@@ -215,7 +216,7 @@ namespace gbrainy.Games.Logic
int n = (int) e.Data;
DrawPossibleAnswer (e.Context, 0.12, 0.03, answer, random_indices [n], n);
- e.Context.DrawTextCentered (drawable_area.Width / 2, 0.22, Answer.GetMultiOptionFigureName (n));
+ e.Context.DrawTextCentered (drawable_area.Width / 2, 0.22, Answer.GetFigureName (n));
e.Context.Stroke ();
};
}
diff --git a/src/Games/Logic/PuzzleMissingPiece.cs b/src/Games/Logic/PuzzleMissingPiece.cs
index 1095249..20fbe63 100644
--- a/src/Games/Logic/PuzzleMissingPiece.cs
+++ b/src/Games/Logic/PuzzleMissingPiece.cs
@@ -38,7 +38,7 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which square completes the figure below? Answer {0}, {1} or {2}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2));}
}
public override string Tip {
@@ -53,12 +53,13 @@ namespace gbrainy.Games.Logic
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
random_indices = new ArrayListIndicesRandom (3);
random_indices.Initialize ();
for (int i = 0; i < random_indices.Count; i++) {
if (random_indices [i] == 0) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
@@ -73,7 +74,7 @@ namespace gbrainy.Games.Logic
drawable_area.SelectedArea = new Rectangle (0, 0, sub_figure, sub_figure);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
container.AddChild (drawable_area);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
@@ -82,7 +83,7 @@ namespace gbrainy.Games.Logic
DrawAnswerFigures (e.Context, 0, 0, random_indices [n]);
e.Context.MoveTo (0, 0.2);
- e.Context.ShowPangoText (Answer.GetMultiOptionFigureName (n));
+ e.Context.ShowPangoText (Answer.GetFigureName (n));
};
}
}
diff --git a/src/Games/Logic/PuzzleMissingSlice.cs b/src/Games/Logic/PuzzleMissingSlice.cs
index 9753cea..21ac44b 100644
--- a/src/Games/Logic/PuzzleMissingSlice.cs
+++ b/src/Games/Logic/PuzzleMissingSlice.cs
@@ -65,7 +65,7 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("The slices below have some kind of relation. Which is the missing slice in the circle below? Answer {0}, {1} or {2}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2));}
}
public override string Tip {
@@ -84,14 +84,16 @@ namespace gbrainy.Games.Logic
random_indices = new ArrayListIndicesRandom (slices.Length / items_per_slice);
random_indices.Initialize ();
ans_pos = random.Next (possible_answers);
- Answer.Correct = GameAnswer.GetMultiOption (ans_pos);
-
+
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+ Answer.SetMultiOptionAnswer (ans_pos, Answer.GetFigureName (ans_pos));
+
bad_answers = new int [possible_answers * items_per_slice];
for (int i = 0; i < bad_answers.Length; i++) {
bad_answers[i] = 1 + random.Next (9);
}
- HorizontalContainer container = new HorizontalContainer (DrawAreaX, 0.68, 0.8, 0.3);
+ HorizontalContainer container = new HorizontalContainer (DrawAreaX, 0.62, 0.8, 0.3);
DrawableArea drawable_area;
AddWidget (container);
@@ -100,7 +102,7 @@ namespace gbrainy.Games.Logic
drawable_area = new DrawableArea (0.8 / 3, 0.3);
drawable_area.SelectedArea = new Rectangle (0, 0, radius, 0.2);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
container.AddChild (drawable_area);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
@@ -112,17 +114,17 @@ namespace gbrainy.Games.Logic
int pos = random_indices [0];
DrawSliceText (e.Context, 0, 0, 0, (sum_offset +
slices [pos * items_per_slice]).ToString (),
- (sum_offset + slices [1 + (pos * items_per_slice)]).ToString (),
+ (sum_offset + slices [1 + (pos * items_per_slice)]).ToString (),
(sum_offset + slices [2 + (pos * items_per_slice)]).ToString ());
} else {
- DrawSliceText (e.Context, 0, 0, 0,
+ DrawSliceText (e.Context, 0, 0, 0,
bad_answers [n * items_per_slice].ToString (),
- bad_answers [1 + (n * items_per_slice)].ToString (),
+ bad_answers [1 + (n * items_per_slice)].ToString (),
bad_answers [2 + (n * items_per_slice)].ToString ());
}
-
+
e.Context.MoveTo (0.0, 0.25);
- e.Context.ShowPangoText (Answer.GetMultiOptionFigureName (n));
+ e.Context.DrawTextCentered (radius / 2, 0.25, Answer.GetFigureName (n));
e.Context.Stroke ();
};
}
@@ -131,7 +133,7 @@ namespace gbrainy.Games.Logic
private static void DrawSlice (CairoContextEx gr, double x, double y)
{
double degrees, x1, y1;
-
+
degrees = 0;
gr.MoveTo (x, y);
x1 = x + radius * Math.Cos (degrees);
@@ -151,7 +153,7 @@ namespace gbrainy.Games.Logic
}
private void DrawSliceText (CairoContextEx gr, double x, double y, int slice, string str1, string str2, string str3)
- {
+ {
double x0, y0, degrees;
// Number more near to the center;
@@ -159,37 +161,37 @@ namespace gbrainy.Games.Logic
x0 = 0.35 * radius * Math.Cos (degrees);
y0 = 0.35 * radius * Math.Sin (degrees);
gr.DrawTextCentered (x + x0, y + y0, str1);
-
+
// Number opposite to the center and at the top
degrees = radian * (slice * ((360 / total_slices)) + (360 / 24));
x0 = 0.8 * radius * Math.Cos (degrees);
y0 = 0.8 * radius * Math.Sin (degrees);
gr.DrawTextCentered (x + x0, y + y0, str2);
-
+
// Number opposite to the center and at the bottom
- degrees = radian * (slice * ((360 / total_slices)) + (360 / 8));
+ degrees = radian * (slice * ((360 / total_slices)) + (360 / 8));
x0 = 0.8 * radius * Math.Cos (degrees);
y0 = 0.8 * radius * Math.Sin (degrees);
gr.DrawTextCentered (x + x0, y + y0, str3);
}
public override void Draw (CairoContextEx gr, int area_width, int area_height, bool rtl)
- {
+ {
double x = DrawAreaX + 0.2, y = DrawAreaY;
double x0, y0, degrees;
int pos;
base.Draw (gr, area_width, area_height, rtl);
-
+
gr.Arc (x + arc_centerx, y + arc_centery, radius, 0, 2 * Math.PI);
gr.Stroke ();
- for (int slice = 0; slice < total_slices; slice++)
+ for (int slice = 0; slice < total_slices; slice++)
{
degrees = radian * slice * (360 / total_slices);
gr.MoveTo (x + arc_centerx, y + arc_centery);
gr.LineTo (x + arc_centerx + (radius * Math.Cos (degrees)), y + arc_centery + (radius * Math.Sin (degrees)));
-
+
if (slice > total_slices - 1) continue;
if (slice == 0) {
@@ -199,7 +201,7 @@ namespace gbrainy.Games.Logic
gr.DrawTextCentered (x + arc_centerx + x0, y + arc_centery + y0, "?");
continue;
}
-
+
if (slice < half_slices) {
pos = random_indices [slice];
DrawSliceText (gr, x + arc_centerx, y + arc_centery, slice, (sum_offset + slices [pos * items_per_slice]).ToString (),
@@ -212,7 +214,7 @@ namespace gbrainy.Games.Logic
}
}
- gr.MoveTo (0.1, 0.61);
+ gr.MoveTo (0.1, 0.55);
gr.ShowPangoText (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Possible answers are:"));
gr.Stroke ();
}
diff --git a/src/Games/Logic/PuzzleMostInCommon.cs b/src/Games/Logic/PuzzleMostInCommon.cs
index 66dbfac..654f823 100644
--- a/src/Games/Logic/PuzzleMostInCommon.cs
+++ b/src/Games/Logic/PuzzleMostInCommon.cs
@@ -79,7 +79,7 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which of the possible answers have the most in common with the four given figures? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
public override string Tip {
@@ -102,6 +102,8 @@ namespace gbrainy.Games.Logic
array_good.AddRange (new Element [] {Element.SmallCircle, Element.SmallCircle, Element.SmallCircle,
Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+
// Four random samples with equal elements
questions = new ArrayList ();
for (int i = 0; i < 4; i++) {
@@ -115,7 +117,7 @@ namespace gbrainy.Games.Logic
for (int i = 0; i < random_indices_answers.Count; i++) {
if ((int) random_indices_answers [i] == 0) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
@@ -184,7 +186,7 @@ namespace gbrainy.Games.Logic
drawable_area = new DrawableArea (figure_size, figure_size + 0.05);
drawable_area.SelectedArea = new Rectangle (0.05, 0.05, 0.15, 0.15);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -192,7 +194,7 @@ namespace gbrainy.Games.Logic
DrawFigure (e.Context, 0.05, 0.05, (FigureElement []) answers[random_indices_answers[n]]);
e.Context.MoveTo (0.05, 0.22);
- e.Context.ShowPangoText (Answer.GetMultiOptionFigureName (n));
+ e.Context.ShowPangoText (Answer.GetFigureName (n));
};
container.AddChild (drawable_area);
diff --git a/src/Games/Logic/PuzzleNextFigure.cs b/src/Games/Logic/PuzzleNextFigure.cs
index 083a9d6..50dcdaf 100644
--- a/src/Games/Logic/PuzzleNextFigure.cs
+++ b/src/Games/Logic/PuzzleNextFigure.cs
@@ -56,7 +56,7 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which is the next logical figure in the sequence? Answer {0}, {1} or {2}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2));}
}
@@ -70,16 +70,17 @@ namespace gbrainy.Games.Logic
{
random_indices = new ArrayListIndicesRandom ((int) Figures.Last);
random_indices.Initialize ();
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
for (int i = 0; i < (int) Figures.Last; i++)
{
if (random_indices[i] == (int) Figures.Third) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
- HorizontalContainer container = new HorizontalContainer (DrawAreaX, DrawAreaY + figure_size + 0.16, 0.8, 0.3);
+ HorizontalContainer container = new HorizontalContainer (DrawAreaX, DrawAreaY + figure_size + 0.16, 0.8, 0.3);
DrawableArea drawable_area;
AddWidget (container);
@@ -89,7 +90,7 @@ namespace gbrainy.Games.Logic
drawable_area = new DrawableArea (space_figures, 0.2);
drawable_area.SelectedArea = new Rectangle (0, 0, figure_size, figure_size);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
container.AddChild (drawable_area);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
@@ -111,7 +112,7 @@ namespace gbrainy.Games.Logic
}
e.Context.MoveTo (0.02, 0.25);
- e.Context.ShowPangoText (Answer.GetMultiOptionFigureName (n));
+ e.Context.ShowPangoText (Answer.GetFigureName (n));
e.Context.Stroke ();
};
}
diff --git a/src/Games/Logic/PuzzleOstracism.cs b/src/Games/Logic/PuzzleOstracism.cs
index 00b637f..2b94310 100644
--- a/src/Games/Logic/PuzzleOstracism.cs
+++ b/src/Games/Logic/PuzzleOstracism.cs
@@ -56,7 +56,7 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which element does not belong to the group? It is not related to divisibility of the numbers. Answer {0}, {1}, {2}, {3} or {4}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3), GameAnswer.GetMultiOption (4));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3), Answer.GetMultiOption (4));}
}
public override string Tip {
@@ -87,6 +87,7 @@ namespace gbrainy.Games.Logic
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
gametype = (GameType) random.Next ((int) GameType.Last + 1);
switch (gametype) {
@@ -127,12 +128,11 @@ namespace gbrainy.Games.Logic
random_indices = new ArrayListIndicesRandom (equations.Length);
random_indices.Initialize ();
- Answer.Correct = string.Empty;
for (int i = 0; i < random_indices.Count; i++)
{
if (random_indices[i] == wrong_answer) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
@@ -147,7 +147,7 @@ namespace gbrainy.Games.Logic
drawable_area.Y = DrawAreaY + 0.2 + i * 0.1;
container.AddChild (drawable_area);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -156,7 +156,7 @@ namespace gbrainy.Games.Logic
e.Context.SetPangoLargeFontSize ();
e.Context.MoveTo (0.05, 0.02);
// Translators: this "option) answer" for example "a) "21 x 60 = 1260". This should not be changed for most of the languages
- e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), GameAnswer.GetMultiOption (n), equations [random_indices[n]]));
+ e.Context.ShowPangoText (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), Answer.GetMultiOption (n), equations [random_indices[n]]));
};
}
}
diff --git a/src/Games/Logic/PuzzlePencil.cs b/src/Games/Logic/PuzzlePencil.cs
index 9dc81c3..2abe422 100644
--- a/src/Games/Logic/PuzzlePencil.cs
+++ b/src/Games/Logic/PuzzlePencil.cs
@@ -41,20 +41,21 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format ( ServiceLocator.Instance.GetService <ITranslations> ().GetString
("Which of the following figures cannot be drawn without crossing any previous lines nor lifting the pencil? Answer {0}, {1}, {2}, {3} or {4}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3), GameAnswer.GetMultiOption (4));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3), Answer.GetMultiOption (4));}
}
protected override void Initialize ()
{
random_indices = new ArrayListIndicesRandom (figures);
random_indices.Initialize ();
- Answer.Correct = string.Empty;
+
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
for (int i = 0; i < random_indices.Count; i++) {
if (random_indices[i] != answer_index)
continue;
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
@@ -86,7 +87,7 @@ namespace gbrainy.Games.Logic
drawable_area = new DrawableArea (box_size, figure_size);
drawable_area.SelectedArea = new Rectangle ((box_size - figure_size) / 2, 0, figure_size, figure_size);
drawable_area.Data = figure;
- drawable_area.DataEx = GameAnswer.GetMultiOption (figure);
+ drawable_area.DataEx = Answer.GetMultiOption (figure);
switch (random_indices[figure]) {
case 0:
@@ -94,7 +95,7 @@ namespace gbrainy.Games.Logic
{
DrawTriangle (e.Context, (e.Width - figure_size) / 2, 0);
e.Context.DrawTextCentered (e.Width / 2, figure_size + text_offset,
- Answer.GetMultiOptionFigureName ((int) e.Data));
+ Answer.GetFigureName ((int) e.Data));
};
break;
case 1:
@@ -102,7 +103,7 @@ namespace gbrainy.Games.Logic
{
DrawDiamon (e.Context, (e.Width - figure_size) / 2, 0);
e.Context.DrawTextCentered (e.Width / 2, figure_size + text_offset,
- Answer.GetMultiOptionFigureName ((int) e.Data));
+ Answer.GetFigureName ((int) e.Data));
};
break;
case 2:
@@ -110,7 +111,7 @@ namespace gbrainy.Games.Logic
{
DrawRectangleWithTriangles (e.Context, (e.Width - figure_size) / 2, 0);
e.Context.DrawTextCentered (e.Width / 2, figure_size + text_offset,
- Answer.GetMultiOptionFigureName ((int) e.Data));
+ Answer.GetFigureName ((int) e.Data));
};
break;
case 3:
@@ -118,7 +119,7 @@ namespace gbrainy.Games.Logic
{
DrawThreeTriangles (e.Context, (e.Width - figure_size) / 2, 0);
e.Context.DrawTextCentered (e.Width / 2, figure_size + text_offset,
- Answer.GetMultiOptionFigureName ((int) e.Data));
+ Answer.GetFigureName ((int) e.Data));
};
break;
case answer_index:
@@ -126,7 +127,7 @@ namespace gbrainy.Games.Logic
{
DrawRectangleWithCross (e.Context, (e.Width - figure_size) / 2, 0);
e.Context.DrawTextCentered (e.Width / 2, figure_size + text_offset,
- Answer.GetMultiOptionFigureName ((int) e.Data));
+ Answer.GetFigureName ((int) e.Data));
};
break;
}
diff --git a/src/Games/Logic/PuzzlePredicateLogic.cs b/src/Games/Logic/PuzzlePredicateLogic.cs
index 7e5d58f..cc46dea 100644
--- a/src/Games/Logic/PuzzlePredicateLogic.cs
+++ b/src/Games/Logic/PuzzlePredicateLogic.cs
@@ -51,80 +51,86 @@ namespace gbrainy.Games.Logic
}
};
- Predicate [] predicates =
+ Predicate [] predicates;
+
+ public PuzzlePredicateLogic ()
{
- new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If all painters are artists and some citizens of Barcelona are artists. Which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3)),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some citizens of Barcelona are painters"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All citizens of Barcelona are painters"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("No citizen of Barcelona is a painter"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("None of the other options"),
- 3),
-
- new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If no ill artist is happy and some artists are happy. Which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3)),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some artist are not ill"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some painters are not artists"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All artists are happy"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("None of the other options"),
- 0),
-
- new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("People that travel always buy a map. You are not going to travel. Which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3)),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You do not have any map"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You do not buy a map"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All people have a map"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("None of the other options"),
- 3),
-
- new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If you whistle if you are happy and you always smile when you whistle, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3)),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You smile if you are happy"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You are only happy if you whistle"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You whistle if you are not happy"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("None of the other options"),
- 0),
-
- new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If your course is always honest and your course is always the best policy, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3)),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Honesty is sometimes the best policy"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Honesty is always the best policy"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Honesty is not always the best policy"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some of the best policies are dishonest"),
- 0),
-
- new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If no old misers are cheerful and some old misers are thin, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3)),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some thin people are not cheerful"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Thin people are not cheerful"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Cheerful people are not thin"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some cheerful people are not thin"),
- 0),
-
- new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If all pigs are fat and nothing that is fed on barley-water is fat, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3)),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All animals fed on barley-water are non pigs"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("No pigs are fed on barley-water"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Pigs are not fed on barley-water"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All the other options"),
- 3),
-
- new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If some pictures are first attempts and no first attempts are really good, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3)),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some bad pictures are not first attempts"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some pictures are not really good"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All bad pictures are first attempts"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All the others"),
- 1),
-
- new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If you have been out for a walk and you are feeling better, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3)),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("To feel better, you must go out for a walk"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If you go out for a walk, you will feel better"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some who go out for a walk feel better"),
- ServiceLocator.Instance.GetService <ITranslations> ().GetString ("No one feels better who does not go out for a walk"),
- 2),
- };
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+ predicates = new Predicate []
+ {
+ new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If all painters are artists and some citizens of Barcelona are artists. Which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3)),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some citizens of Barcelona are painters"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All citizens of Barcelona are painters"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("No citizen of Barcelona is a painter"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("None of the other options"),
+ 3),
+
+ new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If no ill artist is happy and some artists are happy. Which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3)),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some artist are not ill"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some painters are not artists"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All artists are happy"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("None of the other options"),
+ 0),
+
+ new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("People that travel always buy a map. You are not going to travel. Which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3)),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You do not have any map"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You do not buy a map"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All people have a map"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("None of the other options"),
+ 3),
+
+ new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If you whistle if you are happy and you always smile when you whistle, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3)),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You smile if you are happy"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You are only happy if you whistle"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("You whistle if you are not happy"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("None of the other options"),
+ 0),
+
+ new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If your course is always honest and your course is always the best policy, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3)),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Honesty is sometimes the best policy"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Honesty is always the best policy"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Honesty is not always the best policy"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some of the best policies are dishonest"),
+ 0),
+
+ new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If no old misers are cheerful and some old misers are thin, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3)),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some thin people are not cheerful"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Thin people are not cheerful"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Cheerful people are not thin"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some cheerful people are not thin"),
+ 0),
+
+ new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If all pigs are fat and nothing that is fed on barley-water is fat, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3)),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All animals fed on barley-water are non pigs"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("No pigs are fed on barley-water"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Pigs are not fed on barley-water"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All the other options"),
+ 3),
+
+ new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If some pictures are first attempts and no first attempts are really good, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3)),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some bad pictures are not first attempts"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some pictures are not really good"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All bad pictures are first attempts"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("All the others"),
+ 1),
+
+ new Predicate (String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If you have been out for a walk and you are feeling better, which of the following conclusions is correct? Answer {0}, {1}, {2} or {3}."),
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3)),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("To feel better, you must go out for a walk"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("If you go out for a walk, you will feel better"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Some who go out for a walk feel better"),
+ ServiceLocator.Instance.GetService <ITranslations> ().GetString ("No one feels better who does not go out for a walk"),
+ 2),
+ };
+ }
public override string Name {
get {return ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Predicate Logic");}
@@ -150,7 +156,7 @@ namespace gbrainy.Games.Logic
for (int i = 0; i < answers; i++)
{
if (random_indices[i] == correct_answer) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.Correct = Answer.GetMultiOption (i);
break;
}
}
@@ -165,7 +171,7 @@ namespace gbrainy.Games.Logic
drawable_area.Y = DrawAreaY + 0.15 + i * 0.18;
container.AddChild (drawable_area);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -173,7 +179,7 @@ namespace gbrainy.Games.Logic
int option = random_indices [data];
e.Context.SetPangoNormalFontSize ();
- e.Context.DrawStringWithWrapping (0.05, 0.02, String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), GameAnswer.GetMultiOption (data),
+ e.Context.DrawStringWithWrapping (0.05, 0.02, String.Format (ServiceLocator.Instance.GetService <ITranslations> ().GetString ("{0}) {1}"), Answer.GetMultiOption (data),
predicates[question].options[option].ToString ()), 0.8 - DrawAreaX);
e.Context.Stroke ();
};
diff --git a/src/Games/Logic/PuzzleQuadrilaterals.cs b/src/Games/Logic/PuzzleQuadrilaterals.cs
index 3fe5603..c39c950 100644
--- a/src/Games/Logic/PuzzleQuadrilaterals.cs
+++ b/src/Games/Logic/PuzzleQuadrilaterals.cs
@@ -47,8 +47,8 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which of the following figures does not belong to the group? Answer {0}, {1}, {2}, {3}, {4} or {5}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3), GameAnswer.GetMultiOption (4),
- GameAnswer.GetMultiOption (5));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3), Answer.GetMultiOption (4),
+ Answer.GetMultiOption (5));}
}
public override string Rationale {
@@ -59,13 +59,14 @@ namespace gbrainy.Games.Logic
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
random_indices = new ArrayListIndicesRandom ((int) Figures.Last);
random_indices.Initialize ();
for (int i = 0; i < (int) Figures.Last; i++)
{
if ((Figures) random_indices[i] == Figures.FigureA) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
@@ -140,7 +141,7 @@ namespace gbrainy.Games.Logic
for (int i = 0; i < random_indices.Count; i++) {
DrawFigure (gr, x, y, (Figures) random_indices[i]);
gr.MoveTo (x, y - 0.02 + figure_size * 1.6);
- gr.ShowPangoText (Answer.GetMultiOptionFigureName (i));
+ gr.ShowPangoText (Answer.GetFigureName (i));
if (i == 2) {
x = DrawAreaX;
diff --git a/src/Games/Logic/PuzzleSquareDots.cs b/src/Games/Logic/PuzzleSquareDots.cs
index 5bcd97c..05cf361 100644
--- a/src/Games/Logic/PuzzleSquareDots.cs
+++ b/src/Games/Logic/PuzzleSquareDots.cs
@@ -207,11 +207,12 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return (String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which is the next logical figure in the sequence? Answer {0}, {1} or {2}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2)));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2)));}
}
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
possible_answers = new ArrayListIndicesRandom (3);
possible_answers.Initialize ();
@@ -225,7 +226,7 @@ namespace gbrainy.Games.Logic
drawable_area = new DrawableArea (figure_size + space_figures, figure_size + 0.1);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.SelectedArea = new Rectangle (space_figures / 2, space_figures / 2, figure_size, figure_size);
container.AddChild (drawable_area);
@@ -234,13 +235,13 @@ namespace gbrainy.Games.Logic
{
DrawPossibleAnswer (e.Context, space_figures / 2, space_figures / 2, possible_answers [(int)e.Data]);
e.Context.DrawTextCentered (space_figures / 2 + figure_size / 2, space_figures + figure_size + 0.02,
- Answer.GetMultiOptionFigureName ((int)e.Data));
+ Answer.GetFigureName ((int)e.Data));
};
}
for (int i = 0; i < possible_answers.Count; i++) {
if (possible_answers[i] == 0) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
diff --git a/src/Games/Logic/PuzzleTetris.cs b/src/Games/Logic/PuzzleTetris.cs
index 83af9a8..b7c123c 100644
--- a/src/Games/Logic/PuzzleTetris.cs
+++ b/src/Games/Logic/PuzzleTetris.cs
@@ -38,7 +38,7 @@ namespace gbrainy.Games.Logic
public override string Question {
get {return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("What figure completes the set below? Answer {0}, {1} or {2}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2));}
}
public override string Rationale {
@@ -49,6 +49,7 @@ namespace gbrainy.Games.Logic
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
random_indices_questions = new ArrayListIndicesRandom (4);
random_indices_questions.Initialize ();
@@ -57,7 +58,7 @@ namespace gbrainy.Games.Logic
for (int i = 0; i < random_indices_answers.Count; i++) {
if ((int) random_indices_answers [i] == 0) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
@@ -70,7 +71,7 @@ namespace gbrainy.Games.Logic
{
drawable_area = new DrawableArea (0.8 / 3, 0.4);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
container.AddChild (drawable_area);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
@@ -79,7 +80,7 @@ namespace gbrainy.Games.Logic
DrawAnswerFigures (e.Context, 0.05, 0.2, random_indices_answers [n]);
e.Context.MoveTo (0.05, 0.33);
- e.Context.ShowPangoText (Answer.GetMultiOptionFigureName (n));
+ e.Context.ShowPangoText (Answer.GetFigureName (n));
};
}
}
diff --git a/src/Games/Memory/MemoryColouredFigures.cs b/src/Games/Memory/MemoryColouredFigures.cs
index 07a8c78..311db29 100644
--- a/src/Games/Memory/MemoryColouredFigures.cs
+++ b/src/Games/Memory/MemoryColouredFigures.cs
@@ -58,11 +58,13 @@ namespace gbrainy.Games.Memory
public override string MemoryQuestion {
get { return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which of these figures was previously shown? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
columns = rows = 5;
@@ -94,7 +96,7 @@ namespace gbrainy.Games.Memory
for (int i = 0; i < answers_order.Count; i++) {
if (answers_order[i] == 0) {
- Answer.Correct += GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
@@ -115,7 +117,7 @@ namespace gbrainy.Games.Memory
container.AddChild (drawable_area);
drawable_area.SelectedArea = new Rectangle (0.05, 0, 0.3, 0.3);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -124,7 +126,7 @@ namespace gbrainy.Games.Memory
palette.Alpha = alpha;
DrawSquare (e.Context, 0.05, 0, squares_colours, squares * answers_order[n]);
e.Context.MoveTo (0.05, 0 + block_space - 0.02);
- e.Context.ShowPangoText (Answer.GetMultiOptionFigureName (n));
+ e.Context.ShowPangoText (Answer.GetFigureName (n));
e.Context.Stroke ();
};
}
diff --git a/src/Games/Memory/MemoryFiguresNumbers.cs b/src/Games/Memory/MemoryFiguresNumbers.cs
index 482b8c8..35c76c9 100644
--- a/src/Games/Memory/MemoryFiguresNumbers.cs
+++ b/src/Games/Memory/MemoryFiguresNumbers.cs
@@ -42,11 +42,13 @@ namespace gbrainy.Games.Memory
public override string MemoryQuestion {
get { return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which one of these squares was previously shown? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
protected override void Initialize ()
{
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+
switch (CurrentDifficulty) {
case GameDifficulty.Easy:
columns = rows = 2;
@@ -77,7 +79,7 @@ namespace gbrainy.Games.Memory
for (int i = 0; i < answers_order.Count; i++) {
if ((int) answers_order[i] == 0) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
break;
}
}
@@ -98,7 +100,7 @@ namespace gbrainy.Games.Memory
container.AddChild (drawable_area);
drawable_area.SelectedArea = new Rectangle (0.05, 0, 0.3, 0.3);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
@@ -106,7 +108,7 @@ namespace gbrainy.Games.Memory
DrawSquare (e.Context, 0.05, 0, numbers, squares * answers_order[n]);
e.Context.MoveTo (0.05, block_space - 0.02);
- e.Context.ShowPangoText (Answer.GetMultiOptionFigureName (n));
+ e.Context.ShowPangoText (Answer.GetFigureName (n));
e.Context.Stroke ();
};
}
diff --git a/src/Games/Memory/MemoryIndications.cs b/src/Games/Memory/MemoryIndications.cs
index 0915589..a8abd1e 100644
--- a/src/Games/Memory/MemoryIndications.cs
+++ b/src/Games/Memory/MemoryIndications.cs
@@ -163,7 +163,7 @@ namespace gbrainy.Games.Memory
get {
return String.Format (
ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Which of the following graphics represent the indications previously given? Answer {0}, {1}, {2} or {3}."),
- GameAnswer.GetMultiOption (0), GameAnswer.GetMultiOption (1), GameAnswer.GetMultiOption (2), GameAnswer.GetMultiOption (3));}
+ Answer.GetMultiOption (0), Answer.GetMultiOption (1), Answer.GetMultiOption (2), Answer.GetMultiOption (3));}
}
protected override void Initialize ()
@@ -176,6 +176,8 @@ 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
+ Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
+
if (CurrentDifficulty==GameDifficulty.Easy) {
indications[4] = new Indication (Indication.Type.End, 1);
} else {
@@ -229,7 +231,7 @@ namespace gbrainy.Games.Memory
for (int i = 0; i < answers.Count; i++) {
if (answers [i] == 0) {
- Answer.Correct = GameAnswer.GetMultiOption (i);
+ Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
ans = i;
break;
}
@@ -245,14 +247,14 @@ namespace gbrainy.Games.Memory
container.AddChild (drawable_area);
drawable_area.SelectedArea = new Rectangle (0, 0, 0.45, 0.3);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
int n = (int) e.Data;
DrawPossibleAnswers (e.Context, 0.2, 0.1, WhichAnswer (answers[n]));
e.Context.MoveTo (0.2, 0.12 + 0.2);
- e.Context.ShowPangoText (Answer.GetMultiOptionFigureName (n));
+ e.Context.ShowPangoText (Answer.GetFigureName (n));
};
}
@@ -266,14 +268,14 @@ namespace gbrainy.Games.Memory
container.AddChild (drawable_area);
drawable_area.SelectedArea = new Rectangle (0, 0, 0.45, 0.3);
drawable_area.Data = i;
- drawable_area.DataEx = GameAnswer.GetMultiOption (i);
+ drawable_area.DataEx = Answer.GetMultiOption (i);
drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
{
int n = (int) e.Data;
DrawPossibleAnswers (e.Context, 0.2, 0.1, WhichAnswer (answers[n]));
e.Context.MoveTo (0.2, 0.12 + 0.2);
- e.Context.ShowPangoText (Answer.GetMultiOptionFigureName (n));
+ e.Context.ShowPangoText (Answer.GetFigureName (n));
};
}
}
@@ -330,7 +332,7 @@ namespace gbrainy.Games.Memory
}
DrawPossibleAnswers (gr, 0.7, 0.3, WhichAnswer (answers[ans]));
gr.MoveTo (0.7, 0.5);
- gr.ShowPangoText (Answer.GetMultiOptionFigureName (ans));
+ gr.ShowPangoText (Answer.GetFigureName (ans));
gr.Stroke ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]