Ejemplo n.º 1
0
 private void Awake()
 {
     if (PlayerPrefs.HasKey("setLang"))
     {
         GetLangPrefab();
     }
     else
     {
         if (Application.systemLanguage == SystemLanguage.Polish)
         {
             PlayerPrefs.SetString("setLang", "PL");
             currLang = SuppLang.PL;
         }
         else
         {
             PlayerPrefs.SetString("setLang", "EN");
             currLang = SuppLang.EN;
         }
         SetLangPrefab();
     }
     PlayerPrefs.SetInt("iIsDebugMode", 0);
 }
Ejemplo n.º 2
0
    void OnGUI()
    {
        if (globalLevelState == LevelState.mainMenu)
        {
            GUIStyle gS = new GUIStyle();
            gS.fontSize = Screen.width / 8; gS.alignment = TextAnchor.MiddleCenter;
            //GUI.Label (new Rect (25, 25, 100, 30), "Label");
            GUI.Label(new Rect(10, 10, Screen.width - 20, Screen.height / 3), "Flip Block 3D", gS);
            gS          = new GUIStyle(GUI.skin.button);
            gS.fontSize = Screen.width / 12;
            if (GUI.Button(new Rect(10, 2 * Screen.height / 6, Screen.width - 20, Screen.height / 7), sLang_AllLevels, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.allLevels;
            }
            if (GUI.Button(new Rect(10, 3 * Screen.height / 6, Screen.width - 20, Screen.height / 7), sLang_Help, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.help;
            }
            if (GUI.Button(new Rect(10, 4 * Screen.height / 6, Screen.width - 20, Screen.height / 7), sLang_Setting, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.setting;
            }
            if (GUI.Button(new Rect(10, 5 * Screen.height / 6, Screen.width - 20, Screen.height / 7), sLang_AboutGame, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.aboutGame;
            }
        }
        if (globalLevelState == LevelState.allLevels)
        {
            GUIStyle gS = new GUIStyle();
            gS.fontSize = Screen.width / 16; gS.alignment = TextAnchor.MiddleCenter;
            GUI.Label(new Rect(10, 10, Screen.width - 20, (Screen.height / 6) - 20), sLang_AllLevels, gS);
            gS          = new GUIStyle(GUI.skin.button);
            gS.fontSize = Screen.width / 12;
            if (GUI.Button(new Rect(10, 2 * Screen.height / 6, Screen.width - 20, (Screen.height / 6) - 20), sLang_BasicLevels, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.basicLevels;
            }
            if (GUI.Button(new Rect(10, 3 * Screen.height / 6, Screen.width - 20, (Screen.height / 6) - 20), sLang_AdvenceLevels, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.advenceLevels;
            }

            /*
             * if (GUI.Button(new Rect(10, 4 * Screen.height / 6, Screen.width - 20, (Screen.height / 6) - 20), "Debug", gS))
             * {
             *  clickSound.Play();
             *  PlayerPrefs.SetInt("iIsDebugMode", 1);
             *  SceneManager.LoadScene("LevelCommon");
             * }
             */
            if (GUI.Button(new Rect(10, 5 * Screen.height / 6, Screen.width - 20, (Screen.height / 6) - 20), sLang_MainMenu, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.mainMenu;
            }
        }
        if (globalLevelState == LevelState.help)
        {
            GUIStyle gS = new GUIStyle();
            gS.fontSize = Screen.width / 16; gS.alignment = TextAnchor.MiddleCenter;
            GUI.Label(new Rect(10, 10, Screen.width - 20, (6 * Screen.height / 7) - 20), sLang_InfoContent, gS);
            gS          = new GUIStyle(GUI.skin.button);
            gS.fontSize = Screen.width / 12;
            if (GUI.Button(new Rect(10, 5 * Screen.height / 6, Screen.width - 20, Screen.height / 7), sLang_MainMenu, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.mainMenu;
            }
        }
        if (globalLevelState == LevelState.aboutGame)
        {
            GUIStyle gS = new GUIStyle();
            gS.fontSize = Screen.width / 16; gS.alignment = TextAnchor.MiddleCenter;
            GUI.Label(new Rect(10, 10, Screen.width - 20, (6 * Screen.height / 7) - 20), sLang_CratedBy + ":\nBartłomiej Grywalski\n\n" + sLang_Tools + ":\nUnity\nInkscape", gS);
            gS          = new GUIStyle(GUI.skin.button);
            gS.fontSize = Screen.width / 12;
            if (GUI.Button(new Rect(10, 5 * Screen.height / 6, Screen.width - 20, Screen.height / 7), sLang_MainMenu, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.mainMenu;
            }
        }
        if (globalLevelState == LevelState.basicLevels)
        {
            GUIStyle gS = new GUIStyle();
            gS.fontSize = Screen.width / 16; gS.alignment = TextAnchor.MiddleCenter;
            GUI.Label(new Rect(10, 10, Screen.width - 20, (Screen.height / 7) - 20), sLang_BasicLevels, gS);
            gS          = new GUIStyle(GUI.skin.button);
            gS.fontSize = Screen.width / 16;
            for (int i = 0; i < lAllBasic.Count; i++)
            {
                if (GUI.Button(new Rect(10, Screen.height / 7 + 10 + (i * 5 * Screen.height / 7) / lAllBasic.Count, Screen.width - 20, (5 * (Screen.height / 7) / lAllBasic.Count) - 20), sLang_Level + " " + (i + 1).ToString(), gS))
                {
                    clickSound.Play();
                    PlayerPrefs.SetString("LevelToLoad", lAllBasic[i].text);
                    SceneManager.LoadScene("LevelCommon");
                }
            }
            gS.fontSize = Screen.width / 18;
            if (GUI.Button(new Rect(10, 6 * Screen.height / 7, (Screen.width / 2) - 20, (Screen.height / 7) - 20), sLang_MainMenu, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.mainMenu;
            }
            if (GUI.Button(new Rect((Screen.width / 2) + 10, 6 * Screen.height / 7, (Screen.width / 2) - 20, (Screen.height / 7) - 20), sLang_AllLevels, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.allLevels;
            }
        }
        if (globalLevelState == LevelState.advenceLevels)
        {
            GUIStyle gS = new GUIStyle();
            gS.fontSize = Screen.width / 16; gS.alignment = TextAnchor.MiddleCenter;
            GUI.Label(new Rect(10, 10, Screen.width - 20, (Screen.height / 7) - 20), sLang_AdvenceLevels, gS);
            gS          = new GUIStyle(GUI.skin.button);
            gS.fontSize = Screen.width / 16;
            for (int i = 0; i < lAllAdvance.Count; i++)
            {
                if (GUI.Button(new Rect(10, Screen.height / 7 + 10 + (i * 5 * Screen.height / 7) / lAllAdvance.Count, Screen.width - 20, (5 * (Screen.height / 7) / lAllAdvance.Count) - 20), sLang_Level + " " + (i + 1).ToString(), gS))
                {
                    clickSound.Play();
                    PlayerPrefs.SetString("LevelToLoad", lAllAdvance[i].text);
                    SceneManager.LoadScene("LevelCommon");
                }
            }
            gS.fontSize = Screen.width / 18;
            if (GUI.Button(new Rect(10, 6 * Screen.height / 7, (Screen.width / 2) - 20, (Screen.height / 7) - 20), sLang_MainMenu, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.mainMenu;
            }
            if (GUI.Button(new Rect((Screen.width / 2) + 10, 6 * Screen.height / 7, (Screen.width / 2) - 20, (Screen.height / 7) - 20), sLang_AllLevels, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.allLevels;
            }
        }
        if (globalLevelState == LevelState.setting)
        {
            GUIStyle gS = new GUIStyle();
            gS.fontSize = Screen.width / 16; gS.alignment = TextAnchor.MiddleCenter;
            GUI.Label(new Rect(10, 10 + Screen.height / 6, Screen.width - 20, (Screen.height / 7) - 20), sLang_Language, gS);
            gS          = new GUIStyle(GUI.skin.button);
            gS.fontSize = Screen.width / 16;
            if (GUI.Button(new Rect(10, 10 + 2 * Screen.height / 6, Screen.width / 2 - 20, Screen.height / 7), "English", gS))
            {
                clickSound.Play();
                PlayerPrefs.SetString("setLang", "EN");
                currLang = SuppLang.EN;
                SetLangPrefab();
            }
            if (GUI.Button(new Rect(10 + Screen.width / 2, 10 + 2 * Screen.height / 6, Screen.width / 2 - 20, Screen.height / 7), "Polski", gS))
            {
                clickSound.Play();
                PlayerPrefs.SetString("setLang", "PL");
                currLang = SuppLang.PL;
                SetLangPrefab();
            }
            if (GUI.Button(new Rect(10, 5 * Screen.height / 6, Screen.width - 20, Screen.height / 7), sLang_MainMenu, gS))
            {
                clickSound.Play();
                globalLevelState = LevelState.mainMenu;
            }
        }
    }