예제 #1
0
 private void menuNewGame_Click(object sender, EventArgs e)
 {
     if (socket.networkActive)
     {
         Random    rnd     = new Random();
         int       turn    = rnd.Next(10) > 5 ? 1 : -1;
         GameState newGame = new GameState(turn, new int[COLUMNS, ROWS + 1]);
         socket.Add_send("StartGame" + paramDelimiter + newGame.Get_file());
         startGame(this, newGame);
     }
     else
     {
         MessageBox.Show("Please Connect to another Palyer");
     }
 }
예제 #2
0
 private void menuLoadGame_Click(object sender, EventArgs e)
 {
     if (socket.networkActive)
     {
         openFileDialog.Filter = "Binary File|*.bin";
         openFileDialog.Title  = "Load Game";
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             GameState gameState = BinaryFileHelper.LoadGameState(openFileDialog.FileName);
             socket.Add_send("StartGame" + paramDelimiter + gameState.Get_file());
             startGame(this, gameState);
         }
     }
     else
     {
         MessageBox.Show("Please Connect to another Palyer");
     }
 }