Beispiel #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();
            };
        }
Beispiel #2
0
        IEnumerator Co_Failed()
        {
            while (stage.isWait)
            {
                yield return(null);
            }
            while (stage.IsMoving(State.move))
            {
                yield return(null);
            }

            yield return(new WaitForSecondsRealtime(.5f));

            textAnim.SetTrigger("FailedOn");
            yield return(new WaitForSecondsRealtime(0.8f));

            PopupConfirm noMoves = PopupConfirm.Open("Prefabs/Popup/NoMovesPopup", "Failed Moves Popup", null, null, "Play On");

            noMoves.onConfirm += () =>
            {
                currentLimit = 5;
                UpdateLimitCount();
                isGameEnd = false;
            };

            noMoves.onEixt += () =>
            {
                noMoves.Close();

                Failed();
            };
        }
Beispiel #3
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();
            };
        }
Beispiel #4
0
        IEnumerator Co_Failed()
        {
            uiSettingBtn.btn.enabled = false;
            while (stage.isWait)
            {
                yield return(null);
            }
            while (stage.IsMoving(State.move))
            {
                yield return(null);
            }

            yield return(new WaitForSeconds(.5f));

            SoundMgr.G.GameEffectPlay(EffectSound.lose);
            textAnim.SetTrigger("FailedOn");
            yield return(new WaitForSeconds(0.8f));

            PopupConfirm noMoves      = PopupConfirm.Open("Prefabs/Popup/NoMovesPopup", "Failed Moves Popup", null, null, "PLAY ON", false);
            PopupNoMoves popupNoMoves = noMoves.GetComponent <PopupNoMoves>();

            if (popupNoMoves != null)
            {
                popupNoMoves.SetCoin();
            }

            noMoves.onConfirm += () =>
            {
                int useCoin = 100;
                if (UserDataMgr.G.IsCoins(useCoin))
                {
                    currentLimit = 5;
                    UpdateLimitCount();
                    stage.BlockIconSetting();
                    isGameEnd = false;
                    uiSettingBtn.btn.enabled = true;
                    UserDataMgr.G.CoinsUsed(useCoin);
                    if (popupNoMoves != null)
                    {
                        popupNoMoves.SetCoin();
                    }
                    noMoves.Close();
                }
                else
                {
                    PopupMgr.G.ShowAdsPopup(null, "Watch ads and get rewarded.", "OK", () =>
                    {
                        AdsMgr.G.fncSuccess = () =>
                        {
                            if (popupNoMoves != null)
                            {
                                popupNoMoves.SetCoin();
                            }
                        };
                    });
                }
            };

            noMoves.onExit += () =>
            {
                noMoves.Close();

                Failed();
            };
        }