Ejemplo n.º 1
0
    /// <summary>
    /// 从proto中获取关联的proto文件
    /// </summary>
    /// <param name="protoName"></param>
    /// <param name="protoNameList"></param>
    private void GetRelatedProtoFromProto(string protoName, string protoDirPath, List <string> protoNameList)
    {
        CSStringBuilder.Clear();
        //CSStringBuilder.AppendParams(ServerTool_ProtocolControllerWnd.LocalServerProtoPath);
        CSStringBuilder.AppendParams(protoDirPath);
        CSStringBuilder.AppendParams("/");
        CSStringBuilder.AppendParams(protoName);
        CSStringBuilder.AppendParams(".proto");
        string filePath = CSStringBuilder.ToStringParams();

        try
        {
            if (File.Exists(filePath))
            {
                string[] lineStrs = File.ReadAllLines(filePath);
                for (int i = 0; i < lineStrs.Length; i++)
                {
                    if (Regex.IsMatch(lineStrs[i], linePattern_ImportProto))
                    {
                        string newProtoName = lineStrs[i].Replace("import", string.Empty).Replace('\"', ' ').Replace(';', ' ').Replace(".proto", string.Empty).Trim();
                        if (!protoNameList.Contains(newProtoName))
                        {
                            GetRelatedProtoFromProto(newProtoName, protoDirPath, protoNameList);
                        }
                    }
                }
                if (!protoNameList.Contains(protoName))
                {
                    protoNameList.Add(protoName);
                }
            }
        }
        catch (Exception) { }
    }
Ejemplo n.º 2
0
 /// <summary>
 /// 打开协议同名的proto文件
 /// </summary>
 /// <param name="protocol"></param>
 private void OpenProtoFile(ProtocolControlCache_Protocol protocol)
 {
     if (protocol != null)
     {
         ProtocolControlCache_ProtocolXMLStructure xmlStructure = ServerProtocolControllerWnd.DeserializeXML(protocol.xmlName);
         if (xmlStructure != null)
         {
             CSStringBuilder.Clear();
             CSStringBuilder.AppendParams(LocalServerProtoPath);
             CSStringBuilder.AppendParams('/');
             CSStringBuilder.AppendParams(xmlStructure.protoName);
             CSStringBuilder.AppendParams(".proto");
         }
         else
         {
             CSStringBuilder.Clear();
             CSStringBuilder.AppendParams(LocalServerProtoPath);
             CSStringBuilder.AppendParams('/');
             CSStringBuilder.AppendParams(protocol.xmlName);
             CSStringBuilder.AppendParams(".proto");
         }
         string fullPath = CSStringBuilder.ToStringParams();
         if (!File.Exists(fullPath))
         {
             UnityEngine.Debug.LogError(string.Format("{0} 文件不存在", fullPath));
             return;
         }
         Process.Start(fullPath);
     }
 }
