Beispiel #1
0
    public static void OpenUnlockAllLevels()
    {
        if (WorldLevelsPanel.AllLevelsOpen)
        {
            return;
        }

        AllPanelsColsed = false;
        AreYourSureDialog.SetActive(false);
        LevelSelectionPanel.SetActive(false);
        QuitDialog.SetActive(false);
        BuySkinDialog.SetActive(false);
        HighScorePanel.SetActive(false);
        CreditsPanel.SetActive(false);
        OptionsPanel.SetActive(false);
        OptionsPanelIsOpen = false;
        GadgetsPanel.SetActive(true); //Mantiene aperto
        BuyGemsPanel.SetActive(false);
        OpenAllLevelsPanel.SetActive(true);
        AllLevelsOpened.SetActive(false);
        SkinPanel.SetActive(false);
        GuidePanel.SetActive(false);
        NoGems.SetActive(false);
        W_Language.CheckLang();
        MainMenu.AcquistatoIcon.SetActive(WorldLevelsPanel.AllLevelsOpen);
        if (MainMenu.AcquistatoIcon.GetComponentInParent <Button>())
        {
            MainMenu.AcquistatoIcon.GetComponentInParent <Button>().interactable = !WorldLevelsPanel.AllLevelsOpen;
        }
    }
Beispiel #2
0
    public static void ShowHigScore()
    {
        //Aggiorna tutti i dati
        foreach (GetPlayerPrefData getData in FindObjectsOfType <GetPlayerPrefData>())
        {
            getData.GetData();
        }

        AllPanelsColsed = false;
        AreYourSureDialog.SetActive(false);
        LevelSelectionPanel.SetActive(false);
        QuitDialog.SetActive(false);
        BuySkinDialog.SetActive(false);
        HighScorePanel.SetActive(true);
        CreditsPanel.SetActive(false);
        OpenAllLevelsPanel.SetActive(false);
        AllLevelsOpened.SetActive(false);
        OptionsPanel.SetActive(false);
        OptionsPanelIsOpen = false;
        GadgetsPanel.SetActive(false);
        SkinPanel.SetActive(false);
        BuyGemsPanel.SetActive(false);
        GuidePanel.SetActive(false);
        NoGems.SetActive(false);
        W_Language.CheckLang();
    }
Beispiel #3
0
    public void ShowUnlockThisBonusLevel(W_SceneItem sceneItem)
    {
        int LevelNumber = 0;

        int.TryParse(sceneItem.LevelNumber, out LevelNumber);
        AllPanelsColsed = false;
        UnlockBonusLEvelDialog.SetActive(true);
        UnlockBonusLEvelDialog.GetComponentInChildren <W_Button>().parameter = LevelNumber;
        W_Language.CheckLang();
    }
Beispiel #4
0
    public static void UpdateData()
    {
        if (!LangDropDown)
        {
            return;
        }

        if (LangDropDown.value.Equals(0))
        {
            GameManager.Instance.lang = GameManager.Lang.English;
        }
        else if (LangDropDown.value.Equals(1))
        {
            GameManager.Instance.lang = GameManager.Lang.Italian;
        }

        //  Imposta il dropMenu in base al GameManager
        if (QualityDropDown.value.Equals(0))
        {
            GameManager.Instance.quality = GameManager.Quality.Low;
        }
        if (QualityDropDown.value.Equals(1))
        {
            GameManager.Instance.quality = GameManager.Quality.Med;
        }
        if (QualityDropDown.value.Equals(2))
        {
            GameManager.Instance.quality = GameManager.Quality.Hi;
        }

        GameManager.Instance.UseAutoQuality = autoQuality.isOn;

        W_Language.CheckLang();
        if (Social.localUser.authenticated && Social.localUser.userName != "Lerpz")
        {
            SocialConnection.UserName = Social.localUser.userName; // UserName
            SocialConnection.instance.UserNameText.text = SocialConnection.UserName;
        }
        else
        {
            if (!Social.localUser.authenticated)
            {
                if (ConnectionToPlayGame.Instance)
                {
                    ConnectionToPlayGame.Instance.Connect();
                }
            }
        }
        if (SocialConnection.instance.UserNameText.text == "Uninitialized")
        {
            SocialConnection.instance.UserNameText.text = "";
        }

        print("UpdateData - " + " Quality" + GameManager.Instance.quality + " Lang:" + GameManager.Instance.lang);
    }
