using System.Collections.Generic; using UnityEngine; public class LocalizeTextData { private Dictionary TexDic; public string GetString(string key) { if (TexDic.TryGetValue(key, out var text)) { return text; } Debug.LogError($"AOT部分文本配置缺少Key:{key}"); return ""; } /// /// 多语言索引,索引值参考Localize脚本, 0默认, 1中文,2繁中,3英文 /// /// public LocalizeTextData(int index) { switch (index) { case 1: //简体中文 TexDic = TextLocalizeDic.CN; break; case 2: //繁体中文 TexDic = TextLocalizeDic.TW; break; case 3: //英文 TexDic = TextLocalizeDic.EN; break; default: //默认 TexDic = TextLocalizeDic.CN; break; } } } public static class TextLocalizeDic { public static Dictionary CN = new() { ["key_0"] = "简中文本1", }; public static Dictionary TW = new() { ["key_0"] = "繁中文本1", }; public static Dictionary EN = new() { ["key_0"] = "Text 1", }; }