예제 #1
0
        string GetAssetFolderPath(System.Type assetType, string languageCode)
        {
            if (assetType == GameObjectType)
            {
                return(LanguageRuntimeData.PrefabsFolderPath(languageCode));
            }
            else if (assetType == AudioClipType)
            {
                return(LanguageRuntimeData.AudioFilesFolderPath(languageCode));
            }
            else if (assetType == TextureType)
            {
                return(LanguageRuntimeData.TexturesFolderPath(languageCode));
            }
            else if (assetType == TextAssetType)
            {
                return(LanguageRuntimeData.TextAssetsFolderPath(languageCode));
            }
            else if (assetType == FontType)
            {
                return(LanguageRuntimeData.FontsFolderPath(languageCode));
            }

            return(string.Empty);
        }
예제 #2
0
        bool LoadAvailableCultures()
        {
            TextAsset availableCulturesXML = Resources.Load(LanguageRuntimeData.AvailableCulturesFilePath()) as TextAsset;

            if (availableCulturesXML == null)
            {
                Debug.LogError("Не удалось загрузить доступные языки! Файл не найден!");
                return(false);
            }

            availableLanguages = SmartCultureInfoCollection.Deserialize(availableCulturesXML);

            return(true);
        }
예제 #3
0
        /// <summary>
        /// Change the language into a specified culture
        /// </summary>
        /// <param name="languageCode">The culture to change to</param>
        public void ChangeLanguage(string languageCode)
        {
            TextAsset languageData = Resources.Load(LanguageRuntimeData.LanguageFilePath(languageCode)) as TextAsset;

            if (languageData == null)
            {
                Debug.LogError("Не удалось загрузить язык: " + languageCode);
                return;
            }

            LoadLanguage(languageData.text, languageCode);

            if (OnChangeLanguage != null)
            {
                OnChangeLanguage(this);
            }
        }