コード例 #1
0
        protected override async Task ComputerTurnAsync()
        {
            if (Test !.NoAnimations == false)
            {
                await Delay !.DelaySeconds(.75);
            }
            SingleInfo = PlayerList !.GetWhoPlayer(); //just in case the turn is wrong for that player.  can't take any chances.
            var thisCard = _model !.Pile1 !.GetCardInfo();

            if (thisCard.Instructions == EnumInstructionList.Flip)
            {
                if (BasicData !.MultiPlayer)
                {
                    await Network !.SendAllAsync("flipdeck");
                }
                await FlipDeckAsync();

                return;
            }
            if (thisCard.Instructions == EnumInstructionList.Cut)
            {
                await CutDeckAsync();

                return;
            }
            if (_gameContainer.AlreadyDrew == true)
            {
                thisCard = SingleInfo !.MainHandList.Single(items => items.Drew);
                if (CanPlay(thisCard.Deck))
                {
                    await ProcessPlayAsync(thisCard.Deck); //hopefully okay.

                    return;
                }
                if (BasicData !.MultiPlayer == true)
                {
                    await Network !.SendEndTurnAsync();
                }
                await EndTurnAsync();

                return;
            }
            int decks = ComputerToPlay();

            if (decks > 0)
            {
                await ProcessPlayAsync(decks);

                return;
            }
            SingleInfo !.MainHandList.UnhighlightObjects(); //so the computer knows which is the last one drawn.
            if (BasicData !.MultiPlayer == true)
            {
                await Network !.SendDrawAsync(); //i think.
            }
            await DrawAsync();
        }