Commit 7f269318e60603fc36e508764b37de051c636bcb
1 parent
2e0aa298
add pb.go; 添加关闭连接后的操作;
Showing
25 changed files
with
1664 additions
and
34 deletions
Show diff stats
Makefile
@@ -4,7 +4,7 @@ pname = plugin-$(IMGTIME).so | @@ -4,7 +4,7 @@ pname = plugin-$(IMGTIME).so | ||
4 | 4 | ||
5 | gen: | 5 | gen: |
6 | protoc -I./protos --go_out=./protos --go-grpc_out=./protos ./protos/*proto | 6 | protoc -I./protos --go_out=./protos --go-grpc_out=./protos ./protos/*proto |
7 | - protoc-go-inject-tag -input=./protos/pb/*.pb.go | 7 | + protoc-go-inject-tag -input=./pb/*.pb.go |
8 | 8 | ||
9 | test: | 9 | test: |
10 | go run test/client.go | 10 | go run test/client.go |
cmd/game.go
@@ -0,0 +1,316 @@ | @@ -0,0 +1,316 @@ | ||
1 | +// Code generated by protoc-gen-go. DO NOT EDIT. | ||
2 | +// versions: | ||
3 | +// protoc-gen-go v1.26.0 | ||
4 | +// protoc v3.17.3 | ||
5 | +// source: account.proto | ||
6 | + | ||
7 | +package pb | ||
8 | + | ||
9 | +import ( | ||
10 | + protoreflect "google.golang.org/protobuf/reflect/protoreflect" | ||
11 | + protoimpl "google.golang.org/protobuf/runtime/protoimpl" | ||
12 | + reflect "reflect" | ||
13 | + sync "sync" | ||
14 | +) | ||
15 | + | ||
16 | +const ( | ||
17 | + // Verify that this generated code is sufficiently up-to-date. | ||
18 | + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) | ||
19 | + // Verify that runtime/protoimpl is sufficiently up-to-date. | ||
20 | + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) | ||
21 | +) | ||
22 | + | ||
23 | +type ServiceInfo struct { | ||
24 | + state protoimpl.MessageState | ||
25 | + sizeCache protoimpl.SizeCache | ||
26 | + unknownFields protoimpl.UnknownFields | ||
27 | + | ||
28 | + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` | ||
29 | + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` | ||
30 | + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` | ||
31 | +} | ||
32 | + | ||
33 | +func (x *ServiceInfo) Reset() { | ||
34 | + *x = ServiceInfo{} | ||
35 | + if protoimpl.UnsafeEnabled { | ||
36 | + mi := &file_account_proto_msgTypes[0] | ||
37 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
38 | + ms.StoreMessageInfo(mi) | ||
39 | + } | ||
40 | +} | ||
41 | + | ||
42 | +func (x *ServiceInfo) String() string { | ||
43 | + return protoimpl.X.MessageStringOf(x) | ||
44 | +} | ||
45 | + | ||
46 | +func (*ServiceInfo) ProtoMessage() {} | ||
47 | + | ||
48 | +func (x *ServiceInfo) ProtoReflect() protoreflect.Message { | ||
49 | + mi := &file_account_proto_msgTypes[0] | ||
50 | + if protoimpl.UnsafeEnabled && x != nil { | ||
51 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
52 | + if ms.LoadMessageInfo() == nil { | ||
53 | + ms.StoreMessageInfo(mi) | ||
54 | + } | ||
55 | + return ms | ||
56 | + } | ||
57 | + return mi.MessageOf(x) | ||
58 | +} | ||
59 | + | ||
60 | +// Deprecated: Use ServiceInfo.ProtoReflect.Descriptor instead. | ||
61 | +func (*ServiceInfo) Descriptor() ([]byte, []int) { | ||
62 | + return file_account_proto_rawDescGZIP(), []int{0} | ||
63 | +} | ||
64 | + | ||
65 | +func (x *ServiceInfo) GetId() string { | ||
66 | + if x != nil { | ||
67 | + return x.Id | ||
68 | + } | ||
69 | + return "" | ||
70 | +} | ||
71 | + | ||
72 | +func (x *ServiceInfo) GetName() string { | ||
73 | + if x != nil { | ||
74 | + return x.Name | ||
75 | + } | ||
76 | + return "" | ||
77 | +} | ||
78 | + | ||
79 | +func (x *ServiceInfo) GetAddress() string { | ||
80 | + if x != nil { | ||
81 | + return x.Address | ||
82 | + } | ||
83 | + return "" | ||
84 | +} | ||
85 | + | ||
86 | +type LoginRsp struct { | ||
87 | + state protoimpl.MessageState | ||
88 | + sizeCache protoimpl.SizeCache | ||
89 | + unknownFields protoimpl.UnknownFields | ||
90 | + | ||
91 | + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` | ||
92 | + GameService []*ServiceInfo `protobuf:"bytes,2,rep,name=game_service,json=gameService,proto3" json:"game_service,omitempty"` | ||
93 | +} | ||
94 | + | ||
95 | +func (x *LoginRsp) Reset() { | ||
96 | + *x = LoginRsp{} | ||
97 | + if protoimpl.UnsafeEnabled { | ||
98 | + mi := &file_account_proto_msgTypes[1] | ||
99 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
100 | + ms.StoreMessageInfo(mi) | ||
101 | + } | ||
102 | +} | ||
103 | + | ||
104 | +func (x *LoginRsp) String() string { | ||
105 | + return protoimpl.X.MessageStringOf(x) | ||
106 | +} | ||
107 | + | ||
108 | +func (*LoginRsp) ProtoMessage() {} | ||
109 | + | ||
110 | +func (x *LoginRsp) ProtoReflect() protoreflect.Message { | ||
111 | + mi := &file_account_proto_msgTypes[1] | ||
112 | + if protoimpl.UnsafeEnabled && x != nil { | ||
113 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
114 | + if ms.LoadMessageInfo() == nil { | ||
115 | + ms.StoreMessageInfo(mi) | ||
116 | + } | ||
117 | + return ms | ||
118 | + } | ||
119 | + return mi.MessageOf(x) | ||
120 | +} | ||
121 | + | ||
122 | +// Deprecated: Use LoginRsp.ProtoReflect.Descriptor instead. | ||
123 | +func (*LoginRsp) Descriptor() ([]byte, []int) { | ||
124 | + return file_account_proto_rawDescGZIP(), []int{1} | ||
125 | +} | ||
126 | + | ||
127 | +func (x *LoginRsp) GetUid() string { | ||
128 | + if x != nil { | ||
129 | + return x.Uid | ||
130 | + } | ||
131 | + return "" | ||
132 | +} | ||
133 | + | ||
134 | +func (x *LoginRsp) GetGameService() []*ServiceInfo { | ||
135 | + if x != nil { | ||
136 | + return x.GameService | ||
137 | + } | ||
138 | + return nil | ||
139 | +} | ||
140 | + | ||
141 | +type Register struct { | ||
142 | + state protoimpl.MessageState | ||
143 | + sizeCache protoimpl.SizeCache | ||
144 | + unknownFields protoimpl.UnknownFields | ||
145 | + | ||
146 | + Phone string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone,omitempty" binding:"required"` // @inject_tag: binding:"required" | ||
147 | + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" binding:"required"` // @inject_tag: binding:"required" | ||
148 | + Code int32 `protobuf:"varint,3,opt,name=code,proto3" json:"code,omitempty" binding:"required"` // @inject_tag: binding:"required" | ||
149 | +} | ||
150 | + | ||
151 | +func (x *Register) Reset() { | ||
152 | + *x = Register{} | ||
153 | + if protoimpl.UnsafeEnabled { | ||
154 | + mi := &file_account_proto_msgTypes[2] | ||
155 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
156 | + ms.StoreMessageInfo(mi) | ||
157 | + } | ||
158 | +} | ||
159 | + | ||
160 | +func (x *Register) String() string { | ||
161 | + return protoimpl.X.MessageStringOf(x) | ||
162 | +} | ||
163 | + | ||
164 | +func (*Register) ProtoMessage() {} | ||
165 | + | ||
166 | +func (x *Register) ProtoReflect() protoreflect.Message { | ||
167 | + mi := &file_account_proto_msgTypes[2] | ||
168 | + if protoimpl.UnsafeEnabled && x != nil { | ||
169 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
170 | + if ms.LoadMessageInfo() == nil { | ||
171 | + ms.StoreMessageInfo(mi) | ||
172 | + } | ||
173 | + return ms | ||
174 | + } | ||
175 | + return mi.MessageOf(x) | ||
176 | +} | ||
177 | + | ||
178 | +// Deprecated: Use Register.ProtoReflect.Descriptor instead. | ||
179 | +func (*Register) Descriptor() ([]byte, []int) { | ||
180 | + return file_account_proto_rawDescGZIP(), []int{2} | ||
181 | +} | ||
182 | + | ||
183 | +func (x *Register) GetPhone() string { | ||
184 | + if x != nil { | ||
185 | + return x.Phone | ||
186 | + } | ||
187 | + return "" | ||
188 | +} | ||
189 | + | ||
190 | +func (x *Register) GetPassword() string { | ||
191 | + if x != nil { | ||
192 | + return x.Password | ||
193 | + } | ||
194 | + return "" | ||
195 | +} | ||
196 | + | ||
197 | +func (x *Register) GetCode() int32 { | ||
198 | + if x != nil { | ||
199 | + return x.Code | ||
200 | + } | ||
201 | + return 0 | ||
202 | +} | ||
203 | + | ||
204 | +var File_account_proto protoreflect.FileDescriptor | ||
205 | + | ||
206 | +var file_account_proto_rawDesc = []byte{ | ||
207 | + 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, | ||
208 | + 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x4b, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, | ||
209 | + 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, | ||
210 | + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, | ||
211 | + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, | ||
212 | + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, | ||
213 | + 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x55, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x73, | ||
214 | + 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, | ||
215 | + 0x75, 0x69, 0x64, 0x12, 0x37, 0x0a, 0x0c, 0x67, 0x61, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, | ||
216 | + 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x63, 0x63, 0x6f, | ||
217 | + 0x75, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, | ||
218 | + 0x0b, 0x67, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x50, 0x0a, 0x08, | ||
219 | + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, | ||
220 | + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1a, | ||
221 | + 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, | ||
222 | + 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, | ||
223 | + 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x0a, | ||
224 | + 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, | ||
225 | + 0x6f, 0x33, | ||
226 | +} | ||
227 | + | ||
228 | +var ( | ||
229 | + file_account_proto_rawDescOnce sync.Once | ||
230 | + file_account_proto_rawDescData = file_account_proto_rawDesc | ||
231 | +) | ||
232 | + | ||
233 | +func file_account_proto_rawDescGZIP() []byte { | ||
234 | + file_account_proto_rawDescOnce.Do(func() { | ||
235 | + file_account_proto_rawDescData = protoimpl.X.CompressGZIP(file_account_proto_rawDescData) | ||
236 | + }) | ||
237 | + return file_account_proto_rawDescData | ||
238 | +} | ||
239 | + | ||
240 | +var file_account_proto_msgTypes = make([]protoimpl.MessageInfo, 3) | ||
241 | +var file_account_proto_goTypes = []interface{}{ | ||
242 | + (*ServiceInfo)(nil), // 0: account.ServiceInfo | ||
243 | + (*LoginRsp)(nil), // 1: account.LoginRsp | ||
244 | + (*Register)(nil), // 2: account.Register | ||
245 | +} | ||
246 | +var file_account_proto_depIdxs = []int32{ | ||
247 | + 0, // 0: account.LoginRsp.game_service:type_name -> account.ServiceInfo | ||
248 | + 1, // [1:1] is the sub-list for method output_type | ||
249 | + 1, // [1:1] is the sub-list for method input_type | ||
250 | + 1, // [1:1] is the sub-list for extension type_name | ||
251 | + 1, // [1:1] is the sub-list for extension extendee | ||
252 | + 0, // [0:1] is the sub-list for field type_name | ||
253 | +} | ||
254 | + | ||
255 | +func init() { file_account_proto_init() } | ||
256 | +func file_account_proto_init() { | ||
257 | + if File_account_proto != nil { | ||
258 | + return | ||
259 | + } | ||
260 | + if !protoimpl.UnsafeEnabled { | ||
261 | + file_account_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { | ||
262 | + switch v := v.(*ServiceInfo); i { | ||
263 | + case 0: | ||
264 | + return &v.state | ||
265 | + case 1: | ||
266 | + return &v.sizeCache | ||
267 | + case 2: | ||
268 | + return &v.unknownFields | ||
269 | + default: | ||
270 | + return nil | ||
271 | + } | ||
272 | + } | ||
273 | + file_account_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { | ||
274 | + switch v := v.(*LoginRsp); i { | ||
275 | + case 0: | ||
276 | + return &v.state | ||
277 | + case 1: | ||
278 | + return &v.sizeCache | ||
279 | + case 2: | ||
280 | + return &v.unknownFields | ||
281 | + default: | ||
282 | + return nil | ||
283 | + } | ||
284 | + } | ||
285 | + file_account_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { | ||
286 | + switch v := v.(*Register); i { | ||
287 | + case 0: | ||
288 | + return &v.state | ||
289 | + case 1: | ||
290 | + return &v.sizeCache | ||
291 | + case 2: | ||
292 | + return &v.unknownFields | ||
293 | + default: | ||
294 | + return nil | ||
295 | + } | ||
296 | + } | ||
297 | + } | ||
298 | + type x struct{} | ||
299 | + out := protoimpl.TypeBuilder{ | ||
300 | + File: protoimpl.DescBuilder{ | ||
301 | + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | ||
302 | + RawDescriptor: file_account_proto_rawDesc, | ||
303 | + NumEnums: 0, | ||
304 | + NumMessages: 3, | ||
305 | + NumExtensions: 0, | ||
306 | + NumServices: 0, | ||
307 | + }, | ||
308 | + GoTypes: file_account_proto_goTypes, | ||
309 | + DependencyIndexes: file_account_proto_depIdxs, | ||
310 | + MessageInfos: file_account_proto_msgTypes, | ||
311 | + }.Build() | ||
312 | + File_account_proto = out.File | ||
313 | + file_account_proto_rawDesc = nil | ||
314 | + file_account_proto_goTypes = nil | ||
315 | + file_account_proto_depIdxs = nil | ||
316 | +} |
@@ -0,0 +1,460 @@ | @@ -0,0 +1,460 @@ | ||
1 | +// Code generated by protoc-gen-go. DO NOT EDIT. | ||
2 | +// versions: | ||
3 | +// protoc-gen-go v1.26.0 | ||
4 | +// protoc v3.17.3 | ||
5 | +// source: game.proto | ||
6 | + | ||
7 | +package pb | ||
8 | + | ||
9 | +import ( | ||
10 | + protoreflect "google.golang.org/protobuf/reflect/protoreflect" | ||
11 | + protoimpl "google.golang.org/protobuf/runtime/protoimpl" | ||
12 | + reflect "reflect" | ||
13 | + sync "sync" | ||
14 | +) | ||
15 | + | ||
16 | +const ( | ||
17 | + // Verify that this generated code is sufficiently up-to-date. | ||
18 | + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) | ||
19 | + // Verify that runtime/protoimpl is sufficiently up-to-date. | ||
20 | + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) | ||
21 | +) | ||
22 | + | ||
23 | +type HeartReq struct { | ||
24 | + state protoimpl.MessageState | ||
25 | + sizeCache protoimpl.SizeCache | ||
26 | + unknownFields protoimpl.UnknownFields | ||
27 | + | ||
28 | + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` | ||
29 | +} | ||
30 | + | ||
31 | +func (x *HeartReq) Reset() { | ||
32 | + *x = HeartReq{} | ||
33 | + if protoimpl.UnsafeEnabled { | ||
34 | + mi := &file_game_proto_msgTypes[0] | ||
35 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
36 | + ms.StoreMessageInfo(mi) | ||
37 | + } | ||
38 | +} | ||
39 | + | ||
40 | +func (x *HeartReq) String() string { | ||
41 | + return protoimpl.X.MessageStringOf(x) | ||
42 | +} | ||
43 | + | ||
44 | +func (*HeartReq) ProtoMessage() {} | ||
45 | + | ||
46 | +func (x *HeartReq) ProtoReflect() protoreflect.Message { | ||
47 | + mi := &file_game_proto_msgTypes[0] | ||
48 | + if protoimpl.UnsafeEnabled && x != nil { | ||
49 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
50 | + if ms.LoadMessageInfo() == nil { | ||
51 | + ms.StoreMessageInfo(mi) | ||
52 | + } | ||
53 | + return ms | ||
54 | + } | ||
55 | + return mi.MessageOf(x) | ||
56 | +} | ||
57 | + | ||
58 | +// Deprecated: Use HeartReq.ProtoReflect.Descriptor instead. | ||
59 | +func (*HeartReq) Descriptor() ([]byte, []int) { | ||
60 | + return file_game_proto_rawDescGZIP(), []int{0} | ||
61 | +} | ||
62 | + | ||
63 | +func (x *HeartReq) GetCode() int64 { | ||
64 | + if x != nil { | ||
65 | + return x.Code | ||
66 | + } | ||
67 | + return 0 | ||
68 | +} | ||
69 | + | ||
70 | +//ResponseCmd RoleRsp | ||
71 | +type LoginReq struct { | ||
72 | + state protoimpl.MessageState | ||
73 | + sizeCache protoimpl.SizeCache | ||
74 | + unknownFields protoimpl.UnknownFields | ||
75 | + | ||
76 | + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` | ||
77 | + Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` | ||
78 | +} | ||
79 | + | ||
80 | +func (x *LoginReq) Reset() { | ||
81 | + *x = LoginReq{} | ||
82 | + if protoimpl.UnsafeEnabled { | ||
83 | + mi := &file_game_proto_msgTypes[1] | ||
84 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
85 | + ms.StoreMessageInfo(mi) | ||
86 | + } | ||
87 | +} | ||
88 | + | ||
89 | +func (x *LoginReq) String() string { | ||
90 | + return protoimpl.X.MessageStringOf(x) | ||
91 | +} | ||
92 | + | ||
93 | +func (*LoginReq) ProtoMessage() {} | ||
94 | + | ||
95 | +func (x *LoginReq) ProtoReflect() protoreflect.Message { | ||
96 | + mi := &file_game_proto_msgTypes[1] | ||
97 | + if protoimpl.UnsafeEnabled && x != nil { | ||
98 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
99 | + if ms.LoadMessageInfo() == nil { | ||
100 | + ms.StoreMessageInfo(mi) | ||
101 | + } | ||
102 | + return ms | ||
103 | + } | ||
104 | + return mi.MessageOf(x) | ||
105 | +} | ||
106 | + | ||
107 | +// Deprecated: Use LoginReq.ProtoReflect.Descriptor instead. | ||
108 | +func (*LoginReq) Descriptor() ([]byte, []int) { | ||
109 | + return file_game_proto_rawDescGZIP(), []int{1} | ||
110 | +} | ||
111 | + | ||
112 | +func (x *LoginReq) GetUid() string { | ||
113 | + if x != nil { | ||
114 | + return x.Uid | ||
115 | + } | ||
116 | + return "" | ||
117 | +} | ||
118 | + | ||
119 | +func (x *LoginReq) GetDevice() string { | ||
120 | + if x != nil { | ||
121 | + return x.Device | ||
122 | + } | ||
123 | + return "" | ||
124 | +} | ||
125 | + | ||
126 | +type LoginResponse struct { | ||
127 | + state protoimpl.MessageState | ||
128 | + sizeCache protoimpl.SizeCache | ||
129 | + unknownFields protoimpl.UnknownFields | ||
130 | + | ||
131 | + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` | ||
132 | + Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` | ||
133 | +} | ||
134 | + | ||
135 | +func (x *LoginResponse) Reset() { | ||
136 | + *x = LoginResponse{} | ||
137 | + if protoimpl.UnsafeEnabled { | ||
138 | + mi := &file_game_proto_msgTypes[2] | ||
139 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
140 | + ms.StoreMessageInfo(mi) | ||
141 | + } | ||
142 | +} | ||
143 | + | ||
144 | +func (x *LoginResponse) String() string { | ||
145 | + return protoimpl.X.MessageStringOf(x) | ||
146 | +} | ||
147 | + | ||
148 | +func (*LoginResponse) ProtoMessage() {} | ||
149 | + | ||
150 | +func (x *LoginResponse) ProtoReflect() protoreflect.Message { | ||
151 | + mi := &file_game_proto_msgTypes[2] | ||
152 | + if protoimpl.UnsafeEnabled && x != nil { | ||
153 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
154 | + if ms.LoadMessageInfo() == nil { | ||
155 | + ms.StoreMessageInfo(mi) | ||
156 | + } | ||
157 | + return ms | ||
158 | + } | ||
159 | + return mi.MessageOf(x) | ||
160 | +} | ||
161 | + | ||
162 | +// Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead. | ||
163 | +func (*LoginResponse) Descriptor() ([]byte, []int) { | ||
164 | + return file_game_proto_rawDescGZIP(), []int{2} | ||
165 | +} | ||
166 | + | ||
167 | +func (x *LoginResponse) GetUid() string { | ||
168 | + if x != nil { | ||
169 | + return x.Uid | ||
170 | + } | ||
171 | + return "" | ||
172 | +} | ||
173 | + | ||
174 | +func (x *LoginResponse) GetDevice() string { | ||
175 | + if x != nil { | ||
176 | + return x.Device | ||
177 | + } | ||
178 | + return "" | ||
179 | +} | ||
180 | + | ||
181 | +type CreateReq struct { | ||
182 | + state protoimpl.MessageState | ||
183 | + sizeCache protoimpl.SizeCache | ||
184 | + unknownFields protoimpl.UnknownFields | ||
185 | + | ||
186 | + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` | ||
187 | + Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` | ||
188 | +} | ||
189 | + | ||
190 | +func (x *CreateReq) Reset() { | ||
191 | + *x = CreateReq{} | ||
192 | + if protoimpl.UnsafeEnabled { | ||
193 | + mi := &file_game_proto_msgTypes[3] | ||
194 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
195 | + ms.StoreMessageInfo(mi) | ||
196 | + } | ||
197 | +} | ||
198 | + | ||
199 | +func (x *CreateReq) String() string { | ||
200 | + return protoimpl.X.MessageStringOf(x) | ||
201 | +} | ||
202 | + | ||
203 | +func (*CreateReq) ProtoMessage() {} | ||
204 | + | ||
205 | +func (x *CreateReq) ProtoReflect() protoreflect.Message { | ||
206 | + mi := &file_game_proto_msgTypes[3] | ||
207 | + if protoimpl.UnsafeEnabled && x != nil { | ||
208 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
209 | + if ms.LoadMessageInfo() == nil { | ||
210 | + ms.StoreMessageInfo(mi) | ||
211 | + } | ||
212 | + return ms | ||
213 | + } | ||
214 | + return mi.MessageOf(x) | ||
215 | +} | ||
216 | + | ||
217 | +// Deprecated: Use CreateReq.ProtoReflect.Descriptor instead. | ||
218 | +func (*CreateReq) Descriptor() ([]byte, []int) { | ||
219 | + return file_game_proto_rawDescGZIP(), []int{3} | ||
220 | +} | ||
221 | + | ||
222 | +func (x *CreateReq) GetUid() string { | ||
223 | + if x != nil { | ||
224 | + return x.Uid | ||
225 | + } | ||
226 | + return "" | ||
227 | +} | ||
228 | + | ||
229 | +func (x *CreateReq) GetDevice() string { | ||
230 | + if x != nil { | ||
231 | + return x.Device | ||
232 | + } | ||
233 | + return "" | ||
234 | +} | ||
235 | + | ||
236 | +type RoleRsp struct { | ||
237 | + state protoimpl.MessageState | ||
238 | + sizeCache protoimpl.SizeCache | ||
239 | + unknownFields protoimpl.UnknownFields | ||
240 | + | ||
241 | + Role *Role `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` | ||
242 | + Hero []*Hero `protobuf:"bytes,3,rep,name=hero,proto3" json:"hero,omitempty"` | ||
243 | + Team *Team `protobuf:"bytes,4,opt,name=team,proto3" json:"team,omitempty"` | ||
244 | + Equips []*Equipment `protobuf:"bytes,5,rep,name=equips,proto3" json:"equips,omitempty"` | ||
245 | +} | ||
246 | + | ||
247 | +func (x *RoleRsp) Reset() { | ||
248 | + *x = RoleRsp{} | ||
249 | + if protoimpl.UnsafeEnabled { | ||
250 | + mi := &file_game_proto_msgTypes[4] | ||
251 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
252 | + ms.StoreMessageInfo(mi) | ||
253 | + } | ||
254 | +} | ||
255 | + | ||
256 | +func (x *RoleRsp) String() string { | ||
257 | + return protoimpl.X.MessageStringOf(x) | ||
258 | +} | ||
259 | + | ||
260 | +func (*RoleRsp) ProtoMessage() {} | ||
261 | + | ||
262 | +func (x *RoleRsp) ProtoReflect() protoreflect.Message { | ||
263 | + mi := &file_game_proto_msgTypes[4] | ||
264 | + if protoimpl.UnsafeEnabled && x != nil { | ||
265 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
266 | + if ms.LoadMessageInfo() == nil { | ||
267 | + ms.StoreMessageInfo(mi) | ||
268 | + } | ||
269 | + return ms | ||
270 | + } | ||
271 | + return mi.MessageOf(x) | ||
272 | +} | ||
273 | + | ||
274 | +// Deprecated: Use RoleRsp.ProtoReflect.Descriptor instead. | ||
275 | +func (*RoleRsp) Descriptor() ([]byte, []int) { | ||
276 | + return file_game_proto_rawDescGZIP(), []int{4} | ||
277 | +} | ||
278 | + | ||
279 | +func (x *RoleRsp) GetRole() *Role { | ||
280 | + if x != nil { | ||
281 | + return x.Role | ||
282 | + } | ||
283 | + return nil | ||
284 | +} | ||
285 | + | ||
286 | +func (x *RoleRsp) GetHero() []*Hero { | ||
287 | + if x != nil { | ||
288 | + return x.Hero | ||
289 | + } | ||
290 | + return nil | ||
291 | +} | ||
292 | + | ||
293 | +func (x *RoleRsp) GetTeam() *Team { | ||
294 | + if x != nil { | ||
295 | + return x.Team | ||
296 | + } | ||
297 | + return nil | ||
298 | +} | ||
299 | + | ||
300 | +func (x *RoleRsp) GetEquips() []*Equipment { | ||
301 | + if x != nil { | ||
302 | + return x.Equips | ||
303 | + } | ||
304 | + return nil | ||
305 | +} | ||
306 | + | ||
307 | +var File_game_proto protoreflect.FileDescriptor | ||
308 | + | ||
309 | +var file_game_proto_rawDesc = []byte{ | ||
310 | + 0x0a, 0x0a, 0x67, 0x61, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x61, | ||
311 | + 0x6d, 0x65, 0x1a, 0x0c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, | ||
312 | + 0x22, 0x1e, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, | ||
313 | + 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, | ||
314 | + 0x22, 0x34, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, | ||
315 | + 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, | ||
316 | + 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, | ||
317 | + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x39, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, | ||
318 | + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, | ||
319 | + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, | ||
320 | + 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, | ||
321 | + 0x65, 0x22, 0x35, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, | ||
322 | + 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, | ||
323 | + 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, | ||
324 | + 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x07, 0x52, 0x6f, 0x6c, | ||
325 | + 0x65, 0x52, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, | ||
326 | + 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x6f, 0x6c, 0x65, | ||
327 | + 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x03, | ||
328 | + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x48, 0x65, | ||
329 | + 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, | ||
330 | + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, | ||
331 | + 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x29, 0x0a, 0x06, 0x65, 0x71, | ||
332 | + 0x75, 0x69, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, | ||
333 | + 0x65, 0x6c, 0x73, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, | ||
334 | + 0x71, 0x75, 0x69, 0x70, 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, | ||
335 | + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | ||
336 | +} | ||
337 | + | ||
338 | +var ( | ||
339 | + file_game_proto_rawDescOnce sync.Once | ||
340 | + file_game_proto_rawDescData = file_game_proto_rawDesc | ||
341 | +) | ||
342 | + | ||
343 | +func file_game_proto_rawDescGZIP() []byte { | ||
344 | + file_game_proto_rawDescOnce.Do(func() { | ||
345 | + file_game_proto_rawDescData = protoimpl.X.CompressGZIP(file_game_proto_rawDescData) | ||
346 | + }) | ||
347 | + return file_game_proto_rawDescData | ||
348 | +} | ||
349 | + | ||
350 | +var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 5) | ||
351 | +var file_game_proto_goTypes = []interface{}{ | ||
352 | + (*HeartReq)(nil), // 0: game.HeartReq | ||
353 | + (*LoginReq)(nil), // 1: game.LoginReq | ||
354 | + (*LoginResponse)(nil), // 2: game.LoginResponse | ||
355 | + (*CreateReq)(nil), // 3: game.CreateReq | ||
356 | + (*RoleRsp)(nil), // 4: game.RoleRsp | ||
357 | + (*Role)(nil), // 5: models.Role | ||
358 | + (*Hero)(nil), // 6: models.Hero | ||
359 | + (*Team)(nil), // 7: models.Team | ||
360 | + (*Equipment)(nil), // 8: models.Equipment | ||
361 | +} | ||
362 | +var file_game_proto_depIdxs = []int32{ | ||
363 | + 5, // 0: game.RoleRsp.role:type_name -> models.Role | ||
364 | + 6, // 1: game.RoleRsp.hero:type_name -> models.Hero | ||
365 | + 7, // 2: game.RoleRsp.team:type_name -> models.Team | ||
366 | + 8, // 3: game.RoleRsp.equips:type_name -> models.Equipment | ||
367 | + 4, // [4:4] is the sub-list for method output_type | ||
368 | + 4, // [4:4] is the sub-list for method input_type | ||
369 | + 4, // [4:4] is the sub-list for extension type_name | ||
370 | + 4, // [4:4] is the sub-list for extension extendee | ||
371 | + 0, // [0:4] is the sub-list for field type_name | ||
372 | +} | ||
373 | + | ||
374 | +func init() { file_game_proto_init() } | ||
375 | +func file_game_proto_init() { | ||
376 | + if File_game_proto != nil { | ||
377 | + return | ||
378 | + } | ||
379 | + file_models_proto_init() | ||
380 | + if !protoimpl.UnsafeEnabled { | ||
381 | + file_game_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { | ||
382 | + switch v := v.(*HeartReq); i { | ||
383 | + case 0: | ||
384 | + return &v.state | ||
385 | + case 1: | ||
386 | + return &v.sizeCache | ||
387 | + case 2: | ||
388 | + return &v.unknownFields | ||
389 | + default: | ||
390 | + return nil | ||
391 | + } | ||
392 | + } | ||
393 | + file_game_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { | ||
394 | + switch v := v.(*LoginReq); i { | ||
395 | + case 0: | ||
396 | + return &v.state | ||
397 | + case 1: | ||
398 | + return &v.sizeCache | ||
399 | + case 2: | ||
400 | + return &v.unknownFields | ||
401 | + default: | ||
402 | + return nil | ||
403 | + } | ||
404 | + } | ||
405 | + file_game_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { | ||
406 | + switch v := v.(*LoginResponse); i { | ||
407 | + case 0: | ||
408 | + return &v.state | ||
409 | + case 1: | ||
410 | + return &v.sizeCache | ||
411 | + case 2: | ||
412 | + return &v.unknownFields | ||
413 | + default: | ||
414 | + return nil | ||
415 | + } | ||
416 | + } | ||
417 | + file_game_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { | ||
418 | + switch v := v.(*CreateReq); i { | ||
419 | + case 0: | ||
420 | + return &v.state | ||
421 | + case 1: | ||
422 | + return &v.sizeCache | ||
423 | + case 2: | ||
424 | + return &v.unknownFields | ||
425 | + default: | ||
426 | + return nil | ||
427 | + } | ||
428 | + } | ||
429 | + file_game_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { | ||
430 | + switch v := v.(*RoleRsp); i { | ||
431 | + case 0: | ||
432 | + return &v.state | ||
433 | + case 1: | ||
434 | + return &v.sizeCache | ||
435 | + case 2: | ||
436 | + return &v.unknownFields | ||
437 | + default: | ||
438 | + return nil | ||
439 | + } | ||
440 | + } | ||
441 | + } | ||
442 | + type x struct{} | ||
443 | + out := protoimpl.TypeBuilder{ | ||
444 | + File: protoimpl.DescBuilder{ | ||
445 | + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | ||
446 | + RawDescriptor: file_game_proto_rawDesc, | ||
447 | + NumEnums: 0, | ||
448 | + NumMessages: 5, | ||
449 | + NumExtensions: 0, | ||
450 | + NumServices: 0, | ||
451 | + }, | ||
452 | + GoTypes: file_game_proto_goTypes, | ||
453 | + DependencyIndexes: file_game_proto_depIdxs, | ||
454 | + MessageInfos: file_game_proto_msgTypes, | ||
455 | + }.Build() | ||
456 | + File_game_proto = out.File | ||
457 | + file_game_proto_rawDesc = nil | ||
458 | + file_game_proto_goTypes = nil | ||
459 | + file_game_proto_depIdxs = nil | ||
460 | +} |
@@ -0,0 +1,676 @@ | @@ -0,0 +1,676 @@ | ||
1 | +// Code generated by protoc-gen-go. DO NOT EDIT. | ||
2 | +// versions: | ||
3 | +// protoc-gen-go v1.26.0 | ||
4 | +// protoc v3.17.3 | ||
5 | +// source: models.proto | ||
6 | + | ||
7 | +package pb | ||
8 | + | ||
9 | +import ( | ||
10 | + protoreflect "google.golang.org/protobuf/reflect/protoreflect" | ||
11 | + protoimpl "google.golang.org/protobuf/runtime/protoimpl" | ||
12 | + reflect "reflect" | ||
13 | + sync "sync" | ||
14 | +) | ||
15 | + | ||
16 | +const ( | ||
17 | + // Verify that this generated code is sufficiently up-to-date. | ||
18 | + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) | ||
19 | + // Verify that runtime/protoimpl is sufficiently up-to-date. | ||
20 | + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) | ||
21 | +) | ||
22 | + | ||
23 | +type Account struct { | ||
24 | + state protoimpl.MessageState | ||
25 | + sizeCache protoimpl.SizeCache | ||
26 | + unknownFields protoimpl.UnknownFields | ||
27 | + | ||
28 | + Phone string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone,omitempty" index:"unique" pri:"1"` // @inject_tag: index:"unique" pri:"1" | ||
29 | + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` | ||
30 | + Uid string `protobuf:"bytes,3,opt,name=uid,proto3" json:"uid,omitempty"` | ||
31 | +} | ||
32 | + | ||
33 | +func (x *Account) Reset() { | ||
34 | + *x = Account{} | ||
35 | + if protoimpl.UnsafeEnabled { | ||
36 | + mi := &file_models_proto_msgTypes[0] | ||
37 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
38 | + ms.StoreMessageInfo(mi) | ||
39 | + } | ||
40 | +} | ||
41 | + | ||
42 | +func (x *Account) String() string { | ||
43 | + return protoimpl.X.MessageStringOf(x) | ||
44 | +} | ||
45 | + | ||
46 | +func (*Account) ProtoMessage() {} | ||
47 | + | ||
48 | +func (x *Account) ProtoReflect() protoreflect.Message { | ||
49 | + mi := &file_models_proto_msgTypes[0] | ||
50 | + if protoimpl.UnsafeEnabled && x != nil { | ||
51 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
52 | + if ms.LoadMessageInfo() == nil { | ||
53 | + ms.StoreMessageInfo(mi) | ||
54 | + } | ||
55 | + return ms | ||
56 | + } | ||
57 | + return mi.MessageOf(x) | ||
58 | +} | ||
59 | + | ||
60 | +// Deprecated: Use Account.ProtoReflect.Descriptor instead. | ||
61 | +func (*Account) Descriptor() ([]byte, []int) { | ||
62 | + return file_models_proto_rawDescGZIP(), []int{0} | ||
63 | +} | ||
64 | + | ||
65 | +func (x *Account) GetPhone() string { | ||
66 | + if x != nil { | ||
67 | + return x.Phone | ||
68 | + } | ||
69 | + return "" | ||
70 | +} | ||
71 | + | ||
72 | +func (x *Account) GetPassword() string { | ||
73 | + if x != nil { | ||
74 | + return x.Password | ||
75 | + } | ||
76 | + return "" | ||
77 | +} | ||
78 | + | ||
79 | +func (x *Account) GetUid() string { | ||
80 | + if x != nil { | ||
81 | + return x.Uid | ||
82 | + } | ||
83 | + return "" | ||
84 | +} | ||
85 | + | ||
86 | +type Hero struct { | ||
87 | + state protoimpl.MessageState | ||
88 | + sizeCache protoimpl.SizeCache | ||
89 | + unknownFields protoimpl.UnknownFields | ||
90 | + | ||
91 | + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" index:"unique" pri:"1"` // @inject_tag: index:"unique" pri:"1" | ||
92 | + RoleId string `protobuf:"bytes,2,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` | ||
93 | + Type int32 `protobuf:"varint,3,opt,name=type,proto3" json:"type,omitempty"` | ||
94 | + Level int32 `protobuf:"varint,4,opt,name=level,proto3" json:"level,omitempty"` | ||
95 | + ReinCount int32 `protobuf:"varint,5,opt,name=rein_count,json=reinCount,proto3" json:"rein_count,omitempty"` | ||
96 | + ReinPoint int32 `protobuf:"varint,6,opt,name=rein_point,json=reinPoint,proto3" json:"rein_point,omitempty"` | ||
97 | + Equipments string `protobuf:"bytes,7,opt,name=equipments,proto3" json:"equipments,omitempty"` | ||
98 | +} | ||
99 | + | ||
100 | +func (x *Hero) Reset() { | ||
101 | + *x = Hero{} | ||
102 | + if protoimpl.UnsafeEnabled { | ||
103 | + mi := &file_models_proto_msgTypes[1] | ||
104 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
105 | + ms.StoreMessageInfo(mi) | ||
106 | + } | ||
107 | +} | ||
108 | + | ||
109 | +func (x *Hero) String() string { | ||
110 | + return protoimpl.X.MessageStringOf(x) | ||
111 | +} | ||
112 | + | ||
113 | +func (*Hero) ProtoMessage() {} | ||
114 | + | ||
115 | +func (x *Hero) ProtoReflect() protoreflect.Message { | ||
116 | + mi := &file_models_proto_msgTypes[1] | ||
117 | + if protoimpl.UnsafeEnabled && x != nil { | ||
118 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
119 | + if ms.LoadMessageInfo() == nil { | ||
120 | + ms.StoreMessageInfo(mi) | ||
121 | + } | ||
122 | + return ms | ||
123 | + } | ||
124 | + return mi.MessageOf(x) | ||
125 | +} | ||
126 | + | ||
127 | +// Deprecated: Use Hero.ProtoReflect.Descriptor instead. | ||
128 | +func (*Hero) Descriptor() ([]byte, []int) { | ||
129 | + return file_models_proto_rawDescGZIP(), []int{1} | ||
130 | +} | ||
131 | + | ||
132 | +func (x *Hero) GetId() string { | ||
133 | + if x != nil { | ||
134 | + return x.Id | ||
135 | + } | ||
136 | + return "" | ||
137 | +} | ||
138 | + | ||
139 | +func (x *Hero) GetRoleId() string { | ||
140 | + if x != nil { | ||
141 | + return x.RoleId | ||
142 | + } | ||
143 | + return "" | ||
144 | +} | ||
145 | + | ||
146 | +func (x *Hero) GetType() int32 { | ||
147 | + if x != nil { | ||
148 | + return x.Type | ||
149 | + } | ||
150 | + return 0 | ||
151 | +} | ||
152 | + | ||
153 | +func (x *Hero) GetLevel() int32 { | ||
154 | + if x != nil { | ||
155 | + return x.Level | ||
156 | + } | ||
157 | + return 0 | ||
158 | +} | ||
159 | + | ||
160 | +func (x *Hero) GetReinCount() int32 { | ||
161 | + if x != nil { | ||
162 | + return x.ReinCount | ||
163 | + } | ||
164 | + return 0 | ||
165 | +} | ||
166 | + | ||
167 | +func (x *Hero) GetReinPoint() int32 { | ||
168 | + if x != nil { | ||
169 | + return x.ReinPoint | ||
170 | + } | ||
171 | + return 0 | ||
172 | +} | ||
173 | + | ||
174 | +func (x *Hero) GetEquipments() string { | ||
175 | + if x != nil { | ||
176 | + return x.Equipments | ||
177 | + } | ||
178 | + return "" | ||
179 | +} | ||
180 | + | ||
181 | +type Equipment struct { | ||
182 | + state protoimpl.MessageState | ||
183 | + sizeCache protoimpl.SizeCache | ||
184 | + unknownFields protoimpl.UnknownFields | ||
185 | + | ||
186 | + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" index:"unique" pri:"1"` // @inject_tag: index:"unique" pri:"1" | ||
187 | + RoleId string `protobuf:"bytes,2,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` | ||
188 | + Type int64 `protobuf:"varint,3,opt,name=type,proto3" json:"type,omitempty"` | ||
189 | + Equip bool `protobuf:"varint,4,opt,name=equip,proto3" json:"equip,omitempty"` | ||
190 | + EnhanceLevel bool `protobuf:"varint,5,opt,name=enhance_level,json=enhanceLevel,proto3" json:"enhance_level,omitempty"` | ||
191 | +} | ||
192 | + | ||
193 | +func (x *Equipment) Reset() { | ||
194 | + *x = Equipment{} | ||
195 | + if protoimpl.UnsafeEnabled { | ||
196 | + mi := &file_models_proto_msgTypes[2] | ||
197 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
198 | + ms.StoreMessageInfo(mi) | ||
199 | + } | ||
200 | +} | ||
201 | + | ||
202 | +func (x *Equipment) String() string { | ||
203 | + return protoimpl.X.MessageStringOf(x) | ||
204 | +} | ||
205 | + | ||
206 | +func (*Equipment) ProtoMessage() {} | ||
207 | + | ||
208 | +func (x *Equipment) ProtoReflect() protoreflect.Message { | ||
209 | + mi := &file_models_proto_msgTypes[2] | ||
210 | + if protoimpl.UnsafeEnabled && x != nil { | ||
211 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
212 | + if ms.LoadMessageInfo() == nil { | ||
213 | + ms.StoreMessageInfo(mi) | ||
214 | + } | ||
215 | + return ms | ||
216 | + } | ||
217 | + return mi.MessageOf(x) | ||
218 | +} | ||
219 | + | ||
220 | +// Deprecated: Use Equipment.ProtoReflect.Descriptor instead. | ||
221 | +func (*Equipment) Descriptor() ([]byte, []int) { | ||
222 | + return file_models_proto_rawDescGZIP(), []int{2} | ||
223 | +} | ||
224 | + | ||
225 | +func (x *Equipment) GetId() string { | ||
226 | + if x != nil { | ||
227 | + return x.Id | ||
228 | + } | ||
229 | + return "" | ||
230 | +} | ||
231 | + | ||
232 | +func (x *Equipment) GetRoleId() string { | ||
233 | + if x != nil { | ||
234 | + return x.RoleId | ||
235 | + } | ||
236 | + return "" | ||
237 | +} | ||
238 | + | ||
239 | +func (x *Equipment) GetType() int64 { | ||
240 | + if x != nil { | ||
241 | + return x.Type | ||
242 | + } | ||
243 | + return 0 | ||
244 | +} | ||
245 | + | ||
246 | +func (x *Equipment) GetEquip() bool { | ||
247 | + if x != nil { | ||
248 | + return x.Equip | ||
249 | + } | ||
250 | + return false | ||
251 | +} | ||
252 | + | ||
253 | +func (x *Equipment) GetEnhanceLevel() bool { | ||
254 | + if x != nil { | ||
255 | + return x.EnhanceLevel | ||
256 | + } | ||
257 | + return false | ||
258 | +} | ||
259 | + | ||
260 | +type Prop struct { | ||
261 | + state protoimpl.MessageState | ||
262 | + sizeCache protoimpl.SizeCache | ||
263 | + unknownFields protoimpl.UnknownFields | ||
264 | + | ||
265 | + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" index:"unique" pri:"1"` // @inject_tag: index:"unique" pri:"1" | ||
266 | + Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` | ||
267 | +} | ||
268 | + | ||
269 | +func (x *Prop) Reset() { | ||
270 | + *x = Prop{} | ||
271 | + if protoimpl.UnsafeEnabled { | ||
272 | + mi := &file_models_proto_msgTypes[3] | ||
273 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
274 | + ms.StoreMessageInfo(mi) | ||
275 | + } | ||
276 | +} | ||
277 | + | ||
278 | +func (x *Prop) String() string { | ||
279 | + return protoimpl.X.MessageStringOf(x) | ||
280 | +} | ||
281 | + | ||
282 | +func (*Prop) ProtoMessage() {} | ||
283 | + | ||
284 | +func (x *Prop) ProtoReflect() protoreflect.Message { | ||
285 | + mi := &file_models_proto_msgTypes[3] | ||
286 | + if protoimpl.UnsafeEnabled && x != nil { | ||
287 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
288 | + if ms.LoadMessageInfo() == nil { | ||
289 | + ms.StoreMessageInfo(mi) | ||
290 | + } | ||
291 | + return ms | ||
292 | + } | ||
293 | + return mi.MessageOf(x) | ||
294 | +} | ||
295 | + | ||
296 | +// Deprecated: Use Prop.ProtoReflect.Descriptor instead. | ||
297 | +func (*Prop) Descriptor() ([]byte, []int) { | ||
298 | + return file_models_proto_rawDescGZIP(), []int{3} | ||
299 | +} | ||
300 | + | ||
301 | +func (x *Prop) GetId() string { | ||
302 | + if x != nil { | ||
303 | + return x.Id | ||
304 | + } | ||
305 | + return "" | ||
306 | +} | ||
307 | + | ||
308 | +func (x *Prop) GetCount() int64 { | ||
309 | + if x != nil { | ||
310 | + return x.Count | ||
311 | + } | ||
312 | + return 0 | ||
313 | +} | ||
314 | + | ||
315 | +type Team struct { | ||
316 | + state protoimpl.MessageState | ||
317 | + sizeCache protoimpl.SizeCache | ||
318 | + unknownFields protoimpl.UnknownFields | ||
319 | + | ||
320 | + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" index:"unique" pri:"1"` // @inject_tag: index:"unique" pri:"1" | ||
321 | + HeroIds string `protobuf:"bytes,2,opt,name=hero_ids,json=heroIds,proto3" json:"hero_ids,omitempty"` | ||
322 | +} | ||
323 | + | ||
324 | +func (x *Team) Reset() { | ||
325 | + *x = Team{} | ||
326 | + if protoimpl.UnsafeEnabled { | ||
327 | + mi := &file_models_proto_msgTypes[4] | ||
328 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
329 | + ms.StoreMessageInfo(mi) | ||
330 | + } | ||
331 | +} | ||
332 | + | ||
333 | +func (x *Team) String() string { | ||
334 | + return protoimpl.X.MessageStringOf(x) | ||
335 | +} | ||
336 | + | ||
337 | +func (*Team) ProtoMessage() {} | ||
338 | + | ||
339 | +func (x *Team) ProtoReflect() protoreflect.Message { | ||
340 | + mi := &file_models_proto_msgTypes[4] | ||
341 | + if protoimpl.UnsafeEnabled && x != nil { | ||
342 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
343 | + if ms.LoadMessageInfo() == nil { | ||
344 | + ms.StoreMessageInfo(mi) | ||
345 | + } | ||
346 | + return ms | ||
347 | + } | ||
348 | + return mi.MessageOf(x) | ||
349 | +} | ||
350 | + | ||
351 | +// Deprecated: Use Team.ProtoReflect.Descriptor instead. | ||
352 | +func (*Team) Descriptor() ([]byte, []int) { | ||
353 | + return file_models_proto_rawDescGZIP(), []int{4} | ||
354 | +} | ||
355 | + | ||
356 | +func (x *Team) GetId() string { | ||
357 | + if x != nil { | ||
358 | + return x.Id | ||
359 | + } | ||
360 | + return "" | ||
361 | +} | ||
362 | + | ||
363 | +func (x *Team) GetHeroIds() string { | ||
364 | + if x != nil { | ||
365 | + return x.HeroIds | ||
366 | + } | ||
367 | + return "" | ||
368 | +} | ||
369 | + | ||
370 | +type Role struct { | ||
371 | + state protoimpl.MessageState | ||
372 | + sizeCache protoimpl.SizeCache | ||
373 | + unknownFields protoimpl.UnknownFields | ||
374 | + | ||
375 | + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" index:"unique" pri:"1"` // @inject_tag: index:"unique" pri:"1" | ||
376 | + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty" index:"unique"` // @inject_tag: index:"unique" | ||
377 | + Device string `protobuf:"bytes,3,opt,name=device,proto3" json:"device,omitempty"` | ||
378 | + Nick string `protobuf:"bytes,4,opt,name=nick,proto3" json:"nick,omitempty"` | ||
379 | + Level int32 `protobuf:"varint,5,opt,name=level,proto3" json:"level,omitempty"` | ||
380 | + Exp int64 `protobuf:"varint,6,opt,name=exp,proto3" json:"exp,omitempty"` | ||
381 | + Hp int64 `protobuf:"varint,7,opt,name=hp,proto3" json:"hp,omitempty"` | ||
382 | + HpMax int64 `protobuf:"varint,8,opt,name=hp_max,json=hpMax,proto3" json:"hp_max,omitempty"` | ||
383 | + BuyR string `protobuf:"bytes,11,opt,name=buy_r,json=buyR,proto3" json:"buy_r,omitempty"` | ||
384 | + PayR string `protobuf:"bytes,12,opt,name=pay_r,json=payR,proto3" json:"pay_r,omitempty"` | ||
385 | + Del bool `protobuf:"varint,13,opt,name=del,proto3" json:"del,omitempty"` | ||
386 | +} | ||
387 | + | ||
388 | +func (x *Role) Reset() { | ||
389 | + *x = Role{} | ||
390 | + if protoimpl.UnsafeEnabled { | ||
391 | + mi := &file_models_proto_msgTypes[5] | ||
392 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
393 | + ms.StoreMessageInfo(mi) | ||
394 | + } | ||
395 | +} | ||
396 | + | ||
397 | +func (x *Role) String() string { | ||
398 | + return protoimpl.X.MessageStringOf(x) | ||
399 | +} | ||
400 | + | ||
401 | +func (*Role) ProtoMessage() {} | ||
402 | + | ||
403 | +func (x *Role) ProtoReflect() protoreflect.Message { | ||
404 | + mi := &file_models_proto_msgTypes[5] | ||
405 | + if protoimpl.UnsafeEnabled && x != nil { | ||
406 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
407 | + if ms.LoadMessageInfo() == nil { | ||
408 | + ms.StoreMessageInfo(mi) | ||
409 | + } | ||
410 | + return ms | ||
411 | + } | ||
412 | + return mi.MessageOf(x) | ||
413 | +} | ||
414 | + | ||
415 | +// Deprecated: Use Role.ProtoReflect.Descriptor instead. | ||
416 | +func (*Role) Descriptor() ([]byte, []int) { | ||
417 | + return file_models_proto_rawDescGZIP(), []int{5} | ||
418 | +} | ||
419 | + | ||
420 | +func (x *Role) GetId() string { | ||
421 | + if x != nil { | ||
422 | + return x.Id | ||
423 | + } | ||
424 | + return "" | ||
425 | +} | ||
426 | + | ||
427 | +func (x *Role) GetUid() string { | ||
428 | + if x != nil { | ||
429 | + return x.Uid | ||
430 | + } | ||
431 | + return "" | ||
432 | +} | ||
433 | + | ||
434 | +func (x *Role) GetDevice() string { | ||
435 | + if x != nil { | ||
436 | + return x.Device | ||
437 | + } | ||
438 | + return "" | ||
439 | +} | ||
440 | + | ||
441 | +func (x *Role) GetNick() string { | ||
442 | + if x != nil { | ||
443 | + return x.Nick | ||
444 | + } | ||
445 | + return "" | ||
446 | +} | ||
447 | + | ||
448 | +func (x *Role) GetLevel() int32 { | ||
449 | + if x != nil { | ||
450 | + return x.Level | ||
451 | + } | ||
452 | + return 0 | ||
453 | +} | ||
454 | + | ||
455 | +func (x *Role) GetExp() int64 { | ||
456 | + if x != nil { | ||
457 | + return x.Exp | ||
458 | + } | ||
459 | + return 0 | ||
460 | +} | ||
461 | + | ||
462 | +func (x *Role) GetHp() int64 { | ||
463 | + if x != nil { | ||
464 | + return x.Hp | ||
465 | + } | ||
466 | + return 0 | ||
467 | +} | ||
468 | + | ||
469 | +func (x *Role) GetHpMax() int64 { | ||
470 | + if x != nil { | ||
471 | + return x.HpMax | ||
472 | + } | ||
473 | + return 0 | ||
474 | +} | ||
475 | + | ||
476 | +func (x *Role) GetBuyR() string { | ||
477 | + if x != nil { | ||
478 | + return x.BuyR | ||
479 | + } | ||
480 | + return "" | ||
481 | +} | ||
482 | + | ||
483 | +func (x *Role) GetPayR() string { | ||
484 | + if x != nil { | ||
485 | + return x.PayR | ||
486 | + } | ||
487 | + return "" | ||
488 | +} | ||
489 | + | ||
490 | +func (x *Role) GetDel() bool { | ||
491 | + if x != nil { | ||
492 | + return x.Del | ||
493 | + } | ||
494 | + return false | ||
495 | +} | ||
496 | + | ||
497 | +var File_models_proto protoreflect.FileDescriptor | ||
498 | + | ||
499 | +var file_models_proto_rawDesc = []byte{ | ||
500 | + 0x0a, 0x0c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, | ||
501 | + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x22, 0x4d, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, | ||
502 | + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, | ||
503 | + 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, | ||
504 | + 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, | ||
505 | + 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, | ||
506 | + 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0xb7, 0x01, 0x0a, 0x04, 0x48, 0x65, 0x72, 0x6f, 0x12, 0x0e, | ||
507 | + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, | ||
508 | + 0x0a, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, | ||
509 | + 0x06, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, | ||
510 | + 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, | ||
511 | + 0x65, 0x76, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, | ||
512 | + 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, | ||
513 | + 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x65, 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, | ||
514 | + 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x69, 0x6e, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, | ||
515 | + 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x65, 0x69, 0x6e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, | ||
516 | + 0x1e, 0x0a, 0x0a, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x07, 0x20, | ||
517 | + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, | ||
518 | + 0x83, 0x01, 0x0a, 0x09, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, | ||
519 | + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, | ||
520 | + 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, | ||
521 | + 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, | ||
522 | + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x71, | ||
523 | + 0x75, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x71, 0x75, 0x69, 0x70, | ||
524 | + 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x68, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6c, 0x65, 0x76, 0x65, | ||
525 | + 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x65, 0x6e, 0x68, 0x61, 0x6e, 0x63, 0x65, | ||
526 | + 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x2c, 0x0a, 0x04, 0x50, 0x72, 0x6f, 0x70, 0x12, 0x0e, 0x0a, | ||
527 | + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, | ||
528 | + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, | ||
529 | + 0x75, 0x6e, 0x74, 0x22, 0x31, 0x0a, 0x04, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, | ||
530 | + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x68, | ||
531 | + 0x65, 0x72, 0x6f, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, | ||
532 | + 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x22, 0xdf, 0x01, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, | ||
533 | + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, | ||
534 | + 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, | ||
535 | + 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, | ||
536 | + 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x69, 0x63, | ||
537 | + 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x69, 0x63, 0x6b, 0x12, 0x14, 0x0a, | ||
538 | + 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, | ||
539 | + 0x76, 0x65, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, | ||
540 | + 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x68, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, | ||
541 | + 0x03, 0x52, 0x02, 0x68, 0x70, 0x12, 0x15, 0x0a, 0x06, 0x68, 0x70, 0x5f, 0x6d, 0x61, 0x78, 0x18, | ||
542 | + 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x68, 0x70, 0x4d, 0x61, 0x78, 0x12, 0x13, 0x0a, 0x05, | ||
543 | + 0x62, 0x75, 0x79, 0x5f, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x75, 0x79, | ||
544 | + 0x52, 0x12, 0x13, 0x0a, 0x05, 0x70, 0x61, 0x79, 0x5f, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, | ||
545 | + 0x52, 0x04, 0x70, 0x61, 0x79, 0x52, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x65, 0x6c, 0x18, 0x0d, 0x20, | ||
546 | + 0x01, 0x28, 0x08, 0x52, 0x03, 0x64, 0x65, 0x6c, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, | ||
547 | + 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | ||
548 | +} | ||
549 | + | ||
550 | +var ( | ||
551 | + file_models_proto_rawDescOnce sync.Once | ||
552 | + file_models_proto_rawDescData = file_models_proto_rawDesc | ||
553 | +) | ||
554 | + | ||
555 | +func file_models_proto_rawDescGZIP() []byte { | ||
556 | + file_models_proto_rawDescOnce.Do(func() { | ||
557 | + file_models_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_proto_rawDescData) | ||
558 | + }) | ||
559 | + return file_models_proto_rawDescData | ||
560 | +} | ||
561 | + | ||
562 | +var file_models_proto_msgTypes = make([]protoimpl.MessageInfo, 6) | ||
563 | +var file_models_proto_goTypes = []interface{}{ | ||
564 | + (*Account)(nil), // 0: models.Account | ||
565 | + (*Hero)(nil), // 1: models.Hero | ||
566 | + (*Equipment)(nil), // 2: models.Equipment | ||
567 | + (*Prop)(nil), // 3: models.Prop | ||
568 | + (*Team)(nil), // 4: models.Team | ||
569 | + (*Role)(nil), // 5: models.Role | ||
570 | +} | ||
571 | +var file_models_proto_depIdxs = []int32{ | ||
572 | + 0, // [0:0] is the sub-list for method output_type | ||
573 | + 0, // [0:0] is the sub-list for method input_type | ||
574 | + 0, // [0:0] is the sub-list for extension type_name | ||
575 | + 0, // [0:0] is the sub-list for extension extendee | ||
576 | + 0, // [0:0] is the sub-list for field type_name | ||
577 | +} | ||
578 | + | ||
579 | +func init() { file_models_proto_init() } | ||
580 | +func file_models_proto_init() { | ||
581 | + if File_models_proto != nil { | ||
582 | + return | ||
583 | + } | ||
584 | + if !protoimpl.UnsafeEnabled { | ||
585 | + file_models_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { | ||
586 | + switch v := v.(*Account); i { | ||
587 | + case 0: | ||
588 | + return &v.state | ||
589 | + case 1: | ||
590 | + return &v.sizeCache | ||
591 | + case 2: | ||
592 | + return &v.unknownFields | ||
593 | + default: | ||
594 | + return nil | ||
595 | + } | ||
596 | + } | ||
597 | + file_models_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { | ||
598 | + switch v := v.(*Hero); i { | ||
599 | + case 0: | ||
600 | + return &v.state | ||
601 | + case 1: | ||
602 | + return &v.sizeCache | ||
603 | + case 2: | ||
604 | + return &v.unknownFields | ||
605 | + default: | ||
606 | + return nil | ||
607 | + } | ||
608 | + } | ||
609 | + file_models_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { | ||
610 | + switch v := v.(*Equipment); i { | ||
611 | + case 0: | ||
612 | + return &v.state | ||
613 | + case 1: | ||
614 | + return &v.sizeCache | ||
615 | + case 2: | ||
616 | + return &v.unknownFields | ||
617 | + default: | ||
618 | + return nil | ||
619 | + } | ||
620 | + } | ||
621 | + file_models_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { | ||
622 | + switch v := v.(*Prop); i { | ||
623 | + case 0: | ||
624 | + return &v.state | ||
625 | + case 1: | ||
626 | + return &v.sizeCache | ||
627 | + case 2: | ||
628 | + return &v.unknownFields | ||
629 | + default: | ||
630 | + return nil | ||
631 | + } | ||
632 | + } | ||
633 | + file_models_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { | ||
634 | + switch v := v.(*Team); i { | ||
635 | + case 0: | ||
636 | + return &v.state | ||
637 | + case 1: | ||
638 | + return &v.sizeCache | ||
639 | + case 2: | ||
640 | + return &v.unknownFields | ||
641 | + default: | ||
642 | + return nil | ||
643 | + } | ||
644 | + } | ||
645 | + file_models_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { | ||
646 | + switch v := v.(*Role); i { | ||
647 | + case 0: | ||
648 | + return &v.state | ||
649 | + case 1: | ||
650 | + return &v.sizeCache | ||
651 | + case 2: | ||
652 | + return &v.unknownFields | ||
653 | + default: | ||
654 | + return nil | ||
655 | + } | ||
656 | + } | ||
657 | + } | ||
658 | + type x struct{} | ||
659 | + out := protoimpl.TypeBuilder{ | ||
660 | + File: protoimpl.DescBuilder{ | ||
661 | + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | ||
662 | + RawDescriptor: file_models_proto_rawDesc, | ||
663 | + NumEnums: 0, | ||
664 | + NumMessages: 6, | ||
665 | + NumExtensions: 0, | ||
666 | + NumServices: 0, | ||
667 | + }, | ||
668 | + GoTypes: file_models_proto_goTypes, | ||
669 | + DependencyIndexes: file_models_proto_depIdxs, | ||
670 | + MessageInfos: file_models_proto_msgTypes, | ||
671 | + }.Build() | ||
672 | + File_models_proto = out.File | ||
673 | + file_models_proto_rawDesc = nil | ||
674 | + file_models_proto_goTypes = nil | ||
675 | + file_models_proto_depIdxs = nil | ||
676 | +} |
@@ -0,0 +1,139 @@ | @@ -0,0 +1,139 @@ | ||
1 | +// Code generated by protoc-gen-go. DO NOT EDIT. | ||
2 | +// versions: | ||
3 | +// protoc-gen-go v1.26.0 | ||
4 | +// protoc v3.17.3 | ||
5 | +// source: protocode.proto | ||
6 | + | ||
7 | +package pb | ||
8 | + | ||
9 | +import ( | ||
10 | + protoreflect "google.golang.org/protobuf/reflect/protoreflect" | ||
11 | + protoimpl "google.golang.org/protobuf/runtime/protoimpl" | ||
12 | + reflect "reflect" | ||
13 | + sync "sync" | ||
14 | +) | ||
15 | + | ||
16 | +const ( | ||
17 | + // Verify that this generated code is sufficiently up-to-date. | ||
18 | + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) | ||
19 | + // Verify that runtime/protoimpl is sufficiently up-to-date. | ||
20 | + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) | ||
21 | +) | ||
22 | + | ||
23 | +type ProtoCode int32 | ||
24 | + | ||
25 | +const ( | ||
26 | + ProtoCode_UNKNOWN ProtoCode = 0 | ||
27 | + ProtoCode_HeartReq ProtoCode = 1 | ||
28 | + ProtoCode_LoginReq ProtoCode = 2 | ||
29 | + ProtoCode_CreateReq ProtoCode = 3 | ||
30 | + ProtoCode_RoleRsp ProtoCode = 4 | ||
31 | +) | ||
32 | + | ||
33 | +// Enum value maps for ProtoCode. | ||
34 | +var ( | ||
35 | + ProtoCode_name = map[int32]string{ | ||
36 | + 0: "UNKNOWN", | ||
37 | + 1: "HeartReq", | ||
38 | + 2: "LoginReq", | ||
39 | + 3: "CreateReq", | ||
40 | + 4: "RoleRsp", | ||
41 | + } | ||
42 | + ProtoCode_value = map[string]int32{ | ||
43 | + "UNKNOWN": 0, | ||
44 | + "HeartReq": 1, | ||
45 | + "LoginReq": 2, | ||
46 | + "CreateReq": 3, | ||
47 | + "RoleRsp": 4, | ||
48 | + } | ||
49 | +) | ||
50 | + | ||
51 | +func (x ProtoCode) Enum() *ProtoCode { | ||
52 | + p := new(ProtoCode) | ||
53 | + *p = x | ||
54 | + return p | ||
55 | +} | ||
56 | + | ||
57 | +func (x ProtoCode) String() string { | ||
58 | + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) | ||
59 | +} | ||
60 | + | ||
61 | +func (ProtoCode) Descriptor() protoreflect.EnumDescriptor { | ||
62 | + return file_protocode_proto_enumTypes[0].Descriptor() | ||
63 | +} | ||
64 | + | ||
65 | +func (ProtoCode) Type() protoreflect.EnumType { | ||
66 | + return &file_protocode_proto_enumTypes[0] | ||
67 | +} | ||
68 | + | ||
69 | +func (x ProtoCode) Number() protoreflect.EnumNumber { | ||
70 | + return protoreflect.EnumNumber(x) | ||
71 | +} | ||
72 | + | ||
73 | +// Deprecated: Use ProtoCode.Descriptor instead. | ||
74 | +func (ProtoCode) EnumDescriptor() ([]byte, []int) { | ||
75 | + return file_protocode_proto_rawDescGZIP(), []int{0} | ||
76 | +} | ||
77 | + | ||
78 | +var File_protocode_proto protoreflect.FileDescriptor | ||
79 | + | ||
80 | +var file_protocode_proto_rawDesc = []byte{ | ||
81 | + 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, | ||
82 | + 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0x50, 0x0a, 0x09, | ||
83 | + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, | ||
84 | + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, | ||
85 | + 0x65, 0x71, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, | ||
86 | + 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x10, | ||
87 | + 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x10, 0x04, 0x42, 0x0a, | ||
88 | + 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, | ||
89 | + 0x6f, 0x33, | ||
90 | +} | ||
91 | + | ||
92 | +var ( | ||
93 | + file_protocode_proto_rawDescOnce sync.Once | ||
94 | + file_protocode_proto_rawDescData = file_protocode_proto_rawDesc | ||
95 | +) | ||
96 | + | ||
97 | +func file_protocode_proto_rawDescGZIP() []byte { | ||
98 | + file_protocode_proto_rawDescOnce.Do(func() { | ||
99 | + file_protocode_proto_rawDescData = protoimpl.X.CompressGZIP(file_protocode_proto_rawDescData) | ||
100 | + }) | ||
101 | + return file_protocode_proto_rawDescData | ||
102 | +} | ||
103 | + | ||
104 | +var file_protocode_proto_enumTypes = make([]protoimpl.EnumInfo, 1) | ||
105 | +var file_protocode_proto_goTypes = []interface{}{ | ||
106 | + (ProtoCode)(0), // 0: protocode.ProtoCode | ||
107 | +} | ||
108 | +var file_protocode_proto_depIdxs = []int32{ | ||
109 | + 0, // [0:0] is the sub-list for method output_type | ||
110 | + 0, // [0:0] is the sub-list for method input_type | ||
111 | + 0, // [0:0] is the sub-list for extension type_name | ||
112 | + 0, // [0:0] is the sub-list for extension extendee | ||
113 | + 0, // [0:0] is the sub-list for field type_name | ||
114 | +} | ||
115 | + | ||
116 | +func init() { file_protocode_proto_init() } | ||
117 | +func file_protocode_proto_init() { | ||
118 | + if File_protocode_proto != nil { | ||
119 | + return | ||
120 | + } | ||
121 | + type x struct{} | ||
122 | + out := protoimpl.TypeBuilder{ | ||
123 | + File: protoimpl.DescBuilder{ | ||
124 | + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | ||
125 | + RawDescriptor: file_protocode_proto_rawDesc, | ||
126 | + NumEnums: 1, | ||
127 | + NumMessages: 0, | ||
128 | + NumExtensions: 0, | ||
129 | + NumServices: 0, | ||
130 | + }, | ||
131 | + GoTypes: file_protocode_proto_goTypes, | ||
132 | + DependencyIndexes: file_protocode_proto_depIdxs, | ||
133 | + EnumInfos: file_protocode_proto_enumTypes, | ||
134 | + }.Build() | ||
135 | + File_protocode_proto = out.File | ||
136 | + file_protocode_proto_rawDesc = nil | ||
137 | + file_protocode_proto_goTypes = nil | ||
138 | + file_protocode_proto_depIdxs = nil | ||
139 | +} |
src/actions/AccountAction.go
@@ -3,7 +3,7 @@ package actions | @@ -3,7 +3,7 @@ package actions | ||
3 | import ( | 3 | import ( |
4 | "github.com/gin-gonic/gin" | 4 | "github.com/gin-gonic/gin" |
5 | "pro2d/conf" | 5 | "pro2d/conf" |
6 | - "pro2d/protos/pb" | 6 | + "pro2d/pb" |
7 | "pro2d/src/components/net" | 7 | "pro2d/src/components/net" |
8 | "pro2d/src/models" | 8 | "pro2d/src/models" |
9 | "pro2d/src/utils" | 9 | "pro2d/src/utils" |
src/components/db/schema.go
@@ -75,14 +75,14 @@ func (s *Schema) Update() { | @@ -75,14 +75,14 @@ func (s *Schema) Update() { | ||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | -func (s *Schema) UpdateProperty(key string, val interface{}) { | 78 | +func (s *Schema) SetProperty(key string, val interface{}) { |
79 | s.reflectValue.FieldByName(key).Set(reflect.ValueOf(val)) | 79 | s.reflectValue.FieldByName(key).Set(reflect.ValueOf(val)) |
80 | - s.cacheFields[key] = val | 80 | + s.cacheFields[strings.ToLower(key)] = val |
81 | } | 81 | } |
82 | 82 | ||
83 | -func (s *Schema) UpdateProperties(properties map[string]interface{}) { | 83 | +func (s *Schema) SetProperties(properties map[string]interface{}) { |
84 | for key, val := range properties { | 84 | for key, val := range properties { |
85 | s.reflectValue.FieldByName(key).Set(reflect.ValueOf(val)) | 85 | s.reflectValue.FieldByName(key).Set(reflect.ValueOf(val)) |
86 | - s.cacheFields[key] = val | 86 | + s.cacheFields[strings.ToLower(key)] = val |
87 | } | 87 | } |
88 | } | 88 | } |
89 | \ No newline at end of file | 89 | \ No newline at end of file |
src/components/net/conn.go
@@ -133,8 +133,8 @@ func (c *Connection) update() { | @@ -133,8 +133,8 @@ func (c *Connection) update() { | ||
133 | atomic.StoreInt64(&c.nextCheckTime, nextCheckTime) | 133 | atomic.StoreInt64(&c.nextCheckTime, nextCheckTime) |
134 | } | 134 | } |
135 | 135 | ||
136 | - if c.Role != nil { | ||
137 | - c.updateFunc <- func() { | 136 | + c.updateFunc <- func() { |
137 | + if c.Role != nil { | ||
138 | //role 恢复数据 | 138 | //role 恢复数据 |
139 | c.Role.OnRecoverTimer(now) | 139 | c.Role.OnRecoverTimer(now) |
140 | } | 140 | } |
@@ -164,6 +164,10 @@ func (c *Connection) Start() { | @@ -164,6 +164,10 @@ func (c *Connection) Start() { | ||
164 | func (c *Connection) Stop() { | 164 | func (c *Connection) Stop() { |
165 | logger.Debug("ID: %d close", c.Id) | 165 | logger.Debug("ID: %d close", c.Id) |
166 | c.Conn.Close() | 166 | c.Conn.Close() |
167 | + if c.Role != nil { | ||
168 | + c.Role.OnOfflineEvent() | ||
169 | + } | ||
170 | + | ||
167 | c.Server.OnClose(c) | 171 | c.Server.OnClose(c) |
168 | } | 172 | } |
169 | 173 |
src/components/net/server.go
@@ -7,7 +7,7 @@ import ( | @@ -7,7 +7,7 @@ import ( | ||
7 | "net" | 7 | "net" |
8 | "plugin" | 8 | "plugin" |
9 | "pro2d/conf" | 9 | "pro2d/conf" |
10 | - "pro2d/protos/pb" | 10 | + "pro2d/pb" |
11 | "pro2d/src/components/db" | 11 | "pro2d/src/components/db" |
12 | "pro2d/src/components/etcd" | 12 | "pro2d/src/components/etcd" |
13 | "pro2d/src/components/logger" | 13 | "pro2d/src/components/logger" |
@@ -51,7 +51,6 @@ func (s *Server) DoMsgHandler(msg *MsgPkg) { | @@ -51,7 +51,6 @@ func (s *Server) DoMsgHandler(msg *MsgPkg) { | ||
51 | } | 51 | } |
52 | 52 | ||
53 | func (s *Server) OnClose(conn *Connection) { | 53 | func (s *Server) OnClose(conn *Connection) { |
54 | - //conn.Stop() | ||
55 | s.Clients.Delete(conn.Id) | 54 | s.Clients.Delete(conn.Id) |
56 | } | 55 | } |
57 | 56 | ||
@@ -124,7 +123,7 @@ func (s *Server)Stop() { | @@ -124,7 +123,7 @@ func (s *Server)Stop() { | ||
124 | 123 | ||
125 | s.Clients.Range(func(key, value interface{}) bool { | 124 | s.Clients.Range(func(key, value interface{}) bool { |
126 | client := value.(*Connection) | 125 | client := value.(*Connection) |
127 | - client.Stop() | 126 | + client.Quiting() |
128 | return true | 127 | return true |
129 | }) | 128 | }) |
130 | 129 |
src/components/timewheel/timerwheel.go
@@ -39,8 +39,6 @@ func (b*bucket) Add(t *timer) { | @@ -39,8 +39,6 @@ func (b*bucket) Add(t *timer) { | ||
39 | defer b.mu.Unlock() | 39 | defer b.mu.Unlock() |
40 | 40 | ||
41 | b.timers.PushBack(t) | 41 | b.timers.PushBack(t) |
42 | - //t.setBucket(b) | ||
43 | - //t.element = e | ||
44 | } | 42 | } |
45 | 43 | ||
46 | func (b*bucket) Flush(reinsert func(t *timer)) { | 44 | func (b*bucket) Flush(reinsert func(t *timer)) { |
@@ -67,6 +65,7 @@ func init() { | @@ -67,6 +65,7 @@ func init() { | ||
67 | TimingWheel = NewTimeWheel() | 65 | TimingWheel = NewTimeWheel() |
68 | TimingWheel.Start() | 66 | TimingWheel.Start() |
69 | } | 67 | } |
68 | + | ||
70 | type TimeWheel struct { | 69 | type TimeWheel struct { |
71 | tick time.Duration | 70 | tick time.Duration |
72 | ticker *time.Ticker | 71 | ticker *time.Ticker |
src/models/account.go
src/models/equip.go
src/models/hero.go
src/models/init.go
src/models/prop.go
src/models/role.go
@@ -2,10 +2,11 @@ package models | @@ -2,10 +2,11 @@ package models | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | - "pro2d/protos/pb" | 5 | + "pro2d/pb" |
6 | "pro2d/src/common" | 6 | "pro2d/src/common" |
7 | "pro2d/src/components/db" | 7 | "pro2d/src/components/db" |
8 | "pro2d/src/components/logger" | 8 | "pro2d/src/components/logger" |
9 | + "pro2d/src/utils" | ||
9 | "sync/atomic" | 10 | "sync/atomic" |
10 | ) | 11 | ) |
11 | 12 | ||
@@ -92,6 +93,9 @@ func (m *RoleModel) LoadAll() { | @@ -92,6 +93,9 @@ func (m *RoleModel) LoadAll() { | ||
92 | m.LoadEquips() | 93 | m.LoadEquips() |
93 | } | 94 | } |
94 | 95 | ||
96 | +func (m *RoleModel) updateProperty(property map[string]interface{}) { | ||
97 | +} | ||
98 | + | ||
95 | func (m *RoleModel) AddHero(hero *pb.Hero) { | 99 | func (m *RoleModel) AddHero(hero *pb.Hero) { |
96 | h := NewHero(hero.Id) | 100 | h := NewHero(hero.Id) |
97 | h.Hero = hero | 101 | h.Hero = hero |
@@ -111,6 +115,11 @@ func (m *RoleModel) OnRecoverTimer(now int64) { | @@ -111,6 +115,11 @@ func (m *RoleModel) OnRecoverTimer(now int64) { | ||
111 | m.saveRoleData(now) | 115 | m.saveRoleData(now) |
112 | } | 116 | } |
113 | 117 | ||
118 | +func (m *RoleModel) OnOfflineEvent() { | ||
119 | + // 设置最新的登录时间 | ||
120 | + m.saveRoleData(utils.Timex()) | ||
121 | +} | ||
122 | + | ||
114 | func (m *RoleModel) saveRoleData(now int64) { | 123 | func (m *RoleModel) saveRoleData(now int64) { |
115 | if now - m.lastSaveTs < common.SaveDataInterval { | 124 | if now - m.lastSaveTs < common.SaveDataInterval { |
116 | return | 125 | return |
src/models/role_test.go
@@ -3,7 +3,7 @@ package models | @@ -3,7 +3,7 @@ package models | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | _ "pro2d/conf" | 5 | _ "pro2d/conf" |
6 | - "pro2d/protos/pb" | 6 | + "pro2d/pb" |
7 | "pro2d/src/components/db" | 7 | "pro2d/src/components/db" |
8 | "pro2d/src/components/logger" | 8 | "pro2d/src/components/logger" |
9 | "pro2d/src/utils" | 9 | "pro2d/src/utils" |
@@ -26,7 +26,7 @@ func TestNewRole(t *testing.T) { | @@ -26,7 +26,7 @@ func TestNewRole(t *testing.T) { | ||
26 | // ReinPoint: 0, | 26 | // ReinPoint: 0, |
27 | // Equipments: "", | 27 | // Equipments: "", |
28 | //}) | 28 | //}) |
29 | - role.UpdateProperty("Device", "999999999") | 29 | + role.SetProperty("Device", "1111") |
30 | //role.Save() | 30 | //role.Save() |
31 | }else { | 31 | }else { |
32 | //uid不存在,创建角色 | 32 | //uid不存在,创建角色 |
src/models/team.go
src/plugin/RolePlugin.go
@@ -3,7 +3,7 @@ package plugin | @@ -3,7 +3,7 @@ package plugin | ||
3 | import ( | 3 | import ( |
4 | "github.com/golang/protobuf/proto" | 4 | "github.com/golang/protobuf/proto" |
5 | "pro2d/conf" | 5 | "pro2d/conf" |
6 | - "pro2d/protos/pb" | 6 | + "pro2d/pb" |
7 | "pro2d/src/components/logger" | 7 | "pro2d/src/components/logger" |
8 | "pro2d/src/components/net" | 8 | "pro2d/src/components/net" |
9 | "pro2d/src/models" | 9 | "pro2d/src/models" |
@@ -46,14 +46,9 @@ func LoginRpc(msg *net.MsgPkg) (int32, proto.Message) { | @@ -46,14 +46,9 @@ func LoginRpc(msg *net.MsgPkg) (int32, proto.Message) { | ||
46 | if role == nil { | 46 | if role == nil { |
47 | return 2, nil | 47 | return 2, nil |
48 | } | 48 | } |
49 | - role.UpdateProperty("Device", req.Device) | 49 | + role.SetProperty("Device", req.Device) |
50 | + | ||
50 | 51 | ||
51 | - //return 0, &pb.RoleRsp{ | ||
52 | - // Role: role.Role, | ||
53 | - // Hero: nil, | ||
54 | - // Team: nil, | ||
55 | - // Equips: nil, | ||
56 | - //} | ||
57 | msg.Conn.Role = role | 52 | msg.Conn.Role = role |
58 | return 0, &pb.RoleRsp{ | 53 | return 0, &pb.RoleRsp{ |
59 | Role: role.Role, | 54 | Role: role.Role, |
src/plugin/protocode.go
test/client.go
@@ -6,7 +6,7 @@ import ( | @@ -6,7 +6,7 @@ import ( | ||
6 | "encoding/binary" | 6 | "encoding/binary" |
7 | "github.com/golang/protobuf/proto" | 7 | "github.com/golang/protobuf/proto" |
8 | "net" | 8 | "net" |
9 | - "pro2d/protos/pb" | 9 | + "pro2d/pb" |
10 | "pro2d/src/components/logger" | 10 | "pro2d/src/components/logger" |
11 | net2 "pro2d/src/components/net" | 11 | net2 "pro2d/src/components/net" |
12 | "time" | 12 | "time" |
@@ -0,0 +1,32 @@ | @@ -0,0 +1,32 @@ | ||
1 | +package main | ||
2 | + | ||
3 | +import ( | ||
4 | + "testing" | ||
5 | +) | ||
6 | + | ||
7 | +type Error struct { | ||
8 | + errCode uint8 | ||
9 | +} | ||
10 | +func (e *Error) Error() string { | ||
11 | + switch e.errCode { | ||
12 | + case 1: | ||
13 | + return "file not found" | ||
14 | + case 2: | ||
15 | + return "time out" | ||
16 | + case 3: | ||
17 | + return "permission denied" | ||
18 | + default: | ||
19 | + return "unknown error" | ||
20 | + } | ||
21 | +} | ||
22 | + | ||
23 | +func checkError(err error) { | ||
24 | + if err != nil { | ||
25 | + panic(err) | ||
26 | + } | ||
27 | +} | ||
28 | + | ||
29 | +func TestStart( t *testing.T) { | ||
30 | + var e *Error | ||
31 | + checkError(e) | ||
32 | +} | ||
0 | \ No newline at end of file | 33 | \ No newline at end of file |
tools/protostostruct.go
@@ -15,7 +15,7 @@ var ( | @@ -15,7 +15,7 @@ var ( | ||
15 | ProtoCodeLineReq = "\t%sReq = %d;\n" | 15 | ProtoCodeLineReq = "\t%sReq = %d;\n" |
16 | ProtoCodeLineRsp = "\t%sRsp = %d;\n" | 16 | ProtoCodeLineRsp = "\t%sRsp = %d;\n" |
17 | 17 | ||
18 | - GoProtoCodeStr = "package main\n\nimport (\n\t\"pro2d/protos/pb\"\n\t\"pro2d/src/components/logger\"\n\t\"pro2d/src/components/net\"\n)\n\nfunc init() {\n\tlogger.Debug(\"init protocode...\")\n\tnet.ActionMap = make(map[pb.ProtoCode]net.ActionHandler)\n\n%s\n}\n" | 18 | + GoProtoCodeStr = "package main\n\nimport (\n\t\"pro2d/pb\"\n\t\"pro2d/src/components/logger\"\n\t\"pro2d/src/components/net\"\n)\n\nfunc init() {\n\tlogger.Debug(\"init protocode...\")\n\tnet.ActionMap = make(map[pb.ProtoCode]net.ActionHandler)\n\n%s\n}\n" |
19 | GoProtoCodeLine = "\tnet.ActionMap[pb.ProtoCode_%sReq] = %sRpc\n" | 19 | GoProtoCodeLine = "\tnet.ActionMap[pb.ProtoCode_%sReq] = %sRpc\n" |
20 | ) | 20 | ) |
21 | 21 |