예제 #1
0
        async public Task MakeAMove(MakeAMoveModel.InModel inModel)
        {
            if (await _gameServices.MakeMove(inModel.IdUser, inModel.IdGame, inModel.X, inModel.Y)
                == StateGame.GameOver)
            {
                await Clients.OthersInGroup(inModel.IdGame.ToString()).SendAsync("GameOver");

                await Clients.Caller.SendAsync("UserWin");

                await Clients.Groups(inModel.IdGame.ToString()).SendAsync("Disconnect");
            }
            else
            {
                await Clients.OthersInGroup(inModel.IdGame.ToString()).SendAsync("NextMove",
                                                                                 new MakeAMoveModel.OutModel {
                    LastX = inModel.X,
                    LastY = inModel.Y,
                });
            }
        }