Exemplo n.º 1
0
        public Cell[,] GenerateMap(IServerHandlerService serverHandlerService)
        {
            _map = new Map();

            _map._ships.GenerateDefaultShips(_map);

            var _cells = new Cell[10, 10];

            for (var x = 0; x < 10; x++)
            {
                for (var y = 0; y < 10; y++)
                {
                    switch (_map.MapBlocks[x, y].State)
                    {
                    case BlockState.IsShip:
                        _cells[x, y] = new Cell(x, y, "Red", serverHandlerService, CellStateEnum.IsShip);
                        break;

                    default:
                        _cells[x, y] = new Cell(x, y, "Black", serverHandlerService, CellStateEnum.IsEmpty);
                        break;
                    }
                }
            }

            return(_cells);
        }
Exemplo n.º 2
0
        public Cell(int r, int c, string color, IServerHandlerService serverHandlerService, CellStateEnum cellStateEnum)
        {
            Row        = r;
            Column     = c;
            Background = color;
            BlockState = cellStateEnum;

            Click = new RelayCommand(() =>
            {
                var message = new Message(MessageEnum.Coordinate, Row, Column);

                serverHandlerService.SendData(message);
            });
        }
Exemplo n.º 3
0
 public ChatViewModel(IServerHandlerService serverHandlerService)
 {
 }
 public ChatViewModel(IServerHandlerService serverHandlerService)
 {
     serverHandlerService.Message += ServerHandlerService_Message;
     serverHandlerService.Shoot   += ServerHandlerService_Shoot;
 }