Ejemplo n.º 3
0
    public string GetCombineModel(uint model, uint avaterMotion, uint avaterDirection)
    {
        if (avaterMotion == 0 && avaterDirection == 0)
        {
            return(model.ToString());
        }
        uint        motion    = (uint)avaterMotion;
        uint        direction = (uint)avaterDirection;
        CSDirection d         = (CSDirection)direction;

        if (avaterMotion == (uint)CSMotion.Dead)
        {
            d = CSDirection.Up;
        }
        if (d == CSDirection.Left)
        {
            d = CSDirection.Right;
        }
        else if (d == CSDirection.Left_Up)
        {
            d = CSDirection.Right_Up;
        }
        else if (d == CSDirection.Left_Down)
        {
            d = CSDirection.Right_Down;
        }
        direction = (uint)d;
        CSStringBuilder.Clear();
        CSStringBuilder.Append(model.ToString(), "_", SFMisc.stringMotionDic.ContainsKey((int)motion) ? SFMisc.stringMotionDic[(int)motion] : "", "_", direction.ToString());
        return(CSStringBuilder.ToString());
    }
        static int _s_set_strBuilder(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                CSStringBuilder gen_to_be_invoked = (CSStringBuilder)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.strBuilder = (System.Text.StringBuilder)translator.GetObject(L, 2, typeof(System.Text.StringBuilder));
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(0);
        }
        static int _g_get_strBuilder(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                CSStringBuilder gen_to_be_invoked = (CSStringBuilder)translator.FastGetCSObj(L, 1);
                translator.Push(L, gen_to_be_invoked.strBuilder);
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(1);
        }
        static int _m_Clear_xlua_st_(RealStatePtr L)
        {
            try {
                {
                    CSStringBuilder.Clear(  );



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _m_ToStringParams_xlua_st_(RealStatePtr L)
        {
            try {
                {
                    var gen_ret = CSStringBuilder.ToStringParams(  );
                    LuaAPI.lua_pushstring(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 8
0
 private void ShowList()
 {
     #region 协议列表
     EditorGUILayout.Space();
     scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
     EditorGUILayout.BeginVertical();
     for (int i = 0; i < Data.protocols.Count; i++)
     {
         if (IsConformToKeyword(Data.protocols[i].protocolName) || IsConformToKeyword(Data.protocols[i].xmlName))
         {
             EditorGUILayout.BeginHorizontal();
             if (GUILayout.Button("打开协议", GUILayout.Width(80)))
             {
                 OpenXMLFile(Data.protocols[i]);
             }
             if (GUILayout.Button("打开proto", GUILayout.Width(80)))
             {
                 OpenProtoFile(Data.protocols[i]);
             }
             if (GUILayout.Button("从服务器文件夹同步", GUILayout.Width(120)))
             {
                 SyncProtocol(Data.protocols[i]);
             }
             CSStringBuilder.Clear();
             CSStringBuilder.AppendParams((i + 1).ToString("d4"));
             CSStringBuilder.AppendParams(".  ");
             CSStringBuilder.AppendParams(Data.protocols[i].protocolName);
             EditorGUILayout.LabelField(CSStringBuilder.ToStringParams(), GUILayout.Width(100));
             EditorGUILayout.LabelField(Data.protocols[i].xmlName);
             Data.protocols[i].isProtocolUsedInLua = EditorGUILayout.ToggleLeft("Lua相关的协议", Data.protocols[i].isProtocolUsedInLua, GUILayout.Width(100));
             if (GUILayout.Button("移除  " + Data.protocols[i].xmlName, GUILayout.Width(120), GUILayout.ExpandWidth(true)))
             {
                 indexToBeRemoved = i;
             }
             EditorGUILayout.EndHorizontal();
         }
     }
     if (indexToBeRemoved >= 0)
     {
         Data.protocols.RemoveAt(indexToBeRemoved);
         indexToBeRemoved = -1;
     }
     EditorGUILayout.EndVertical();
     GUI.enabled = true;
     EditorGUILayout.EndScrollView();
     #endregion
 }
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    var gen_ret = new CSStringBuilder();
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to CSStringBuilder constructor!"));
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 打开协议对应的xml文件
 /// </summary>
 /// <param name="protocol">协议</param>
 private void OpenXMLFile(ProtocolControlCache_Protocol protocol)
 {
     if (protocol != null)
     {
         CSStringBuilder.Clear();
         CSStringBuilder.AppendParams(LocalServerProtoXMLPath);
         CSStringBuilder.AppendParams('/');
         CSStringBuilder.AppendParams(protocol.xmlName);
         CSStringBuilder.AppendParams(".xml");
         string fullPath = CSStringBuilder.ToStringParams();
         if (!File.Exists(fullPath))
         {
             UnityEngine.Debug.LogError(string.Format("{0} 文件不存在", fullPath));
             return;
         }
         Process.Start(fullPath);
     }
 }
Ejemplo n.º 11
0
    /// <summary>
    /// 从缓存池里面获得GameObject,并且从缓存池里面去除,返回的Gameobject.active = false
    /// </summary>resPath 资源路径,也是缓存池名称
    /// <param name="poolName">资源路径</param>
    CSObjectPoolItem GetPoolItem(string resName, string resPath, EPoolType poolType, int poolNum = 0, bool isForever = false)
    {
        CSObjectPoolBase pool     = null;
        string           poolName = resPath;

        if (mDic.ContainsKey(poolName))
        {
            pool = mDic[poolName];
        }
        else
        {
            if (poolNum == 0)
            {
                return(null);
            }
            CSStringBuilder.Clear();

            GameObject poolGO = new GameObject();
            Transform  trans  = poolGO.transform;
            trans.parent = transform;
            if (poolType == EPoolType.Normal)
            {
                pool = poolGO.AddComponent <CSObjectPoolNormal>();
                CSStringBuilder.Append("Normal Pool->", resName);
                poolGO.name = CSStringBuilder.ToString();
            }
            else if (poolType == EPoolType.Resource)
            {
                pool = poolGO.AddComponent <CSObjectPoolAtlas>();
                CSStringBuilder.Append("Atlas Pool->", resName);
                poolGO.name = CSStringBuilder.ToString();
            }
            pool.resName = resName;
            //pool.resType = resType;
            pool.Init(this);
            mDic.Add(poolName, pool);
            mList.Add(pool);
        }
        pool.poolNum   = poolNum;
        pool.poolName  = poolName;
        pool.isForever = isForever;
        return(pool.GetGOFromPool());
    }
        static int _m_AppendParams_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    object[] _strs = translator.GetParams <object>(L, 1);

                    var gen_ret = CSStringBuilder.AppendParams(_strs);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Ejemplo n.º 13
0
    /// <summary>
    /// 从缓存池里面获得GameObject,并且从缓存池里面去除,返回的Gameobject.active = false
    /// </summary>resPath 资源路径,也是缓存池名称
    /// <param name="poolName">资源路径</param>
    private CSObjectPoolItem GetPoolItem(string resName, string resPath, EPoolType poolType, int poolNum = 0, bool isForever = false)
    {
        CSObjectPoolBase pool     = null;
        string           poolName = resPath;

        if (mDic.TryGetValue(poolName, out pool) && pool != null)
        {
            pool = mDic[poolName];
        }
        else
        {
            if (poolNum == 0)
            {
                return(null);
            }

            CSStringBuilder.Clear();

            GameObject poolGO = new GameObject();
            Transform  trans  = poolGO.transform;
            trans.parent = transform;
            if (poolType == EPoolType.Normal)
            {
                pool = poolGO.AddComponent <CSObjectPoolNormal>();
                CSStringBuilder.Append("Normal Pool->", resName);
                poolGO.name = CSStringBuilder.ToString();
            }
            pool.resName = resName;
            //pool.resType = resType;
            pool.Init();
            mDic[poolName]            = pool;
            pool.transform.localScale = Vector3.zero;
            //mDic.Add(poolName, pool);
            mList.Add(pool);
        }
        pool.poolNum   = poolNum;
        pool.poolName  = poolName;
        pool.isForever = isForever;
        return(pool.GetGOFromPool());
    }
Ejemplo n.º 14
0
    /// <summary>
    /// 从xml协议中获取相关的proto文件名
    /// </summary>
    /// <param name="xmlDirPath">xml文件夹路径</param>
    /// <param name="xmlName">xml名</param>
    /// <param name="mainProto">该xml对应的proto文件名</param>
    /// <returns></returns>
    private List <string> GetRelatedProtoFromXML(string xmlDirPath, string protoDirPath, string xmlName, out string mainProto)
    {
        List <string> protoNameList = new List <string>();

        CSStringBuilder.Clear();
        CSStringBuilder.AppendParams(xmlDirPath);
        CSStringBuilder.AppendParams("/");
        CSStringBuilder.AppendParams(xmlName);
        CSStringBuilder.AppendParams(".xml");
        ProtocolControlCache_ProtocolXMLStructure xmlStructure = ServerProtocolControllerWnd.DeserializeXML(CSStringBuilder.ToStringParams());

        if (xmlStructure != null)
        {
            mainProto = xmlStructure.protoName;
            GetRelatedProtoFromProto(mainProto, protoDirPath, protoNameList);
        }
        else
        {
            mainProto = string.Empty;
        }
        return(protoNameList);
    }
Ejemplo n.º 15
0
    public static string GetPath(string fileName, ResourceType LocalType, bool isLocal)
    {
        string path = "";

        if (isLocal)
        {
            CSStringBuilder.Clear();
            CSStringBuilder.Append(GetModelTypePath(LocalType), fileName);
            path = CSStringBuilder.ToString();//Resource.Load(存的是相对路径)
        }
        else
        {
            CSStringBuilder.Clear();

            bool isAssetBundle = false;
            switch (LocalType)
            {
            case ResourceType.Map:
            case ResourceType.MiniMap:
            case ResourceType.Player:
            case ResourceType.PlayerAtlas:
            case ResourceType.Monster:
            case ResourceType.MonsterAtlas:
            case ResourceType.Npc:
            case ResourceType.NpcAtlas:
            case ResourceType.Weapon:
            case ResourceType.WeaponAtlas:
            case ResourceType.Effect:
            case ResourceType.EffectAtlas:
            case ResourceType.Skill:
            case ResourceType.SkillAtlas:
            case ResourceType.UIItem:
            case ResourceType.Audio:
            case ResourceType.Wing:
            case ResourceType.WingAtlas:
            case ResourceType.UIMountAtlas:
            case ResourceType.ScaleMap:
            case ResourceType.UIEffect:
            case ResourceType.UIWingTex:
            case ResourceType.UIPlayer:
            case ResourceType.UIWeapon:
            case ResourceType.SceneRes:
            case ResourceType.ResourceRes:
            {
                isAssetBundle = true;
            }
            break;
            }

#if UNITY_EDITOR
            if (SFOut.IGame.IsLoadLocalRes)
            {
                if (string.IsNullOrEmpty(applicationDataPath))
                {
                    applicationDataPath = Application.dataPath;
                }

                if (UnityEditor.EditorUserBuildSettings.selectedBuildTargetGroup == UnityEditor.BuildTargetGroup.iOS)
                {
                    path = applicationDataPath.Replace("Client/Branch/ClientIos/Assets", "Data/Branch/CurrentUseData/Normal/wzcq_ios/");
                }
                else
                {
                    path = applicationDataPath + "/../../Normal/wzcq_android/";
                    //path = applicationDataPath.Replace("Client/Branch/WZAndroidOrigin/Assets", "Data/Branch/CurrentUseData/Normal/wzcq_android/");
                }
                path = CSStringBuilder.Append("file://", path, GetModelTypePath(LocalType), fileName, isAssetBundle ? assetbunldeStr : "").ToString();
            }
            else
            {
                if (string.IsNullOrEmpty(applicationDataPath))
                {
                    applicationDataPath = Application.persistentDataPath;
                }
                path = CSStringBuilder.Append("file:///", applicationDataPath, "/", GetModelTypePath(LocalType), fileName, isAssetBundle ? assetbunldeStr : "").ToString();
            }
#else
            if (string.IsNullOrEmpty(applicationDataPath))
            {
                applicationDataPath = Application.persistentDataPath;
            }
            path = CSStringBuilder.Append("file://", applicationDataPath, "/", GetModelTypePath(LocalType), fileName, isAssetBundle ? assetbunldeStr : "").ToString();
#endif
        }
        return(path);
    }
        static int _m_Append_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 1 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
                {
                    string _str = LuaAPI.lua_tostring(L, 1);

                    var gen_ret = CSStringBuilder.Append(_str);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
                {
                    string _str0 = LuaAPI.lua_tostring(L, 1);
                    string _str1 = LuaAPI.lua_tostring(L, 2);

                    var gen_ret = CSStringBuilder.Append(_str0, _str1);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 3 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
                {
                    string _str0 = LuaAPI.lua_tostring(L, 1);
                    string _str1 = LuaAPI.lua_tostring(L, 2);
                    string _str2 = LuaAPI.lua_tostring(L, 3);

                    var gen_ret = CSStringBuilder.Append(_str0, _str1, _str2);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 4 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 4) || LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TSTRING))
                {
                    string _str0 = LuaAPI.lua_tostring(L, 1);
                    string _str1 = LuaAPI.lua_tostring(L, 2);
                    string _str2 = LuaAPI.lua_tostring(L, 3);
                    string _str3 = LuaAPI.lua_tostring(L, 4);

                    var gen_ret = CSStringBuilder.Append(_str0, _str1, _str2, _str3);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 5 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 4) || LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 5) || LuaAPI.lua_type(L, 5) == LuaTypes.LUA_TSTRING))
                {
                    string _str0 = LuaAPI.lua_tostring(L, 1);
                    string _str1 = LuaAPI.lua_tostring(L, 2);
                    string _str2 = LuaAPI.lua_tostring(L, 3);
                    string _str3 = LuaAPI.lua_tostring(L, 4);
                    string _str4 = LuaAPI.lua_tostring(L, 5);

                    var gen_ret = CSStringBuilder.Append(_str0, _str1, _str2, _str3, _str4);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 6 && (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 4) || LuaAPI.lua_type(L, 4) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 5) || LuaAPI.lua_type(L, 5) == LuaTypes.LUA_TSTRING) && (LuaAPI.lua_isnil(L, 6) || LuaAPI.lua_type(L, 6) == LuaTypes.LUA_TSTRING))
                {
                    string _str0 = LuaAPI.lua_tostring(L, 1);
                    string _str1 = LuaAPI.lua_tostring(L, 2);
                    string _str2 = LuaAPI.lua_tostring(L, 3);
                    string _str3 = LuaAPI.lua_tostring(L, 4);
                    string _str4 = LuaAPI.lua_tostring(L, 5);
                    string _str5 = LuaAPI.lua_tostring(L, 6);

                    var gen_ret = CSStringBuilder.Append(_str0, _str1, _str2, _str3, _str4, _str5);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to CSStringBuilder.Append!"));
        }
Ejemplo n.º 17
0
    /// <summary>
    /// 刷新相关proto
    /// </summary>
    public void RefreshProtoRelated()
    {
        if (EditorApplication.isCompiling)
        {
            UnityEngine.Debug.LogError("请等待代码编译完毕");
            return;
        }
        EditorUtility.DisplayProgressBar("刷新相关的proto文件", string.Empty, 0);
        string protoFolderPath  = Application.dataPath.Substring(0, Application.dataPath.Length - 7) + "/luaRes/protobufLua/proto";
        string decodeFolderPath = Application.dataPath.Substring(0, Application.dataPath.Length - 7) + "/luaRes/protobufLua/decode";
        string adjustFolderPath = Application.dataPath.Substring(0, Application.dataPath.Length - 7) + "/luaRes/protobufLua/adjust";

        //将proto和proto生成的lua文件复制到对应文件夹
        EditorUtility.DisplayProgressBar("刷新相关的proto文件", "正在清空文件夹", 0.5f);
        CreateEmptyFolder(protoFolderPath);
        CreateEmptyFolder(decodeFolderPath);
        CreateEmptyFolder(adjustFolderPath);
        //proto名列表,保留了关联顺序
        List <string> protoNameList = new List <string>();

        for (int i = 0; i < Data.protocols.Count; i++)
        {
            var temp = Data.protocols[i];
            EditorUtility.DisplayProgressBar("刷新相关的proto文件", "正在解析协议文件 " + temp.xmlName + ".xml", ((float)i / Data.protocols.Count));
            string        mainProto;
            List <string> relatedProtos = GetRelatedProtoFromXML(LocalServerProtoXMLPath, LocalServerProtoPath, temp.xmlName, out mainProto);
            if (!string.IsNullOrEmpty(mainProto) && relatedProtos != null)
            {
                for (int j = 0; j < relatedProtos.Count; j++)
                {
                    if (!protoNameList.Contains(relatedProtos[j]))
                    {
                        protoNameList.Add(relatedProtos[j]);
                    }
                }
            }
        }
        EditorUtility.DisplayProgressBar("刷新相关的proto文件", "正在复制proto文件至文件夹中", 0.3f);
        //复制相关的proto文件到proto文件夹
        CopyAllFiles(protoNameList, LocalServerProtoPath, protoFolderPath, ".proto");
        //从proto文件生成lua文件
        EditorUtility.DisplayProgressBar("刷新相关的proto文件", "正在生成Decode文件(同时检查C#数据结构完整性)", 0f);
        List <string> luaGeneratedList = GenerateLuaFilesFromProto(protoNameList, protoFolderPath, decodeFolderPath, adjustFolderPath);
        //注册所有相关的proto文件到lua中
        string registerAllRelatedProtoLuaScriptPath = Application.dataPath.Substring(0, Application.dataPath.Length - 7) + "/luaRes/protobufLua/registerAllRelatedProto.lua";

        try
        {
            if (File.Exists(registerAllRelatedProtoLuaScriptPath))
            {
                File.Delete(registerAllRelatedProtoLuaScriptPath);
            }
            CSStringBuilder.Clear();
            CSStringBuilder.AppendParams("--[[本文件为工具自动生成,禁止手动修改]]\r\n");
            CSStringBuilder.AppendParams("---加载所有相关proto\r\nlocal LoadAllRelatedProto = {}\r\n\r\n---@param protobufMgr protobuf管理器\r\nfunction LoadAllRelatedProto:LoadAll(protobufMgr)\r\n");
            CSStringBuilder.AppendParams("    ---luaTable->C#数据结构转换\r\n    protobufMgr.DecodeTable = {}\r\n    ---调整luaTable\r\n    protobufMgr.AdjustTable = {}\r\n\r\n");
            for (int i = 0; i < protoNameList.Count; i++)
            {
                EditorUtility.DisplayProgressBar("刷新相关的proto文件", "正在绑定Decode文件中", (i / (float)protoNameList.Count));
                CSStringBuilder.AppendParams("    protobufMgr.RegisterPb(\"");
                CSStringBuilder.AppendParams(protoNameList[i]);
                CSStringBuilder.AppendParams(".proto\")\r\n");
                CSStringBuilder.AppendParams("    ");
                if (!luaGeneratedList.Contains(protoNameList[i]))
                {
                    //如果该proto未生成对应的lua解析文件,则不去引用该文件
                    CSStringBuilder.AppendParams("---未生成 ");
                    CSStringBuilder.AppendParams(protoNameList[i]);
                    CSStringBuilder.AppendParams(".proto 的lua=>C#文件\r\n\r\n");
                    UnityEngine.Debug.LogFormat("{0} 文件中未找到任一C#中已生成的类,故忽略该lua=>C#转换文件", protoNameList[i]);
                }
                else
                {
                    CSStringBuilder.AppendParams("protobufMgr.DecodeTable.");
                    CSStringBuilder.AppendParams(protoNameList[i]);
                    CSStringBuilder.AppendParams(" = require(\"luaRes.protobufLua.decode.");
                    CSStringBuilder.AppendParams(protoNameList[i]);
                    CSStringBuilder.AppendParams("\")\r\n    protobufMgr.AdjustTable.");
                    CSStringBuilder.AppendParams(protoNameList[i]);
                    CSStringBuilder.AppendParams("_adj = require(\"luaRes.protobufLua.adjust.");
                    CSStringBuilder.AppendParams(protoNameList[i]);
                    CSStringBuilder.AppendParams("_adj\")\r\n\r\n");
                }
            }
            CSStringBuilder.AppendParams("end\r\n\r\n");
            CSStringBuilder.AppendParams("return LoadAllRelatedProto");
            File.WriteAllText(registerAllRelatedProtoLuaScriptPath, CSStringBuilder.ToStringParams(), Encoding.UTF8);
            UnityEngine.Debug.Log("消息注册完毕");
        }
        catch (Exception ex)
        {
            UnityEngine.Debug.Log(string.Format("lua注册相关proto失败\r\n{0}\r\n{1}", ex.Message, ex.StackTrace));
        }
        finally
        {
            EditorUtility.ClearProgressBar();
        }
    }