Commit 8d983031318209d7e26d72354aada45ef9c1d251
1 parent
436e0af4
loginReq uid -> token; model is ISchema
Showing
24 changed files
with
376 additions
and
168 deletions
Show diff stats
cmd/gameserver/action/RoleAction.go
@@ -31,6 +31,7 @@ func CreateRpc(msg components.IMessage) (int32, interface{}) { | @@ -31,6 +31,7 @@ func CreateRpc(msg components.IMessage) (int32, interface{}) { | ||
31 | logger.Error("CreateRpc role create err: %v", err) | 31 | logger.Error("CreateRpc role create err: %v", err) |
32 | return 3, nil | 32 | return 3, nil |
33 | } | 33 | } |
34 | + role.InitRole() | ||
34 | return 0, nil | 35 | return 0, nil |
35 | } | 36 | } |
36 | 37 | ||
@@ -48,10 +49,5 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) { | @@ -48,10 +49,5 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) { | ||
48 | } | 49 | } |
49 | role.SetProperty("Device", req.Device) | 50 | role.SetProperty("Device", req.Device) |
50 | 51 | ||
51 | - return 0, &pb.RoleRsp{ | ||
52 | - Role: role.Role, | ||
53 | - Hero: role.GetAllHero(), | ||
54 | - Team: role.Teams.Team, | ||
55 | - Equips: []*pb.Equipment{role.Equip.Equip}, | ||
56 | - } | 52 | + return 0, role |
57 | } | 53 | } |
cmd/gameserver/action/protocode.go
@@ -13,4 +13,4 @@ func GetActionMap() map[interface{}]interface{} { | @@ -13,4 +13,4 @@ func GetActionMap() map[interface{}]interface{} { | ||
13 | am[uint32(pb.ProtoCode_CreateReq)] = CreateRpc | 13 | am[uint32(pb.ProtoCode_CreateReq)] = CreateRpc |
14 | 14 | ||
15 | return am | 15 | return am |
16 | -} | 16 | -} |
17 | +} | ||
17 | \ No newline at end of file | 18 | \ No newline at end of file |
cmd/gameserver/agent.go
@@ -3,10 +3,12 @@ package main | @@ -3,10 +3,12 @@ package main | ||
3 | import ( | 3 | import ( |
4 | "github.com/golang/protobuf/proto" | 4 | "github.com/golang/protobuf/proto" |
5 | "math" | 5 | "math" |
6 | + "pro2d/cmd/gameserver/action" | ||
6 | "pro2d/common" | 7 | "pro2d/common" |
7 | "pro2d/common/components" | 8 | "pro2d/common/components" |
8 | "pro2d/common/logger" | 9 | "pro2d/common/logger" |
9 | "pro2d/models" | 10 | "pro2d/models" |
11 | + "pro2d/pb" | ||
10 | "pro2d/utils" | 12 | "pro2d/utils" |
11 | "sync" | 13 | "sync" |
12 | "sync/atomic" | 14 | "sync/atomic" |
@@ -38,8 +40,38 @@ func (c *Agent) OnConnection(conn components.IConnection) { | @@ -38,8 +40,38 @@ func (c *Agent) OnConnection(conn components.IConnection) { | ||
38 | c.IConnection = conn | 40 | c.IConnection = conn |
39 | } | 41 | } |
40 | 42 | ||
43 | +func (c *Agent) OnLogin(msg components.IMessage) { | ||
44 | + //第一次登录 | ||
45 | + errCode, irole := action.LoginRpc(msg) | ||
46 | + if errCode != 0 { | ||
47 | + c.Send(errCode, msg.GetHeader().GetMsgID(), nil) | ||
48 | + return | ||
49 | + } | ||
50 | + | ||
51 | + role := irole.(*models.RoleModel) | ||
52 | + protoMsg := &pb.RoleRsp{ | ||
53 | + Role: role.Role, | ||
54 | + Hero: role.GetAllHero(), | ||
55 | + Team: role.GetAllTeam(), | ||
56 | + } | ||
57 | + rsp, err := proto.Marshal(protoMsg) | ||
58 | + if err != nil { | ||
59 | + c.Send(-100, msg.GetHeader().GetMsgID(), nil) | ||
60 | + return | ||
61 | + } | ||
62 | + c.Send(errCode, msg.GetHeader().GetMsgID(), rsp) | ||
63 | + //登录成功,存储agent role | ||
64 | + c.Role = role | ||
65 | +} | ||
66 | + | ||
41 | func (c *Agent) OnMessage(msg components.IMessage) { | 67 | func (c *Agent) OnMessage(msg components.IMessage) { |
42 | atomic.StoreInt64(&c.lastHeartCheckTime, utils.Timex()) | 68 | atomic.StoreInt64(&c.lastHeartCheckTime, utils.Timex()) |
69 | + | ||
70 | + if msg.GetHeader().GetMsgID() == uint32(pb.ProtoCode_LoginReq) { | ||
71 | + c.OnLogin(msg) | ||
72 | + return | ||
73 | + } | ||
74 | + | ||
43 | md := c.Server.GetAction(msg.GetHeader().GetMsgID()) | 75 | md := c.Server.GetAction(msg.GetHeader().GetMsgID()) |
44 | if md == nil { | 76 | if md == nil { |
45 | logger.Debug("cmd: %d, handler is nil", msg.GetHeader().GetMsgID()) | 77 | logger.Debug("cmd: %d, handler is nil", msg.GetHeader().GetMsgID()) |
@@ -50,24 +82,18 @@ func (c *Agent) OnMessage(msg components.IMessage) { | @@ -50,24 +82,18 @@ func (c *Agent) OnMessage(msg components.IMessage) { | ||
50 | 82 | ||
51 | f := md.(func (msg components.IMessage) (int32, interface{})) | 83 | f := md.(func (msg components.IMessage) (int32, interface{})) |
52 | errCode, protoMsg := f(msg) | 84 | errCode, protoMsg := f(msg) |
85 | + | ||
53 | if protoMsg == nil { | 86 | if protoMsg == nil { |
87 | + c.Send(errCode, msg.GetHeader().GetMsgID(), nil) | ||
54 | return | 88 | return |
55 | } | 89 | } |
56 | 90 | ||
57 | rsp, err := proto.Marshal(protoMsg.(proto.Message)) | 91 | rsp, err := proto.Marshal(protoMsg.(proto.Message)) |
58 | if err != nil { | 92 | if err != nil { |
59 | - conn := msg.GetSession() | ||
60 | - if conn != nil { | ||
61 | - conn.Send(-100, msg.GetHeader().GetMsgID(), nil) | ||
62 | - } | ||
63 | - return | ||
64 | - } | ||
65 | - conn := msg.GetSession() | ||
66 | - if conn != nil { | ||
67 | - conn.Send(errCode, msg.GetHeader().GetMsgID(), rsp) | 93 | + c.Send(-100, msg.GetHeader().GetMsgID(), nil) |
68 | return | 94 | return |
69 | } | 95 | } |
70 | - logger.Error("protocol not handler: %d", msg.GetHeader().GetMsgID()) | 96 | + c.Send(errCode, msg.GetHeader().GetMsgID(), rsp) |
71 | } | 97 | } |
72 | 98 | ||
73 | func (c *Agent) OnTimer() { | 99 | func (c *Agent) OnTimer() { |
@@ -91,6 +117,7 @@ func (c *Agent) OnClose() { | @@ -91,6 +117,7 @@ func (c *Agent) OnClose() { | ||
91 | } | 117 | } |
92 | 118 | ||
93 | func (c *Agent) Close() { | 119 | func (c *Agent) Close() { |
120 | + c.Role = nil | ||
94 | agentPool.Put(c) | 121 | agentPool.Put(c) |
95 | 122 | ||
96 | if c.Role == nil { | 123 | if c.Role == nil { |
cmd/gameserver/game.go
@@ -38,7 +38,7 @@ func NewGameServer(sconf *common.SConf) (*GameServer, error) { | @@ -38,7 +38,7 @@ func NewGameServer(sconf *common.SConf) (*GameServer, error) { | ||
38 | if err != nil { | 38 | if err != nil { |
39 | return nil, err | 39 | return nil, err |
40 | } | 40 | } |
41 | - models.InitModels() | 41 | + models.InitGameModels() |
42 | 42 | ||
43 | //Etcd 初始化 | 43 | //Etcd 初始化 |
44 | s.EtcdClient, err = etcd.NewEtcdClient(common.GlobalConf.Etcd) | 44 | s.EtcdClient, err = etcd.NewEtcdClient(common.GlobalConf.Etcd) |
cmd/gameserver/plugin/plugin.go
@@ -37,7 +37,7 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) { | @@ -37,7 +37,7 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) { | ||
37 | return 0, &pb.RoleRsp{ | 37 | return 0, &pb.RoleRsp{ |
38 | Role: role.Role, | 38 | Role: role.Role, |
39 | Hero: role.GetAllHero(), | 39 | Hero: role.GetAllHero(), |
40 | - Team: role.Teams.Team, | 40 | + Team: role.GetAllTeam(), |
41 | Equips: []*pb.Equipment{role.Equip.Equip}, | 41 | Equips: []*pb.Equipment{role.Equip.Equip}, |
42 | } | 42 | } |
43 | } | 43 | } |
cmd/httpserver/http.go
@@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
9 | "pro2d/common/db/mongoproxy" | 9 | "pro2d/common/db/mongoproxy" |
10 | "pro2d/common/etcd" | 10 | "pro2d/common/etcd" |
11 | "pro2d/common/logger" | 11 | "pro2d/common/logger" |
12 | + "pro2d/models" | ||
12 | "syscall" | 13 | "syscall" |
13 | ) | 14 | ) |
14 | 15 | ||
@@ -30,6 +31,7 @@ func (s *AccountServer) Init() error { | @@ -30,6 +31,7 @@ func (s *AccountServer) Init() error { | ||
30 | if err != nil { | 31 | if err != nil { |
31 | return err | 32 | return err |
32 | } | 33 | } |
34 | + models.InitGameModels() | ||
33 | 35 | ||
34 | //Etcd 初始化 | 36 | //Etcd 初始化 |
35 | s.EtcdClient, err = etcd.NewEtcdClient(common.GlobalConf.Etcd) | 37 | s.EtcdClient, err = etcd.NewEtcdClient(common.GlobalConf.Etcd) |
cmd/test/client.go
@@ -19,7 +19,7 @@ func main() { | @@ -19,7 +19,7 @@ func main() { | ||
19 | } | 19 | } |
20 | 20 | ||
21 | loginReq := &pb.LoginReq{ | 21 | loginReq := &pb.LoginReq{ |
22 | - Uid: "141815055745814528", | 22 | + Token: "141815055745814528", |
23 | Device: "123123", | 23 | Device: "123123", |
24 | } | 24 | } |
25 | l, _ :=proto.Marshal(loginReq) | 25 | l, _ :=proto.Marshal(loginReq) |
common/components/icompontents.go
@@ -101,6 +101,7 @@ type ( | @@ -101,6 +101,7 @@ type ( | ||
101 | CreateTable() error | 101 | CreateTable() error |
102 | 102 | ||
103 | Create() (interface{}, error) | 103 | Create() (interface{}, error) |
104 | + Save() error | ||
104 | Load() error | 105 | Load() error |
105 | FindOne() error | 106 | FindOne() error |
106 | UpdateProperty(key string, val interface{}) error | 107 | UpdateProperty(key string, val interface{}) error |
common/db/mongoproxy/mongo.go
@@ -49,6 +49,14 @@ func (m *MgoColl) Create() (interface{}, error){ | @@ -49,6 +49,14 @@ func (m *MgoColl) Create() (interface{}, error){ | ||
49 | return m.coll.InsertOne(context.TODO(), m.Schema.GetSchema()) | 49 | return m.coll.InsertOne(context.TODO(), m.Schema.GetSchema()) |
50 | } | 50 | } |
51 | 51 | ||
52 | +func (m *MgoColl) Save() error{ | ||
53 | + _, err := m.coll.UpdateOne(context.TODO(), m.Schema.GetPri(), m.Schema.GetSchema()) | ||
54 | + if err != nil { | ||
55 | + return err | ||
56 | + } | ||
57 | + return nil | ||
58 | +} | ||
59 | + | ||
52 | func (m *MgoColl) Load() error{ | 60 | func (m *MgoColl) Load() error{ |
53 | r := m.coll.FindOne(context.TODO(), m.Schema.GetPri()) | 61 | r := m.coll.FindOne(context.TODO(), m.Schema.GetPri()) |
54 | err := r.Decode(m.Schema.GetSchema()) | 62 | err := r.Decode(m.Schema.GetSchema()) |
common/db/mongoproxy/mongoplugin.go
@@ -71,6 +71,14 @@ func FindOne(pri interface{}, schema interface{}) error { | @@ -71,6 +71,14 @@ func FindOne(pri interface{}, schema interface{}) error { | ||
71 | return r.Decode(schema) | 71 | return r.Decode(schema) |
72 | } | 72 | } |
73 | 73 | ||
74 | +func FindMany(coll string, key string, val interface{}, schema interface{}) error { | ||
75 | + r, err := mongoDatabase.Collection(coll).Find(context.TODO(), bson.M{key:val}) | ||
76 | + if err != nil { | ||
77 | + return err | ||
78 | + } | ||
79 | + return r.All(context.TODO(), schema) | ||
80 | +} | ||
81 | + | ||
74 | func GetBsonD(key string, value interface{}) interface{} { | 82 | func GetBsonD(key string, value interface{}) interface{} { |
75 | return bson.D{ {key, value}} | 83 | return bson.D{ {key, value}} |
76 | } | 84 | } |
conf/conf.yaml
models/account.go
1 | package models | 1 | package models |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "pro2d/common/components" | ||
4 | "pro2d/pb" | 5 | "pro2d/pb" |
5 | ) | 6 | ) |
6 | 7 | ||
7 | type AccountModel struct { | 8 | type AccountModel struct { |
8 | - *Schema | 9 | + components.ISchema |
9 | *pb.Account | 10 | *pb.Account |
10 | } | 11 | } |
11 | 12 | ||
@@ -24,7 +25,7 @@ func NewAccount(phone string) *AccountModel { | @@ -24,7 +25,7 @@ func NewAccount(phone string) *AccountModel { | ||
24 | } | 25 | } |
25 | 26 | ||
26 | account := &AccountModel{ | 27 | account := &AccountModel{ |
27 | - Schema: NewSchema(phone, ac), | 28 | + ISchema: NewSchema(phone, ac), |
28 | Account: ac, | 29 | Account: ac, |
29 | } | 30 | } |
30 | 31 |
models/equip.go
1 | package models | 1 | package models |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "pro2d/common/components" | ||
4 | "pro2d/pb" | 5 | "pro2d/pb" |
5 | ) | 6 | ) |
6 | 7 | ||
7 | type EquipModel struct { | 8 | type EquipModel struct { |
8 | - *Schema | 9 | + components.ISchema |
9 | Equip *pb.Equipment | 10 | Equip *pb.Equipment |
10 | } | 11 | } |
11 | 12 | ||
@@ -14,7 +15,7 @@ func NewEquip(id string) *EquipModel { | @@ -14,7 +15,7 @@ func NewEquip(id string) *EquipModel { | ||
14 | Id: id, | 15 | Id: id, |
15 | } | 16 | } |
16 | m := &EquipModel{ | 17 | m := &EquipModel{ |
17 | - Schema: NewSchema(id, data), | 18 | + ISchema: NewSchema(id, data), |
18 | Equip: data, | 19 | Equip: data, |
19 | } | 20 | } |
20 | 21 |
models/hero.go
1 | package models | 1 | package models |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "pro2d/common/components" | ||
4 | "pro2d/pb" | 5 | "pro2d/pb" |
5 | ) | 6 | ) |
6 | 7 | ||
7 | type HeroModel struct { | 8 | type HeroModel struct { |
8 | - *Schema | 9 | + components.ISchema |
9 | Hero *pb.Hero | 10 | Hero *pb.Hero |
10 | } | 11 | } |
11 | -type HeroMap map[string]*HeroModel | ||
12 | - | ||
13 | -func GetHeros(hm HeroMap) map[string]*pb.Hero { | ||
14 | - h := make(map[string]*pb.Hero) | ||
15 | - for k, v := range hm { | ||
16 | - h[k] = v.Hero | ||
17 | - } | ||
18 | - return h | ||
19 | -} | ||
20 | - | ||
21 | -func NewHero(id string) *HeroModel { | ||
22 | - h := &pb.Hero{ | ||
23 | - Id: id, | ||
24 | - } | 12 | +type HeroMap map[string]components.ISchema |
13 | +func NewHero(hero *pb.Hero) *HeroModel { | ||
25 | m := &HeroModel{ | 14 | m := &HeroModel{ |
26 | - Schema: NewSchema(id, h), | ||
27 | - Hero: h, | 15 | + ISchema: NewSchema(hero.Id, hero), |
16 | + Hero: hero, | ||
28 | } | 17 | } |
29 | return m | 18 | return m |
30 | } | 19 | } |
models/init.go
@@ -5,9 +5,15 @@ import ( | @@ -5,9 +5,15 @@ import ( | ||
5 | "pro2d/pb" | 5 | "pro2d/pb" |
6 | ) | 6 | ) |
7 | 7 | ||
8 | -func InitModels() { | ||
9 | - var schema []interface{} = []interface{}{ | 8 | +func InitAccountModels() { |
9 | + var schema = []interface{}{ | ||
10 | pb.Account{}, | 10 | pb.Account{}, |
11 | + } | ||
12 | + mongoproxy.InitDoc(schema...) | ||
13 | +} | ||
14 | + | ||
15 | +func InitGameModels() { | ||
16 | + var schema = []interface{}{ | ||
11 | pb.Equipment{}, | 17 | pb.Equipment{}, |
12 | pb.Hero{}, | 18 | pb.Hero{}, |
13 | pb.Prop{}, | 19 | pb.Prop{}, |
models/prop.go
1 | package models | 1 | package models |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "pro2d/common/components" | ||
4 | "pro2d/pb" | 5 | "pro2d/pb" |
5 | ) | 6 | ) |
6 | 7 | ||
7 | type PropModel struct { | 8 | type PropModel struct { |
8 | - *Schema | 9 | + components.ISchema |
9 | Prop *pb.Prop | 10 | Prop *pb.Prop |
10 | } | 11 | } |
11 | 12 | ||
@@ -14,7 +15,7 @@ func NewProp(id string) *PropModel { | @@ -14,7 +15,7 @@ func NewProp(id string) *PropModel { | ||
14 | Id: id, | 15 | Id: id, |
15 | } | 16 | } |
16 | m := &PropModel{ | 17 | m := &PropModel{ |
17 | - Schema: NewSchema(id, data), | 18 | + ISchema: NewSchema(id, data), |
18 | Prop: data, | 19 | Prop: data, |
19 | } | 20 | } |
20 | 21 |
models/role.go
1 | package models | 1 | package models |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | - "fmt" | ||
5 | "pro2d/common" | 4 | "pro2d/common" |
5 | + "pro2d/common/components" | ||
6 | "pro2d/common/db/mongoproxy" | 6 | "pro2d/common/db/mongoproxy" |
7 | "pro2d/common/logger" | 7 | "pro2d/common/logger" |
8 | "pro2d/pb" | 8 | "pro2d/pb" |
@@ -11,11 +11,10 @@ import ( | @@ -11,11 +11,10 @@ import ( | ||
11 | ) | 11 | ) |
12 | 12 | ||
13 | type RoleModel struct { | 13 | type RoleModel struct { |
14 | - *Schema | 14 | + components.ISchema |
15 | Role *pb.Role | 15 | Role *pb.Role |
16 | Heros HeroMap | 16 | Heros HeroMap |
17 | - Teams *TeamModel | ||
18 | - Equip *EquipModel | 17 | + Teams TeamMap |
19 | Prop *PropModel | 18 | Prop *PropModel |
20 | 19 | ||
21 | lastSaveTs int64 | 20 | lastSaveTs int64 |
@@ -31,11 +30,10 @@ func RoleExistByUid(uid string) *RoleModel { | @@ -31,11 +30,10 @@ func RoleExistByUid(uid string) *RoleModel { | ||
31 | 30 | ||
32 | 31 | ||
33 | r := &RoleModel{ | 32 | r := &RoleModel{ |
34 | - Schema: NewSchema(data.Id, data), | 33 | + ISchema: NewSchema(data.Id, data), |
35 | Role: data, | 34 | Role: data, |
36 | Heros: make(HeroMap), | 35 | Heros: make(HeroMap), |
37 | - Teams: new(TeamModel), | ||
38 | - Equip: new(EquipModel), | 36 | + Teams: make(TeamMap), |
39 | Prop: new(PropModel), | 37 | Prop: new(PropModel), |
40 | } | 38 | } |
41 | r.LoadAll() | 39 | r.LoadAll() |
@@ -45,72 +43,127 @@ func RoleExistByUid(uid string) *RoleModel { | @@ -45,72 +43,127 @@ func RoleExistByUid(uid string) *RoleModel { | ||
45 | func NewRole(id string) *RoleModel { | 43 | func NewRole(id string) *RoleModel { |
46 | data := &pb.Role{Id: id} | 44 | data := &pb.Role{Id: id} |
47 | m := &RoleModel{ | 45 | m := &RoleModel{ |
48 | - Schema: NewSchema(id, data), | 46 | + ISchema: NewSchema(id, data), |
49 | Role: data, | 47 | Role: data, |
50 | Heros: make(HeroMap), | 48 | Heros: make(HeroMap), |
51 | - Teams: new(TeamModel), | ||
52 | - Equip: new(EquipModel), | ||
53 | - Prop: new(PropModel), | 49 | + Teams: make(TeamMap), |
54 | } | 50 | } |
55 | return m | 51 | return m |
56 | } | 52 | } |
57 | 53 | ||
58 | -func (m *RoleModel) LoadHero() { | ||
59 | - m.Heros["test"] = NewHero("") | ||
60 | - m.Heros["test"].Hero = &pb.Hero{ | ||
61 | - Id: "1", | 54 | +func (m *RoleModel) InitRole() { |
55 | + //init hero | ||
56 | + h1 := pb.Hero{ | ||
57 | + Id: common.SnowFlack.NextValStr(), | ||
62 | RoleId: m.Role.Id, | 58 | RoleId: m.Role.Id, |
63 | Type: 1, | 59 | Type: 1, |
64 | Level: 1, | 60 | Level: 1, |
65 | ReinCount: 0, | 61 | ReinCount: 0, |
66 | ReinPoint: 0, | 62 | ReinPoint: 0, |
67 | - Equipments: "123123", | 63 | + Equipments: "", |
68 | } | 64 | } |
65 | + m.AddHero(&h1) | ||
66 | + | ||
67 | + h2 := h1 | ||
68 | + h2.Id = common.SnowFlack.NextValStr() | ||
69 | + h2.Type = 2 | ||
70 | + m.AddHero(&h2) | ||
71 | + | ||
72 | + h3 := h1 | ||
73 | + h3.Id = common.SnowFlack.NextValStr() | ||
74 | + h3.Type = 3 | ||
75 | + m.AddHero(&h3) | ||
76 | + | ||
77 | + h4 := h1 | ||
78 | + h4.Id = common.SnowFlack.NextValStr() | ||
79 | + h4.Type = 4 | ||
80 | + m.AddHero(&h4) | ||
81 | + | ||
82 | + //init team | ||
83 | + t1 := pb.Team{ | ||
84 | + Id: common.SnowFlack.NextValStr(), | ||
85 | + RoleId: m.Role.Id, | ||
86 | + HeroId1: h1.Id, | ||
87 | + HeroId2: h2.Id, | ||
88 | + HeroId3: h3.Id, | ||
89 | + } | ||
90 | + m.AddTeam(&t1) | ||
91 | + | ||
92 | + t2 := t1 | ||
93 | + t2.Id = common.SnowFlack.NextValStr() | ||
94 | + m.AddTeam(&t2) | ||
95 | + | ||
96 | + t3 := t1 | ||
97 | + t3.Id = common.SnowFlack.NextValStr() | ||
98 | + m.AddTeam(&t3) | ||
99 | + | ||
100 | + t4 := t1 | ||
101 | + t4.Id = common.SnowFlack.NextValStr() | ||
102 | + m.AddTeam(&t4) | ||
69 | } | 103 | } |
70 | 104 | ||
71 | -func (m *RoleModel) LoadTeams() { | ||
72 | - m.Teams = NewTeam("0") | ||
73 | - m.Teams.Team = &pb.Team{ | ||
74 | - Id: "1", | ||
75 | - HeroIds: "1", | 105 | +func (m *RoleModel) LoadHero() { |
106 | + heros := make([]*pb.Hero, 10) | ||
107 | + err := mongoproxy.FindMany("hero", "role_id", m.Role.Id, &heros) | ||
108 | + if err != nil { | ||
109 | + logger.Error(err) | ||
110 | + return | ||
111 | + } | ||
112 | + for _, hero := range heros { | ||
113 | + m.Heros[hero.Id] = NewHero(hero) | ||
76 | } | 114 | } |
77 | } | 115 | } |
78 | 116 | ||
79 | -func (m *RoleModel) LoadEquips() { | ||
80 | - m.Equip = NewEquip("0") | ||
81 | - m.Equip.Equip = &pb.Equipment{ | ||
82 | - Id: "0", | ||
83 | - RoleId: m.Role.Id, | ||
84 | - Type: 0, | ||
85 | - Equip: false, | ||
86 | - EnhanceLevel: false, | 117 | +func (m *RoleModel) LoadTeams() { |
118 | + teams := make([]*pb.Team, 4) | ||
119 | + err := mongoproxy.FindMany("hero", "role_id", m.Role.Id, &teams) | ||
120 | + if err != nil { | ||
121 | + logger.Error(err) | ||
122 | + return | ||
123 | + } | ||
124 | + for _, team:= range teams { | ||
125 | + m.Teams[team.Id] = NewTeam(team) | ||
87 | } | 126 | } |
88 | } | 127 | } |
89 | 128 | ||
90 | func (m *RoleModel) LoadAll() { | 129 | func (m *RoleModel) LoadAll() { |
91 | m.LoadHero() | 130 | m.LoadHero() |
92 | m.LoadTeams() | 131 | m.LoadTeams() |
93 | - m.LoadEquips() | ||
94 | } | 132 | } |
95 | 133 | ||
96 | func (m *RoleModel) updateProperty(property map[string]interface{}) { | 134 | func (m *RoleModel) updateProperty(property map[string]interface{}) { |
97 | } | 135 | } |
98 | 136 | ||
99 | -func (m *RoleModel) AddHero(hero *pb.Hero) { | ||
100 | - h := NewHero(hero.Id) | ||
101 | - h.Hero = hero | ||
102 | - h.Create() | ||
103 | - m.Heros[fmt.Sprintf("%s%s", m.Role.Id, h.Hero.Id)] = h | ||
104 | -} | ||
105 | - | ||
106 | func (m *RoleModel) GetAllHero() []*pb.Hero { | 137 | func (m *RoleModel) GetAllHero() []*pb.Hero { |
107 | var h []*pb.Hero | 138 | var h []*pb.Hero |
108 | for _, hero := range m.Heros { | 139 | for _, hero := range m.Heros { |
109 | - h = append(h, hero.Hero) | 140 | + h = append(h, hero.(*HeroModel).Hero) |
110 | } | 141 | } |
111 | return h | 142 | return h |
112 | } | 143 | } |
113 | 144 | ||
145 | +func (m *RoleModel) GetAllTeam() []*pb.Team{ | ||
146 | + var t []*pb.Team | ||
147 | + for _, team := range m.Teams{ | ||
148 | + t = append(t, team.Team) | ||
149 | + } | ||
150 | + return t | ||
151 | +} | ||
152 | + | ||
153 | + | ||
154 | +func (m *RoleModel) AddHero(hero *pb.Hero) { | ||
155 | + h := NewHero(hero) | ||
156 | + h .Create() | ||
157 | + m.Heros[hero.Id] = h | ||
158 | +} | ||
159 | + | ||
160 | +func (m *RoleModel) AddTeam(team *pb.Team) { | ||
161 | + t := NewTeam(team) | ||
162 | + t.Create() | ||
163 | + m.Teams[team.Id] = t | ||
164 | +} | ||
165 | + | ||
166 | + | ||
114 | func (m *RoleModel) OnRecoverTimer(now int64) { | 167 | func (m *RoleModel) OnRecoverTimer(now int64) { |
115 | m.saveRoleData(now) | 168 | m.saveRoleData(now) |
116 | } | 169 | } |
@@ -126,4 +179,20 @@ func (m *RoleModel) saveRoleData(now int64) { | @@ -126,4 +179,20 @@ func (m *RoleModel) saveRoleData(now int64) { | ||
126 | } | 179 | } |
127 | atomic.StoreInt64(&m.lastSaveTs, now) | 180 | atomic.StoreInt64(&m.lastSaveTs, now) |
128 | m.Update() | 181 | m.Update() |
182 | + | ||
183 | + tbObjs := []components.ISchema{} | ||
184 | + for _, tbObj := range tbObjs { | ||
185 | + if tbObj != nil { | ||
186 | + tbObj.Update() | ||
187 | + } | ||
188 | + } | ||
189 | + | ||
190 | + //mpObjs := []interface{}{m.Heros, m.Teams} | ||
191 | + //for _, mpObj := range mpObjs { | ||
192 | + // for _, v := range mpObj.(map[string]components.ISchema) { | ||
193 | + // if v != nil { | ||
194 | + // v.Update() | ||
195 | + // } | ||
196 | + // } | ||
197 | + //} | ||
129 | } | 198 | } |
130 | \ No newline at end of file | 199 | \ No newline at end of file |
models/role_test.go
@@ -6,12 +6,11 @@ import ( | @@ -6,12 +6,11 @@ import ( | ||
6 | "pro2d/common/db/mongoproxy" | 6 | "pro2d/common/db/mongoproxy" |
7 | "pro2d/common/logger" | 7 | "pro2d/common/logger" |
8 | "pro2d/pb" | 8 | "pro2d/pb" |
9 | - "pro2d/utils" | ||
10 | "testing" | 9 | "testing" |
11 | ) | 10 | ) |
12 | 11 | ||
13 | func TestNewRole(t *testing.T) { | 12 | func TestNewRole(t *testing.T) { |
14 | - err := mongoproxy.ConnectMongo(common.GlobalConf.MongoConf) | 13 | + err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf) |
15 | if err != nil { | 14 | if err != nil { |
16 | logger.Error(err) | 15 | logger.Error(err) |
17 | return | 16 | return |
@@ -45,8 +44,25 @@ func TestNewRole(t *testing.T) { | @@ -45,8 +44,25 @@ func TestNewRole(t *testing.T) { | ||
45 | } | 44 | } |
46 | 45 | ||
47 | func TestRoleIndex(t *testing.T) { | 46 | func TestRoleIndex(t *testing.T) { |
48 | - coll, keys := utils.FindIndex(pb.Role{}) | 47 | + coll, keys := mongoproxy.FindIndex(pb.Role{}) |
49 | for _, index := range keys { | 48 | for _, index := range keys { |
50 | logger.Debug("coll: %s, key: %s", coll, index) | 49 | logger.Debug("coll: %s, key: %s", coll, index) |
51 | } | 50 | } |
51 | +} | ||
52 | + | ||
53 | +func TestRoleModel_AddHero(t *testing.T) { | ||
54 | + err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf) | ||
55 | + if err != nil { | ||
56 | + logger.Error(err) | ||
57 | + return | ||
58 | + } | ||
59 | + | ||
60 | + var uid = "141815055745814528" | ||
61 | + role := RoleExistByUid(uid) | ||
62 | + if role == nil { | ||
63 | + logger.Error("role not exist") | ||
64 | + return | ||
65 | + } | ||
66 | + | ||
67 | + role.InitRole() | ||
52 | } | 68 | } |
53 | \ No newline at end of file | 69 | \ No newline at end of file |
models/schema.go
@@ -97,6 +97,10 @@ func (s *Schema) Create() error { | @@ -97,6 +97,10 @@ func (s *Schema) Create() error { | ||
97 | return err | 97 | return err |
98 | } | 98 | } |
99 | 99 | ||
100 | +func (s *Schema) Save() error { | ||
101 | + return s.db.Save() | ||
102 | +} | ||
103 | + | ||
100 | func (s *Schema) Update() { | 104 | func (s *Schema) Update() { |
101 | if s.cacheFields != nil { | 105 | if s.cacheFields != nil { |
102 | s.db.UpdateProperties(s.cacheFields) | 106 | s.db.UpdateProperties(s.cacheFields) |
models/team.go
@@ -4,17 +4,15 @@ import ( | @@ -4,17 +4,15 @@ import ( | ||
4 | "pro2d/pb" | 4 | "pro2d/pb" |
5 | ) | 5 | ) |
6 | 6 | ||
7 | +type TeamMap map[string]*TeamModel | ||
7 | type TeamModel struct { | 8 | type TeamModel struct { |
8 | *Schema | 9 | *Schema |
9 | Team *pb.Team | 10 | Team *pb.Team |
10 | } | 11 | } |
11 | 12 | ||
12 | -func NewTeam(id string) *TeamModel { | ||
13 | - data := &pb.Team{ | ||
14 | - Id: id, | ||
15 | - } | 13 | +func NewTeam(data *pb.Team) *TeamModel { |
16 | m := &TeamModel{ | 14 | m := &TeamModel{ |
17 | - Schema: NewSchema(id, data), | 15 | + Schema: NewSchema(data.Id, data), |
18 | Team: data, | 16 | Team: data, |
19 | } | 17 | } |
20 | 18 |
pb/game.pb.go
@@ -67,6 +67,53 @@ func (x *HeartReq) GetCode() int64 { | @@ -67,6 +67,53 @@ func (x *HeartReq) GetCode() int64 { | ||
67 | return 0 | 67 | return 0 |
68 | } | 68 | } |
69 | 69 | ||
70 | +type HeartRsp struct { | ||
71 | + state protoimpl.MessageState | ||
72 | + sizeCache protoimpl.SizeCache | ||
73 | + unknownFields protoimpl.UnknownFields | ||
74 | + | ||
75 | + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` | ||
76 | +} | ||
77 | + | ||
78 | +func (x *HeartRsp) Reset() { | ||
79 | + *x = HeartRsp{} | ||
80 | + if protoimpl.UnsafeEnabled { | ||
81 | + mi := &file_game_proto_msgTypes[1] | ||
82 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
83 | + ms.StoreMessageInfo(mi) | ||
84 | + } | ||
85 | +} | ||
86 | + | ||
87 | +func (x *HeartRsp) String() string { | ||
88 | + return protoimpl.X.MessageStringOf(x) | ||
89 | +} | ||
90 | + | ||
91 | +func (*HeartRsp) ProtoMessage() {} | ||
92 | + | ||
93 | +func (x *HeartRsp) ProtoReflect() protoreflect.Message { | ||
94 | + mi := &file_game_proto_msgTypes[1] | ||
95 | + if protoimpl.UnsafeEnabled && x != nil { | ||
96 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
97 | + if ms.LoadMessageInfo() == nil { | ||
98 | + ms.StoreMessageInfo(mi) | ||
99 | + } | ||
100 | + return ms | ||
101 | + } | ||
102 | + return mi.MessageOf(x) | ||
103 | +} | ||
104 | + | ||
105 | +// Deprecated: Use HeartRsp.ProtoReflect.Descriptor instead. | ||
106 | +func (*HeartRsp) Descriptor() ([]byte, []int) { | ||
107 | + return file_game_proto_rawDescGZIP(), []int{1} | ||
108 | +} | ||
109 | + | ||
110 | +func (x *HeartRsp) GetCode() int64 { | ||
111 | + if x != nil { | ||
112 | + return x.Code | ||
113 | + } | ||
114 | + return 0 | ||
115 | +} | ||
116 | + | ||
70 | //ResponseCmd RoleRsp | 117 | //ResponseCmd RoleRsp |
71 | type LoginReq struct { | 118 | type LoginReq struct { |
72 | state protoimpl.MessageState | 119 | state protoimpl.MessageState |
@@ -80,7 +127,7 @@ type LoginReq struct { | @@ -80,7 +127,7 @@ type LoginReq struct { | ||
80 | func (x *LoginReq) Reset() { | 127 | func (x *LoginReq) Reset() { |
81 | *x = LoginReq{} | 128 | *x = LoginReq{} |
82 | if protoimpl.UnsafeEnabled { | 129 | if protoimpl.UnsafeEnabled { |
83 | - mi := &file_game_proto_msgTypes[1] | 130 | + mi := &file_game_proto_msgTypes[2] |
84 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 131 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
85 | ms.StoreMessageInfo(mi) | 132 | ms.StoreMessageInfo(mi) |
86 | } | 133 | } |
@@ -93,7 +140,7 @@ func (x *LoginReq) String() string { | @@ -93,7 +140,7 @@ func (x *LoginReq) String() string { | ||
93 | func (*LoginReq) ProtoMessage() {} | 140 | func (*LoginReq) ProtoMessage() {} |
94 | 141 | ||
95 | func (x *LoginReq) ProtoReflect() protoreflect.Message { | 142 | func (x *LoginReq) ProtoReflect() protoreflect.Message { |
96 | - mi := &file_game_proto_msgTypes[1] | 143 | + mi := &file_game_proto_msgTypes[2] |
97 | if protoimpl.UnsafeEnabled && x != nil { | 144 | if protoimpl.UnsafeEnabled && x != nil { |
98 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 145 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
99 | if ms.LoadMessageInfo() == nil { | 146 | if ms.LoadMessageInfo() == nil { |
@@ -106,7 +153,7 @@ func (x *LoginReq) ProtoReflect() protoreflect.Message { | @@ -106,7 +153,7 @@ func (x *LoginReq) ProtoReflect() protoreflect.Message { | ||
106 | 153 | ||
107 | // Deprecated: Use LoginReq.ProtoReflect.Descriptor instead. | 154 | // Deprecated: Use LoginReq.ProtoReflect.Descriptor instead. |
108 | func (*LoginReq) Descriptor() ([]byte, []int) { | 155 | func (*LoginReq) Descriptor() ([]byte, []int) { |
109 | - return file_game_proto_rawDescGZIP(), []int{1} | 156 | + return file_game_proto_rawDescGZIP(), []int{2} |
110 | } | 157 | } |
111 | 158 | ||
112 | func (x *LoginReq) GetToken() string { | 159 | func (x *LoginReq) GetToken() string { |
@@ -135,7 +182,7 @@ type CreateReq struct { | @@ -135,7 +182,7 @@ type CreateReq struct { | ||
135 | func (x *CreateReq) Reset() { | 182 | func (x *CreateReq) Reset() { |
136 | *x = CreateReq{} | 183 | *x = CreateReq{} |
137 | if protoimpl.UnsafeEnabled { | 184 | if protoimpl.UnsafeEnabled { |
138 | - mi := &file_game_proto_msgTypes[2] | 185 | + mi := &file_game_proto_msgTypes[3] |
139 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 186 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
140 | ms.StoreMessageInfo(mi) | 187 | ms.StoreMessageInfo(mi) |
141 | } | 188 | } |
@@ -148,7 +195,7 @@ func (x *CreateReq) String() string { | @@ -148,7 +195,7 @@ func (x *CreateReq) String() string { | ||
148 | func (*CreateReq) ProtoMessage() {} | 195 | func (*CreateReq) ProtoMessage() {} |
149 | 196 | ||
150 | func (x *CreateReq) ProtoReflect() protoreflect.Message { | 197 | func (x *CreateReq) ProtoReflect() protoreflect.Message { |
151 | - mi := &file_game_proto_msgTypes[2] | 198 | + mi := &file_game_proto_msgTypes[3] |
152 | if protoimpl.UnsafeEnabled && x != nil { | 199 | if protoimpl.UnsafeEnabled && x != nil { |
153 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 200 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
154 | if ms.LoadMessageInfo() == nil { | 201 | if ms.LoadMessageInfo() == nil { |
@@ -161,7 +208,7 @@ func (x *CreateReq) ProtoReflect() protoreflect.Message { | @@ -161,7 +208,7 @@ func (x *CreateReq) ProtoReflect() protoreflect.Message { | ||
161 | 208 | ||
162 | // Deprecated: Use CreateReq.ProtoReflect.Descriptor instead. | 209 | // Deprecated: Use CreateReq.ProtoReflect.Descriptor instead. |
163 | func (*CreateReq) Descriptor() ([]byte, []int) { | 210 | func (*CreateReq) Descriptor() ([]byte, []int) { |
164 | - return file_game_proto_rawDescGZIP(), []int{2} | 211 | + return file_game_proto_rawDescGZIP(), []int{3} |
165 | } | 212 | } |
166 | 213 | ||
167 | func (x *CreateReq) GetUid() string { | 214 | func (x *CreateReq) GetUid() string { |
@@ -183,16 +230,15 @@ type RoleRsp struct { | @@ -183,16 +230,15 @@ type RoleRsp struct { | ||
183 | sizeCache protoimpl.SizeCache | 230 | sizeCache protoimpl.SizeCache |
184 | unknownFields protoimpl.UnknownFields | 231 | unknownFields protoimpl.UnknownFields |
185 | 232 | ||
186 | - Role *Role `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` | ||
187 | - Hero []*Hero `protobuf:"bytes,3,rep,name=hero,proto3" json:"hero,omitempty"` | ||
188 | - Team *Team `protobuf:"bytes,4,opt,name=team,proto3" json:"team,omitempty"` | ||
189 | - Equips []*Equipment `protobuf:"bytes,5,rep,name=equips,proto3" json:"equips,omitempty"` | 233 | + Role *Role `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` |
234 | + Hero []*Hero `protobuf:"bytes,3,rep,name=hero,proto3" json:"hero,omitempty"` | ||
235 | + Team []*Team `protobuf:"bytes,4,rep,name=team,proto3" json:"team,omitempty"` | ||
190 | } | 236 | } |
191 | 237 | ||
192 | func (x *RoleRsp) Reset() { | 238 | func (x *RoleRsp) Reset() { |
193 | *x = RoleRsp{} | 239 | *x = RoleRsp{} |
194 | if protoimpl.UnsafeEnabled { | 240 | if protoimpl.UnsafeEnabled { |
195 | - mi := &file_game_proto_msgTypes[3] | 241 | + mi := &file_game_proto_msgTypes[4] |
196 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 242 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
197 | ms.StoreMessageInfo(mi) | 243 | ms.StoreMessageInfo(mi) |
198 | } | 244 | } |
@@ -205,7 +251,7 @@ func (x *RoleRsp) String() string { | @@ -205,7 +251,7 @@ func (x *RoleRsp) String() string { | ||
205 | func (*RoleRsp) ProtoMessage() {} | 251 | func (*RoleRsp) ProtoMessage() {} |
206 | 252 | ||
207 | func (x *RoleRsp) ProtoReflect() protoreflect.Message { | 253 | func (x *RoleRsp) ProtoReflect() protoreflect.Message { |
208 | - mi := &file_game_proto_msgTypes[3] | 254 | + mi := &file_game_proto_msgTypes[4] |
209 | if protoimpl.UnsafeEnabled && x != nil { | 255 | if protoimpl.UnsafeEnabled && x != nil { |
210 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 256 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
211 | if ms.LoadMessageInfo() == nil { | 257 | if ms.LoadMessageInfo() == nil { |
@@ -218,7 +264,7 @@ func (x *RoleRsp) ProtoReflect() protoreflect.Message { | @@ -218,7 +264,7 @@ func (x *RoleRsp) ProtoReflect() protoreflect.Message { | ||
218 | 264 | ||
219 | // Deprecated: Use RoleRsp.ProtoReflect.Descriptor instead. | 265 | // Deprecated: Use RoleRsp.ProtoReflect.Descriptor instead. |
220 | func (*RoleRsp) Descriptor() ([]byte, []int) { | 266 | func (*RoleRsp) Descriptor() ([]byte, []int) { |
221 | - return file_game_proto_rawDescGZIP(), []int{3} | 267 | + return file_game_proto_rawDescGZIP(), []int{4} |
222 | } | 268 | } |
223 | 269 | ||
224 | func (x *RoleRsp) GetRole() *Role { | 270 | func (x *RoleRsp) GetRole() *Role { |
@@ -235,20 +281,13 @@ func (x *RoleRsp) GetHero() []*Hero { | @@ -235,20 +281,13 @@ func (x *RoleRsp) GetHero() []*Hero { | ||
235 | return nil | 281 | return nil |
236 | } | 282 | } |
237 | 283 | ||
238 | -func (x *RoleRsp) GetTeam() *Team { | 284 | +func (x *RoleRsp) GetTeam() []*Team { |
239 | if x != nil { | 285 | if x != nil { |
240 | return x.Team | 286 | return x.Team |
241 | } | 287 | } |
242 | return nil | 288 | return nil |
243 | } | 289 | } |
244 | 290 | ||
245 | -func (x *RoleRsp) GetEquips() []*Equipment { | ||
246 | - if x != nil { | ||
247 | - return x.Equips | ||
248 | - } | ||
249 | - return nil | ||
250 | -} | ||
251 | - | ||
252 | var File_game_proto protoreflect.FileDescriptor | 291 | var File_game_proto protoreflect.FileDescriptor |
253 | 292 | ||
254 | var file_game_proto_rawDesc = []byte{ | 293 | var file_game_proto_rawDesc = []byte{ |
@@ -256,6 +295,8 @@ var file_game_proto_rawDesc = []byte{ | @@ -256,6 +295,8 @@ var file_game_proto_rawDesc = []byte{ | ||
256 | 0x6d, 0x65, 0x1a, 0x0c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, | 295 | 0x6d, 0x65, 0x1a, 0x0c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, |
257 | 0x22, 0x1e, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, | 296 | 0x22, 0x1e, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, |
258 | 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, | 297 | 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, |
298 | + 0x22, 0x1e, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, | ||
299 | + 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, | ||
259 | 0x22, 0x38, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, | 300 | 0x22, 0x38, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, |
260 | 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, | 301 | 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, |
261 | 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, | 302 | 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, |
@@ -263,18 +304,15 @@ var file_game_proto_rawDesc = []byte{ | @@ -263,18 +304,15 @@ var file_game_proto_rawDesc = []byte{ | ||
263 | 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, | 304 | 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, |
264 | 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, | 305 | 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, |
265 | 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, | 306 | 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, |
266 | - 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x12, 0x20, 0x0a, | ||
267 | - 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, | ||
268 | - 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, | ||
269 | - 0x20, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, | ||
270 | - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, | ||
271 | - 0x6f, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, | ||
272 | - 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x74, | ||
273 | - 0x65, 0x61, 0x6d, 0x12, 0x29, 0x0a, 0x06, 0x65, 0x71, 0x75, 0x69, 0x70, 0x73, 0x18, 0x05, 0x20, | ||
274 | - 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x45, 0x71, 0x75, | ||
275 | - 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x71, 0x75, 0x69, 0x70, 0x73, 0x42, 0x0a, | ||
276 | - 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, | ||
277 | - 0x6f, 0x33, | 307 | + 0x65, 0x22, 0x6f, 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x04, |
308 | + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, | ||
309 | + 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x20, | ||
310 | + 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, | ||
311 | + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, | ||
312 | + 0x12, 0x20, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, | ||
313 | + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x74, 0x65, | ||
314 | + 0x61, 0x6d, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, | ||
315 | + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | ||
278 | } | 316 | } |
279 | 317 | ||
280 | var ( | 318 | var ( |
@@ -289,27 +327,26 @@ func file_game_proto_rawDescGZIP() []byte { | @@ -289,27 +327,26 @@ func file_game_proto_rawDescGZIP() []byte { | ||
289 | return file_game_proto_rawDescData | 327 | return file_game_proto_rawDescData |
290 | } | 328 | } |
291 | 329 | ||
292 | -var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 4) | 330 | +var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 5) |
293 | var file_game_proto_goTypes = []interface{}{ | 331 | var file_game_proto_goTypes = []interface{}{ |
294 | (*HeartReq)(nil), // 0: game.HeartReq | 332 | (*HeartReq)(nil), // 0: game.HeartReq |
295 | - (*LoginReq)(nil), // 1: game.LoginReq | ||
296 | - (*CreateReq)(nil), // 2: game.CreateReq | ||
297 | - (*RoleRsp)(nil), // 3: game.RoleRsp | ||
298 | - (*Role)(nil), // 4: models.Role | ||
299 | - (*Hero)(nil), // 5: models.Hero | ||
300 | - (*Team)(nil), // 6: models.Team | ||
301 | - (*Equipment)(nil), // 7: models.Equipment | 333 | + (*HeartRsp)(nil), // 1: game.HeartRsp |
334 | + (*LoginReq)(nil), // 2: game.LoginReq | ||
335 | + (*CreateReq)(nil), // 3: game.CreateReq | ||
336 | + (*RoleRsp)(nil), // 4: game.RoleRsp | ||
337 | + (*Role)(nil), // 5: models.Role | ||
338 | + (*Hero)(nil), // 6: models.Hero | ||
339 | + (*Team)(nil), // 7: models.Team | ||
302 | } | 340 | } |
303 | var file_game_proto_depIdxs = []int32{ | 341 | var file_game_proto_depIdxs = []int32{ |
304 | - 4, // 0: game.RoleRsp.role:type_name -> models.Role | ||
305 | - 5, // 1: game.RoleRsp.hero:type_name -> models.Hero | ||
306 | - 6, // 2: game.RoleRsp.team:type_name -> models.Team | ||
307 | - 7, // 3: game.RoleRsp.equips:type_name -> models.Equipment | ||
308 | - 4, // [4:4] is the sub-list for method output_type | ||
309 | - 4, // [4:4] is the sub-list for method input_type | ||
310 | - 4, // [4:4] is the sub-list for extension type_name | ||
311 | - 4, // [4:4] is the sub-list for extension extendee | ||
312 | - 0, // [0:4] is the sub-list for field type_name | 342 | + 5, // 0: game.RoleRsp.role:type_name -> models.Role |
343 | + 6, // 1: game.RoleRsp.hero:type_name -> models.Hero | ||
344 | + 7, // 2: game.RoleRsp.team:type_name -> models.Team | ||
345 | + 3, // [3:3] is the sub-list for method output_type | ||
346 | + 3, // [3:3] is the sub-list for method input_type | ||
347 | + 3, // [3:3] is the sub-list for extension type_name | ||
348 | + 3, // [3:3] is the sub-list for extension extendee | ||
349 | + 0, // [0:3] is the sub-list for field type_name | ||
313 | } | 350 | } |
314 | 351 | ||
315 | func init() { file_game_proto_init() } | 352 | func init() { file_game_proto_init() } |
@@ -332,7 +369,7 @@ func file_game_proto_init() { | @@ -332,7 +369,7 @@ func file_game_proto_init() { | ||
332 | } | 369 | } |
333 | } | 370 | } |
334 | file_game_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { | 371 | file_game_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { |
335 | - switch v := v.(*LoginReq); i { | 372 | + switch v := v.(*HeartRsp); i { |
336 | case 0: | 373 | case 0: |
337 | return &v.state | 374 | return &v.state |
338 | case 1: | 375 | case 1: |
@@ -344,7 +381,7 @@ func file_game_proto_init() { | @@ -344,7 +381,7 @@ func file_game_proto_init() { | ||
344 | } | 381 | } |
345 | } | 382 | } |
346 | file_game_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { | 383 | file_game_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { |
347 | - switch v := v.(*CreateReq); i { | 384 | + switch v := v.(*LoginReq); i { |
348 | case 0: | 385 | case 0: |
349 | return &v.state | 386 | return &v.state |
350 | case 1: | 387 | case 1: |
@@ -356,6 +393,18 @@ func file_game_proto_init() { | @@ -356,6 +393,18 @@ func file_game_proto_init() { | ||
356 | } | 393 | } |
357 | } | 394 | } |
358 | file_game_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { | 395 | file_game_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { |
396 | + switch v := v.(*CreateReq); i { | ||
397 | + case 0: | ||
398 | + return &v.state | ||
399 | + case 1: | ||
400 | + return &v.sizeCache | ||
401 | + case 2: | ||
402 | + return &v.unknownFields | ||
403 | + default: | ||
404 | + return nil | ||
405 | + } | ||
406 | + } | ||
407 | + file_game_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { | ||
359 | switch v := v.(*RoleRsp); i { | 408 | switch v := v.(*RoleRsp); i { |
360 | case 0: | 409 | case 0: |
361 | return &v.state | 410 | return &v.state |
@@ -374,7 +423,7 @@ func file_game_proto_init() { | @@ -374,7 +423,7 @@ func file_game_proto_init() { | ||
374 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | 423 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), |
375 | RawDescriptor: file_game_proto_rawDesc, | 424 | RawDescriptor: file_game_proto_rawDesc, |
376 | NumEnums: 0, | 425 | NumEnums: 0, |
377 | - NumMessages: 4, | 426 | + NumMessages: 5, |
378 | NumExtensions: 0, | 427 | NumExtensions: 0, |
379 | NumServices: 0, | 428 | NumServices: 0, |
380 | }, | 429 | }, |
pb/models.pb.go
@@ -318,7 +318,10 @@ type Team struct { | @@ -318,7 +318,10 @@ type Team struct { | ||
318 | unknownFields protoimpl.UnknownFields | 318 | unknownFields protoimpl.UnknownFields |
319 | 319 | ||
320 | Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" index:"unique" pri:"1"` // @inject_tag: index:"unique" pri:"1" | 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"` | 321 | + RoleId string `protobuf:"bytes,2,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` |
322 | + HeroId1 string `protobuf:"bytes,3,opt,name=hero_id1,json=heroId1,proto3" json:"hero_id1,omitempty"` | ||
323 | + HeroId2 string `protobuf:"bytes,4,opt,name=hero_id2,json=heroId2,proto3" json:"hero_id2,omitempty"` | ||
324 | + HeroId3 string `protobuf:"bytes,5,opt,name=hero_id3,json=heroId3,proto3" json:"hero_id3,omitempty"` | ||
322 | } | 325 | } |
323 | 326 | ||
324 | func (x *Team) Reset() { | 327 | func (x *Team) Reset() { |
@@ -360,9 +363,30 @@ func (x *Team) GetId() string { | @@ -360,9 +363,30 @@ func (x *Team) GetId() string { | ||
360 | return "" | 363 | return "" |
361 | } | 364 | } |
362 | 365 | ||
363 | -func (x *Team) GetHeroIds() string { | 366 | +func (x *Team) GetRoleId() string { |
364 | if x != nil { | 367 | if x != nil { |
365 | - return x.HeroIds | 368 | + return x.RoleId |
369 | + } | ||
370 | + return "" | ||
371 | +} | ||
372 | + | ||
373 | +func (x *Team) GetHeroId1() string { | ||
374 | + if x != nil { | ||
375 | + return x.HeroId1 | ||
376 | + } | ||
377 | + return "" | ||
378 | +} | ||
379 | + | ||
380 | +func (x *Team) GetHeroId2() string { | ||
381 | + if x != nil { | ||
382 | + return x.HeroId2 | ||
383 | + } | ||
384 | + return "" | ||
385 | +} | ||
386 | + | ||
387 | +func (x *Team) GetHeroId3() string { | ||
388 | + if x != nil { | ||
389 | + return x.HeroId3 | ||
366 | } | 390 | } |
367 | return "" | 391 | return "" |
368 | } | 392 | } |
@@ -526,10 +550,15 @@ var file_models_proto_rawDesc = []byte{ | @@ -526,10 +550,15 @@ var file_models_proto_rawDesc = []byte{ | ||
526 | 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x2c, 0x0a, 0x04, 0x50, 0x72, 0x6f, 0x70, 0x12, 0x0e, 0x0a, | 550 | 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, | 551 | 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, | 552 | 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, | 553 | + 0x75, 0x6e, 0x74, 0x22, 0x80, 0x01, 0x0a, 0x04, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x0e, 0x0a, 0x02, |
554 | + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, | ||
555 | + 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, | ||
556 | + 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x5f, 0x69, 0x64, | ||
557 | + 0x31, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x31, | ||
558 | + 0x12, 0x19, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x5f, 0x69, 0x64, 0x32, 0x18, 0x04, 0x20, 0x01, | ||
559 | + 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x32, 0x12, 0x19, 0x0a, 0x08, 0x68, | ||
560 | + 0x65, 0x72, 0x6f, 0x5f, 0x69, 0x64, 0x33, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, | ||
561 | + 0x65, 0x72, 0x6f, 0x49, 0x64, 0x33, 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, | 562 | 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, | 563 | 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, | 564 | 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, |
pb/protocode.pb.go
@@ -25,9 +25,10 @@ type ProtoCode int32 | @@ -25,9 +25,10 @@ type ProtoCode int32 | ||
25 | const ( | 25 | const ( |
26 | ProtoCode_UNKNOWN ProtoCode = 0 | 26 | ProtoCode_UNKNOWN ProtoCode = 0 |
27 | ProtoCode_HeartReq ProtoCode = 1 | 27 | ProtoCode_HeartReq ProtoCode = 1 |
28 | - ProtoCode_LoginReq ProtoCode = 2 | ||
29 | - ProtoCode_CreateReq ProtoCode = 3 | ||
30 | - ProtoCode_RoleRsp ProtoCode = 4 | 28 | + ProtoCode_HeartRsp ProtoCode = 2 |
29 | + ProtoCode_LoginReq ProtoCode = 3 | ||
30 | + ProtoCode_CreateReq ProtoCode = 4 | ||
31 | + ProtoCode_RoleRsp ProtoCode = 5 | ||
31 | ) | 32 | ) |
32 | 33 | ||
33 | // Enum value maps for ProtoCode. | 34 | // Enum value maps for ProtoCode. |
@@ -35,16 +36,18 @@ var ( | @@ -35,16 +36,18 @@ var ( | ||
35 | ProtoCode_name = map[int32]string{ | 36 | ProtoCode_name = map[int32]string{ |
36 | 0: "UNKNOWN", | 37 | 0: "UNKNOWN", |
37 | 1: "HeartReq", | 38 | 1: "HeartReq", |
38 | - 2: "LoginReq", | ||
39 | - 3: "CreateReq", | ||
40 | - 4: "RoleRsp", | 39 | + 2: "HeartRsp", |
40 | + 3: "LoginReq", | ||
41 | + 4: "CreateReq", | ||
42 | + 5: "RoleRsp", | ||
41 | } | 43 | } |
42 | ProtoCode_value = map[string]int32{ | 44 | ProtoCode_value = map[string]int32{ |
43 | "UNKNOWN": 0, | 45 | "UNKNOWN": 0, |
44 | "HeartReq": 1, | 46 | "HeartReq": 1, |
45 | - "LoginReq": 2, | ||
46 | - "CreateReq": 3, | ||
47 | - "RoleRsp": 4, | 47 | + "HeartRsp": 2, |
48 | + "LoginReq": 3, | ||
49 | + "CreateReq": 4, | ||
50 | + "RoleRsp": 5, | ||
48 | } | 51 | } |
49 | ) | 52 | ) |
50 | 53 | ||
@@ -79,14 +82,14 @@ var File_protocode_proto protoreflect.FileDescriptor | @@ -79,14 +82,14 @@ var File_protocode_proto protoreflect.FileDescriptor | ||
79 | 82 | ||
80 | var file_protocode_proto_rawDesc = []byte{ | 83 | var file_protocode_proto_rawDesc = []byte{ |
81 | 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, | 84 | 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, | 85 | + 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0x5e, 0x0a, 0x09, |
83 | 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, | 86 | 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, | 87 | 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, | 88 | + 0x65, 0x71, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x73, 0x70, |
89 | + 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x10, 0x03, | ||
90 | + 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x10, 0x04, 0x12, | ||
91 | + 0x0b, 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x10, 0x05, 0x42, 0x0a, 0x5a, 0x08, | ||
92 | + 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | ||
90 | } | 93 | } |
91 | 94 | ||
92 | var ( | 95 | var ( |