예제 #1
0
        private void Player1Click()
        {
            Move m = moves.First();

            moves.RemoveAt(0);
            Player1Board.SetBlock(m.AtX, m.AtY, m.Result);
            updateButtons();
        }
예제 #2
0
 public void Run(long gameId)
 {
     Player1Board.Clear();
     Player2Board.Clear();
     moves.Clear();
     player1 = null;
     player2 = null;
     using (var channelFactory = new ChannelFactory <IBattleshipsService>("MyNetNamedPipeEndpoint"))
     {
         IBattleshipsService client = channelFactory.CreateChannel();
         GameReplay          gr     = client.GetGameReplay(gameId);
         if (gr == null)
         {
             return;
         }
         player1 = gr.Player1;
         player2 = gr.Player2;
         moves   = gr.Moves.OrderBy(m => m.Time).ToList();
     }
     updateButtons();
     Player1Button.MainText = $"Player {player1.Name} turn...";
     Player2Button.MainText = $"Player {player2.Name} turn...";
     Visibility             = Visibility.Visible;
 }