diff --git a/go.mod b/go.mod index 23fce6a5..eb0cc311 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,14 @@ module github.com/aceld/zinx go 1.17 require ( - github.com/golang/protobuf v1.5.3 github.com/gorilla/websocket v1.5.0 github.com/stretchr/testify v1.8.1 github.com/xtaci/kcp-go v5.4.20+incompatible + google.golang.org/protobuf v1.26.0 // indirect ) +require github.com/golang/protobuf v1.5.0 + require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/klauspost/cpuid/v2 v2.1.1 // indirect @@ -22,6 +24,5 @@ require ( golang.org/x/crypto v0.11.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.10.0 // indirect - google.golang.org/protobuf v1.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index e0ce9faa..30b26277 100644 --- a/go.sum +++ b/go.sum @@ -20,9 +20,8 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= diff --git a/zinx_app_demo/mmo_game/pb/msg.pb.go b/zinx_app_demo/mmo_game/pb/msg.pb.go index fb880b2f..caf302f8 100644 --- a/zinx_app_demo/mmo_game/pb/msg.pb.go +++ b/zinx_app_demo/mmo_game/pb/msg.pb.go @@ -20,6 +20,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +// Synchronize client player ID // 同步客户端玩家ID type SyncPID struct { PID int32 `protobuf:"varint,1,opt,name=PID,proto3" json:"PID,omitempty"` @@ -60,7 +61,7 @@ func (m *SyncPID) GetPID() int32 { return 0 } -// 玩家位置 +// Player position type Position struct { X float32 `protobuf:"fixed32,1,opt,name=X,proto3" json:"X,omitempty"` Y float32 `protobuf:"fixed32,2,opt,name=Y,proto3" json:"Y,omitempty"` @@ -124,11 +125,14 @@ func (m *Position) GetV() float32 { return 0 } +// Player broadcast data // 玩家广播数据 type BroadCast struct { PID int32 `protobuf:"varint,1,opt,name=PID,proto3" json:"PID,omitempty"` - Tp int32 `protobuf:"varint,2,opt,name=Tp,proto3" json:"Tp,omitempty"` - // Types that are valID to be assigned to Data: + // 1 - World chat, 2 - Player position, 3 - Action, 4 - Update of coordinates after movement + // 1-世界聊天 2-玩家位置 3 动作 4 移动之后坐标信息更新 + Tp int32 `protobuf:"varint,2,opt,name=Tp,proto3" json:"Tp,omitempty"` + // Types that are valid to be assigned to Data: // *BroadCast_Content // *BroadCast_P // *BroadCast_ActionData @@ -236,6 +240,7 @@ func (*BroadCast) XXX_OneofWrappers() []interface{} { } } +// Player chat data // 玩家聊天数据 type Talk struct { Content string `protobuf:"bytes,1,opt,name=Content,proto3" json:"Content,omitempty"` @@ -276,7 +281,7 @@ func (m *Talk) GetContent() string { return "" } -// 玩家信息 +// Player information type Player struct { PID int32 `protobuf:"varint,1,opt,name=PID,proto3" json:"PID,omitempty"` P *Position `protobuf:"bytes,2,opt,name=P,proto3" json:"P,omitempty"` @@ -324,6 +329,7 @@ func (m *Player) GetP() *Position { return nil } +// Synchronize player display data // 同步玩家显示数据 type SyncPlayers struct { Ps []*Player `protobuf:"bytes,1,rep,name=ps,proto3" json:"ps,omitempty"` @@ -379,20 +385,20 @@ var fileDescriptor_c06e4cca6c2cc899 = []byte{ // 278 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbf, 0x4e, 0xc3, 0x30, 0x10, 0x87, 0x63, 0xe7, 0x4f, 0xc9, 0xa5, 0x42, 0xc8, 0x93, 0x15, 0x18, 0x22, 0x4f, 0x65, 0xc9, - 0x50, 0x24, 0x76, 0x52, 0x86, 0x8c, 0x96, 0x89, 0xaa, 0xb6, 0x9b, 0xd3, 0x54, 0x28, 0xa2, 0xc4, - 0x56, 0xec, 0xa5, 0x8f, 0xc1, 0x6b, 0xf0, 0x94, 0xc8, 0x8e, 0x0a, 0x48, 0xed, 0x64, 0x7f, 0x77, - 0xf6, 0xef, 0x3e, 0xd9, 0x90, 0x7e, 0x9a, 0xf7, 0x52, 0x8f, 0xca, 0x2a, 0x82, 0x75, 0xcb, 0xee, - 0x61, 0xf6, 0x76, 0x1a, 0xf6, 0xbc, 0xef, 0xc8, 0x1d, 0x84, 0xbc, 0xef, 0x28, 0x2a, 0xd0, 0x22, - 0x16, 0x6e, 0xcb, 0x2a, 0xb8, 0xe1, 0xca, 0xf4, 0xb6, 0x57, 0x03, 0x99, 0x03, 0xda, 0xf8, 0x1e, - 0x16, 0x68, 0xe3, 0x68, 0x4b, 0xf1, 0x44, 0x5b, 0x47, 0x3b, 0x1a, 0x4e,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xa8, 0x08, 0x67, 0xd9, 0x1c, 0xfc, 0x59, 0xdf, 0x10, 0x58, 0x9b, 0x2a, + 0xfe, 0xc6, 0x98, 0x77, 0x5d, 0xe2, 0xff, 0xe2, 0xe9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x31, 0xa4, + 0x44, 0x79, 0x98, 0x01, 0x00, 0x00, }