示例#1
0
        private void TriggerMove(IMove move)
        {
            MoveReceivedEventArgs args = new MoveReceivedEventArgs {
                MoveMade = move
            };

            moveReceived?.Invoke(this, args);
        }
        private async void OnMoveReceived(object sender, MoveReceivedEventArgs e)
        {
            Debug.WriteLine("UI: OnMoveReceived");
            IMove move = e?.MoveMade;

            if (move != null)
            {
                await AnimateMove(move.PlayerId, move.Row, move.Column);

                if (move.IsConnected)
                {
                    ShowWinner(move.PlayerId + " won!");
                }
                if (move.IsTie)
                {
                    ShowWinner("Game Over! Nobody won");
                }
            }
        }
示例#3
0
 /// <summary>
 /// Adds a marker to the opponent field when the move information is received.
 /// </summary>
 /// <param name="sender">The sender of the MoveReceived event.</param>
 /// <param name="e">The event arguments.</param>
 private void Client_MoveReportReceived(object sender, MoveReceivedEventArgs e)
 {
     this.OpponentBattleFieldArea.AddMarker(e.Marker);
 }