예제 #1
0
 /// <summary>
 /// Game draw method
 /// </summary>
 /// <param name="result">Result of game</param>
 private void Game_Draw(string result)
 {
     Enabled = true;
     profile.Draw(game.Difficult.ToString());
     GameDataBus.SaveGameResultInScore(profile, locale);
     DeleteSubscribes();
     GameDataBus.ShowResult(result, locale);
     GamePanel.Visible = false;
 }
예제 #2
0
 /// <summary>
 /// Set russian language
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void RussianItem_Click(object sender, EventArgs e)
 {
     locale = CreateLocale(InterfaceLanguage.ru);
     SetLocale(locale);
     GameDataBus.SaveGameResultInScore(profile, locale);
     SetLanguageFlags(locale.Localization);
     if (game != null)
     {
         ((SinglePlayer)game).ChangeBotNameWithLocale(locale);
     }
     ShowParameters();
 }
예제 #3
0
        /// <summary>
        /// Click on game field buttons method
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event</param>
        private void GameFieldButton_Click(object sender, EventArgs e)
        {
            var button = (Button)sender;
            int i      = int.Parse(button.Tag.ToString());

            game.PlayerStep(i, out bool isPossible);
            if (!isPossible)
            {
                GameDataBus.ShowImpossibleStepMessage(locale);
            }
            UpdateButtons();
            game.CheckGameStatus();
            if (game.GameInProgress && isPossible)
            {
                game.ChangeCurrentPlayer();
            }
        }
예제 #4
0
 /// <summary>
 /// Game win method
 /// </summary>
 /// <param name="result">Result of game</param>
 private void Game_Win(string result)
 {
     Enabled = true;
     if (game.Winner == game.Player1)
     {
         profile.Win(game.Difficult.ToString());
         GameDataBus.SaveGameResultInScore(profile, locale);
         ChangeButtonColor(Color.Green);
     }
     else
     {
         profile.Lose(game.Difficult.ToString());
         GameDataBus.SaveGameResultInScore(profile, locale);
         ChangeButtonColor(Color.Red);
     }
     GameDataBus.ShowResult(result, locale);
     DeleteSubscribes();
     GamePanel.Visible = false;
 }
예제 #5
0
        /// <summary>
        /// Main form load event method
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event</param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            if (!SaveLoadProfile.CheckExistFileSave())
            {
#pragma warning disable IDE0067 // Dispose objects before losing scope
                NewProfile addUserForm = new NewProfile(profile, locale);
#pragma warning restore IDE0067 // Dispose objects before losing scope
                addUserForm.ShowDialog();
                if (!GameDataBus.ProfileIsCreated)
                {
                    Close();
                    return;
                }
                profile = GameDataBus.TempProfile;
            }
            else
            {
                profile = GameDataBus.LoadGameResultInScore(locale);
            }

            locale = CreateLocale(profile.PlayerLocale);
            SetLocale(locale);
            SetLanguageFlags(locale.Localization);
        }
예제 #6
0
 /// <summary>
 /// Show game score method
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="e">Param</param>
 private void ScoreMenu_Click(object sender, EventArgs e)
 {
     GameDataBus.ShowScore(profile, locale);
 }
예제 #7
0
 /// <summary>
 /// Main form exit event method
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="e">Event</param>
 private void ExitMenu_Click(object sender, EventArgs e)
 {
     GameDataBus.SaveGameResultInScore(profile, locale);
     Application.Exit();
 }