Ejemplo n.º 1
0
        public void AnimateTurn(BoardOwner side)
        {
            if (this._turnAnimationTarget.HasValue && this._turnAnimationTarget.Value == side)
            {
                return;
            }
            if (this._turnAnimationTarget.HasValue)
            {
                this._turnAnimation.BeginTime = null;
                this._turnAnimationLabel.BorderBrush.BeginAnimation(SolidColorBrush.ColorProperty, this._turnAnimation);
                ColorAnimation revert = new ColorAnimation((this._turnAnimationLabel.BorderBrush as SolidColorBrush).Color, this._turnAnimation.From.Value, new Duration(TimeSpan.FromSeconds(0.1)));
                this._turnAnimationLabel.BorderBrush.BeginAnimation(SolidColorBrush.ColorProperty, revert);
            }
            var            sideColor = (side == BoardOwner.ME) ? this._myColor : this._enemyColor;
            ColorAnimation animation = new ColorAnimation(sideColor, Colors.White, new Duration(TimeSpan.FromSeconds(0.75)));

            animation.RepeatBehavior = RepeatBehavior.Forever;
            animation.AutoReverse    = true;
            var label = (side == BoardOwner.ME) ? labelMyNickname : labelEnemyNickname;

            label.BorderBrush.BeginAnimation(SolidColorBrush.ColorProperty, animation);

            this._turnAnimation       = animation;
            this._turnAnimationLabel  = label;
            this._turnAnimationTarget = side;
        }
Ejemplo n.º 2
0
 public void UpdateCells(BoardOwner board, IEnumerable <SimpleSeaCell> cells)
 {
     this.Invoke((b, c) =>
     {
         var _board = (b == BoardOwner.ME) ? myBoard : enemyBoard;
         foreach (var cell in c)
         {
             _board[cell.X, cell.Y].AnimateState(cell.CellState);
         }
     }, board, cells);
 }
Ejemplo n.º 3
0
    private BoardInfo GetMessageBoard()
    {
        switch (BoardOwner.ToLowerInvariant())
        {
        case "user":
            return(GetUserMessageBoard());

        default:
            return(GetDocumentMessageBoard());
        }
    }
Ejemplo n.º 4
0
 public S2C_GameEnded(BoardOwner winner, GameResult gameResult)
 {
     this.Winner     = winner;
     this.GameResult = gameResult;
 }
Ejemplo n.º 5
0
 public S2C_GameTurnInfo(BoardOwner player, bool reasonHit)
 {
     this.Player     = player;
     this.Reason_Hit = reasonHit;
 }
Ejemplo n.º 6
0
 public void EndGame(BoardOwner winner, GameResult result)
 {
     this.Game        = null;
     this.PlayerState = PlayerState.POST_GAME;
     Connection.Send(new S2C_GameEnded(winner, result));
 }
Ejemplo n.º 7
0
 public S2C_GameBoardUpdated(BoardOwner boardOwner, IEnumerable <SimpleSeaCell> updatedCells)
 {
     this.BoardOwner   = boardOwner;
     this.UpdatedCells = updatedCells;
 }