//set values
    //Input: sending player string, activity card to be cooperated on, choice index highlighted by sending player
    public void Init(string sendingPlayerCompanyName, ActivityCard activityCard, ActivityChoice choice)
    {
        companyNameText.text = sendingPlayerCompanyName;

        coopCardController.SetCardData(activityCard);
        coopCardController.HighlightChoice(choice);
        coopCardController.SetPlayerHandController(GameObject.Find("Player").GetComponent <PlayerHandController>());
    }
Ejemplo n.º 2
0
 public void CheckForDuplicatesInHand(ActivityCard card)
 {
     for (int i = 0; i < handTransform.childCount; i++)
     {
         if (handTransform.GetChild(i).GetComponent <CardController>().cardData == card)
         {
             handTransform.GetChild(i).GetComponent <CardController>().DestroyCard();
         }
     }
 }
Ejemplo n.º 3
0
            public void AddCard(ActivityCard card)
            {
                if (_cards.ContainsKey(card.Id))
                {
                    _cards[card.Id].Add(card);
                }
                else
                {
                    IList <ActivityCard> newCards = new List <ActivityCard>();
                    newCards.Add(card);

                    _cards.Add(card.Id, newCards);
                }
            }
Ejemplo n.º 4
0
    List <int> choicePrerequisitesIndices; //list of indices for popups

    //List<string> choicePrerequisitesOptions;

    public static void Init(ActivityCard activityCard)
    {
        ActivityCardEditor window = EditorWindow.GetWindow <ActivityCardEditor>(typeof(ActivityCardEditor));

        //init editor values
        window.activityCard = activityCard;

        //set up choicePrerequisites indices to point to the correct choice index in the card
        window.choicePrerequisitesIndices = new List <int>();
        foreach (var prerequisite in activityCard.choicePrerequisites)
        {
            window.choicePrerequisitesIndices.Add(prerequisite.choiceIndex);
        }
        window.Show();
    }
Ejemplo n.º 5
0
    //Gets valid card based on Player's stats, features and history
    public ActivityCard GetCard(int currentTurn, CardIntDictionary choiceHistory, PlayerStatIntDictionary playerStats, HashSet <BusinessFeatureTitle> purchasedFeatures)
    {
        ActivityCard result = null;

        //Check priority queue first
        if (priorityCards.Count > 0)
        {
            var queueCard = priorityCards.Dequeue();
            if (queueCard.ValidateCard(currentTurn, purchasedFeatures, playerStats, choiceHistory))
            {
                result = queueCard;
            }
        }
        else //otherwise find random valid card from list of all cards
        {
            //super duper excellent algorithm for getting random card..
            HashSet <int> used = new HashSet <int>();
            while (result == null && used.Count < deck.Count)
            {
                int index = Random.Range(0, deck.Count);
                if (!used.Contains(index))
                {
                    used.Add(index);
                    if (deck[index].ValidateCard(currentTurn, purchasedFeatures, playerStats, choiceHistory))
                    {
                        result = deck[index];
                        deck.RemoveAt(index);
                    }
                }
            }
            //for(int i = 0; i < deck.Count; i++)
            //{

            //}
        }
        if (result != null)
        {
            return(result);
        }
        else
        {
            //No cards returned..
            Debug.Log("No valid cards were found", this);
            return(null);
        }
    }
Ejemplo n.º 6
0
    public void SetCardData(ActivityCard activityCard)
    {
        this.cardData  = activityCard;
        choiceDropdown = transform.Find("ChoiceDropdown").GetComponent <TMP_Dropdown>();
        //set type text
        transform.Find("TypeText").GetComponent <TextMeshProUGUI>().text = cardData.cardCategory.ToString();

        //set description text
        transform.Find("DescriptionScrollView/Viewport/Content/DescriptionText").GetComponent <TextMeshProUGUI>().text = cardData.description;

        //Temporary way of displaying valid choices
        for (int i = 0; i < cardData.choices.Count; i++)
        {
            choiceDropdown.options.Add(new TMP_Dropdown.OptionData(cardData.choices[i].title));
        }

        //force label to update
        choiceDropdown.transform.Find("Label").GetComponent <TextMeshProUGUI>().text = choiceDropdown.options[0].text;
    }
Ejemplo n.º 7
0
    public void FillHand(int currentTurn, CardIntDictionary choiceHistory, PlayerStatIntDictionary playerStats, HashSet <BusinessFeatureTitle> purchasedFeatures)
    {
        //Gets card asset from deck, instantiates new cards with that asset
        //Until hand is full
        while (handTransform.childCount < maxCardsInHand)
        {
            ActivityCard newCard = deck.GetCard(currentTurn, choiceHistory, playerStats, purchasedFeatures);
            if (newCard == null)
            {
                Debug.Log("No new cards found");
                break;
            }

            //spawn coop or individual card

            GameObject c = newCard.cooperative ? Instantiate(coopCardPrefab, handTransform, false) : Instantiate(individualCardPrefab, handTransform, false);
            c.GetComponent <CardController>().cardData             = newCard;
            c.GetComponent <CardController>().playerHandController = this;
        }

        //Set interactable status in all cards
        SetInteractableInCards();
    }
Ejemplo n.º 8
0
 //Public methods
 public void AddToQueue(ActivityCard card)
 {
     priorityCards.Enqueue(card);
 }
Ejemplo n.º 9
0
            public void AddCard(ActivityCard card)
            {
                if (_cards.ContainsKey(card.Id))
                {
                    _cards[card.Id].Add(card);
                }
                else
                {
                    IList<ActivityCard> newCards = new List<ActivityCard>();
                    newCards.Add(card);

                    _cards.Add(card.Id, newCards);
                }
            }