2
* Copyright (C) 2007 Jordi Mas i Hernàndez <jmas@softcatala.org>
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; either version 2 of the
7
* License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* General Public License for more details.
14
* You should have received a copy of the GNU General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
23
using gbrainy.Core.Main;
24
using gbrainy.Core.Libraries;
26
namespace gbrainy.Games.Memory
28
public class MemoryColouredText : Core.Main.Memory
30
private ColorPalette palette;
32
private string question_colorname;
33
private int colors_shown;
35
public override string Name {
36
get {return Catalog.GetString ("Colored text");}
39
public override bool UsesColors {
43
public override string MemoryQuestion {
45
return String.Format (Catalog.GetString ("What was the color of the text that said '{0}'?"), question_colorname);}
48
public override void Initialize ()
50
switch (CurrentDifficulty) {
54
case Difficulty.Medium:
57
case Difficulty.Master:
62
palette = new ColorPalette (colors_shown);
63
palette.Initialize ();
65
question = random.Next (palette.Count);
66
right_answer = palette.Name (question);
67
question_colorname = palette.Name ((ColorPalette.Id) question);
72
public override void DrawObjectToMemorize (CairoContextEx gr, int area_width, int area_height)
74
base.DrawObjectToMemorize (gr, area_width, area_height);
78
private void DrawObject (CairoContextEx gr)
82
double x= DrawAreaX + 0.125, y = DrawAreaY + 0.2;
84
for (int i = 0; i < palette.Count ; i++)
86
gr.Color = palette.Cairo(i);
88
gr.ShowPangoText ( palette.Name((ColorPalette.Id)i) );
93
x = DrawAreaX + 0.125;