Ejemplo n.º 1
0
        static void ProtobufPreference()
        {
            EditorGUI.BeginChangeCheck();

            enabled = EditorGUILayout.Toggle(new GUIContent("Enable Protobuf Compilation", ""), enabled);

            EditorGUI.BeginDisabledGroup(!enabled);

            EditorGUILayout.HelpBox(@"On Windows put the path to protoc.exe (e.g. C:\My Dir\protoc.exe), on macOS and Linux you can use ""which protoc"" to find its location. (e.g. /usr/local/bin/protoc)", MessageType.Info);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Path to protoc", GUILayout.Width(100));
            rawExcPath = EditorGUILayout.TextField(rawExcPath, GUILayout.ExpandWidth(true));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            logError = EditorGUILayout.Toggle(new GUIContent("Log Error Output", "Log compilation errors from protoc command."), logError);

            logStandard = EditorGUILayout.Toggle(new GUIContent("Log Standard Output", "Log compilation completion messages."), logStandard);

            EditorGUILayout.Space();

            if (GUILayout.Button(new GUIContent("Force Compilation")))
            {
                ProtobufUnityCompiler.CompileAllInProject();
            }

            EditorGUI.EndDisabledGroup();

            if (EditorGUI.EndChangeCheck())
            {
            }
        }
Ejemplo n.º 2
0
        static void ProtobufPreference()
        {
            EditorGUI.BeginChangeCheck();

            enabled = EditorGUILayout.Toggle(new GUIContent("Enable Protobuf Compilation", ""), enabled);

            EditorGUI.BeginDisabledGroup(!enabled);

            EditorGUILayout.HelpBox(
                @"On Windows put the path to protoc.exe (e.g. C:\My Dir\protoc.exe), on macOS and Linux you can use ""which protoc"" to find its location. (e.g. /usr/local/bin/protoc)",
                MessageType.Info);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Path to protoc", GUILayout.Width(100));
            rawExcPath = EditorGUILayout.TextField(rawExcPath, GUILayout.ExpandWidth(true));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Path to grpc", GUILayout.Width(100));
            grpcPath = EditorGUILayout.TextField(grpcPath, GUILayout.ExpandWidth(true));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            logError = EditorGUILayout.Toggle(
                new GUIContent("Log Error Output", "Log compilation errors from protoc command."), logError);

            logStandard =
                EditorGUILayout.Toggle(new GUIContent("Log Standard Output", "Log compilation completion messages."),
                                       logStandard);

            // uniqueNameToDirectory =
            //     EditorGUILayout.Toggle(
            //         new GUIContent("Set Unique To Directory",
            //             "Will make files unique to directory by using directory name as prefix, useful when working with protos with the same name."),
            //         uniqueNameToDirectory);

            // EditorGUILayout.Space();
            //
            // EditorGUILayout.HelpBox(
            //     @"WARNING: This will delete all CS files in the same directory as your proto files, if you have non generated files in these directories they will also be deleted!",
            //     MessageType.Warning);
            //
            // if (GUILayout.Button(new GUIContent("Delete Code Gen Files"))) {
            //     ProtobufUnityCompiler.RemoveGeneratedFiles();
            // }

            EditorGUILayout.Space();

            if (GUILayout.Button(new GUIContent("Force Compilation")))
            {
                ProtobufUnityCompiler.CompileAllInProject();
            }

            EditorGUI.EndDisabledGroup();

            if (EditorGUI.EndChangeCheck())
            {
            }
        }