Пример #1
0
        public void Failed()
        {
            string       levelNumber = string.Format("Level {0}", GameDataMgr.G.endLevel.ToString());
            PopupConfirm temp        = PopupConfirm.Open("Prefabs/Popup/GamePopup", "FailedPopup", levelNumber, null, "Try Again");

            temp.GetComponent <GamePopup>().OnPopup(GamePopupState.failed);
            GamePopupItemGroup item = temp.GetComponentInChildren <GamePopupItemGroup>();

            if (item != null)
            {
                item.BoosterItemSetting();
                item.gameObject.GetComponent <UIWidget>().bottomAnchor.absolute = -4;
            }

            temp.onConfirm += () =>
            {
                temp.Close();
                Reset();
                PopupGoal.Open("Goal Popup", level.goals);
            };

            temp.onEixt += () =>
            {
                sceneFade.delayTime = 0.15f;
                sceneFade.fadeTime  = 0.3f;
                sceneFade.OnPressed();
            };
        }
Пример #2
0
        public void Failed()
        {
            UserDataMgr.G.UpdateLife();

            string       levelNumber = string.Format("LEVEL {0}", GameDataMgr.G.endLevel.ToString());
            PopupConfirm temp        = PopupConfirm.Open("Prefabs/Popup/GamePopup", "FailedPopup", levelNumber, null, "TRY AGAIN", false);

            temp.GetComponent <GamePopup>().OnPopup(GamePopupState.failed);
            GamePopupItemGroup item = temp.GetComponentInChildren <GamePopupItemGroup>();

            if (item != null)
            {
                item.BoosterItemSetting();
                item.gameObject.GetComponent <UIWidget>().bottomAnchor.absolute = -4;
            }

            temp.onConfirm += () =>
            {
                if (UserDataMgr.G.life > 0)
                {
                    temp.Close();
                    Reset();
                    PopupGoal.Open("Goal Popup", level.goals);
                }
                else
                {
                    int count = 1;
                    if (UserDataMgr.G.IsItemCoins(count))
                    {
                        PopupMgr.G.ShowItemPopup("Life Item Popup", "LIFE", "You can play the game with life!", "BUY",
                                                 "life_icon", count, GameDataMgr.G.itemCost, () =>
                        {
                            UserDataMgr.G.CoinsUsed(GameDataMgr.G.itemCost * count);
                            UserDataMgr.G.life += count;
                            UserDataMgr.G.SetTimeToNextLife();
                        }, true);
                    }
                    else
                    {
                        PopupMgr.G.ShowAdsPopup(null, "Watch ads and get rewarded.", "OK");
                    }
                }
            };

            temp.onExit += () =>
            {
                GoLooby();
            };
        }