Пример #1
0
    public void Begin()
    {
        // 检测网络状态
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            // 开启网络状态提示框
            m_uiNetworkBox.SetActive(true);
            return;
        }
        else
        {
            // 关闭网络状态提示框
            m_uiNetworkBox.SetActive(false);
        }

        // 读取包里的资源版本文件
        m_pPackageResverIni.OpenFromStreamingAssets(m_szResverTxt);

        // 读取本地的资源版本文件
        m_pLocalResverIni.OpenFromTXT(PathUtil.ConfigPath() + m_szResverTxt);

        if (Const.ResourceMode == "assetbundle")
        {
            // 其它模式先检查源
            CheckResource();
        }
        else
        {
            // 非assetbundle模式直接从Resource目录读取资源
            OnInited();
        }
    }
Пример #2
0
 static int OpenFromTXT(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         IniUtil obj  = (IniUtil)ToLua.CheckObject(L, 1, typeof(IniUtil));
         string  arg0 = ToLua.CheckString(L, 2);
         bool    o    = obj.OpenFromTXT(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #3
0
    /// <summary>
    /// 初始化游戏管理器
    /// </summary>
    void Awake()
    {
        Screen.sleepTimeout         = SleepTimeout.NeverSleep;
        Application.targetFrameRate = Const.GameFrameRate;

        // 创建日志系统
        LogUtil.GetInstance().Create(PathUtil.LogPath());
        LogUtil.GetInstance().WriteGame("------------------ Game Log Begin ------------------");
        LogUtil.GetInstance().WriteNet("------------------ Net Log Begin ------------------");

        // 本地化系统初始化,再读一遍,因为文字表有更新
        if (Localization.init() < 0)
        {
            LogUtil.GetInstance().WriteGame("Localization Init Failed");
            return;
        }
        LogUtil.GetInstance().WriteGame("STEP 1");
        // 再次读取本地程序配置文件,因为编辑器模式下,启动场景不使用
        if (m_pLocalAppIni.OpenFromData(m_szAppTxt) == false)
        {
            LogUtil.GetInstance().WriteGame(m_szAppTxt + " Not Found!!!");
        }
        else
        {
            m_pLocalAppIni.SetGlobal();
        }
        LogUtil.GetInstance().WriteGame("STEP 2");

        // 再次读取本地资源版本文件,因为编辑器模式下,启动场景不使用
        if (m_pLocalResverIni.OpenFromTXT(PathUtil.ConfigPath() + m_szResverTxt) == false)
        {
            LogUtil.GetInstance().WriteGame(PathUtil.ConfigPath() + m_szResverTxt + " Not Found");
        }
        else
        {
            m_pLocalResverIni.SetGlobal();
        }
        LogUtil.GetInstance().WriteGame("STEP 3");

        Utils.Add <ObjectPoolManager>(gameObject); // 添加对象池管理器
        LogUtil.GetInstance().WriteGame("Add ObjectPoolManager");
        Utils.Add <ResourceManager>(gameObject);   // 添加资源管理器组件
        LogUtil.GetInstance().WriteGame("Add ResourceManager");
        Utils.Add <SocketClient>(gameObject);      // 添加socket组件
        LogUtil.GetInstance().WriteGame("Add SocketClient");
        Utils.Add <NetworkManager>(gameObject);    // 添加网络消息管理器组件
        LogUtil.GetInstance().WriteGame("Add NetworkManager");
        Utils.Add <UIManager>(gameObject);         // 添加UI管理器
        LogUtil.GetInstance().WriteGame("Add UIManager");
        Utils.Add <LuaManager>(gameObject);        // 添加LUA管理器
        LogUtil.GetInstance().WriteGame("Add LuaManager");

        // 初始化LUA
        LuaInited();
        LogUtil.GetInstance().WriteGame("LuaInited");

        // 初始化资源管理
        eye.resourceManager.Initialize(delegate()
        {
            // 先读取部分AssetBundle
            ResourceManager.LoadAssetBundle("ui_dialog_login");

            // 游戏开始
            LuaFun.gameStart.Call();

            // 启动游戏主逻辑, 每分钟调用
            StartCoroutine(GameLogic());
        });
    }
Пример #4
0
    public bool Initialize()
    {
        // 创建日志系统
        LogUtil.GetInstance().Create(PathUtil.LogPath());
        LogUtil.GetInstance().WriteGame("------------------ Game Log Begin ------------------");
        LogUtil.GetInstance().WriteNet("------------------ Net Log Begin ------------------");

        // 本地化系统初始化,再读一遍,因为文字表有更新
        if (Localization.init() < 0)
        {
            LogUtil.GetInstance().WriteGame("Localization Init Failed");
            return(false);
        }
        LogUtil.GetInstance().WriteGame("STEP 1");
        // 再次读取本地程序配置文件,因为编辑器模式下,启动场景不使用
        if (m_pLocalAppIni.OpenFromData(m_szAppTxt) == false)
        {
            LogUtil.GetInstance().WriteGame(m_szAppTxt + " Not Found!!!");
        }
        else
        {
            m_pLocalAppIni.SetGlobal();
        }
        LogUtil.GetInstance().WriteGame("STEP 2");

        // 再次读取本地资源版本文件,因为编辑器模式下,启动场景不使用
        if (m_pLocalResverIni.OpenFromTXT(PathUtil.ConfigPath() + m_szResverTxt) == false)
        {
            LogUtil.GetInstance().WriteGame(PathUtil.ConfigPath() + m_szResverTxt + " Not Found");
        }
        else
        {
            m_pLocalResverIni.SetGlobal();
        }
        LogUtil.GetInstance().WriteGame("STEP 3");

        Utils.Add <ObjectPoolManager>(gameObject); // 添加对象池管理器
        LogUtil.GetInstance().WriteGame("Add ObjectPoolManager");
        Utils.Add <ResourceManager>(gameObject);   // 添加资源管理器组件
        LogUtil.GetInstance().WriteGame("Add ResourceManager");
        Utils.Add <SocketClient>(gameObject);      // 添加socket组件
        LogUtil.GetInstance().WriteGame("Add SocketClient");
        Utils.Add <NetworkManager>(gameObject);    // 添加网络消息管理器组件
        LogUtil.GetInstance().WriteGame("Add NetworkManager");
        Utils.Add <UIManager>(gameObject);         // 添加UI管理器
        LogUtil.GetInstance().WriteGame("Add UIManager");
        Utils.Add <LuaManager>(gameObject);        // 添加LUA管理器
        LogUtil.GetInstance().WriteGame("Add LuaManager");
        Utils.Add <AudioManager>(gameObject);      // 添加音效管理器
        LogUtil.GetInstance().WriteGame("Add AudioManager");

        // 初始化LUA
        LuaInited();
        LogUtil.GetInstance().WriteGame("LuaInited");

        // 初始化资源管理
        eye.resourceManager.Initialize(delegate()
        {
            // 游戏开始
            LuaFun.gameStart.Call();

            // 启动游戏主逻辑, 每秒调用
            InvokeRepeating("GameLogic", 0, 1.0f);

            m_bLuaInit = true;
        });
        return(true);
    }
Пример #5
0
    /// <summary>
    /// 打包
    /// </summary>
    public static void BuildAssets(BuildTarget target)
    {
        // StreamingAssets 目录
        string streamingAssetsPath       = Application.dataPath + "/StreamingAssets/";
        string StreamingAssetsPathUpload = Application.dataPath + "/../StreamingAssetsUpload/";

        // 没有StreamingAssets就创建
        if (!Directory.Exists(streamingAssetsPath))
        {
            Directory.CreateDirectory(streamingAssetsPath);
        }
        if (!Directory.Exists(StreamingAssetsPathUpload))
        {
            Directory.CreateDirectory(StreamingAssetsPathUpload);
        }

        // 清空StreamingAssets目录
        clearDirectory(streamingAssetsPath);
        clearDirectory(StreamingAssetsPathUpload);

        //if ( Const.ResourceMode == "assetbundle" )
        //{
        BuildPipeline.BuildAssetBundles(StreamingAssetsPathUpload, BuildAssetBundleOptions.ChunkBasedCompression, target);
        //}
        //else
        //    UnityEngine.Debug.Log( "Const.ResourceMode = " + Const.ResourceMode );

        FileInfo fi = new FileInfo(StreamingAssetsPathUpload + "StreamingAssetsUpload");

        fi.MoveTo(StreamingAssetsPathUpload + "StreamingAssets");

        fi = new FileInfo(StreamingAssetsPathUpload + "StreamingAssetsUpload.manifest");
        fi.MoveTo(StreamingAssetsPathUpload + "StreamingAssets.manifest");

        // -------------------------------------- 资源版本文件部分 -------------------------------------------
        // 修改app配置的版本号,每次打包+1
        IniUtil resverIni = new IniUtil();

        resverIni.OpenFromTXT(Application.dataPath + "/../Config/resver.txt");
        int new_resource_version = Convert.ToInt32(resverIni.ReadValue("RESOURCE_VERSION", "0")) + 1;

        resverIni.WriteValue("RESOURCE_VERSION", new_resource_version);
        File.Copy(Application.dataPath + "/../Config/resver.txt", StreamingAssetsPathUpload + "resver.txt", true);

        // -------------------------------------- 配置文件部分 -------------------------------------------
        // 配置文件在StreamingAssets文件夹中的路径
        string targetTxtPath = StreamingAssetsPathUpload + "/Data/";

        if (Directory.Exists(targetTxtPath))
        {
            Directory.Delete(targetTxtPath, true);
        }
        Directory.CreateDirectory(targetTxtPath);

        paths.Clear();
        files.Clear();

        // 配置文件源路径
        string sourceTxtPath = Application.dataPath + "/Resources/PackAssets/Data/";

        // 递归遍历所有文件文件夹
        Recursive(sourceTxtPath);

        // 遍历所有文件并复制
        foreach (string f in files)
        {
            if (f.EndsWith(".meta") || f.EndsWith(".DS_Store"))
            {
                continue;
            }
            string newfile = f.Replace(sourceTxtPath, "");
            if (newfile.Equals("user.txt"))
            {
                continue;
            }
            string newpath = targetTxtPath + newfile;
            string path    = Path.GetDirectoryName(newpath);
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            File.Copy(f, newpath, true);
        }

        // -------------------------------------- lua脚本部分 -------------------------------------------
        // lua脚本在StreamingAssets文件夹中的路径
        string luaPath = StreamingAssetsPathUpload + "Lua/";

        if (Directory.Exists(luaPath))
        {
            Directory.Delete(luaPath, true);
        }
        Directory.CreateDirectory(luaPath);

        paths.Clear();
        files.Clear();

        // lua脚本源路径
        string luaDataPath = Application.dataPath + "/Lua/";

        // 递归遍历所有文件文件夹
        Recursive(luaDataPath);

        // 遍历所有文件并复制
        foreach (string f in files)
        {
            if (!f.EndsWith(".lua"))
            {
                continue;
            }
            string newfile = f.Replace(luaDataPath, "");
            string newpath = luaPath + newfile;
            string path    = Path.GetDirectoryName(newpath);
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            File.Copy(f, newpath, true);
//            if ( target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneOSXUniversal )
//                File.Copy( f, newpath, true );
//            else
//#if UNITY_STANDALONE_WIN
//                Execute( Application.dataPath + "/../../Public/ghlua.exe", f + " " + newpath, 0 );
//#else
//			Execute(Application.dataPath+"/../../Public/ghlua", f + " " + newpath, 0);
//#endif

            //Execute(Application.dataPath+"/../../Public/luajit/luajit.exe", " -b " + f + " " + newpath, 0);
            //Execute(Application.dataPath + "/../../Public/luac/Luac.exe", " -o " + newpath + " " + f, 0);
        }

        // -------------------------------------- 所有文件列表部分 -------------------------------------------
        // 文件列表
        string newFilePath = StreamingAssetsPathUpload + "files.txt";

        if (target == BuildTarget.Android)
        {
            newFilePath = StreamingAssetsPathUpload + "android_files.txt";
        }
        else if (target == BuildTarget.iOS)
        {
            newFilePath = StreamingAssetsPathUpload + "ios_files.txt";
        }
        else if (target == BuildTarget.StandaloneWindows)
        {
            newFilePath = StreamingAssetsPathUpload + "windows_files.txt";
        }
        else if (target == BuildTarget.StandaloneOSXUniversal)
        {
            newFilePath = StreamingAssetsPathUpload + "osx_files.txt";
        }

        // 如果文件存在删除文件
        if (File.Exists(newFilePath))
        {
            File.Delete(newFilePath);
        }

        paths.Clear();
        files.Clear();

        // 递归遍历所有文件文件夹
        Recursive(StreamingAssetsPathUpload);

        // 创建文件列表
        FileStream   fs = new FileStream(newFilePath, FileMode.CreateNew);
        StreamWriter sw = new StreamWriter(fs);

        for (int i = 0; i < files.Count; i++)
        {
            string file = files[i];
            string ext  = Path.GetExtension(file);
            if (ext.Equals(".meta") || ext.Equals(".manifest") || ext.Equals(".DS_Store"))
            {
                continue;
            }

            // md5 值
            string md5 = Utils.md5file(file);
            // 文件大小
            FileInfo fileInfo = new FileInfo(file);
            long     size     = fileInfo.Length;
            // 文件相对路径
            string value = file.Replace(StreamingAssetsPathUpload, string.Empty);
            sw.WriteLine(value + "|" + md5 + "|" + size);
        }
        sw.Close();
        fs.Close();

        // ------------------------------------------------------------------------------------------------------------------------------------------------------------
        // -------------------------------------- 完毕以后,把StreamingAssetsUpload里的文件拷贝到StreamingAssets,刨去需要过滤的 -------------------------------------------
        if (target == BuildTarget.Android || target == BuildTarget.StandaloneWindows)
        {
            foreach (string f in files)
            {
                //string filename = Path.GetFileName( f );
                //if ( filename.Equals( "android_files.txt" )  )
                //    continue;

                //if ( filename.Equals( "ui_background" ) )
                //    continue;
                //if ( filename.Equals( "ui_background.manifest" ) )
                //    continue;

                //if ( filename.Equals( "ui_building" ) )
                //    continue;
                //if ( filename.Equals( "ui_building.manifest" ) )
                //    continue;

                //if ( filename.Equals( "ui_dialog" ) )
                //    continue;
                //if ( filename.Equals( "ui_dialog.manifest" ) )
                //    continue;

                //if ( filename.Equals( "ui_film" ) )
                //    continue;
                //if ( filename.Equals( "ui_film.manifest" ) )
                //    continue;

                //if ( filename.Equals( "ui_pre" ) )
                //    continue;
                //if ( filename.Equals( "ui_pre.manifest" ) )
                //    continue;

                //if ( filename.Equals( "tiled2unity" ) )
                //    continue;
                //if ( filename.Equals( "tiled2unity.manifest" ) )
                //    continue;

                //if ( filename.Equals( "mapthumb" ) )
                //    continue;
                //if ( filename.Equals( "mapthumb.manifest" ) )
                //    continue;

                //if ( filename.Equals( "mapcity" ) )
                //    continue;
                //if ( filename.Equals( "mapcity.manifest" ) )
                //    continue;

                //if ( filename.Equals( "building" ) )
                //    continue;
                //if ( filename.Equals( "building.manifest" ) )
                //    continue;

                //if ( filename.Equals( "char_1" ) )
                //    continue;
                //if ( filename.Equals( "char_1.manifest" ) )
                //    continue;

                //if ( filename.Equals( "city_0" ) )
                //    continue;
                //if ( filename.Equals( "city_0.manifest" ) )
                //    continue;

                //if ( filename.Equals( "effect_0" ) )
                //    continue;
                //if ( filename.Equals( "effect_0.manifest" ) )
                //    continue;

                //if ( filename.Equals( "effect_2" ) )
                //    continue;
                //if ( filename.Equals( "effect_2.manifest" ) )
                //    continue;

                string newfile = f.Replace("../StreamingAssetsUpload", "StreamingAssets");
                string path    = Path.GetDirectoryName(newfile);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                File.Copy(f, newfile, true);
            }
        }
        else if (target == BuildTarget.iOS)
        {
            foreach (string f in files)
            {
                string filename = Path.GetFileName(f);
                if (filename.Equals("ios_files.txt"))
                {
                    continue;
                }

                string newfile = f.Replace("../StreamingAssetsUpload", "StreamingAssets");
                string path    = Path.GetDirectoryName(newfile);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                File.Copy(f, newfile, true);
            }
        }

        newFilePath = newFilePath.Replace("../StreamingAssetsUpload", "StreamingAssets");
        // 如果文件存在删除文件
        if (File.Exists(newFilePath))
        {
            File.Delete(newFilePath);
        }

        paths.Clear();
        files.Clear();

        // 递归遍历所有文件文件夹
        Recursive(streamingAssetsPath);

        // 从新创建文件列表
        fs = new FileStream(newFilePath, FileMode.CreateNew);
        sw = new StreamWriter(fs);
        for (int i = 0; i < files.Count; i++)
        {
            string file = files[i];
            string ext  = Path.GetExtension(file);
            if (ext.Equals(".meta") || ext.Equals(".manifest") || ext.Equals(".DS_Store"))
            {
                continue;
            }
            // md5 值
            string md5 = Utils.md5file(file);
            // 文件大小
            FileInfo fileInfo = new FileInfo(file);
            long     size     = fileInfo.Length;
            // 文件相对路径
            string value = file.Replace(streamingAssetsPath, string.Empty);
            sw.WriteLine(value + "|" + md5 + "|" + size);
        }
        sw.Close();
        fs.Close();

        AssetDatabase.Refresh();
        //ZipProxy.compless(resPath, "z.zip");
    }
Пример #6
0
    // 根据选择语言进行初始化
    public static int init()
    {
        destroy();

        countryCodeTable  = new Dictionary <string, string[]>();
        countryIdTable    = new Dictionary <int, string[]>();
        languageCodeTable = new Dictionary <string, string[]>();
        languageIdTable   = new Dictionary <int, string[]>();

        // 读取国家信息
        TableUtil _countryTxt = new TableUtil();

        if (_countryTxt.OpenFromData("localization_country.txt") == false)
        {
            return(-1);
        }
        for (int row = 0; row < _countryTxt.GetRecordsNum(); row++)
        {
            string countryCode   = _countryTxt.GetValue(row, 0);       //  国家英文代码(国际标准)
            string CountryID     = _countryTxt.GetValue(row, 1);       //  国家数字代码(国际标准)
            string CountryNameID = _countryTxt.GetValue(row, 2);       //  国家名称ID
            string CountryFlag   = _countryTxt.GetValue(row, 3);       //  国旗资源名
            string CountryMoney  = _countryTxt.GetValue(row, 4);       //  货币简称

            // 英文编码作key
            if (countryCodeTable.ContainsKey(countryCode) == false)
            {
                string[] ls = new string[4];
                ls[0] = CountryID;
                ls[1] = CountryNameID;
                ls[2] = CountryFlag;
                ls[3] = CountryMoney;
                countryCodeTable.Add(countryCode, ls);
            }
            // 数字编码作key
            if (countryIdTable.ContainsKey(Convert.ToInt32(CountryID)) == false)
            {
                string[] ls = new string[4];
                ls[0] = countryCode;
                ls[1] = CountryNameID;
                ls[2] = CountryFlag;
                ls[3] = CountryMoney;
                countryIdTable.Add(Convert.ToInt32(CountryID), ls);
            }
        }

        // 读取语言信息
        TableUtil _languageTxt = new TableUtil();

        if (_languageTxt.OpenFromData("localization_language.txt") == false)
        {
            return(-2);
        }
        for (int row = 0; row < _languageTxt.GetRecordsNum(); row++)
        {
            string LanguageCode      = _languageTxt.GetValue(row, 0);       //  语言英文代码(国际标准)
            string LanguageCustomID  = _languageTxt.GetValue(row, 1);       //  语言自定义ID(无标准,暂时跟u3d里定义的语言ID走)
            string LanguageNameID    = _languageTxt.GetValue(row, 2);       //  语言名称ID
            string LanguageDirectory = _languageTxt.GetValue(row, 3);       //  语言存在目录
            string TranslationCode   = _languageTxt.GetValue(row, 4);       //  翻译Code

            // 英文编码作key
            if (languageCodeTable.ContainsKey(LanguageCode) == false)
            {
                string[] ls = new string[4];
                ls[0] = LanguageCustomID;
                ls[1] = LanguageNameID;
                ls[2] = LanguageDirectory;
                ls[3] = TranslationCode;
                languageCodeTable.Add(LanguageCode, ls);
            }
            // 数字编码作key
            if (languageIdTable.ContainsKey(Convert.ToInt32(LanguageCustomID)) == false)
            {
                string[] ls = new string[4];
                ls[0] = LanguageCode;
                ls[1] = LanguageNameID;
                ls[2] = LanguageDirectory;
                ls[3] = TranslationCode;
                languageIdTable.Add(Convert.ToInt32(LanguageCustomID), ls);
            }
        }

        // 用户本地配置文件里获取玩家已经选择的国家语言
        IniUtil userIni = new IniUtil();

        userIni.OpenFromTXT(PathUtil.ConfigPath() + "user.txt");

        // 读取使用语言
        currentLanguage = userIni.ReadValue("LANGUAGE", "").ToString();
        if (currentLanguage == "")
        {
            // 没有存档的,使用设备当前的
            currentLanguage = DeviceHelper.getLanguage();
            userIni.WriteValue("LANGUAGE", currentLanguage);
        }

        // 读取使用国家
        currentCountry = userIni.ReadValue("COUNTRY", "").ToString();
        if (currentCountry == "")
        {
            // 没有存档的,使用设备当前的
            currentCountry = DeviceHelper.getCountry();
            userIni.WriteValue("COUNTRY", currentCountry);
        }

        // 先去语言信息里找一下,语言-地区的目录(如zh-cn),没有则直接使用语言(如zh,ru,en等),还是没有则使用英文的
        string localizeDir = languageDirectory(currentLanguage + "-" + currentCountry);

        if (localizeDir == "")
        {
            localizeDir = languageDirectory(currentLanguage);
            if (localizeDir == "")
            {
                localizeDir = languageDirectory("en");
                if (localizeDir == "")
                {
                    return(-3);
                }
            }
        }
        localizeDir = localizeDir + "/";

        // 读取基础文字表
        TableUtil _localizetxt = new TableUtil();

        localize = new Dictionary <int, string>();
        if (_localizetxt.OpenFromData(localizeDir + "localize.txt") == false)
        {
            // 没有对应的语言文件夹,用英语的
            localizeDir = languageDirectory("en") + "/";
            if (_localizetxt.OpenFromData(localizeDir + "localize.txt") == false)
            {
                return(-4);
            }
        }

        for (int row = 0; row < _localizetxt.GetRecordsNum(); row++)
        {
            int    key  = Convert.ToInt32(_localizetxt.GetValue(row, 0));
            string text = _localizetxt.GetValue(row, 1);
            text = text.Replace("\\n", "\n");
            localize.Add(key, text);
        }

        // 读取道具文字表
        TableUtil _localizeItemTxt = new TableUtil();

        localize_item = new Dictionary <int, string>();
        if (_localizeItemTxt.OpenFromData(localizeDir + "localize_item.txt") == false)
        {
            // 没有对应的语言文件夹,用英语的
            localizeDir = languageDirectory("en") + "/";
            if (_localizeItemTxt.OpenFromData(localizeDir + "localize_item.txt") == false)
            {
                return(-5);
            }
        }

        for (int row = 0; row < _localizeItemTxt.GetRecordsNum(); row++)
        {
            int    key  = Convert.ToInt32(_localizeItemTxt.GetValue(row, 0));
            string text = _localizeItemTxt.GetValue(row, 1);
            text = text.Replace("\\n", "\n");
            localize_item.Add(key, text);
        }

        // 读取任务文字表
        TableUtil _localizeQuestTxt = new TableUtil();

        localize_quest = new Dictionary <int, string>();
        if (_localizeQuestTxt.OpenFromData(localizeDir + "localize_quest.txt") == false)
        {
            // 没有对应的语言文件夹,用英语的
            localizeDir = languageDirectory("en") + "/";
            if (_localizeQuestTxt.OpenFromData(localizeDir + "localize_quest.txt") == false)
            {
                return(-6);
            }
        }

        for (int row = 0; row < _localizeQuestTxt.GetRecordsNum(); row++)
        {
            int    key  = Convert.ToInt32(_localizeQuestTxt.GetValue(row, 0));
            string text = _localizeQuestTxt.GetValue(row, 1);
            text = text.Replace("\\n", "\n");
            localize_quest.Add(key, text);
        }

        // 容错处理,所有找不到的文字使用英文
        localizeDir = languageDirectory("en") + "/";

        // 读取基础文字表
        TableUtil localizetxt_en_us = new TableUtil();

        localize_en_us = new Dictionary <int, string>();
        localizetxt_en_us.OpenFromData(localizeDir + "localize.txt");
        for (int row = 0; row < localizetxt_en_us.GetRecordsNum(); row++)
        {
            int    key  = Convert.ToInt32(localizetxt_en_us.GetValue(row, 0));
            string text = localizetxt_en_us.GetValue(row, 1);
            text = text.Replace("\\n", "\n");
            localize_en_us.Add(key, text);
        }

        // 读取道具文字表
        TableUtil localizeitemtxt_en_us = new TableUtil();

        localize_item_en_us = new Dictionary <int, string>();
        localizeitemtxt_en_us.OpenFromData(localizeDir + "localize_item.txt");
        for (int row = 0; row < localizeitemtxt_en_us.GetRecordsNum(); row++)
        {
            int    key  = Convert.ToInt32(localizeitemtxt_en_us.GetValue(row, 0));
            string text = localizeitemtxt_en_us.GetValue(row, 1);
            text = text.Replace("\\n", "\n");
            localize_item_en_us.Add(key, text);
        }

        // 读取任务文字表
        TableUtil localizequesttxt_en_us = new TableUtil();

        localize_quest_en_us = new Dictionary <int, string>();
        localizequesttxt_en_us.OpenFromData(localizeDir + "localize_quest.txt");
        for (int row = 0; row < localizequesttxt_en_us.GetRecordsNum(); row++)
        {
            int    key  = Convert.ToInt32(localizequesttxt_en_us.GetValue(row, 0));
            string text = localizequesttxt_en_us.GetValue(row, 1);
            text = text.Replace("\\n", "\n");
            localize_quest_en_us.Add(key, text);
        }

        bInited = true;
        return(0);
    }