王虎 4 anni fa
commit
d7bb332b55
6 ha cambiato i file con 80 aggiunte e 0 eliminazioni
  1. 1 0
      .gitignore
  2. 33 0
      README.md
  3. 13 0
      handshark.proto
  4. 15 0
      login.proto
  5. 7 0
      result.proto
  6. 11 0
      userinfo.proto

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+gobuild.sh

+ 33 - 0
README.md

@@ -0,0 +1,33 @@
+# 快递项目socket协议protobuf定义
+
+## go
+
+### gogoprotobuf
+* 安装插件 
+* gogoprotobuf有两个插件可以使用
+* protoc-gen-gogo:和protoc-gen-go生成的文件差不多,性能也几乎一样(稍微快一点点)
+* protoc-gen-gofast:生成的文件更复杂,性能也更高(快5-7倍)
+
+```
+//gogo
+go get github.com/gogo/protobuf/protoc-gen-gogo
+
+//gofast
+go get github.com/gogo/protobuf/protoc-gen-gofast
+```
+* 安装gogoprotobuf库文件
+
+```
+go get github.com/gogo/protobuf/proto
+go get github.com/gogo/protobuf/gogoproto  //这个不装也没关系
+```
+* 生成go文件
+```
+//gogo
+protoc --gogo_out=. *.proto
+
+//gofast
+protoc --gofast_out=. *.proto
+```
+
+## unity

+ 13 - 0
handshark.proto

@@ -0,0 +1,13 @@
+
+syntax = "proto3";
+
+package protos;
+
+message HandsharkNotify {
+}
+
+message HandsharkPush {
+}
+
+message HandsharkAckPush {
+}

+ 15 - 0
login.proto

@@ -0,0 +1,15 @@
+syntax = "proto3";
+package protos;
+
+import "result.proto";
+import "userinfo.proto";
+
+message LoginRequest {
+    UserInfo UserInfo = 1;
+}
+
+message LoginResponse {
+    Result Result = 1;
+    int32 LobbyID = 2;
+    int32 RoomID = 3;
+}

+ 7 - 0
result.proto

@@ -0,0 +1,7 @@
+syntax = "proto3";
+package protos;
+
+message Result {
+    int32 Code = 1;
+    string Msg = 2;
+}

+ 11 - 0
userinfo.proto

@@ -0,0 +1,11 @@
+syntax = "proto3";
+package protos;
+
+message UserInfo{
+    int32 UserID = 1; // 用户id
+    string Openid = 2; // 平台openid
+    string Unionid = 3; // 平台unionid
+    string Nickname = 4; // 用户昵称
+    string Avatar = 5; // 用户形象
+    // 其他扩展属性
+}