public void OnInit()
 {
     m_DataManagerDic = new Dictionary <Type, DataManagerBase>();
     RegisterModel();
     CLog.Log("初始化DataManagerPool完成");
 }
Exemple #2
0
        public static void LogForMat(string form, params string[] strs)
        {
            string strR = string.Format(form, strs);

            CLog.Log(strR);
        }
 /// <summary>
 /// 工具输出日志
 /// </summary>
 public static void Error(string str)
 {
     CLog.Log("<color=#FF0000>[Tools]" + str + "</color>");
 }
        /// <summary>
        /// 设置本地拥有的语言库
        /// </summary>
        public void SetLocalLangLibrary(LocalELangLibrary LangLibrary, ELangType AppDefaultLangType = ELangType.ZH_CN)
        {
            localELangLibrary = LangLibrary;

#if UNITY_EDITOR
            defaultType = (ELangType)PlayerPrefs.GetInt("ELangType", (int)ELangType.ZH_CN);
#else
            defaultType = AppDefaultLangType;
            LocalELangLibrary defaultLangNeedLangLibrary = LocalELangLibrary.EN;
            int SysytemLangType = DBTSDK.AppInfoManager.Instance.GetSystemLanguage();
            CLog.Log("系统语言:" + SysytemLangType);
            switch (SysytemLangType)
            {
            case 0:
                defaultType = ELangType.EN;
                defaultLangNeedLangLibrary = LocalELangLibrary.EN;
                break;

            case 1:
                defaultType = ELangType.ZH_CN;
                defaultLangNeedLangLibrary = LocalELangLibrary.ZH_CN;
                break;

            case 2:
                defaultType = ELangType.ZH_TW;
                defaultLangNeedLangLibrary = LocalELangLibrary.ZH_TW;
                break;

            case 10:
                defaultType = ELangType.KO;
                defaultLangNeedLangLibrary = LocalELangLibrary.KO;
                break;

            case 11:
                defaultType = ELangType.JA;
                defaultLangNeedLangLibrary = LocalELangLibrary.JA;
                break;
            }
            if (defaultType == AppDefaultLangType)
            {
                CLog.Log("不属于5大语言,使用默认语言:" + AppDefaultLangType);
                return;
            }
            //判断当前选择的语言,本地是否拥有语言配置
            if (!localELangLibrary.HasFlag(defaultLangNeedLangLibrary))
            {
                Debug.Log($"本地未配置{defaultLangNeedLangLibrary}语言库,准备回退到默认语言库--{AppDefaultLangType}");
                if (defaultLangNeedLangLibrary == LocalELangLibrary.ZH_CN)
                {
                    //如果发生APP不包含简体资源 优先寻找繁体资源  然后再找默认资源
                    if (localELangLibrary.HasFlag(LocalELangLibrary.ZH_TW))
                    {
                        Debug.Log($"本地配置繁体语言库,简体手机使用繁体语言库");
                        defaultType = ELangType.ZH_TW;
                        return;
                    }
                }
                defaultType = AppDefaultLangType;
                CLog.Log($"本地版本库没有当前语言[{defaultLangNeedLangLibrary}]:改成使用默认语言[{defaultType}]");
            }
#endif
        }
 /// <summary>
 /// 工具输出日志
 /// </summary>
 public static void Warning(string str)
 {
     CLog.Log("<color=#EEEE00>[Tools]" + str + "</color>");
 }