public static void RegisterTextConfig(string region, string tag, TextLocalizationConfig config) { if (string.IsNullOrEmpty(region) || string.IsNullOrEmpty(tag) || config == null) { Debug.LogError("Localization Config is null."); return; } if (!TextDict.ContainsKey(region)) { TextDict[region] = new Dictionary <string, TextLocalizationConfig>(); } if (TextDict[region].ContainsKey(tag)) { Debug.LogError($"This tag [{tag}] is exist."); return; } TextDict[region].Add(tag, config); OnRegionChange?.Invoke(); }
public static TextLocalizationConfig LoadCaseLocalization(string caseName) { string caseAssetPath = $"{LocalizationSystem.CASE_PATH_PREFIX}/{caseName}/Localization/CN.asset"; TextLocalizationConfig config = AssetDatabase.LoadAssetAtPath <TextLocalizationConfig>(caseAssetPath); if (config != null) { config.Discard(); config.BuildBuffer(); } else { Debug.LogError($"case localization config not exist => {caseAssetPath}"); } LocalizationSystem.UnRegisterTextConfig(LocalizationSystem.Region, LocalizationSystem.TAG_CURRENT_CASE); LocalizationSystem.RegisterTextConfig(LocalizationSystem.Region, LocalizationSystem.TAG_CURRENT_CASE, config); return(config); }