Exemplo n.º 1
0
    void Awake()
    {
        //first we'll set "en" (english) as the default language
        res = PlayerPrefs.GetString("Language");


        if (res.Equals("English"))
        {
            LanguageDictionary.SetLanguage(SystemLanguage.English);
        }
        else if (res.Equals("French"))
        {
            LanguageDictionary.SetLanguage(SystemLanguage.French);
        }
        else if (res.Equals("Spanish"))
        {
            LanguageDictionary.SetLanguage(SystemLanguage.Spanish);
        }



        //if the system language isn't included in here, then the game will show the texts only in the default language

        Debug.Log("Language set: " + Application.systemLanguage);
    }
Exemplo n.º 2
0
 void Update()
 {
     res = PlayerPrefs.GetString("PlayerLanguage");
     if (res.Equals("English"))
     {
         LanguageDictionary.SetLanguage(SystemLanguage.English);
     }
     else if (res.Equals("French"))
     {
         LanguageDictionary.SetLanguage(SystemLanguage.French);
     }
     else if (res.Equals("Spanish"))
     {
         LanguageDictionary.SetLanguage(SystemLanguage.Spanish);
     }
 }
Exemplo n.º 3
0
    //*****************************************************************************
    // Init.
    //*****************************************************************************
    void Awake()
    {
        chapas = playerController.chapas;

        //Updates 3d text with saved values fetched from playerprefs
        availableMoney = PlayerPrefs.GetInt("PlayerMoney");
        playerMoney.GetComponent <TextMesh>().text = "Coins: " + availableMoney;
        string res = PlayerPrefs.GetString("PlayerLanguage");



        if (res.Equals("English"))
        {
            LanguageDictionary.SetLanguage(SystemLanguage.English);
            PlayerPrefs.SetString("PlayerLanguage", "English");
        }
        else if (res.Equals("French"))
        {
            LanguageDictionary.SetLanguage(SystemLanguage.French);
            PlayerPrefs.SetString("PlayerLanguage", "French");
        }
        else if (res.Equals("Spanish"))
        {
            LanguageDictionary.SetLanguage(SystemLanguage.Spanish);
            PlayerPrefs.SetString("PlayerLanguage", "Spanish");
        }


        //check if we previously purchased these items.
        for (int i = 0; i < totalItemsForSale.Length; i++)
        {
            //format the correct string we use to store purchased items into playerprefs
            string shopItemName = "shopItem-" + totalItemsForSale[i].GetComponent <ShopItemProperties>().itemIndex.ToString();
            if (PlayerPrefs.GetInt(shopItemName) == 1)
            {
                //we already purchased this item
                totalItemsForSale[i].GetComponent <Renderer>().material.color = new Color(0, 1, 0, 1); //Make it green
                totalItemsForSale[i].GetComponent <BoxCollider>().enabled     = false;                 //Not clickable anymore
            }
        }
    }
Exemplo n.º 4
0
 public void SetSpanish()
 {
     LanguageDictionary.SetLanguage(SystemLanguage.Spanish);
     res = "Spanish";
     PlayerPrefs.SetString("Language", res);
 }
Exemplo n.º 5
0
 public void SetFrench()
 {
     LanguageDictionary.SetLanguage(SystemLanguage.French);
     res = "French";
     PlayerPrefs.SetString("Language", res);
 }
Exemplo n.º 6
0
 void Awake()
 {
     LanguageDictionary.SetLanguage(Application.systemLanguage);
     Debug.Log("Language set: " + Application.systemLanguage);
 }