public void DisplayItemPurchasePanel(UnityUIStoreItem item)
        {
            itemInfo = item;
            itemNameDisplay.text = item.storeItem.ItemInformation.Name;

            Debug.Log("Sale: " + item.storeItem.Sale.Count);

            if (item.storeItem.Sale.Count > 0)
            {
                if (item.storeItem.Sale[0].PremiumCurrencySaleValue > 0)
                    premiumCurrencyCost = item.storeItem.Sale[0].PremiumCurrencySaleValue;
                else
                {
                    premiumCurrencyCost = item.storeItem.CreditValue;
                }

                if (item.storeItem.Sale[0].StandardCurrencySaleValue > 0)
                    standardCurrencyCost = item.storeItem.Sale[0].StandardCurrencySaleValue;
                else
                    standardCurrencyCost = item.storeItem.CoinValue;
            }
            else
            {
                premiumCurrencyCost = item.storeItem.CreditValue;
                standardCurrencyCost = item.storeItem.CoinValue;
            }

            itemQuantityAmount.text = "1";
            SetItemDetailDisplay(item);

            itemTexture.texture = item.gameObject.GetComponentInChildren<RawImage>().texture;

            ChangePurchaseButtonDisplay(premiumCurrencyCost, standardCurrencyCost);
        }
Exemple #2
0
        void SetItemDetailDisplay(UnityUIStoreItem storeItem)
        {
            string statusText = "";

            foreach (StoreItem.StoreItemDetail detail in storeItem.storeItem.ItemDetails)
            {
                statusText += detail.Name + " : " + detail.Value + "\n";
            }

            itemDetailsDisplay.text = statusText;
        }
        public override void LoadStoreWithPaging(List <StoreItem> listItems, int pageNum)
        {
            if (isLoadingPage == false)
            {
                if (listItems.Count <= 0)
                {
                    ClearCurrentGrid();
                    return;
                }

                isLoadingPage = true;

                filteredList = listItems;

                if (currentPageItems.Count > 0)
                {
                    ClearCurrentGrid();
                }

                currentPageItems.Clear();

                int PageMax = GetPageMax(listItems.Count, pageNum);

                Debug.Log("Page num: " + pageNum);
                Debug.Log("pagemax: " + PageMax);
                Debug.Log("pageNUm + grid amount: " + (pageNum * maxGridAmount));

                for (int i = pageNum * maxGridAmount; i < (pageNum * maxGridAmount + PageMax); i++)
                {
                    Debug.Log("Index: " + i);

                    GameObject newItem = (GameObject)GameObject.Instantiate(itemButtonPrefab);
                    newItem.transform.SetParent(transform);
                    newItem.transform.localPosition = Vector3.zero;
                    newItem.transform.localScale    = Vector3.one;
                    currentPageItems.Add(newItem);

                    UnityUIStoreItem itemInfo = newItem.GetComponent <UnityUIStoreItem>();
                    itemInfo.Init(listItems[i], this);

                    Button storeButton = newItem.GetComponent <Button>();
                    storeButton.onClick.AddListener(itemInfo.OnStoreItemClicked);
                }

                SetPageButtons(GetPageAmount(listItems.Count));

                isLoadingPage = false;
            }
        }
Exemple #4
0
        public void DisplayItemPurchasePanel(UnityUIStoreItem item)
        {
            itemInfo             = item;
            itemNameDisplay.text = item.storeItem.ItemInformation.Name;

            Debug.Log("Sale: " + item.storeItem.Sale.Count);

            if (item.storeItem.Sale.Count > 0)
            {
                if (item.storeItem.Sale[0].PremiumCurrencySaleValue > 0)
                {
                    premiumCurrencyCost = item.storeItem.Sale[0].PremiumCurrencySaleValue;
                }
                else
                {
                    premiumCurrencyCost = item.storeItem.CreditValue;
                }

                if (item.storeItem.Sale[0].StandardCurrencySaleValue > 0)
                {
                    standardCurrencyCost = item.storeItem.Sale[0].StandardCurrencySaleValue;
                }
                else
                {
                    standardCurrencyCost = item.storeItem.CoinValue;
                }
            }
            else
            {
                premiumCurrencyCost  = item.storeItem.CreditValue;
                standardCurrencyCost = item.storeItem.CoinValue;
            }

            itemQuantityAmount.text = "1";
            SetItemDetailDisplay(item);

            itemTexture.texture = item.gameObject.GetComponentInChildren <RawImage>().texture;

            ChangePurchaseButtonDisplay(premiumCurrencyCost, standardCurrencyCost);
        }
        void SetItemDetailDisplay(UnityUIStoreItem storeItem)
        {
            string statusText = "";

            foreach (StoreItem.StoreItemDetail detail in storeItem.storeItem.ItemDetails)
            {
                statusText += detail.Name + " : " + detail.Value + "\n";
            }

            itemDetailsDisplay.text = statusText;
        }