コード例 #1
0
    public static BaseCardData CreateFromJson(JToken cardToken)
    {
        string type     = cardToken.Value <string>("cardType");
        string id       = cardToken.Value <string>("id");
        string titleKey = cardToken.Value <string>("titleKey");
        string iconName = cardToken.Value <string>("iconName");

        if (type == CardType.CUSTOMER)
        {
            CustomerCardData cData = new CustomerCardData();
            cData.cardType           = type;
            cData.id                 = id;
            cData.titleKey           = titleKey;
            cData.iconName           = iconName;
            cData.baseReward         = cardToken.Value <int>("baseReward");
            cData.meatRequirement    = cardToken.Value <int>("meatRequirement");
            cData.veggieRequirement  = cardToken.Value <int>("veggieRequirement");
            cData.toppingRequirement = cardToken.Value <int>("toppingRequirement");
            string modifier = cardToken.Value <string>("modifier");
            cData.modifier = (modifier == null) ? "" : modifier;
            return(cData);
        }
        else
        {
            IngredientCardData iData = new IngredientCardData();
            iData.cardType  = type;
            iData.id        = id;
            iData.titleKey  = titleKey;
            iData.iconName  = iconName;
            iData.foodValue = cardToken.Value <int>("foodValue");
            return(iData);
        }
    }
コード例 #2
0
    public static CustomerCardState Create(CustomerCardData cardData)
    {
        CustomerCardState state = new CustomerCardState();

        state.cardData        = cardData;
        state.lastPlayerIndex = -1;

        return(state);
    }
コード例 #3
0
    private void _setupCustomerCards(CardDeck customerDeck)
    {
        ActiveCustomerSet customers = ActiveCustomerSet.Create();

        // Intentionally not using commands here, as we don't want to be able to
        // undo the first set of customers
        for (int i = 0; i < ActiveCustomerSet.kMaxActiveCustomers; ++i)
        {
            CustomerCardData  cardData  = customerDeck.Pop() as CustomerCardData;
            CustomerCardState cardState = CustomerCardState.Create(cardData);
            customers.SetCustomerAtIndex(i, cardState);
        }
        activeCustomerSet = customers;
    }
コード例 #4
0
    public void Execute()
    {
        _savedCustomerState = _customerSet.GetCustomerByIndex(_slotIndex);
        _activePlayer.deadCustomerStack.Push(_savedCustomerState.cardData);

        CustomerCardData card = _customerDeck.Pop() as CustomerCardData;

        if (card != null)
        {
            CustomerCardState newState = CustomerCardState.Create(card);
            _customerSet.SetCustomerAtIndex(_slotIndex, newState);
        }
        else
        {
            _customerSet.SetCustomerAtIndex(_slotIndex, null);
        }
    }
コード例 #5
0
        /// <summary>
        /// Method returns string value of all values of CustomerCardData object
        /// </summary>
        /// <param name="oCustomerCardData">CustomerCardData object to create string from</param>
        /// <returns>string value containing all CustomerCardData object values</returns>
        public static string CustomerCardDataToString(this CustomerCardData oCustomerCardData)
        {
            if (oCustomerCardData == null)
            {
                return("");
            }

            var items = new Dictionary <string, string>();

            if (oCustomerCardData.Items != null && oCustomerCardData.ItemsElementName != null)
            {
                for (int i = 0; i < oCustomerCardData.Items.Length; i++)
                {
                    items.Add(oCustomerCardData.ItemsElementName[i].ToString(), oCustomerCardData.Items[i]);
                }
            }

            return(items.NotNullDataToString() + Environment.NewLine);
        }