Created a card hand from a list but cannot access card hand

Gid day all,

I am trying to create a 2d card game. I have a List of cards within a CardStack Class, which is used to push and pop two different card hands (their each CardStack) of five cards. I have been modifying/working off Sloan Kelly’s Black Jack card game tutorial.

I do not know how to C# script a button to push/pop each one of the different cards in the hands?

Thank you for any assistance

Gid day all,

This is the CardStack C# script for the cards

public class CardStack : MonoBehaviour
{
List cards;

public bool isGameDeck;



public bool HasCards
{
	get { return cards != null && cards.Count > 0; }
}

public event CardRemoveEventHandler CardRemoved;

public int CardCount
{
	get
	{ 
		if(cards == null)
		{
			return 0;
		}
		else
		{
			return cards.Count;
		}
	}
}

public IEnumerable<int> GetCards()
{
	foreach(int i in cards)
	{
		yield return i;
	}
}

public int Pop()
{
	int temp = cards[0];
	cards.RemoveAt(0);

	if(CardRemoved != null)
	{
		CardRemoved(this, new CardRemoveEventArgs(temp));
	}
	return temp;
}

public void Push(int card)
{
	cards.Add(card);
}

This is part of my GameController script which push/pop the different hands of cards.

[RequireComponent(typeof(CardStackView))]
[RequireComponent(typeof(CardStack))]
[RequireComponent(typeof(FPSCounter))]

public class GameController : MonoBehaviour
{
public CardStack player;
public CardStack dealer;
public CardStack deck;
public CardStack makingCard;
public CardStack playingHand;
public CardStack discardPile;
#region Unity messages
void Start()
{
StartGame();
}
#endregion
public void PlayerPlayingACard()
{
Debug.Log(“you have pressed a button”);
playingHand.Push(player.Pop());
}
void StartGame()
{
for (int i = 0; i < 5; i++)
{
player.Push(deck.Pop());
dealer.Push(deck.Pop());
}
makingCard.Push(deck.Pop());
WhatCard();
HandToArray();
}

I am having problems with attaching a function for UI Buttons which push/pop individual player CardStack cards so the player can pay any of the card. This is a Euchre game.

Thank you for any assistance