Exemple #1
0
    public void SetBallSprite(Ball ball)
    {
        choosedBall = ball;//set the coosed ball which the player choosed it

        if (ball.IsAdNeeded)
        {
            ShowLockedPanel(ball);//show this ball is locked because of not enough score
            print("AdNeeded");
        }
        else if (!ball.IsAdNeeded && ball.BallScoreOpen == 0)
        {
            unlockedBallsFile.BallsLockStates[ball.BallName] = true;                                  //unlock the ball
            SaveFiles.SaveObjectAsJSONAtPersDataPath(unlockedBallsFile, SaveFilesName.UnlockedBalls); //save the new ball lock state
            RemoveUsedBallPanel();                                                                    //remove the UsedBallPanel from the other balls
            ball.UsedBallPanel.SetActive(true);                                                       //active the UsedBallPanel of this ball
            SaveFiles.SetStringPlayerPref("BallName", ball.BallName.ToString());
            print("BallChoosed");
        }
        else
        {
            if (topScore >= ball.BallScoreOpen)     //if he has enough score then use this ball
            {
                RemoveUsedBallPanel();              //remove the UsedBallPanel from the other balls
                ball.UsedBallPanel.SetActive(true); //active the UsedBallPanel of this ball
                SaveFiles.SetStringPlayerPref("BallName", ball.BallName.ToString());
                print("BallChoosed");
            }
            else
            {
                ShowLockedPanel(ball);//show this ball is locked because of not enough score
                print("BallLocked");
            }
        }
    }
Exemple #2
0
 public void MuteMainMusic()
 {
     if (audioSourceMusic.isPlaying)
     {
         isMusicMuted = true;
         audioSourceMusic.Pause();
         SaveFiles.SetStringPlayerPref("IsMusicMuted", isMusicMuted.ToString());//save the current music state
     }
 }
Exemple #3
0
    //private void OnApplicationQuit()
    //{
    //    SaveFiles.SetStringPlayerPref("IsMusicMuted", isMusicMuted.ToString());//save the current music state
    //    SaveFiles.SetStringPlayerPref("IsSoundsMuted", isSoundsMuted.ToString());//save the current sounds state
    //}


    public void UnMuteMainMusic()
    {
        if (!audioSourceMusic.isPlaying)
        {
            isMusicMuted          = false;
            audioSourceMusic.clip = soundInfo.mainMusicClip;
            audioSourceMusic.loop = true;
            audioSourceMusic.Play();
            SaveFiles.SetStringPlayerPref("IsMusicMuted", isMusicMuted.ToString());//save the current music state
        }
    }
Exemple #4
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);
        }
    }
Exemple #5
0
    public IEnumerator GetAuthorization()
    {
        UnityWebRequest myHttpWebRequest = UnityWebRequest.Get("http://ph-scince.000webhostapp.com/zaherGame/getPermission.php");

        yield return(myHttpWebRequest.Send());

        isItAuthorized = myHttpWebRequest.downloadHandler.text;

        if (isItAuthorized == "false")//if it was not authorized
        {
            SaveFiles.SetStringPlayerPref("Authorization", "false");
            print("Not Authorized  " + isItAuthorized);
            Application.Quit();//close the game
        }
        else if (isItAuthorized == "true")
        {
            SaveFiles.SetStringPlayerPref("Authorization", "true");
            print("Authorized  " + isItAuthorized);
        }
    }
Exemple #6
0
 public void UnMuteSounds()
 {
     isSoundsMuted = false;
     SaveFiles.SetStringPlayerPref("IsSoundsMuted", isSoundsMuted.ToString());//save the current sounds state
 }
Exemple #7
0
 public void MuteSounds()
 {
     isSoundsMuted = true;
     audioSourceUI.Stop();
     SaveFiles.SetStringPlayerPref("IsSoundsMuted", isSoundsMuted.ToString());//save the current sounds state
 }