예제 #1
0
        private void LoadStringsInternal(string data, EB.Language locale)
        {
            switch (locale)
            {
            case EB.Language.ChineseSimplified:
            case EB.Language.ChineseTraditional:
                m_File = new ZH_CN_NameFile();
                break;

            default:
                m_File = new ZH_CN_NameFile();
                break;
            }
            m_File.Read(data);
        }
예제 #2
0
        /// <summary>
        /// 初始化名字库
        /// </summary>
        public void LoadAllFromResources(EB.Language locale, bool loadCommon, System.Action <string> callback = null)
        {
            var    language = Localizer.GetNameSparxLanguageCode(locale);
            string path     = "Bundles/Name/RandomName_" + language;

            EB.Assets.LoadAsync(path, typeof(TextAsset), o => {
                if (!o)
                {
                    return;
                }
                TextAsset nameAsset = o as TextAsset;
                var Text            = Encoding.GetString(nameAsset.bytes);
                LoadStringsInternal(Text, locale);

                if (callback != null)
                {
                    callback(RandomName(false));
                }
            });
        }