Beispiel #5
0
    public static void ShowOptions()
    {
        AllPanelsColsed = false;
        AreYourSureDialog.SetActive(false);
        QuitDialog.SetActive(false);
        BuySkinDialog.SetActive(false);
        LevelSelectionPanel.SetActive(false);
        HighScorePanel.SetActive(false);
        CreditsPanel.SetActive(false);
        OptionsPanel.SetActive(true);
        AllLevelsOpened.SetActive(false);
        GadgetsPanel.SetActive(false);
        BuyGemsPanel.SetActive(false);
        OpenAllLevelsPanel.SetActive(false);
        SkinPanel.SetActive(false);
        GuidePanel.SetActive(false);
        NoGems.SetActive(false);
        W_Language.CheckLang();


        //  Imposta il dropMenu in base al GameManager
        if (GameManager.Instance.lang == GameManager.Lang.English)
        {
            LangDropDown.value = 0;
        }
        else if (GameManager.Instance.lang == GameManager.Lang.Italian)
        {
            LangDropDown.value = 1;
        }

        //  Imposta il dropMenu in base al GameManager
        if (GameManager.Instance.quality == GameManager.Quality.Low)
        {
            QualityDropDown.value = 0;
        }
        else if (GameManager.Instance.quality == GameManager.Quality.Med)
        {
            QualityDropDown.value = 1;
        }
        else if (GameManager.Instance.quality == GameManager.Quality.Hi)
        {
            QualityDropDown.value = 2;
        }


        autoQuality.isOn = GameManager.Instance.UseAutoQuality;

        OptionsPanelIsOpen = true;
    }
Beispiel #6
0
 public static void OpenGuidePanel()
 {
     AllPanelsColsed = false;
     AreYourSureDialog.SetActive(false);
     LevelSelectionPanel.SetActive(false);
     QuitDialog.SetActive(false);
     BuySkinDialog.SetActive(false);
     HighScorePanel.SetActive(false);
     CreditsPanel.SetActive(false);
     AllLevelsOpened.SetActive(false);
     OptionsPanel.SetActive(false);
     OptionsPanelIsOpen = false;
     BuyGemsPanel.SetActive(false);
     OpenAllLevelsPanel.SetActive(false);
     GadgetsPanel.SetActive(false);
     SkinPanel.SetActive(false);
     GuidePanel.SetActive(true);
     NoGems.SetActive(false);
     W_Language.CheckLang();
 }
Beispiel #7
0
 public static void ShowLevels()
 {
     AllPanelsColsed = false;
     AreYourSureDialog.SetActive(false);
     LevelSelectionPanel.SetActive(true);
     QuitDialog.SetActive(false);
     BuySkinDialog.SetActive(false);
     HighScorePanel.SetActive(false);
     CreditsPanel.SetActive(false);
     OptionsPanel.SetActive(false);
     AllLevelsOpened.SetActive(false);
     GadgetsPanel.SetActive(false);
     SkinPanel.SetActive(false);
     OpenAllLevelsPanel.SetActive(false);
     BuyGemsPanel.SetActive(false);
     GuidePanel.SetActive(false);
     OptionsPanelIsOpen = false;
     UnlockBonusLEvelDialog.SetActive(false);
     NoGems.SetActive(false);
     W_Language.CheckLang();
     allSceneItems = FindObjectsOfType <W_SceneItem>();
     print("W_SceneItem trovati: " + allSceneItems.Length);
 }
Beispiel #8
0
    //Eseguito all'apertura dell'App e quando si riapre il MainMenu (nel caso siano stati modificati i valori dal MiniMenu)
    public void GetSettingData()
    {
        if (!PrimoAvvio)
        {
            //Predo i dati salvati
            if (MusicVol_Slider)
            {
                MusicVol_Slider.value = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_MusicVolume");
            }
            if (SoundsVol_Slider)
            {
                SoundsVol_Slider.value = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_SoundsVolume");
            }
            // if (UIScale_Slider) UIScale_Slider.value = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_UIScale");
            CameraDistance     = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_CameraDistance");
            GetUIScale.UIAlpha = PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_UITransparence");
            SelectSkin(PlayerPrefs.GetInt(GameManager.Instance.AppName + "_Skin"));
            if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_autoQuality") == "true")
            {
                UseAutoQuality = true;
            }
            else
            {
                UseAutoQuality = false;
            }

            /*
             *  print("<color=green>Get saved SoundsVol:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_MusicVolume"));
             *  print("<color=green>Get saved MusicVol:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_SoundsVolume"));
             *  print("<color=green>Get saved _UIScale:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_UIScale"));
             *  print("<color=green>Get saved Language:</color> " + PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language"));
             *  print("<color=green>Get saved Quality:</color> " + PlayerPrefs.GetString(GameManager.Instance.AppName + "_Quality"));
             *  print("<color=green>Get saved CameraDistance:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_CameraDistance"));
             *  print("<color=green>Get saved UITransparence:</color> " + PlayerPrefs.GetFloat(GameManager.Instance.AppName + "_UITransparence"));
             *  print("<color=green>Get saved SelectSkin:</color> " + PlayerPrefs.GetInt(GameManager.Instance.AppName + "_Skin"));
             */
        }
        else
        {
            if (MusicVol_Slider)
            {
                MusicVol_Slider.value = 10f;
            }
            if (SoundsVol_Slider)
            {
                SoundsVol_Slider.value = 10f;
            }
            CameraDistance     = 22.5f;
            UseAutoQuality     = false;
            quality            = Quality.Med;
            GetUIScale.UIAlpha = 1f;
            MainMenu.Instance._QualityDropDown.value = 1;
            SelectSkin(0);

            PlayerPrefs.SetFloat(GameManager.Instance.AppName + "_CameraDistance", CameraDistance);
            PlayerPrefs.SetFloat(GameManager.Instance.AppName + "_UITransparence", GetUIScale.UIAlpha);
        }


        //Assegno i volori deli slider alle variabili (al loading dei valori salvati)
        if (MasterMixer)
        {
            if (SoundsVol_Slider)
            {
                MasterMixer.SetFloat("SoundsVolume", (SoundsVol_Slider.value * AudioMultipler) - 20);
            }
            if (MusicVol_Slider)
            {
                MasterMixer.SetFloat("MusicVolume", (MusicVol_Slider.value * MusicManager.MusicAmplifer) - 20);
            }
        }
        // if (UIScale_Slider) ControlsUIScale = UIScale_Slider.value;



        ////Limito il suono
        if (SoundsVol_Slider)
        {
            if (SoundsVol_Slider.value <= -0.01f)
            {
                MasterMixer.SetFloat("SoundsVolume", -100);
            }
        }
        if (MusicVol_Slider)
        {
            if (MusicVol_Slider.value <= -0.01f)
            {
                MasterMixer.SetFloat("MusicVolume", -100);
            }
        }

        W_Language.CheckLang();
    }
