Exemple #1
0
        private async Task UpdateGameProcess(ClientMessage route, WebSocket socket)
        {
            command = "UpdateGameProcess";
            MoveResult outcome;

            switch (route.Message)
            {
            case "Attacking":
                outcome = game.AttackerMove(route.Card);

                if (outcome != MoveResult.OK)
                {
                    await ManageAttackOutcomeWarnings(outcome, socket);

                    return;
                }

                break;

            case "Defending":
                outcome = game.DefenderMove(route.Card);

                if (outcome != MoveResult.OK)
                {
                    await ManageDefenseOutcomeWarning(outcome, socket);

                    return;
                }

                break;

            case "Done":
                game.AttackerDone();
                break;

            case "Take":
                command = "TakeCards";
                game.DefenderTake();
                break;
            }

            // Distribute updated GameView to players
            await DistributeGameViewToPlayers();
        }