Beispiel #1
0
        public void LoadLanguage(dfLanguageCode language, bool forceReload = false)
        {
            if (I18N.CurrentUIDict == null)
            {
                orig_LoadLanguage(language, forceReload);
            }
            else
            {
                strings = I18N.CurrentUIDict;

                if (forceReload)
                {
                    dfControl[] componentsInChildren = base.GetComponentsInChildren <dfControl>();
                    for (int i = 0; i < componentsInChildren.Length; i++)
                    {
                        componentsInChildren[i].Localize();
                    }
                    for (int j = 0; j < componentsInChildren.Length; j++)
                    {
                        componentsInChildren[j].PerformLayout();
                        if (componentsInChildren[j].LanguageChanged != null)
                        {
                            componentsInChildren[j].LanguageChanged(componentsInChildren[j]);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void Load()
        {
            if (File.Exists(Application.persistentDataPath + "/playerInfo.dat"))
            {
                BinaryFormatter bf   = new BinaryFormatter();
                FileStream      file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
                try
                {
                    GameInfo i = (GameInfo)bf.Deserialize(file);
                    Debug.Log("Loaded \'" + Application.persistentDataPath + "/playerInfo.dat\'");


                    i.bonuses.Load();
                    bonuses = i.bonuses;

                    GameManager.Instance.CollectionInitializedEvent(bonuses);

                    completedLevels = i.completedLevels;
                    lang            = i.lang;
                }
                catch (Exception)
                {
                    Debug.Log("Created new info. (Catched exception in Deserialize())");
                    Reset();
                }

                file.Close();
            }
            else
            {
                Debug.Log("File \'" + Application.persistentDataPath + "/playerInfo.dat\' isn't exist");
                Reset();
            }
        }
Beispiel #3
0
 public void Reset()
 {
     bonuses         = new BonusCollection();
     completedLevels = 0;
     lang            = dfLanguageCode.EN;
     Debug.Log("info reseted");
     GameManager.Instance.CollectionInitializedEvent(bonuses);
 }
Beispiel #4
0
    public void Start()
    {
        dfLanguageCode languageCode = this.currentLanguage;

        if (this.currentLanguage == dfLanguageCode.None)
        {
            languageCode = this.SystemLanguageToLanguageCode(Application.systemLanguage);
        }
        this.LoadLanguage(languageCode);
    }
Beispiel #5
0
 public void LoadLanguage(dfLanguageCode language)
 {
     this.currentLanguage = language;
     this.strings.Clear();
     if (this.dataFile != null)
     {
         this.parseDataFile();
     }
     dfControl[] componentsInChildren = base.GetComponentsInChildren <dfControl>();
     for (int i = 0; i < (int)componentsInChildren.Length; i++)
     {
         componentsInChildren[i].Localize();
     }
 }
 public void LoadLanguage(dfLanguageCode language)
 {
     this.currentLanguage = language;
     this.strings.Clear();
     if (this.dataFile != null)
     {
         this.parseDataFile();
     }
     dfControl[] componentsInChildren = base.GetComponentsInChildren<dfControl>();
     for (int i = 0; i < (int)componentsInChildren.Length; i++)
     {
         componentsInChildren[i].Localize();
     }
 }
Beispiel #7
0
    /// <summary>
    /// Loads the indicated language from the data file
    /// </summary>
    /// <param name="language">The language code representing the language data to be loaded</param>
    public void LoadLanguage(dfLanguageCode language)
    {
        // Keep track of the current language
        this.currentLanguage = language;

        // Start from a clean slate
        strings.Clear();

        if (dataFile != null)
        {
            parseDataFile();
        }

        // When the language is loaded, localize all controls
        var controls = GetComponentsInChildren <dfControl>();

        for (int i = 0; i < controls.Length; i++)
        {
            controls[i].Localize();
        }
    }
Beispiel #8
0
 public extern void orig_LoadLanguage(dfLanguageCode language, bool forceReload = false);
Beispiel #9
0
 public GameInfo()
 {
     bonuses         = new BonusCollection();
     completedLevels = 0;
     lang            = dfLanguageCode.EN;
 }
	/// <summary>
	/// Loads the indicated language from the data file
	/// </summary>
	/// <param name="language">The language code representing the language data to be loaded</param>
	public void LoadLanguage( dfLanguageCode language )
	{

		// Keep track of the current language
		this.currentLanguage = language;

		// Start from a clean slate
		strings.Clear();

		if( dataFile != null )
		{
			parseDataFile();
		}
		
		// When the language is loaded, localize all controls
		var controls = GetComponentsInChildren<dfControl>();
		for( int i = 0; i < controls.Length; i++ )
		{
			controls[ i ].Localize();
		}

	}