Example #1
0
 void Awake()
 {
     if (Instance)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
 }
Example #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;
        }
        private void CreateBoostersPanel()
        {
            FooterBoosterHelper[] fBH = BoostersParent.GetComponentsInChildren <FooterBoosterHelper>();
            foreach (FooterBoosterHelper item in fBH)
            {
                DestroyImmediate(item.gameObject);
            }
            BoostersHolder bHolder = BubblesPlayer.Instance.BoostHolder;

            foreach (var item in bHolder.Boosters)
            {
                item.CreateFooterBooster(BoostersParent, footerBoosterPrefab, () =>
                {
                    int id = item.bData.ID;
                    InGamePurchaser iGP    = InGamePurchaser.Instance;
                    ShopThingDataInGame sd = iGP.GetProductById(id.ToString());
                    if (BubblesGuiController.Instance)
                    {
                        switch (sd.shopType)
                        {
                        case InGameShopType.None:
                            break;

                        case InGameShopType.BoosterMulticolor:
                            BubblesGuiController.Instance.ShowBoosterMulticolorShop();
                            break;

                        case InGameShopType.BoosterFireBall:
                            BubblesGuiController.Instance.ShowBoosterFireBallShop();
                            break;

                        case InGameShopType.BoosterEyeBall:
                            BubblesGuiController.Instance.ShowBoosterEyeBallShop();
                            break;

                        default:
                            break;
                        }
                    }
                });
            }
        }
Example #4
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]));
                }
            }
        }