Exemple #1
0
        private void GetTextFromLanguageControllerAndPlaceItOnLabel()
        {
            string newText = LanguageController.GetText(IdOfTextEntry);

            if (newText.Equals(string.Empty))
            {
                newText = "Entry is missing from language file!";
                Debug.LogError("L_Text | GetTextFromLanguageControllerAndPlaceItOnLabel | Atempted to load a text entry that is not availible in the language file, is the file up to date?");
            }
            LabelToChangeTextOf.text = newText;
        }
Exemple #2
0
        public void GetImagePathFromLanguageControllerAndChangeImage()
        {
            string newImgPath = LanguageController.GetImage(IdOfImage);

            if (newImgPath.Equals(string.Empty))
            {
                Debug.LogWarning("L_Image | GetSpriteFromLanguageControllerAndPlaceItInImage | Atempted to load a Image entry that is not availible in the language file, is the file up to date?");
            }
            else
            {
                StartCoroutine(LoadAndApplyTexture(newImgPath)); //WebRequest is made to function withing a coroutine and is dodgy outside of it
            }
        }
Exemple #3
0
        public void GetIAudioPathFromLanguageControllerAndChangeClip()
        {
            string newAudioPath = LanguageController.GetAudio(IdOfAudioFile);

            if (newAudioPath.Equals(string.Empty))
            {
                Debug.LogWarning("L_Image | GetSpriteFromLanguageControllerAndPlaceItInImage | Atempted to load a Image entry that is not availible in the language file, is the file up to date?");
            }
            else
            {
                StartCoroutine(LoadAndApplyAudio(newAudioPath));
            }
        }
        private void Awake()
        {
            //singleton
            if (Instance == null)
            {
                Instance = this;
                DontDestroyOnLoad(gameObject);
            }
            else
            {
                Debug.LogWarning("LanguageController | Awake | A second language controller was loaded, maybe you should make a initialisation scene?");
                Destroy(this);
            }

            //Inventorise what languages are availible
            _AvailibleLanguages = new List <string>();
            foreach (string path in Directory.GetFiles(Application.dataPath + "\\StreamingAssets\\Languages", "??.xml"))
            {
                _AvailibleLanguages.Add(Path.GetFileNameWithoutExtension(path));
            }
        }