Beispiel #1
0
    private void Start()
    {
        print(Application.persistentDataPath);

        if (SceneManager.GetActiveScene().name == "StartScene")//to get the high score
        {
            topScore           = ScoreManager.GetTopScore();
            highScoreText.text = "High Score:" + topScore;//show top score on the screen
        }

        if (audioManager.IsMusicsMuted)
        {
            buttonMusicControl.GetComponent <Image>().sprite = muteMusicSprite;
        }
        if (audioManager.IsSoundsMuted)
        {
            buttonSoundsControl.GetComponent <Image>().sprite = muteSoundSprite;
        }

        if (PlayerPrefs.HasKey("BallName"))                              //if the player choosed a ball
        {
            string ballName = SaveFiles.GetStringPlayerPref("BallName"); //get the choosen bal name

            RemoveUsedBallPanel();
            for (int i = 0; i < usedBallPanels.Length; i++)
            {
                if (usedBallPanels[i].transform.parent.GetComponent <Ball>().BallName.ToString() == ballName)
                {
                    usedBallPanels[i].SetActive(true);
                }
            }
        }
    }
Beispiel #2
0
    public IEnumerator checkInternetConnection()
    {
        WWW www = new WWW("http://ph-scince.000webhostapp.com/zaherGame/getPermission.php");

        yield return(www);

        if (www.error != null)
        {
            print("Disconnected");

            isItAuthorized = SaveFiles.GetStringPlayerPref("Authorization");
            if (isItAuthorized == "false")
            {
                Application.Quit();//close the game
                print("NotAuthorized  " + isItAuthorized);
            }
            else if (isItAuthorized == "true")
            {
                print("Authorized  " + isItAuthorized);
            }
        }
        else//if there was an internet connection the git datetime from internet
        {
            print("connected");
            StartCoroutine(GetAuthorization());
        }
        yield return(null);
    }
Beispiel #3
0
    void Awake()
    {
        if (!instance && SceneManager.GetActiveScene().name == "StartScene")
        {
            instance = true;

            if (SaveFiles.GetStringPlayerPref("IsMusicMuted") != null)       //if there are music state before nad this is not the first time you play the game
            {
                if (SaveFiles.GetStringPlayerPref("IsMusicMuted") == "True") //check the old music state
                {
                    isMusicMuted = true;
                }
                else
                {
                    isMusicMuted = false;
                    UnMuteMainMusic();//play main music
                }
            }
            else//if this the first time you play the game
            {
                isMusicMuted = false;
                UnMuteMainMusic();
                SaveFiles.SetStringPlayerPref("IsMusicMuted", "False");
            }
            if (SaveFiles.GetStringPlayerPref("IsSoundsMuted") != null)       //if there are sounds state before nad this is not the first time you play the game
            {
                if (SaveFiles.GetStringPlayerPref("IsSoundsMuted") == "True") //check the old sounds state
                {
                    isSoundsMuted = true;
                }
                else
                {
                    isSoundsMuted = false;
                }
            }
            else//if this the first time you play the game
            {
                isSoundsMuted = false;
                SaveFiles.SetStringPlayerPref("IsSoundsMuted", "False");
            }
            DontDestroyOnLoad(gameObject);
        }
        else if (SceneManager.GetActiveScene().name == "StartScene")
        {
            Destroy(gameObject);
        }
    }