public async Task PlayCardAsync() { int decks = _model.PlayerHand1.ObjectSelected(); if (decks == 0) { await UIPlatform.ShowMessageAsync("Must choose a card to play"); return; } var thisCard = _mainGame.SingleInfo !.MainHandList.GetSpecificItem(decks); if (_mainGame.CanPlayCard(thisCard) == false) { await UIPlatform.ShowMessageAsync("Illegal Move"); return; } if (_mainGame.BasicData !.MultiPlayer) { await _mainGame.Network !.SendAllAsync("playcard", decks); } CommandContainer !.ManuelFinish = true; await _mainGame.PlayCardAsync(thisCard); }
private void PutBackHand(int decks) { var thisDomino = _mainGame !.SingleInfo !.MainHandList.GetSpecificItem(decks); _viewModel.PrivateTrain1 !.HandList.Add(thisDomino); _mainGame.SingleInfo.LongestTrainList.Add(thisDomino); thisDomino.IsSelected = false; _mainGame.SingleInfo.MainHandList.RemoveObjectByDeck(decks); _viewModel.UpdateCount(_mainGame.SingleInfo); }
public async Task CreateNewSetAsync(IDeckDict <RegularRummyCard> thisCol, EnumWhatSets setType, bool useSecond) { DeckRegularDict <RegularRummyCard> newCol = new DeckRegularDict <RegularRummyCard>(); thisCol.ForEach(ThisCard => newCol.Add(SingleInfo !.MainHandList.GetSpecificItem(ThisCard.Deck))); SingleInfo !.MainHandList.RemoveGivenList(newCol, System.Collections.Specialized.NotifyCollectionChangedAction.Remove); RummySet thisSet = new RummySet(_gameContainer !); thisSet.CreateNewSet(thisCol, setType, useSecond); _model !.MainSets1 !.CreateNewSet(thisSet); UpdatePoints(); await ContinueTurnAsync(); }
public async Task PlayDominoAsync(int deck, int whichOne) { if (SingleInfo !.CanSendMessage(BasicData !)) { PlayInfo thisPlay = new PlayInfo(); thisPlay.Deck = deck; thisPlay.WhichOne = whichOne; await Network !.SendAllAsync("play", thisPlay); } SimpleDominoInfo thisDomino = SingleInfo !.MainHandList.GetSpecificItem(deck); await PlayDominoAsync(thisDomino, whichOne); }
async Task IMiscDataNM.MiscDataReceived(string status, string content) { LifeCardGameCardInformation thisCard; switch (status) { case "turnbacktime": DeckRegularDict <LifeCardGameCardInformation> thisList = await content.GetNewObjectListFromDeckListAsync(_gameContainer.DeckList !); //hopefully this is fine too. await FinishedTurningBackTimeAsync(thisList); return; case "playcard": thisCard = SingleInfo !.MainHandList.GetSpecificItem(int.Parse(content)); await PlayCardAsync(thisCard); return; case "choseplayer": await ChosePlayerAsync(int.Parse(content)); return; case "cardchosen": thisCard = _gameContainer.DeckList !.GetSpecificItem(int.Parse(content)); await ChoseSingleCardAsync(thisCard); return; case "cardstraded": var thisTrade = await js.DeserializeObjectAsync <TradeCard>(content); var yourCard = _gameContainer.DeckList !.GetSpecificItem(thisTrade.YourCard); var opponentCard = _gameContainer.DeckList.GetSpecificItem(thisTrade.OtherCard); await TradeCardsAsync(yourCard, opponentCard); return; case "lifeswap": var thisSwap = await js.DeserializeObjectAsync <Swap>(content); await FinishLifeSwapAsync(thisSwap.Player, thisSwap.YourCards, thisSwap.OtherCards); return; default: throw new BasicBlankException($"Nothing for status {status} with the message of {content}"); } }
async Task IMiscDataNM.MiscDataReceived(string status, string content) { switch (status) //can't do switch because we don't know what the cases are ahead of time. { case "dominoplayed": SendPlay output = await js.DeserializeObjectAsync <SendPlay>(content); MexicanDomino thisDomino = SingleInfo !.MainHandList.GetSpecificItem(output.Deck); SingleInfo.MainHandList.RemoveObjectByDeck(output.Deck); await _model.TrainStation1 !.AnimateShowSelectedDominoAsync(output.Section, thisDomino, this); return; default: throw new BasicBlankException($"Nothing for status {status} with the message of {content}"); } }
private async Task DominoPileClicked(int whichOne) { int decks = _model.PlayerHand1 !.ObjectSelected(); if (decks == 0) { await UIPlatform.ShowMessageAsync($"Sorry, you have to select a domino to play for {whichOne}"); return; } var thisDomino = SingleInfo !.MainHandList.GetSpecificItem(decks); if (_model.GameBoard1.IsValidMove(whichOne, thisDomino) == false) { await UIPlatform.ShowMessageAsync("Illegal Move"); return; } await PlayDominoAsync(decks, whichOne); }
public async Task DiscardFromHandAsync(int deck) { var thisCard = _gameContainer.SingleInfo !.MainHandList.GetSpecificItem(deck); await DiscardFromHandAsync(thisCard); }