public void Load(string[] files) { if (!IsLoaded) { this.files = files; strings.Clear(); foreach (string file in files) { Debug.Log($"parse file => {file.Colored(ConsoleTextColor.yellow)}"); var listItems = JsonConvert.DeserializeObject <List <LocalizationStringData> >(Resources.Load <TextAsset>(file).text); foreach (var item in listItems) { uint jenkinsID = BosUtils.JenkinsOneAtATimeHash(item.id); if (strings.ContainsKey(jenkinsID)) { Debug.LogWarning($"string => {item.id} has repeated jenkins id => {jenkinsID} at file => {file}"); } else { strings.Add(jenkinsID, item.GetString(Language)); } } } IsLoaded = true; } }
public string GetFrequentString(string key) { uint id = BosUtils.JenkinsOneAtATimeHash(key); if (!frequentSubcache.Contains(id)) { frequentSubcache.Add(id, GetString(id)); } return(frequentSubcache.GetObject(id)); }
public string GetString(string key) { uint id = BosUtils.JenkinsOneAtATimeHash(key); if (strings.ContainsKey(id)) { return(strings[id]); } Debug.LogError($"not found string with key => {key}"); return(string.Empty); }