Beispiel #1
0
        /// <summary>
        /// Create new footer booster instance
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="prefab"></param>
        /// <param name="boost"></param>
        /// <param name="GotoShopHandler"></param>
        /// <returns></returns>
        public FooterBoosterHelper CreateFooterBooster(RectTransform parent, FooterBoosterHelper prefab, Action GotoShopHandler)
        {
            Debug.Log("create footer booster");
            footerBooster = UnityEngine.Object.Instantiate(prefab);
            footerBooster.transform.localScale = parent.transform.lossyScale;
            footerBooster.transform.SetParent(parent);
            footerBooster.boosterImage.sprite = bData.GuiImage;
            footerBooster.boosterCounter.text = Count.ToString();

            // add footer click handlers
            FooterClickEvent = () => { if (GotoShopHandler != null && Count == 0)
                                       {
                                           GotoShopHandler();
                                       }
            };
            FooterClickEvent += FooterClickEventHandler;
            footerBooster.boosterButton.onClick.AddListener(FooterClickEvent.Invoke);

            footerBooster.booster = this;
            footerBooster.InitStart();
            return(footerBooster);
        }
Beispiel #2
0
        /// <summary>
        /// Create new footer booster instance
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="prefab"></param>
        /// <param name="boost"></param>
        /// <param name="GotoShopHandler"></param>
        /// <returns></returns>
        public FooterBoosterHelper CreateFooterBooster(RectTransform parent, GameObject prefab, Action GotoShopHandler)
        {
            GameObject footerBooster = UnityEngine.Object.Instantiate(prefab);

            footerBooster.transform.localScale = parent.transform.lossyScale;
            footerBooster.transform.SetParent(parent);
            FooterBoosterHelper footerBoosterHelper = footerBooster.GetComponent <FooterBoosterHelper>();

            footerBoosterHelper.boosterImage.sprite = bData.GuiImage;

            // add footer click handlers
            FooterClickEvent = () => { if (GotoShopHandler != null && Count == 0)
                                       {
                                           GotoShopHandler();
                                       }
            };
            FooterClickEvent += FooterClickEventHandler;
            footerBoosterHelper.boosterButton.onClick.AddListener(OnFooterClickEvent);

            footerBoosterHelper.booster = this;
            return(footerBoosterHelper);
        }