Exemple #1
0
        public static void AllProto2CS()
        {
            // InnerMessage.proto生成cs代码
            InnerProto2CS.Proto2CS();

            msgOpcode.Clear();
            Proto2CS("ETModel", "OuterMessage.proto", clientMessagePath, "OuterOpcode", 100);

            msgOpcode.Clear();
            Proto2CS("ETModel", "FrameMessage.proto", "Assets/GameMain/Libraries/ET/Module/FrameSync/", "FrameOpcode", 10);

            msgOpcode.Clear();
            Proto2CS("Trinity.Hotfix", "HotfixMessage.proto", hotfixMessagePath, "HotfixOpcode", 10000);

            //TODO:有问题,暂时只能手动了
//#if !UNITY_EDITOR_OSX
//			CommandRun(System.Environment.CurrentDirectory +@"\Tools\protoc.bat", "");
//#else
//			"bash ./protoc.sh".Bash(System.Environment.CurrentDirectory);
//#endif
            AssetDatabase.Refresh();
        }
Exemple #2
0
        public static void AllProto2CS()
        {
            string rootDir  = Environment.CurrentDirectory;
            string protoDir = Utility.Path.GetCombinePath(rootDir, "Proto/");

            string protoc;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                protoc = Utility.Path.GetCombinePath(protoDir, "protoc.exe");
            }
            else
            {
                protoc = Utility.Path.GetCombinePath(protoDir, "protoc");
            }

            string outerMessageCodePath = Utility.Path.GetCombinePath(rootDir, "Assets", "GameMain", "Libraries", "ET", "Module", "Message/");

            string hotfixMessageCodePath = Utility.Path.GetCombinePath(rootDir, "Assets", "GameMain", "Scripts", "Hotfix", "ETNetwork", "Module", "Message/");

            string argument1 = $"--csharp_out=\"{outerMessageCodePath}\" --proto_path=\"{protoDir}\" OuterMessage.proto";
            string argument2 = $"--csharp_out=\"{hotfixMessageCodePath}\" --proto_path=\"{protoDir}\" HotfixMessage.proto";

            ProcessHelper.Run(protoc, argument1, waitExit: true);
            ProcessHelper.Run(protoc, argument2, waitExit: true);

            // InnerMessage.proto生成cs代码
            InnerProto2CS.Proto2CS();

            msgOpcode.Clear();
            Proto2CS("ETModel", "OuterMessage.proto", clientMessagePath, "OuterOpcode", 100);

            msgOpcode.Clear();
            Proto2CS("ETHotfix", "HotfixMessage.proto", hotfixMessagePath, "HotfixOpcode", 10000);

            UnityEngine.Debug.Log("proto2cs succeed!");

            AssetDatabase.Refresh();
        }