Ejemplo n.º 1
0
 // Закрытие экрана пользователя
 public void CloseUserScreen()
 {
     if (userForm != null)
     {
         userForm.Close();
         userForm = null;
     }
 }
Ejemplo n.º 2
0
 // Выход игрока со стола
 public void QuitTable()
 {
     //SetGameHandlers(false);
     if (Place != 1)
     {
         serverActions.PlayerQuitFromTable();
     }
     else
     {// Завершаем игру иначе
         SetGameHandlers(false);
         serverActions.ExitPlayerFromTable(Place);
         ChangeCurrentTable(null);
         ChangeCurrentPlace(-1);
         if (betForm123 != null)
             betForm123.Close();
         if (betForm4 != null)
             betForm4.Close();
         MessageBox.Show("Игра завершена. Кто-то вышел со стола");
         gameForm.Close();
         gameForm = null;
         userForm = new MainUserForm(this);
         userForm.UpdateTables();
         userForm.Show();
     }
 }
Ejemplo n.º 3
0
        // Выход игрока со стола во время игры
        public void PlayerQuitHandler(Message Msg)
        {
            Dictionary<string, string> qParams = Helpers.SplitCommandString(Msg.Msg);
            // Продолжаем игру
            if (qParams["Continue"] == "1")
            {
                int BotPlace = Int32.Parse(qParams["Place"]);
                if (BotPlace != Place)
                {
                    MessageBox.Show(String.Format("Игрок №{0} покинул стол, его заменил бот. Игра продолжается", BotPlace));
                    switch (BotPlace)
                    {
                        case 2:
                            {
                                CurrentTable.Player2 = -BotPlace;
                                break;
                            }
                        case 3:
                            {
                                CurrentTable.Player3 = -BotPlace;
                                break;
                            }
                        case 4:
                            {
                                CurrentTable.Player4 = -BotPlace;
                                break;
                            }
                    }
                    return;
                }
            }
            else
            {
                MessageBox.Show("Игра завершена. Кто-то вышел со стола");
            }

            // Завершаем игру иначе
            SetGameHandlers(false);
            ChangeCurrentTable(null);
            ChangeCurrentPlace(-1);
            if (betForm123 != null)
                betForm123.Close();
            if (betForm4 != null)
                betForm4.Close();
            gameForm.Close();
            gameForm = null;
            userForm = new MainUserForm(this);
            userForm.UpdateTables();
            userForm.Show();
        }
Ejemplo n.º 4
0
 // Завершение игры
 public void GameEndHandler(Message Msg)
 {
     Dictionary<string, string> gParams = Helpers.SplitCommandString(Msg.Msg);
     TotalScore1 = Int32.Parse(gParams["Scores1"]);
     TotalScore2 = Int32.Parse(gParams["Scores2"]);
     if (TotalScore1 > TotalScore2)
     {
         if ((Place == 1) || (Place == 3))
             MessageBox.Show(String.Format("Вы победили! Счет - {0} : {1}", TotalScore1, TotalScore2));
         else
             MessageBox.Show(String.Format("Вы проиграли! Счет - {0} : {1}", TotalScore1, TotalScore2));
     }
     else
     {
         if ((Place == 2) || (Place == 4))
             MessageBox.Show(String.Format("Вы победили! Счет - {0} : {1}", TotalScore1, TotalScore2));
         else
             MessageBox.Show(String.Format("Вы проиграли! Счет - {0} : {1}", TotalScore1, TotalScore2));
     }
     TotalScore1 = 0;
     TotalScore2 = 0;
     SetGameHandlers(false);
     ChangeCurrentTable(null);
     ChangeCurrentPlace(-1);
     gameForm.Close();
     gameForm = null;
     userForm = new MainUserForm(this);
     userForm.UpdateTables();
     userForm.Show();
 }
Ejemplo n.º 5
0
 // Выход игрока со стола. IsSelf - сам ли игрок вышел со стола
 public void ExitFromTable(bool IsSelf)
 {
     if (IsSelf)
         serverActions.ExitPlayerFromTable(Place);
     SetPreGameHandlers(false);
     ChangeCurrentTable(null);
     ChangeCurrentPlace(-1);
     waitingForm.Close();
     waitingForm = null;
     userForm = new MainUserForm(this);
     userForm.UpdateTables();
     userForm.Show();
 }
Ejemplo n.º 6
0
 // Посадка на игровой стол
 public void EnterTheTable(int PlayerPlace, int TableID)
 {
     if (Tables[TableID] == null)
         return;
     if (serverActions.AddPlayerToTable(TableID, PlayerPlace))
     {
         ChangeCurrentTable(serverActions.GetTable(TableID));
         ChangeCurrentPlace(PlayerPlace);
         if (userForm != null)
         {
             userForm.Close();
             userForm = null;
         }
         waitingForm = new WaitingForm(this);
         waitingForm.UpdateLabels();
         SetPreGameHandlers(true);
         waitingForm.Show();
         serverActions.TestFullfillTable();
     }
     else
     {
         MessageBox.Show("Не удалось сесть на игровой стол");
         userForm.UpdateTables();
     }
 }
Ejemplo n.º 7
0
 // Создание тренировочного стола
 public void CreateTrainingTable()
 {
     Table t = serverActions.CreateTable(this.Player.Profile.Id, 0, true, false, 0, false, false, false, false);
     if (t != null)
     {
         //MessageBox.Show("Создание стола прошло успешно!");
         ChangeCurrentTable(t);
         ChangeCurrentPlace(1);
         if (userForm != null)
         {
             userForm.Close();
             userForm = null;
         }
         SetPreGameHandlers(true);
         AddBot(2);
         AddBot(3);
         AddBot(4);
     }
     else
     {
         MessageBox.Show("Не удалось создать игровой стол");
     }
 }
Ejemplo n.º 8
0
 public void CreateTable(int Bet, bool PlayersVisibility, bool Chat, int MinimalLevel, bool TableVisibility,
     bool VIPOnly, bool Moderation, bool AI)
 {
     Table t = serverActions.CreateTable(this.Player.Profile.Id, Bet, PlayersVisibility, Chat, MinimalLevel, TableVisibility,
         VIPOnly, Moderation, AI);
     if (t != null)
     {
         //MessageBox.Show("Создание стола прошло успешно!");
         ChangeCurrentTable(t);
         ChangeCurrentPlace(1);
         if (userForm != null)
         {
             userForm.Close();
             userForm = null;
         }
         waitingForm = new WaitingForm(this);
         SetPreGameHandlers(true);
         waitingForm.UpdateLabels();
         waitingForm.Show();
     }
     else
     {
         MessageBox.Show("Не удалось создать игровой стол");
     }
 }
Ejemplo n.º 9
0
 // Авторизация с помощью электронной почты
 public void AutorizationEmail(string Email, string Password)
 {
     int PlayerID;
     if (serverActions.AutorizationEmail(Email, Password, out PlayerID))
     {
         //MessageBox.Show("Вход успешен!");
         Player = serverActions.GetPlayer(PlayerID);
         UpdatePlayers();
         guestForm.Close();
         guestForm = null;
         userForm = new MainUserForm(this);
         userForm.UpdateTables();
         userForm.Show();
     }
     else
     {
         MessageBox.Show("Не удалось войти");
     }
 }
Ejemplo n.º 10
0
 // Отображение экрана пользователя
 public void ShowUserScreen()
 {
     userForm = new MainUserForm(this.Game);
     userForm.Show();
 }