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; }
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); }
private BoardInfo GetMessageBoard() { switch (BoardOwner.ToLowerInvariant()) { case "user": return(GetUserMessageBoard()); default: return(GetDocumentMessageBoard()); } }
public S2C_GameEnded(BoardOwner winner, GameResult gameResult) { this.Winner = winner; this.GameResult = gameResult; }
public S2C_GameTurnInfo(BoardOwner player, bool reasonHit) { this.Player = player; this.Reason_Hit = reasonHit; }
public void EndGame(BoardOwner winner, GameResult result) { this.Game = null; this.PlayerState = PlayerState.POST_GAME; Connection.Send(new S2C_GameEnded(winner, result)); }
public S2C_GameBoardUpdated(BoardOwner boardOwner, IEnumerable <SimpleSeaCell> updatedCells) { this.BoardOwner = boardOwner; this.UpdatedCells = updatedCells; }