Beispiel #1
0
    public void PresentChoiceOfCards(List <Card> cards, Interpreter interpreter)
    {
        choiceDisplay.transform.parent.gameObject.SetActive(true);
        foreach (Card card in cards)
        {
            GameObject display = Instantiate(choiceItemPrefab) as GameObject;
            display.transform.SetParent(choiceDisplay.transform);

            ChoiceItemDisplay displayInfo = display.GetComponent <ChoiceItemDisplay>();
            displayInfo.SetText(
                card.GetName(),
                card.GetRulesText()
                );
            Button button = display.GetComponent <Button>();
            button.onClick.AddListener(() => {
                RemoveChoiceDisplay();
                interpreter.CardChoiceCallback(card);
            });
        }
    }
Beispiel #2
0
    public void PresentChoiceOfPlayers(List <GamePlayer> players, Interpreter interpreter)
    {
        choiceDisplay.transform.parent.gameObject.SetActive(true);
        foreach (GamePlayer player in players)
        {
            GameObject display = Instantiate(choiceItemPrefab) as GameObject;
            display.transform.SetParent(choiceDisplay.transform);

            ChoiceItemDisplay displayInfo = display.GetComponent <ChoiceItemDisplay>();
            displayInfo.SetText(
                player.Name,
                player.Points + "pts\n" + player.Hand.GetNumCards() + "cards in hand"
                );
            Button button = display.GetComponent <Button>();
            button.onClick.AddListener(() => {
                RemoveChoiceDisplay();
                interpreter.PlayerChoiceCallback(player);
            });
        }
    }