public CBoardControlPresenter(Guid gameId, EPieceColor mySideColor, BoardControl attachedBoard)
 {
     _gameId              = gameId;
     _attachedBoard       = attachedBoard;
     _virtualBoardService = new VirtualBoardServiceClient(new InstanceContext(this));
     _boardStates         = new CBoardOccupancy();
     _pieces              = new Dictionary <Int32, CPiece>();
     _attachedTiles       = new HashSet <CTile>();
     InitializeBoardView(mySideColor);
     _virtualBoardService.ConnectBoard(_gameId, CAuthenticationStaff.Instance.User.UserId);
 }
 private EventHandler GetMovementAnimationCompletedEventHandler(CBoardOccupancy states, CPiece piece)
 {
     return((obj, args) =>
     {
         states[new CTile(piece.Margin)] = piece.Color;
         RemoveAttachedTile(piece);
         Rectangle timeoutIndicator = PutNewTimeoutIndicatorOnBoard(piece.Margin);
         piece.AttachedTimeoutIndicator = timeoutIndicator;
         DoubleAnimation timeoutIndicatorAnimation = GetNewTimeoutIndicatorAnimation();
         timeoutIndicatorAnimation.Completed += GetTimeoutIndicatorAnimationCompletedEventHandler(piece);
         timeoutIndicator.BeginAnimation(Rectangle.HeightProperty, timeoutIndicatorAnimation);
     });
 }
Esempio n. 3
0
 public Boolean CheckAll(CBoardOccupancy boardStates, CTile currentTile, CTile proposedTile)
 {
     return(_rules.Any(rule =>
     {
         try
         {
             return rule(boardStates, currentTile, proposedTile);
         }
         catch
         {
             return false;
         }
     }));
 }
Esempio n. 4
0
 public Boolean IsMoveValid(CBoardOccupancy boardStates, CTile proposedTile)
 {
     return(_movementValidator.CheckAll(boardStates, new CTile(Margin), proposedTile));
 }