public void Load(string langCode, string json) { mCurLang = langCode; if (mCurLang == null) //langCode shouldn't be null { mCurLang = ""; } Dictionary <string, object> defs; if (!string.IsNullOrEmpty(json)) { defs = JSON.Parse(json) as Dictionary <string, object>; } else { defs = new Dictionary <string, object>(); } mEntries = new Dictionary <string, LocalizeData>(defs.Count); foreach (var item in defs) { string key = item.Key; string val = item.Value.ToString(); LocalizeData dat = new LocalizeData(val, new string[0]); mEntries.Add(key, dat); } Refresh(); }
protected override bool TryGetData(string key, out LocalizeData data) { if (mEntries == null) { data = new LocalizeData(); return(false); } return(mEntries.TryGetValue(key, out data)); }
public override void Init() { base.Init(); ins = this; string path = Path.Combine(m_LoadLangPath, "LanguageSetting"); TextAsset texts = Resources.Load(path) as TextAsset; if (texts != null) { m_LocalizeSetting = new LocalizeData(texts.ToString()); Debug.LogWarning(m_LocalizeSetting.GetDic().UCL_ToString()); } }