Ejemplo n.º 1
0
        private IEnumerator ResizeSubCategories(ShopData _shopData)
        {
            yield return(new WaitForEndOfFrame());

            for (int i = 0; i < categories.Count; i++)
            {
                CategoryVisual categoryVisual = categories[i];
                if (categoryVisual != null)
                {
                    categoryVisual.ResizeSubCategories(_shopData.line, _shopData.column, _shopData.categories[i]);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Update the shop view based on _shop
        /// </summary>
        /// <param name="shopData"></param>
        public void UpdateShopView(ShopData shopData)
        {
            if (shopData == null || categories == null || categories.Count == 0)
            {
                return;
            }

            for (int i = 0; i < categories.Count; i++)
            {
                CategoryVisual categoryVisual = categories[i];
                if (categoryVisual)
                {
                    categoryVisual.UpdateCategory(shopData.categories[i]);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create and initialize the shop view based on _shopData.
        /// This method is called automatically in the Initialize method of the Shop.
        /// </summary>
        /// <param name="_shopData"></param>
        public void CreateVisualShop(ShopData _shopData)
        {
            categories     = new List <CategoryVisual>();
            chestRoomText  = chestRoomArea.GetComponentInChildren <TextMeshProUGUI>(true);
            comingSoonText = comingSoonArea.GetComponentInChildren <TextMeshProUGUI>(true);
            titleText      = header.GetComponentInChildren <TextMeshProUGUI>(true);
            canvas         = GetComponentInParent <Canvas>();
            canvasGroup    = GetComponent <CanvasGroup>();
            camera         = canvas.GetComponentInChildren <Camera>(true);
            shop           = Shop.Instance;

            if (_shopData == null)
            {
                return;
            }

            if (rvButton != null)
            {
                rvButton.UpdateValue(_shopData.RVBonusCurrency, _shopData.RVBonusValue);
            }

            if (paymentPicker != null)
            {
                paymentPicker.buttonPicker.onClick.AddListener(RequestPurchase);
            }

            if (scrollRect != null)
            {
//					List<CategoryDataServer> categoryDataServers = RemoteConfigManager.Instance.List<CategoryDataServer>();

                for (var i = 0; i < _shopData.categories.Count; i++)
                {
                    CategoryData categoryData = _shopData.categories[i];

//						CategoryDataServer categoryDataServer = categoryDataServers.Find(x => x.id == categoryData.id);
//						if (categoryDataServer != null)
//							categoryData.Initialize(categoryDataServer);

                    CategoryVisual categoryVisual = categoryData.AddShopCategory(scrollRect, subCategoryDotZoneParent);
                    categories.Add(categoryVisual);
                }
            }

            StartCoroutine(ResizeSubCategories(_shopData));
        }