Exemplo n.º 1
0
    public void UpdateDeck()
    {
        gridField.QueueFreeChildren();
        int index = 0;

        foreach (CardId id in GameData.Instance.Deck)
        {
            CardVisual visual = CardVisual.Instance();
            gridField.AddChild(visual);
            visual.Connect(nameof(CardVisual.OnClick), this, nameof(OpenCard));
            visual.ShowCard(id.Data());
            index++;
        }
    }
Exemplo n.º 2
0
    public void ShowDeck()
    {
        CloseCard();
        GameData.Instance.Deck = GameData.Instance.Deck.OrderBy(card => (int)card).ToList();
        gridField.QueueFreeChildren();
        int index = 0;

        foreach (CardId id in GameData.Instance.Deck)
        {
            CardVisual visual = CardVisual.Instance();
            gridField.AddChild(visual);
            visual.Connect(nameof(CardVisual.OnClick), this, nameof(OpenCard));
            visual.ShowCard(id.Data());
            index++;
        }
    }
Exemplo n.º 3
0
    public void SetCard(CardId card, int index)
    {
        CardVisual cardVisual = index switch { 0 => leftCard, 1 => middleCard, 2 => rightCard, _ => null };

        cardsForSale[index] = card;
        if (card == CardId.None)
        {
            cardVisual.Hide();
        }
        else
        {
            cardVisual.ShowCard(card.Data());
            cardVisual.Show();
        }

        cardVisual.GetNode <SmartText>("Text").BbcodeText = $"[center]{card.Data().MonPrice} [img]res://Assets/Sprites/GUI/mon_icon.png[/img][/center]";
    }