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++; } }
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++; } }
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]"; }