public string GetResult(ITranslations translations) { string s; if (GamesPlayed >= 10) { int percentage_won = (int)(100 * GamesWon / GamesPlayed); if (percentage_won >= 90) { s = translations.GetString("Outstanding results"); } else if (percentage_won >= 70) { s = translations.GetString("Excellent results"); } else if (percentage_won >= 50) { s = translations.GetString("Good results"); } else if (percentage_won >= 30) { s = translations.GetString("Poor results"); } else { s = translations.GetString("Disappointing results"); } } else { s = string.Empty; } return(s); }
// Type enum to string representation (locale sensitive) public static string GetLocalized(ITranslations translations, GameTypes type) { switch (type) { case GameTypes.LogicPuzzle: return translations.GetString ("Logic"); case GameTypes.Memory: return translations.GetString ("Memory"); case GameTypes.Calculation: return translations.GetString ("Calculation"); case GameTypes.VerbalAnalogy: return translations.GetString ("Verbal"); default: throw new InvalidOperationException ("Unknown game type"); } }
public string GetGamesSummary(ITranslations translations) { String s = string.Empty; #if MONO_ADDINS s += translations.GetString("Extensions database:") + " " + System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "gbrainy"); s += Environment.NewLine; #endif // Translators: 'Games registered' is the games know to gbrainy (build-in and load from addins-in and external files) s += String.Format(translations.GetString("{0} games registered: {1} logic puzzles, {2} calculation trainers, {3} memory trainers, {4} verbal analogies"), cnt_logic + cnt_memory + cnt_calculation + cnt_verbal, cnt_logic, cnt_calculation, cnt_memory, cnt_verbal); return(s); }
// Type enum to string representation (locale sensitive) static public string GetLocalized(ITranslations translations, GameTypes type) { switch (type) { case GameTypes.LogicPuzzle: return(translations.GetString("Logic")); case GameTypes.Memory: return(translations.GetString("Memory")); case GameTypes.Calculation: return(translations.GetString("Calculation")); case GameTypes.VerbalAnalogy: return(translations.GetString("Verbal")); default: throw new InvalidOperationException("Unknown game type"); } }
public string GetGamesSummary(ITranslations translations) { String s = string.Empty; #if MONO_ADDINS s += translations.GetString("Extensions database:") + " " + System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "gbrainy"); s += Environment.NewLine; #endif // Translators: 'Games registered' is the games know to gbrainy (build-in and load from addins-in and external files) int total = cnt_logic + cnt_memory + cnt_calculation + cnt_verbal; s += String.Format(translations.GetPluralString("{0} game registered:", "{0} games registered:", total) + Environment.NewLine, total); s += AddString(String.Format(translations.GetPluralString("{0} logic puzzle", "{0} logic puzzles", cnt_logic), cnt_logic)); s += AddString(String.Format(translations.GetPluralString("{0} calculation trainer", "{0} calculation trainers", cnt_calculation), cnt_calculation)); s += AddString(String.Format(translations.GetPluralString("{0} memory trainer", "{0} memory trainers", cnt_memory), cnt_memory)); s += AddString(String.Format(translations.GetPluralString("{0} verbal analogy", "{0} verbal analogies", cnt_verbal), cnt_verbal)); return(s); }
void LoadColorArrays() { CairoColor = new Cairo.Color[] { new Cairo.Color(0.81, 0.1, 0.13), new Cairo.Color(0.54, 0.71, 0.24), new Cairo.Color(0.17, 0.23, 0.56), new Cairo.Color(0.86, 0.85, 0.25), new Cairo.Color(0.82, 0.25, 0.59), new Cairo.Color(1, 0.54, 0), new Cairo.Color(0, 0, 0), new Cairo.Color(.9, .9, .9) }; ColorName = new string[] { Translations.GetString("red"), Translations.GetString("green"), Translations.GetString("blue"), Translations.GetString("yellow"), Translations.GetString("magenta"), Translations.GetString("orange"), Translations.GetString("black"), Translations.GetString("white") }; }
public WelcomeView(ITranslations translations) { Container container; DrawableArea drawable_area; double y = 0.22; Translations = translations; containers = new List <Toolkit.Container> (); /* Logic */ container = new HorizontalContainer(0.05, y, 0.95, space); containers.Add(container); drawable_area = new DrawableArea(0.17, image_size); container.AddChild(drawable_area); drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e) { e.Context.DrawImageFromAssembly("logic-games.svg", 0, 0, image_size, image_size); }; drawable_area = new DrawableArea(0.75, space); container.AddChild(drawable_area); drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e) { e.Context.DrawStringWithWrapping(0, 0, Translations.GetString("Logic puzzles. Challenge your reasoning and thinking skills."), e.Width); }; /* Math */ y += space; container = new HorizontalContainer(0.05, y, 0.95, space); containers.Add(container); drawable_area = new DrawableArea(0.17, image_size); container.AddChild(drawable_area); drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e) { e.Context.DrawImageFromAssembly("math-games.svg", 0, 0, image_size, image_size); }; drawable_area = new DrawableArea(0.75, space); container.AddChild(drawable_area); drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e) { e.Context.DrawStringWithWrapping(0, 0, Translations.GetString("Mental calculation. Arithmetical operations that test your mental calculation abilities."), e.Width); }; /* Memory */ y += space; container = new HorizontalContainer(0.05, y, 0.95, space); containers.Add(container); drawable_area = new DrawableArea(0.17, image_size); container.AddChild(drawable_area); drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e) { e.Context.DrawImageFromAssembly("memory-games.svg", 0, 0, image_size, image_size); }; drawable_area = new DrawableArea(0.75, space); container.AddChild(drawable_area); drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e) { e.Context.DrawStringWithWrapping(0, 0, Translations.GetString("Memory trainers. To prove your short term memory."), e.Width); }; /* Verbal */ y += space; container = new HorizontalContainer(0.05, y, 0.95, space); containers.Add(container); drawable_area = new DrawableArea(0.17, image_size); container.AddChild(drawable_area); drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e) { e.Context.DrawImageFromAssembly("verbal-games.svg", 0, 0, image_size, image_size); }; drawable_area = new DrawableArea(0.75, space); container.AddChild(drawable_area); drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e) { e.Context.DrawStringWithWrapping(0, 0, Translations.GetString("Verbal analogies. Challenge your verbal aptitude."), e.Width); }; }
public string GetResult(ITranslations translations) { string s; if (GamesPlayed >= 10) { int percentage_won = (int) (100 * GamesWon / GamesPlayed); if (percentage_won >= 90) s = translations.GetString ("Outstanding results"); else if (percentage_won >= 70) s = translations.GetString ("Excellent results"); else if (percentage_won >= 50) s = translations.GetString ("Good results"); else if (percentage_won >= 30) s = translations.GetString ("Poor results"); else s = translations.GetString ("Disappointing results"); } else s = string.Empty; return s; }
public WelcomeView(ITranslations translations) { Container container; DrawableArea drawable_area; double y = 0.22; Translations = translations; containers = new List <Toolkit.Container> (); /* Logic */ container = new HorizontalContainer (0.05, y, 0.95, space); containers.Add (container); drawable_area = new DrawableArea (0.17, image_size); container.AddChild (drawable_area); drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e) { e.Context.DrawImageFromAssembly ("logic-games.svg", 0, 0, image_size, image_size); }; drawable_area = new DrawableArea (0.75, space); container.AddChild (drawable_area); drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e) { e.Context.DrawStringWithWrapping (0, 0, Translations.GetString ("Logic puzzles. Challenge your reasoning and thinking skills."), e.Width); }; /* Math */ y += space; container = new HorizontalContainer (0.05, y, 0.95, space); containers.Add (container); drawable_area = new DrawableArea (0.17, image_size); container.AddChild (drawable_area); drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e) { e.Context.DrawImageFromAssembly ("math-games.svg", 0, 0, image_size, image_size); }; drawable_area = new DrawableArea (0.75, space); container.AddChild (drawable_area); drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e) { e.Context.DrawStringWithWrapping (0, 0, Translations.GetString ("Mental calculation. Arithmetical operations that test your mental calculation abilities."), e.Width); }; /* Memory */ y += space; container = new HorizontalContainer (0.05, y, 0.95, space); containers.Add (container); drawable_area = new DrawableArea (0.17, image_size); container.AddChild (drawable_area); drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e) { e.Context.DrawImageFromAssembly ("memory-games.svg", 0, 0, image_size, image_size); }; drawable_area = new DrawableArea (0.75, space); container.AddChild (drawable_area); drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e) { e.Context.DrawStringWithWrapping (0, 0, Translations.GetString ("Memory trainers. To prove your short term memory."), e.Width); }; /* Verbal */ y += space; container = new HorizontalContainer (0.05, y, 0.95, space); containers.Add (container); drawable_area = new DrawableArea (0.17, image_size); container.AddChild (drawable_area); drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e) { e.Context.DrawImageFromAssembly ("verbal-games.svg", 0, 0, image_size, image_size); }; drawable_area = new DrawableArea (0.75, space); container.AddChild (drawable_area); drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e) { e.Context.DrawStringWithWrapping (0, 0, Translations.GetString ("Verbal analogies. Challenge your verbal aptitude."), e.Width); }; }
public string GetGamesSummary(ITranslations translations) { String s = string.Empty; #if MONO_ADDINS s += translations.GetString ("Extensions database:") + " " + System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "gbrainy"); s += Environment.NewLine; #endif // Translators: 'Games registered' is the games know to gbrainy (build-in and load from addins-in and external files) s += String.Format (translations.GetString ("{0} games registered: {1} logic puzzles, {2} calculation trainers, {3} memory trainers, {4} verbal analogies"), cnt_logic + cnt_memory + cnt_calculation + cnt_verbal, cnt_logic, cnt_calculation, cnt_memory, cnt_verbal); return s; }