Beispiel #1
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));
        }