private void _OnLanguageChanged() { string keyUpdate; if (char.IsWhiteSpace(key, 0)) { keyUpdate = key.Remove(0, 1); } else { keyUpdate = key; } if (label != null) { label.text = ISILocalization.GetValueOf(keyUpdate); } if (textMesh != null) { textMesh.text = ISILocalization.GetValueOf(keyUpdate); } if (textMeshPro != null) { textMeshPro.text = ISILocalization.GetValueOf(keyUpdate); } if (textMeshProUGUI != null) { textMeshProUGUI.text = ISILocalization.GetValueOf(keyUpdate); } }
private void _OnLanguageChanged() { if (type == SpriteComponentType.Image) { image.sprite = ISILocalization.GetSprite(key); } else { spriteRenderer.sprite = ISILocalization.GetSprite(key); } }
void Start() { GetComponent <Button>().onClick.AddListener(() => { ISILocalization.ChangeLanguage(language); if (loadNextLevel) { ISILocalization.LoadNextLevel(); } }); }
/// <summary> /// Plays the localized audio in the current language. /// </summary> public void Play() { if (key == null) { Debugger.LogError("This audio key is null", gameObject); return; } clip = ISILocalization.GetAudio(key); if (clip == null) { Debugger.LogError("There is not localized audio with the key" + key, gameObject); return; } AudioSource.PlayClipAtPoint(clip, Vector3.zero); }
void Start() { FindComponent(); if (ISILocalization.LoadIfNotInScene()) { Infinity.When(() => ISILocalization.IsInitialized, _OnLanguageChanged); } if (LocalizedStrings == null) { LocalizedStrings = new List <LocalizedString>(); } if (!LocalizedStrings.Contains(this)) { LocalizedStrings.Add(this); } }
private void _OnLanguageChanged() { if (label != null) { label.text = ISILocalization.GetValueOf(key); } if (textMesh != null) { textMesh.text = ISILocalization.GetValueOf(key); } if (textMeshPro != null) { textMeshPro.text = ISILocalization.GetValueOf(key); } if (textMeshProUGUI != null) { textMeshProUGUI.text = ISILocalization.GetValueOf(key); } }
void Start() { if (type == SpriteComponentType.Image) { image = GetComponent <Image>(); if (image == null) { Debugger.LogError("There is no Image component attached to this GameObject", gameObject); return; } } else { spriteRenderer = GetComponent <SpriteRenderer>(); if (spriteRenderer == null) { Debugger.LogError("There is no SpriteRenderer component attached to this GameObject", gameObject); return; } } if (ISILocalization.LoadIfNotInScene()) { Infinity.When(() => ISILocalization.IsInitialized, _OnLanguageChanged); } if (LocalizedSprites == null) { LocalizedSprites = new List <LocalizedSprite>(); } if (!LocalizedSprites.Contains(this)) { LocalizedSprites.Add(this); } }