public void MinGamesRecord() { PlayerHistory history; GameSessionHistory game = new GameSessionHistory (); game.GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey); history = new PlayerHistory (); history.ConfigPath = "."; history.Clean (); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD - 2; i++) { history.SaveGameSession (game); } game.LogicScore = 10; history.SaveGameSession (game); Assert.AreEqual (0, history.GetLastGameRecords ().Count, "Did not reach MinPlayedGamesKey, the game should not be a person record yet"); game.LogicScore = 30; history.SaveGameSession (game); Assert.AreEqual (1, history.GetLastGameRecords ().Count, "We have just recorded a personal record"); game.LogicScore = 20; history.SaveGameSession (game); Assert.AreEqual (0, history.GetLastGameRecords ().Count, "Score saved was lower than previous, no record"); }
public PlayerHistoryDialog(ITranslations translations, PlayerHistory history) : base(translations, "PlayerHistoryDialog.ui", "playerhistory") { string intro, built; intro = Catalog.GetString ("The graph below shows the player's game score evolution."); if (history.Games.Count < 2) { built = Catalog.GetString ("You need more than one game session recorded to see the score evolution."); } else { built = String.Format (Catalog.GetPluralString ("It is built using the results of {0} recorded game session.", "It is built using the results of the last {0} recorded game sessions.", history.Games.Count), history.Games.Count); } // Translators: "The graph below" + "It is built using" sentences label_playerhistory.Text = String.Format (Catalog.GetString ("{0} {1}"), intro, built); drawing_area = new CairoPreview (translations, history); drawing_area.SetSizeRequest (history_preview.WidthRequest, history_preview.HeightRequest); history_preview.Add (drawing_area); drawing_area.Visible = true; checkbutton_total.Label = Catalog.GetString ("Total"); checkbutton_logic.Label = GameTypesDescription.GetLocalized (translations, GameTypes.LogicPuzzle); checkbutton_calculation.Label = GameTypesDescription.GetLocalized (translations, GameTypes.Calculation); checkbutton_memory.Label = GameTypesDescription.GetLocalized (translations, GameTypes.Memory); checkbutton_verbal.Label = GameTypesDescription.GetLocalized (translations, GameTypes.VerbalAnalogy); checkbutton_total.Active = checkbutton_memory.Active = checkbutton_logic.Active = checkbutton_calculation.Active = checkbutton_verbal.Active = true; }
public PreferencesDialog(ITranslations translations, PlayerHistory history) : base(translations, "PreferencesDialog.ui", "preferences") { this.history = history; prefspinbutton.Value = Preferences.Get <int> (Preferences.MemQuestionTimeKey); prefcheckbutton.Active = Preferences.Get <bool> (Preferences.MemQuestionWarnKey); maxstoredspinbutton.Value = Preferences.Get <int> (Preferences.MaxStoredGamesKey); minplayedspinbutton.Value = Preferences.Get <int> (Preferences.MinPlayedGamesKey); colorblindcheckbutton.Active = Preferences.Get <bool> (Preferences.ColorBlindKey); englishcheckbutton.Active = Preferences.Get <bool> (Preferences.EnglishKey); loadextensionscheckbutton.Active = Preferences.Get <bool> (Preferences.LoadPlugginsKey); switch ((GameDifficulty) Preferences.Get <int> (Preferences.DifficultyKey)) { case GameDifficulty.Easy: rb_easy.Active = rb_easy.HasFocus = true; break; case GameDifficulty.Medium: rb_medium.Active = rb_medium.HasFocus = true; break; case GameDifficulty.Master: rb_master.Active = rb_master.HasFocus = true; break; } ListStore store = new ListStore (typeof (string), typeof (Theme)); // DisplayName, theme reference CellRenderer layout_cell = new CellRendererText (); themes_combobox.Model = store; themes_combobox.PackStart (layout_cell, true); themes_combobox.SetCellDataFunc (layout_cell, ComboBoxCellFunc); foreach (Theme theme in ThemeManager.Themes) store.AppendValues (Catalog.GetString(theme.LocalizedName), theme); // Default value TreeIter iter; bool more = store.GetIterFirst (out iter); while (more) { Theme theme = (Theme) store.GetValue (iter, COLUMN_VALUE); if (String.Compare (theme.Name, Preferences.Get <string> (Preferences.ThemeKey), true) == 0) { themes_combobox.SetActiveIter (iter); break; } more = store.IterNext (ref iter); } #if !MONO_ADDINS loadextensionscheckbutton.Visible = false; #endif }
public GameSession() { id = 0; game_manager = new GameManager(); game_time = TimeSpan.Zero; timer = new System.Timers.Timer(); timer.Elapsed += TimerUpdater; timer.Interval = (1 * 1000); // 1 second controler = new ViewsControler(this); Status = SessionStatus.NotPlaying; player_history = new PlayerHistory(); history = new GameSessionHistoryExtended(); }
public GameSession() { id = 0; game_manager = new GameManager (); game_time = TimeSpan.Zero; timer = new System.Timers.Timer (); timer.Elapsed += TimerUpdater; timer.Interval = (1 * 1000); // 1 second controler = new ViewsControler (this); Status = SessionStatus.NotPlaying; player_history = new PlayerHistory (); history = new GameSessionHistoryExtended (); }
public void MinGamesNotReached() { PlayerHistory history = new PlayerHistory () { ConfigPath = "." }; GameSessionHistory game = new GameSessionHistory () { GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey) }; history.Clean (); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD - 2; i++) { history.SaveGameSession (game); } game.LogicScore = 10; history.SaveGameSession (game); Assert.AreEqual (0, history.GetLastGameRecords ().Count, "Did not reach MinPlayedGamesKey, the game should not be a personal record yet"); }
public GameSession(ITranslations translations) { Translations = translations; id = 0; game_manager = new GameManager(); play_list = new GameSessionPlayList(game_manager); game_time = TimeSpan.Zero; timer = new System.Timers.Timer(); timer.Elapsed += TimerUpdater; timer.Interval = (1 * 1000); // 1 second controler = new ViewsControler(translations, this); Status = SessionStatus.NotPlaying; player_history = new PlayerHistory(); history = new GameSessionHistoryExtended(); }
public GameSession(ITranslations translations) { Translations = translations; id = 0; game_manager = new GameManager (); play_list = new GameSessionPlayList (game_manager); game_time = TimeSpan.Zero; timer = new System.Timers.Timer (); timer.Elapsed += TimerUpdater; timer.Interval = (1 * 1000); // 1 second controler = new ViewsControler (translations, this); Status = SessionStatus.NotPlaying; player_history = new PlayerHistory (); history = new GameSessionHistoryExtended (); }
public void PersonalRecordDone() { PlayerHistory history = new PlayerHistory () { ConfigPath = "." }; GameSessionHistory game = new GameSessionHistory () { GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey) }; history.Clean (); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD - 1; i++) { history.SaveGameSession (game); } game.LogicScore = 20; history.SaveGameSession (game); game.LogicScore = 30; history.SaveGameSession (game); Assert.AreEqual (1, history.GetLastGameRecords ().Count, "We have just recorded a personal record"); }
public CairoPreview(ITranslations translations, PlayerHistory history) { view = new PlayerHistoryView (translations, history); }
public CairoPreview(PlayerHistory history) { view = new PlayerHistoryView (history); }
public PlayerHistoryView(PlayerHistory history) { this.history = history; ShowLogic = ShowMemory = ShowCalculation = ShowVerbal = true; }
public PlayerHistoryView(ITranslations translations, PlayerHistory history) { Translations = translations; this.history = history; ShowLogic = ShowMemory = ShowCalculation = ShowVerbal = true; }
public void PersonalRecordDoneButPreviousWas0() { PlayerHistory history = new PlayerHistory () { ConfigPath = "." }; GameSessionHistory game = new GameSessionHistory () { GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey) }; history.Clean (); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD; i++) { history.SaveGameSession (game); } game.LogicScore = 30; history.SaveGameSession (game); Assert.AreEqual (0, history.GetLastGameRecords ().Count, "No record since previous was 0"); }
public void ScoreLowerThanPrevious() { PlayerHistory history = new PlayerHistory () { ConfigPath = "." }; GameSessionHistory game = new GameSessionHistory () { GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey) }; history.Clean (); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD - 1; i++) { history.SaveGameSession (game); } game.LogicScore = 30; history.SaveGameSession (game); game.LogicScore = 20; history.SaveGameSession (game); Assert.AreEqual (0, history.GetLastGameRecords ().Count, "Score saved was lower than previous, no record"); }