コード例 #1
0
        public async Task AddToSetAsync(int whatSet, int deck, int position)
        {
            RummySet thisSet = _model !.MainSets1 !.GetIndividualSet(whatSet);

            SingleInfo !.MainHandList.RemoveObjectByDeck(deck);
            RegularRummyCard thisCard = _gameContainer.DeckList !.GetSpecificItem(deck);

            thisSet.AddCard(thisCard, position);
            UpdatePoints();
            await ContinueTurnAsync();
        }
コード例 #2
0
        public async Task ProcessPlayAsync(int deck1, int deck2)
        {
            SingleInfo !.MainHandList.RemoveObjectByDeck(deck1);
            RegularSimpleCard secondCard = SingleInfo.MainHandList.RemoveObjectByDeck(deck2);

            SingleInfo.Pairs++;
            secondCard.IsSelected = false;
            secondCard.Drew       = false;
            if (_model !.Pile1 !.CardExist(secondCard.Deck) == false)
            {
                _model.Pile1.AddCard(secondCard);
            }
        private async Task TrainClickedAsync(int index)
        {
            CommandContainer.StartExecuting();
            int decks = DominoSelected(out bool train);

            if (decks == 0)
            {
                await UIPlatform.ShowMessageAsync("Sorry, must have one domino selected to put on the pile");

                CommandContainer.StopExecuting();
                CommandContainer.ManualReport();
                return;
            }
            MexicanDomino thisDomino;

            if (train)
            {
                thisDomino = _viewModel.PrivateTrain1 !.HandList.GetSpecificItem(decks);
            }
            else
            {
                thisDomino = _viewModel.PlayerHand1.HandList.GetSpecificItem(decks);
            }
            if (_viewModel.TrainStation1 !.CanPlacePiece(thisDomino, index) == false)
            {
                await UIPlatform.ShowMessageAsync("Illegal Move");

                CommandContainer.StopExecuting();
                return;
            }
            if (_mainGame.BasicData !.MultiPlayer)
            {
                SendPlay output = new SendPlay();
                output.Deck    = decks;
                output.Section = index;
                await _mainGame.Network !.SendAllAsync("dominoplayed", output);
            }
            if (train)
            {
                _mainGame !.SingleInfo !.LongestTrainList.RemoveObjectByDeck(decks);
                _viewModel.PrivateTrain1 !.HandList.RemoveObjectByDeck(decks);
            }
            else
            {
                _mainGame !.SingleInfo !.MainHandList.RemoveObjectByDeck(decks);
            }
            _viewModel.UpdateCount(_mainGame.SingleInfo !);
            await _viewModel.TrainStation1.AnimateShowSelectedDominoAsync(index, thisDomino, _mainGame); //hopefully this simple.

            CommandContainer.StopExecuting();                                                            //try this as well.
        }
        public async Task ReplaceCardsAsync(IDeckDict <YahtzeeHandsDownCardInformation> thisList)
        {
            LeftToDraw  = thisList.Count;
            PlayerDraws = WhoTurn;
            await thisList.ForEachAsync(async thisCard =>
            {
                thisCard.Drew       = false;
                thisCard.IsSelected = false;
                SingleInfo !.MainHandList.RemoveObjectByDeck(thisCard.Deck);
                await AnimatePlayAsync(thisCard);
                if (Test !.NoAnimations == false)
                {
                    await Delay !.DelaySeconds(.25);
                }
            });

            await DrawAsync();
        }
コード例 #5
0
 public override async Task DiscardAsync(RegularRummyCard thisCard)
 {
     SingleInfo !.MainHandList.RemoveObjectByDeck(thisCard.Deck);
     _model !.DiscardList1 !.AddToDiscard(thisCard);
     await EndTurnAsync();
 }
コード例 #6
0
        async Task IMiscDataNM.MiscDataReceived(string status, string content)
        {
            switch (status)
            {
            case "laiddowninitial":
                await CreateSetsAsync(content);
                await InitialCompletedAsync();

                return;

            case "createnewset":
                var thisItem = await js.DeserializeObjectAsync <SendCreateSet>(content);

                var thisCol  = thisItem.CardList.GetObjectsFromList(SingleInfo !.MainHandList);
                var thisTemp = new TempInfo();
                thisTemp.CardList = thisCol;
                thisTemp.WhatSet  = thisItem.WhatSet;
                await CreateNewSetAsync(thisTemp, false);

                return;

            case "undomove":
                await UndoMoveAsync();

                return;

            case "finished":
                await FinishedAsync(bool.Parse(content));     //hopefully okay.

                return;

            case "drewtile":
                var thisSend1 = await js.DeserializeObjectAsync <SendDraw>(content);

                var thisTile = _model !.Pool1 !.GetTile(thisSend1.Deck);
                await DrawTileAsync(thisTile, thisSend1.FromEnd);

                return;

            case "removeentireset":
                await RemoveEntireSetAsync(int.Parse(content));

                return;

            case "removeonefromset":
                var thisSend2 = await js.DeserializeObjectAsync <SendSet>(content);
                await RemoveTileFromSetAsync(thisSend2.Index, thisSend2.Tile);

                return;

            case "addtoset":
                var thisSend3 = await js.DeserializeObjectAsync <SendSet>(content);

                var thisTile2 = _model !.Pool1 !.GetTile(thisSend3.Tile);
                thisTile2.IsUnknown = false;
                SingleInfo !.MainHandList.RemoveObjectByDeck(thisSend3.Tile);
                await AddToSetAsync(thisSend3.Index, thisTile2, thisSend3.Position);

                return;

            case "endcustom":
                var thisEnd = await js.DeserializeObjectAsync <SendCustom>(content);
                await EndTurnAsync(thisEnd.DidPlay, thisEnd.ValidSets);

                return;

            default:
                throw new BasicBlankException($"Nothing for status {status}  with the message of {content}");
            }
        }