コード例 #1
0
ファイル: GameManager.cs プロジェクト: HyunsunRyu/LineCrush
    public static void GameOver(bool bTimeUp)
    {
        if (instance == null)
        {
            return;
        }

        instance.bPlaying = false;
        instance.tileSystem.GameOver();

        ScenesManager.SetEscapeMethod(null);

        SoundManager.GetInstance().FadeOutAndStopBGM(Define.SoundType.TickTock, 0.5f);
        SoundManager.GetInstance().FadeOutAndStopBGM(Define.SoundType.TickTockBack, 0.5f);
        SoundManager.GetInstance().FadeOutAndStopBGM(Define.SoundType.GameBGM, 0.5f);

        TimeUpPopup popup = PopupSystem.GetPopup <TimeUpPopup>(Define.PopupType.TimeUp);

        popup.SetData(bTimeUp, () =>
        {
            bool bShowContinue = DataManager.GetInstance().CanShowContinueVideo();
            if (bShowContinue && UnityAdsController.IsReady(Define.continueId))
            {
                ContinueDialog.SetData(bTimeUp);
                UISystem.OpenDialog(Define.DialogType.ContinueDialog);
            }
            else
            {
                UISystem.OpenDialog(Define.DialogType.ResultDialog);
            }
        });
        PopupSystem.OpenPopup(Define.PopupType.TimeUp);

        instance.uiSystem.GameOver();
    }
コード例 #2
0
 private IEnumerator OnTimeUp()
 {
     while (true)
     {
         if (checking || gameState == GAMESTATE.PAUSED)
         {
             yield return(new WaitForSeconds(0.1f));
         }
         else
         {
             break;
         }
     }
     if (gameState == GAMESTATE.PLAYING)
     {
         int totalCount = ConfigController.Config.rubyCostToContinue.Length;
         int cost       = ConfigController.Config.rubyCostToContinue[continueCount];
         if (CurrencyController.GetBalance() >= cost && continueCount < totalCount)
         {
             System.Action onYes = (System.Action)(() =>
             {
                 continueCount++;
                 CurrencyController.DebitBalance(cost);
                 totalTime  += ConfigController.Config.continueTime;
                 warningTime = false;
                 timeUp      = false;
                 gameState   = GAMESTATE.PLAYING;
             });
             System.Action onNo = (System.Action)(() =>
             {
                 ShowEndGame(gameMode == GameMode.CLASSIC_MODE, false);
             });
             gameState = GAMESTATE.PAUSED;
             ContinueDialog contDialog = (ContinueDialog)DialogController.instance.GetDialog(DialogType.Continue);
             contDialog.message.SetText(cost.ToString());
             contDialog.onYesClick = onYes;
             contDialog.onNoClick  = onNo;
             DialogController.instance.ShowDialog(contDialog);
         }
         else
         {
             ShowEndGame(gameMode == GameMode.CLASSIC_MODE, false);
         }
     }
 }