https://github.com/netpyoung/nf.protocol-flow
:blue_book: Generate interface class from .proto
https://github.com/netpyoung/nf.protocol-flow
code-generator netpyoung-nf protobuf unity3d workflow
Last synced: 3 months ago
JSON representation
:blue_book: Generate interface class from .proto
- Host: GitHub
- URL: https://github.com/netpyoung/nf.protocol-flow
- Owner: netpyoung
- License: mit
- Created: 2017-03-01T18:38:38.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-09-15T01:54:06.000Z (9 months ago)
- Last Synced: 2025-02-28T16:55:41.489Z (3 months ago)
- Topics: code-generator, netpyoung-nf, protobuf, unity3d, workflow
- Language: Python
- Homepage:
- Size: 562 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# nf.protocol-flow

[flow.puml](flow.puml)## introduce
this is sample protocol flow. When I making a game(in unity), I don't like to hard-coding for protocol class from message.Almost mobile projects use web api server. so I choose protobuf as [IDL](https://en.wikipedia.org/wiki/Interface_description_language). after that, I need to writing API call method. But It's boring work that changing code everytime when .proto changed. so I'm writing custom class generator, and protocol exporter for that work.
If you want to use [Akka.net](http://getakka.net/), check [Akka.Interfaced](https://github.com/SaladLab/Akka.Interfaced).
## basic Knowledge.
* [Rakefile](https://github.com/ruby/rake)
* [dotnet cli](https://www.microsoft.com/net/core)
* [Protobuf](https://developers.google.com/protocol-buffers/)# flow
## example
```
$ rake --version
rake, version 10.4.2
$ dotnet --version
2.1.101
$ protoc --version
libprotoc 3.5.1# autogen
$ rake# launch test server
$ rake test_server# generate protoc-doc
$ rake doc
```## message
``` protocol-buffer
message QHello {
int32 q1 = 1; /// hello description.
int32 q2 = 2;
}message RHello {
int32 r1 = 1;
int32 r2 = 2;
}
```## server
``` python
@post('/')
def hello():
r = hello_pb2.RHello()
r.r1 = 11
r.r2 = 22
print(r)
return r.SerializeToString()
```## client
``` csharp
// Hello.autogen.cs
public interface IHello: IMessageSender
{
Task> Hello(QHello q);
Task> Hello(System.Int32 Q1, System.Int32 Q2);
}
`````` csharp
private async void Start()
{
ProtobufHttpSender sender = new ProtobufHttpSender(new Uri("http://127.0.0.1:8080/"), 3000);
Result t = await sender.Hello(1, 2);
if (t.IsErr)
{
Debug.LogError(t.Err);
return;
}Debug.Log(t.Ok);
}
```## etc
* https://atom.io/packages/plantuml-viewer
* https://chrome.google.com/webstore/detail/plantuml-viewer/legbfeljfbjgfifnkmpoajgpgejojooj