Example #1
0
    IEnumerator EndGame()
    {
        yield return(new WaitForSeconds(1));

        admob.ShowInterstitial();
        Time.timeScale = 0;
        time.value     = 0;
        for (i = 1; i <= layoutlength; i++)
        {
            becuri [i].sprite     = nulla;
            becuriframe [i].color = new Color(1f, 0f, 0f, 0.5f);
            starttimetext.gameObject.SetActive(false);
            gameover.gameObject.SetActive(true);


            Text actualscore   = gameover.Find("ActualScore").GetComponent <Text> ();
            Text bestscoretext = gameover.Find("BestScore").GetComponent <Text> ();
            actualscore.text = scoreint.ToString();

            if (scoreint > PlayerPrefs.GetInt("Best" + layoutnumber.ToString()))
            {
                PlayerPrefs.SetInt("Best" + layoutnumber.ToString(), scoreint);
            }

            bestscoretext.text = PlayerPrefs.GetInt("Best" + layoutnumber.ToString()).ToString();


            StopAllCoroutines();
        }
    }
    void EndScores()
    {
        for (i = 1; i <= questionNumber; i++)
        {
            scoreTextsEnd [i].SetActive(true);
            scoreTextsAux [i].SetActive(true);

            Text aux = scoreTextsEnd[i].transform.Find("Text").GetComponent <Text>();
            if (answered[i].correct)
            {
                aux.color = Color.green;
                aux.text  = "Correct!";
            }
            else
            {
                aux.color = Color.red;
                aux.text  = "Incorrect!";
            }
        }
        for (i = questionNumber + 1; i <= 15; i++)
        {
            scoreTextsEnd [i].SetActive(false);
            scoreTextsAux [i].SetActive(false);
        }
        admob.ShowInterstitial();
    }
        public void ShowInterstitial(Action onAdClosed)
        {
                        #if UNITY_EDITOR
            onAdClosed();
            return;
                        #endif

            if (AdsEnabled)
            {
                switch (interstitialAdNetworkToUse)
                {
                                #if ALLINONE_ADMOB
                case InterstitialAdNetworks.admob:
                    adMob.ShowInterstitial(onAdClosed);
                    break;
                                #endif
                                        #if ALLINONE_CHARTBOOST
                case InterstitialAdNetworks.chartboost:
                    chartboost.ShowInterstitial(onAdClosed);
                    break;
                                        #endif
                default:
                    break;
                }
            }
            else
            {
                Debug.LogWarning("Calling interstitial but ads are not enabled");
            }
        }
Example #4
0
 void Update()
 {
     if (showAd == true)
     {
         adMob.ShowInterstitial();
     }
     if (proccessEvent)
     {
         time += Time.deltaTime;
         if (time > 0.35f)
         {
             switch (message)
             {
             case "BackMainMenu":
                 StateManager.ChangeState("MainMenu", "State.MainMenuState");
                 break;
             }
         }
     }
 }
Example #5
0
    public void Finish(string diff)
    {
        congratsMenu.SetActive(true);
        moves.text = Scorehandler.moves.ToString();

        if (diff == "easy")
        {
            if ((Scorehandler.moves <= 84 && Scorehandler.moves > 72) || Scorehandler.moves > 84)
            {
                rank.text = "F";
            }
            if (Scorehandler.moves <= 72)
            {
                rank.text = "E";
            }
            if (Scorehandler.moves <= 60)
            {
                rank.text = "D";
            }
            if (Scorehandler.moves < 48)
            {
                rank.text = "C";
            }
            if (Scorehandler.moves <= 36)
            {
                rank.text = "B";
            }
            if (Scorehandler.moves <= 24)
            {
                rank.text = "A";
            }

            if (PlayerPrefs.GetInt("EasyMoves") == 0)
            {
                PlayerPrefs.SetInt("EasyMoves", Scorehandler.moves);
                PlayerPrefs.SetString("EasyRank", rank.text);
            }
            else if (Scorehandler.moves < PlayerPrefs.GetInt("EasyMoves") && PlayerPrefs.GetInt("EasyMoves") != 0)
            {
                PlayerPrefs.SetInt("EasyMoves", Scorehandler.moves);
                PlayerPrefs.SetString("EasyRank", rank.text);
            }
        }
        else if (diff == "medium")
        {
            if ((Scorehandler.moves <= 108 && Scorehandler.moves > 96) || Scorehandler.moves > 108)
            {
                rank.text = "F";
            }
            if (Scorehandler.moves <= 96)
            {
                rank.text = "E";
            }
            if (Scorehandler.moves <= 84)
            {
                rank.text = "D";
            }
            if (Scorehandler.moves < 72)
            {
                rank.text = "C";
            }
            if (Scorehandler.moves <= 60)
            {
                rank.text = "B";
            }
            if (Scorehandler.moves <= 48)
            {
                rank.text = "A";
            }

            if (PlayerPrefs.GetInt("MediumMoves") == 0)
            {
                PlayerPrefs.SetInt("MediumMoves", Scorehandler.moves);
                PlayerPrefs.SetString("MediumRank", rank.text);
            }
            else if (Scorehandler.moves < PlayerPrefs.GetInt("MediumMoves") && PlayerPrefs.GetInt("MediumMoves") != 0)
            {
                PlayerPrefs.SetInt("MediumMoves", Scorehandler.moves);
                PlayerPrefs.SetString("MediumRank", rank.text);
            }
        }
        else if (diff == "hard")
        {
            if ((Scorehandler.moves <= 156 && Scorehandler.moves > 144) || Scorehandler.moves > 156)
            {
                rank.text = "F";
            }
            if (Scorehandler.moves <= 144)
            {
                rank.text = "E";
            }
            if (Scorehandler.moves <= 132)
            {
                rank.text = "D";
            }
            if (Scorehandler.moves < 120)
            {
                rank.text = "C";
            }
            if (Scorehandler.moves <= 108)
            {
                rank.text = "B";
            }
            if (Scorehandler.moves <= 96)
            {
                rank.text = "A";
            }

            if (PlayerPrefs.GetInt("HardMoves") == 0)
            {
                PlayerPrefs.SetInt("HardMoves", Scorehandler.moves);
                PlayerPrefs.SetString("HardRank", rank.text);
            }
            else if (Scorehandler.moves < PlayerPrefs.GetInt("HardMoves") && PlayerPrefs.GetInt("HardMoves") != 0)
            {
                PlayerPrefs.SetInt("HardMoves", Scorehandler.moves);
                PlayerPrefs.SetString("HardRank", rank.text);
            }
        }
        admob.ShowInterstitial();
    }
Example #6
0
 private void Btn_Interstitial_Clicked(object sender, EventArgs e)
 {
     adMob.ShowInterstitial(this);
 }