using System.Collections.Generic; using UnityEngine; namespace NBC { public class LanguageText : ILanguage { /// /// 多语言配置数据 /// private readonly Dictionary> _languages = new Dictionary>(); /// /// 当前语言包键值对 /// private Dictionary _currentLanguageDictionary = new Dictionary(); public string Get(string key) { if (_currentLanguageDictionary != null && _currentLanguageDictionary.TryGetValue(key, out var value)) { return value; } return key; } public void AddLanguage(SystemLanguage language) { var keys = Lan.Inst.GetLanguageConfig(LanguageConst.languageMap[language]); if (keys != null) { _languages[language] = keys; } else { _languages[language] = new Dictionary(); } } public bool UseLanguage(SystemLanguage language) { if (_languages.TryGetValue(language, out var language1)) { _currentLanguageDictionary = language1; return true; } Debug.LogError("语言包不存在"); return false; } } }