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 async Task AddCard(CardId card) { CardVisual visualCard; lock (handFlowLock) { visualCard = CardVisual.Instance(); visuals.Add(visualCard); } container.AddChild(visualCard); visualCard.Modulate = new Color(1, 1, 1, 0); visualCard.ShowCard(card.Data()); visualCard.MoveFrom(new Vector2(1000, 0)); await ToSignal(visualCard.MyTween, "tween_completed"); Refresh(); visualCard.Connect(nameof(CardVisual.OnClick), this, nameof(SelectCard), visualCard.InArray()); visualCard.Connect(nameof(CardVisual.FocusEntered), this, nameof(HoverCard)); visualCard.Connect(nameof(CardVisual.FocusExited), this, nameof(UnHoverCard)); }