ArmedCards.BusinessLogic.AppServices.GamePlayerCard.Play.Execute C# (CSharp) 메소드

Execute() 공개 메소드

Play a list of cards from a user's hand
public Execute ( List cardIDs, Int32 gameID, Int32 userId, System.Boolean autoPlayed = false ) : Entities.ActionResponses.PlayCard
cardIDs List The card IDs the user has selected
gameID System.Int32 The game ID in which the user wants to play the card
userId System.Int32 The user Id
autoPlayed System.Boolean Were these cards auto played
리턴 Entities.ActionResponses.PlayCard
        public Entities.ActionResponses.PlayCard Execute(List<Int32> cardIDs, Int32 gameID, Int32 userId, Boolean autoPlayed = false)
        {
            Entities.ActionResponses.PlayCard response = _playCard.Execute(cardIDs, gameID, userId, autoPlayed);

            if (response.ResponseCode == Entities.ActionResponses.Enums.PlayCardResponseCode.Success)
            {
                Entities.Filters.Game.Select filter = new Entities.Filters.Game.Select();
                filter.DataToSelect = Entities.Enums.Game.Select.GamePlayerCards;
                filter.GameID = gameID;

                Entities.Game game = _selectGame.Execute(filter);

                game.Rounds.Add(response.CurrentRound);

                if(response.CurrentRound.AllPlayersAnswered() && game.SecondsToPlay > 0)
                {
                    var cachedJobId = MemoryCache.Default.Get(game.RoundTimerKey);

                    BackgroundJob.Delete(cachedJobId as String);
                }

                _sendMessage.CardPlayed(game, true);
                _updateGame.Execute(game.GameID, DateTime.UtcNow, null);
            }

            return response;
        }