Example #1
0
    public bool SetUp(IReadOnlyList <ICanBeCardViewed> pickableCards, int minCards, int maxCards, string headerMessage, Action <List <Card> > handler)
    {
        if (pickableCards.Count < minCards)
        {
            return(false);
        }
        UIEvents.EnableUIBlocker.Invoke();
        headerTextMesh.text = GetHeaderString(minCards, maxCards, headerMessage);

        this.handler  = handler;
        this.minCards = minCards;
        this.maxCards = maxCards;
        // enable button if needed
        if (minCards == 0)
        {
            confirmButton.gameObject.SetActive(true);
        }
        else
        {
            confirmButton.gameObject.SetActive(false);
        }
        // setup individual card veiwers
        foreach (ICanBeCardViewed c in pickableCards)
        {
            scrollView.AddCard(c);
        }
        foreach (CardViewer c in scrollView.ActiveViewers)
        {
            c.E_OnClicked.AddListener(ToggleCardPicked);
        }
        return(true);
    }
    public void SetupAndShow(List <Card> cardList, string windowName)
    {
        foreach (Card c in cardList)
        {
            scrollView.AddCard(c);
        }

        headerText.text = windowName;
        gameObject.SetActive(true);
    }