public void SetTrick(ITrick trick) { _trick = trick; _playedIndex = 0; _offset = -400; if (!IsTrickSet) { Table.PlayedCards = new AndroidCard[trick.Count()]; IsTrickSet = true; } var score = trick.TrickValue(); var winner = trick.TheWinnerPlayer(); _roundStats[0].Text = "Trick Score: " + score.ToString(); _roundStats[1].Text = "Round Winner: " + winner.Name; foreach (var cardPlayerPair in _trick) { var card = cardPlayerPair.Item2; if (card == null) { continue; } var cardtexture = Table.GameContent.TextureDict[card]; var trickCard = new AndroidCard(cardtexture, card) { Position = new Vector2((Table.ScreenWidth / 2 + _offset), Table.ScreenHeight / 4.0f) }; _offset += 150; trickCard.State = StateType.Playing; trickCard.IsTrick = true; Table.PlayedCards[_playedIndex++] = trickCard; } }
private string Prompt(PromptType prompt_type, Dictionary <PromptData, object> data) { string prompt = ""; int index; ITrick trick = null; IPlayer player = null; IPlayer picker = null; IBlind blind = null; switch (prompt_type) { case PromptType.Pick: Console.Clear(); prompt = "Your cards:\n"; player = (IPlayer)data[PromptData.Player]; foreach (ICard card in player.Hand) { prompt += string.Format("{0}\n", card); } ; prompt += "\nDo you want to pick? (yes/no)\n"; break; case PromptType.PickBlind: Console.Clear(); prompt = "Blind cards:\n"; blind = (IBlind)data[PromptData.Blind]; index = 0; foreach (ICard card in blind) { prompt += string.Format("{0}) {1}\n", index++, card); } ; prompt += "\nYour Cards:\n"; index = 0; player = (IPlayer)data[PromptData.Player]; foreach (ICard card in player.Hand) { prompt += string.Format("{0}) {1}\n", index++, card); } ; break; case PromptType.PlayCard: Console.Clear(); picker = (IPlayer)data[PromptData.Picker]; prompt = string.Format("Picker: {0}\n", picker); prompt += "Cards Played\n"; trick = (ITrick)data[PromptData.Trick]; foreach ((IPlayer, ICard)playerCard in trick) { prompt += string.Format("{0}\n", playerCard); } ; prompt += "\nYour playable cards:\n"; List <ICard> cards = (List <ICard>)data[PromptData.Cards]; index = 0; cards.ForEach(card => { prompt += string.Format("{0}) {1}\n", index++, card); }); break; case PromptType.RoundOver: trick = ((IRound)data[PromptData.Round]).Trick; trick = ((IRound)data[PromptData.Round]).Trick; prompt = string.Format("{0} won the trick for {1} points\n", trick.TheWinnerPlayer(), trick.TrickValue()); prompt += "All cards played:\n"; foreach ((IPlayer, ICard)playerCard in trick) { prompt += string.Format("{0}\n", playerCard); } ; break; case PromptType.GameOver: var game = (IGame)data[PromptData.Game]; prompt = string.Format("Picker {0} got {1} points\n", game.Picker, game.GetPickerScore()); prompt += "Scoresheet:\n"; table.Players.ForEach(playerIt => { prompt += string.Format("{0}: {1} ", playerIt, table.ScrSheet.Scores[playerIt][table.Games.Count - 1]); }); prompt += "\n"; break; case PromptType.TableOver: prompt = "Totals:\n"; table.Players.ForEach(playerIt => { prompt += string.Format("{0}: {1} ", playerIt, table.ScrSheet.Total()[playerIt]); }); break; case PromptType.CallUp: prompt = "Would you like to call up? (yes/no): "; break; case PromptType.CalledUp: prompt = string.Format("\nPicker called up to {0}\n", (ICard)data[PromptData.Card]); break; default: Console.Clear(); return(""); } Console.WriteLine(prompt); return(Console.ReadLine()); }