Exemple #1
0
        /// <summary>
        /// Initialize the Category
        /// </summary>
        /// <param name="_categoryData"></param>
        /// <param name="_subCategoryDotsZoneParent"></param>
        /// <param name="_scrollRect"></param>
        public void Initialize(CategoryData _categoryData, Transform _subCategoryDotsZoneParent, ScrollRect _scrollRect)
        {
            shopView           = ShopView.Instance;
            payments           = new List <Payment>();
            subCategoryVisuals = new List <SubCategoryVisual>();
            scrollRect         = (ScrollRectSwipe)_scrollRect;
            toggleGroup        = GetComponent <ToggleGroup>();
            layoutGroup        = GetComponent <LayoutGroup>();

//            List<SubCategoryDataServer> categoryDataServers = RemoteConfigManager.Instance.List<SubCategoryDataServer>();
//            categoryDataServers.AddRange(RemoteConfigManager.Instance.List<SubCategoryDataSkinServer>());
//            categoryDataServers.AddRange(RemoteConfigManager.Instance.List<SubCategoryDataBundleServer>());

            for (int i = 0; i < _categoryData.subCategories.Count; i++)
            {
                SubCategoryData subCategoryData = _categoryData.subCategories[i];
                if (subCategoryData != null)
                {
//                    SubCategoryDataServer categoryDataServer = categoryDataServers.Find(x => x.id == subCategoryData.id);
//                    if (categoryDataServer != null)
//                        subCategoryData.Initialize(categoryDataServer);

                    SubCategoryVisual subCategoryVisual = subCategoryData.AddSubCategory(transform);
                    subCategoryVisuals.Add(subCategoryVisual);
                    payments.Add(subCategoryData.payment);
                }
            }

            scrollRect.content = GetComponent <RectTransform>();

            UpdateToggleGroup(_categoryData);
            InitDots(_categoryData, _subCategoryDotsZoneParent);
        }
Exemple #2
0
        /// <summary>
        /// Instantiate the prefab of the subcategory under _parent and initialize it with the related data.
        /// Returns the instance of the prefab.
        /// </summary>
        /// <param name="_parent"></param>
        /// <returns></returns>
        public SubCategoryVisual AddSubCategory(Transform _parent)
        {
            SubCategoryVisual subCategoryVisual = Instantiate(prefab, _parent);

            subCategoryVisual.Initialize(this, _parent);

            return(subCategoryVisual);
        }
Exemple #3
0
 protected virtual void Reset()
 {
     id     = Guid.NewGuid().GetHashCode();
     title  = name;
     prefab = null;
     CreatePaymentInstance(typeof(PaymentCurrency));
     line   = 0;
     column = 0;
 }
Exemple #4
0
 /// <summary>
 /// Loop over each subCategoryData of the _categoryData  and resize them.
 /// They will match whether the default values _line & _column or the one from the their subCategoryData.
 /// </summary>
 /// <param name="_line"></param>
 /// <param name="_column"></param>
 /// <param name="_categoryData"></param>
 public void ResizeSubCategories(uint _line, uint _column, CategoryData _categoryData)
 {
     for (int i = 0; i < subCategoryVisuals.Count; i++)
     {
         SubCategoryVisual subCategoryVisual = subCategoryVisuals[i];
         subCategoryVisual.ResizeComponent();
         subCategoryVisual.ResizeContent(_line, _column, _categoryData.subCategories[i], scrollRect);
     }
 }
Exemple #5
0
        /// <summary>
        /// Update the category UI based on _categoryData
        /// </summary>
        /// <param name="_categoryData"></param>
        public void UpdateCategory(CategoryData _categoryData)
        {
            UpdateToggleGroup(_categoryData);

            for (int i = 0; i < subCategoryVisuals.Count; i++)
            {
                SubCategoryVisual subCategoryVisual = subCategoryVisuals[i];
                subCategoryVisual.UpdateSubCategory(_categoryData.subCategories[i]);
            }
        }