add project files

This commit is contained in:
Boris Nikolaev
2026-08-14 01:58:31 +03:00
parent 9134cad79b
commit 5f1e94b653
4399 changed files with 12286903 additions and 0 deletions
@@ -0,0 +1,45 @@
using UnityEngine;
using UnityEngine.UI;
namespace OHM.UnityToolkit.Localization
{
public class LocalizedText : MonoBehaviour
{
public string key;
public TextWrapper text;
private void Awake()
{
text = GetComponent<TextWrapper>();
}
private void Start()
{
ApplyLocalization();
LocalizationManager.Instance.OnLangChanged.AddListener(ApplyLocalization);
}
public void ChangeKey(string key)
{
this.key = key;
ApplyLocalization();
}
public void ApplyLocalization()
{
SetText(string.IsNullOrEmpty(key)
? string.Empty
: LocalizationUtils.Localize(LocalizationManager.Instance.CurrentLocale, key));
}
private void SetText(string content)
{
if (text != null)
{
text.text = content;
}
}
}
}