Ejemplo n.º 1
0
        private void CreateThingTab()
        {
            ShopThingHelper[] sT = ThingsParent.GetComponentsInChildren <ShopThingHelper>();
            foreach (var item in sT)
            {
                DestroyImmediate(item.gameObject);
            }

            Purchaser p = Purchaser.Instance;

            if (p == null)
            {
                return;
            }

            List <ShopThingDataReal> products = new List <ShopThingDataReal>();

            VideoPurchaser vP = VideoPurchaser.Instance;

            if (vP && vP.gameProducts != null && vP.gameProducts.Length > 0)
            {
                products.AddRange(vP.gameProducts);
            }

            if (p.consumable != null && p.consumable.Length > 0)
            {
                products.AddRange(p.consumable);
            }
            if (p.nonConsumable != null && p.nonConsumable.Length > 0)
            {
                products.AddRange(p.nonConsumable);
            }
            if (p.subscriptions != null && p.subscriptions.Length > 0)
            {
                products.AddRange(p.subscriptions);
            }

            Debug.Log("products count: " + products.Count);
            if (products.Count == 0)
            {
                return;
            }

            shopThings = new List <ShopThingHelper>();
            for (int i = 0; i < products.Count; i++)
            {
                if (products[i] != null && (products[i].shopType == shopType) && products[i].prefab)
                {
                    shopThings.Add(ShopThingHelper.CreateShopThingsHelper(products[i].prefab, ThingsParent, products[i]));
                }
            }

            if (scrollFlag)
            {
                scrollFlag.SetActive(products.Count > 4);
            }
        }
Ejemplo n.º 2
0
        private void CreateThingTab()
        {
            ShopThingHelper[] sT = ThingsParent.GetComponentsInChildren <ShopThingHelper>();
            foreach (var item in sT)
            {
                DestroyImmediate(item.gameObject);
            }

            InGamePurchaser p = InGamePurchaser.Instance;

            if (p == null)
            {
                return;
            }

            List <ShopThingDataInGame> products = new List <ShopThingDataInGame>();

            if (p.gameProducts != null && p.gameProducts.Length > 0)
            {
                products.AddRange(p.gameProducts);
            }


            if (products.Count == 0)
            {
                return;
            }

            shopThings = new List <ShopThingHelper>();
            for (int i = 0; i < products.Count; i++)
            {
                Debug.Log(ID + " : " + products[i].kProductID);

                if (string.IsNullOrEmpty(ID) || ID.Contains(products[i].kProductID))
                {
                    if (products[i] != null && (products[i].shopType == shopType) && products[i].prefab)
                    {
                        shopThings.Add(ShopThingHelper.CreateShopThingsHelper(products[i].prefab, ThingsParent, products[i]));
                    }
                }
            }
            if (caption && !string.IsNullOrEmpty(ShopCaption))
            {
                caption.text = ShopCaption;
            }
            if (scrollFlag)
            {
                scrollFlag.SetActive(products.Count > 2);
            }
            ID          = null;
            ShopCaption = null;
        }
Ejemplo n.º 3
0
        private void CreateThingTab()
        {
            ShopThingHelper[] sT = ThingsParent.GetComponentsInChildren <ShopThingHelper>();
            foreach (var item in sT)
            {
                DestroyImmediate(item.gameObject);
            }

            InGamePurchaser p = InGamePurchaser.Instance;

            if (p == null)
            {
                return;
            }

            List <ShopThingDataInGame> products = new List <ShopThingDataInGame>();

            if (p.gameProducts != null && p.gameProducts.Length > 0)
            {
                products.AddRange(p.gameProducts);
            }


            if (products.Count == 0)
            {
                return;
            }

            shopThings = new List <ShopThingHelper>();
            for (int i = 0; i < products.Count; i++)
            {
                if (products[i] != null && (products[i].shopType == shopType) && products[i].prefab)
                {
                    shopThings.Add(ShopThingHelper.CreateShopThingsHelper(products[i].prefab, ThingsParent, products[i]));
                }
            }
        }