Beispiel #9
0
    public void ReadLanguage()
    {
        if (Level.Equals(1))//Se è il menu
        {
            print("Default System Language: <color=withe>" + Application.systemLanguage + "</color>");

            W_Language.AllTexts = FindObjectsOfType <W_Language>();


            //Se è IL PRIMO AVVIO DEL GIOCO su questo dispositivo, se è un nuovo utente
            if (PlayerPrefs.GetInt(GameManager.Instance.AppName + "_PrimoAvvio", 0) == 0)
            {
                print("Apply default language: <color=withe>" + Application.systemLanguage + "</color>");

                //Al primo avvio usa sempre la lingua di sistema
                if (Application.systemLanguage.ToString() == "English")
                {
                    lang = Lang.English;
                }
                else if (Application.systemLanguage.ToString() == "Italian")
                {
                    lang = Lang.Italian;
                }

                PlayerPrefs.SetString(GameManager.Instance.AppName + "_Language", lang.ToString());

                if (GameManager.Instance.lang == GameManager.Lang.English)
                {
                    MainMenu.LangDropDown.value = 0;
                }
                else if (GameManager.Instance.lang == GameManager.Lang.Italian)
                {
                    MainMenu.LangDropDown.value = 1;
                }

                PrimoAvvio = true;
            }
            else
            {
                //Se non è il primo avvio legge dal PlayerPref la lingua scelta
                if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language") == "English")
                {
                    lang = Lang.English;
                    MainMenu.Instance._LangDropDown.value = 0;
                }
                else if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language") == "Italian")
                {
                    lang = Lang.Italian;
                    MainMenu.Instance._LangDropDown.value = 1;
                }

                if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Quality") == "Low")
                {
                    quality = Quality.Low;
                    MainMenu.Instance._QualityDropDown.value = 0;
                }
                else if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Quality") == "Med")
                {
                    quality = Quality.Med;
                    MainMenu.Instance._QualityDropDown.value = 1;
                }
                else if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Quality") == "Hi")
                {
                    quality = Quality.Hi;
                    MainMenu.Instance._QualityDropDown.value = 2;
                }


                StartCoroutine(MainMenu.UpdateDataDelayed());
            }
            //Imposto _PrimoAvvio su true
            PlayerPrefs.SetInt(GameManager.Instance.AppName + "_PrimoAvvio", 1);
            PlayerPrefs.Save();

            Time.timeScale = 1 * TimeMultipler;

            print("PrimoAvvio:<color=#00FF00> " + PrimoAvvio + "</color>");

            return;
        }
        else
        {
            //Questo Else serve se si fa partire un livello non passando dal menu
            if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language") == "English")
            {
                lang = Lang.English;
            }
            else if (PlayerPrefs.GetString(GameManager.Instance.AppName + "_Language") == "Italian")
            {
                lang = Lang.Italian;
            }

            print("PrimoAvvio: " + PrimoAvvio);
        }

        W_Language.CheckLang();
    }
Beispiel #10
0
 public static void ShowNoGemsMessage()
 {
     AllPanelsColsed = false;
     NoGems.SetActive(true);
     W_Language.CheckLang();
 }