diff --git a/modules/items/api_getlist.go b/modules/items/api_getlist.go index 6239280d1..1c93b4f75 100644 --- a/modules/items/api_getlist.go +++ b/modules/items/api_getlist.go @@ -23,7 +23,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq) tempgrids []*pb.DB_UserItemData grids []*pb.DB_UserItemData modifys []*pb.DB_UserItemData - dels []string + dels []*pb.DB_UserItemData ) defer func() { session.SendMsg(string(this.module.GetType()), "getlist", &pb.ItemsGetlistResp{Grids: grids}) @@ -46,12 +46,12 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq) } else { tempgrids = this.module.configure.GetPackItemByType(items, req.IType) modifys = make([]*pb.DB_UserItemData, 0, len(tempgrids)) - dels = make([]string, 0, len(tempgrids)) + dels = make([]*pb.DB_UserItemData, 0, len(tempgrids)) grids = make([]*pb.DB_UserItemData, 0, len(items)) nt = time.Now().Unix() for _, v := range tempgrids { if v.ETime > 0 && v.ETime < nt { //已经过期 - dels = append(dels, v.GridId) + dels = append(dels, v) } else { grids = append(grids, v) if v.IsNewItem { diff --git a/modules/items/modelitems.go b/modules/items/modelitems.go index d1a1b8e68..4f1d234ad 100644 --- a/modules/items/modelitems.go +++ b/modules/items/modelitems.go @@ -76,7 +76,11 @@ func (this *ModelItemsComp) Pack_UpdateUserPack(uId string, itmes ...*pb.DB_User } //更新用户的背包信息 -func (this *ModelItemsComp) Pack_DeleteUserPack(uId string, gridIds ...string) (err error) { +func (this *ModelItemsComp) Pack_DeleteUserPack(uId string, itmes ...*pb.DB_UserItemData) (err error) { + gridIds := make([]string, len(itmes)) + for i, v := range itmes { + gridIds[i] = v.GridId + } if err = this.DelListlds(uId, gridIds...); err != nil { this.module.Errorf("err:%v", err) return @@ -110,8 +114,9 @@ func (this *ModelItemsComp) Pack_AddItemToUserPack(uId string, itemId int32, add var ( itmes []*pb.DB_UserItemData add []*pb.DB_UserItemData - del []string + del []*pb.DB_UserItemData update []*pb.DB_UserItemData + change []*pb.DB_UserItemData leftnum int64 ) if addnum == 0 { @@ -121,6 +126,7 @@ func (this *ModelItemsComp) Pack_AddItemToUserPack(uId string, itemId int32, add this.module.Errorf("err:%v", err) return } + change = make([]*pb.DB_UserItemData, len(itmes)) add, update, del, leftnum = this.pack_addItemToUserPack(itmes, itemId, addnum) if leftnum < 0 { err = ItemNotEnoughError @@ -134,20 +140,22 @@ func (this *ModelItemsComp) Pack_AddItemToUserPack(uId string, itemId int32, add this.module.Errorf("err:%v", err) return } + change = append(change, add...) } if len(del) > 0 { if err = this.Pack_DeleteUserPack(uId, del...); err != nil { this.module.Errorf("err:%v", err) return } + change = append(change, del...) } if len(update) > 0 { if err = this.Pack_UpdateUserPack(uId, update...); err != nil { this.module.Errorf("err:%v", err) return } + change = append(change, update...) } - return } @@ -156,7 +164,7 @@ func (this *ModelItemsComp) Pack_AddItemsToUserPack(uId string, items map[int32] var ( itmes []*pb.DB_UserItemData add []*pb.DB_UserItemData - del []string + del []*pb.DB_UserItemData update []*pb.DB_UserItemData leftnum int64 ) @@ -237,7 +245,7 @@ func (this *ModelItemsComp) Pack_AddItemToUserPackByGrid(uId string, gridid stri } ///添加移除物品到用户背包 -func (this *ModelItemsComp) pack_addItemToUserPack(items []*pb.DB_UserItemData, itemId int32, addnum int32) (add, update []*pb.DB_UserItemData, del []string, leftnum int64) { +func (this *ModelItemsComp) pack_addItemToUserPack(items []*pb.DB_UserItemData, itemId int32, addnum int32) (add, update, del []*pb.DB_UserItemData, leftnum int64) { var ( err error conf *cfg.Game_itemData @@ -253,7 +261,7 @@ func (this *ModelItemsComp) pack_addItemToUserPack(items []*pb.DB_UserItemData, isNew = true leftnum = int64(addnum) add = make([]*pb.DB_UserItemData, 0) - del = make([]string, 0) + del = make([]*pb.DB_UserItemData, 0) update = make([]*pb.DB_UserItemData, 0) for _, v := range items { @@ -263,7 +271,7 @@ func (this *ModelItemsComp) pack_addItemToUserPack(items []*pb.DB_UserItemData, if num < 0 { leftnum += int64(v.Amount) v.Amount = 0 - del = append(del, v.GridId) + del = append(del, v) } else if num > 0 && num < int64(v.Amount) { leftnum = 0 v.Amount = uint32(num) @@ -285,7 +293,7 @@ func (this *ModelItemsComp) pack_addItemToUserPack(items []*pb.DB_UserItemData, } else if num == 0 { leftnum = 0 v.Amount = 0 - del = append(del, v.GridId) + del = append(del, v) } } } diff --git a/modules/items/module.go b/modules/items/module.go index 27a809184..3f9c7de17 100644 --- a/modules/items/module.go +++ b/modules/items/module.go @@ -63,9 +63,12 @@ func (this *Items) QueryItemsAmount(source *comm.ModuleCallSource, uId string, i ///添加单个物品到背包 (可以加物品和减物品) func (this *Items) AddItem(source *comm.ModuleCallSource, uId string, itemid, addnum int32) (code pb.ErrorCode) { - var err error + var ( + err error + change []*pb.DB_UserItemData + ) defer this.Debugf("给用户添加物品 uId:%s itemid:%d addnum:%d issucc:%v", uId, itemid, addnum, err == nil) - if err = this.modelItems.Pack_AddItemToUserPack(uId, itemid, addnum); err != nil { + if change, err = this.modelItems.Pack_AddItemToUserPack(uId, itemid, addnum); err != nil { this.Errorf("给用户添加物品 uId:%s itemid:%d addnum:%d err:%v", uId, itemid, addnum, err) if err == ItemNotEnoughError { code = pb.ErrorCode_ItemsNoEnough @@ -74,15 +77,21 @@ func (this *Items) AddItem(source *comm.ModuleCallSource, uId string, itemid, ad } else { code = pb.ErrorCode_Unknown } + return } + this.itemsChangePush(uId, change) //推送道具背包变化 return } ///添加多个物品到背包 (可以加物品和减物品) func (this *Items) AddItems(source *comm.ModuleCallSource, uId string, items map[int32]int32) (code pb.ErrorCode) { - var err error + var ( + err error + change []*pb.DB_UserItemData + ) + defer this.Debugf("给用户添加物品 uId:%s items:%d items:%v", uId, items, err == nil) - if err = this.modelItems.Pack_AddItemsToUserPack(uId, items); err != nil { + if change, err = this.modelItems.Pack_AddItemsToUserPack(uId, items); err != nil { this.Errorf("给用户添加物品 uId:%s items:%d err:%v", uId, items, err) if err == ItemNotEnoughError { code = pb.ErrorCode_ItemsNoEnough @@ -91,8 +100,20 @@ func (this *Items) AddItems(source *comm.ModuleCallSource, uId string, items map } else { code = pb.ErrorCode_Unknown } + return + } + if len(change) > 0 { + this.itemsChangePush(uId, change) //推送道具背包变化 } return } //Evens-------------------------------------------------------------------------------------------------------------------------------- +//推送道具变化消息 +func (this *Items) itemsChangePush(uid string, items []*pb.DB_UserItemData) (err error) { + if session, ok := this.GetUserSession(uid); ok { + session.SendMsg(string(this.GetType()), "change", &pb.ItemsChangePush{Grids: items}) + err = session.Push() + } + return +} diff --git a/pb/items_msg.pb.go b/pb/items_msg.pb.go index 82183d34f..52347d417 100644 --- a/pb/items_msg.pb.go +++ b/pb/items_msg.pb.go @@ -116,6 +116,54 @@ func (x *ItemsGetlistResp) GetGrids() []*DB_UserItemData { return nil } +//背包变化推送 +type ItemsChangePush struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Grids []*DB_UserItemData `protobuf:"bytes,1,rep,name=Grids,proto3" json:"Grids"` //变化数据 +} + +func (x *ItemsChangePush) Reset() { + *x = ItemsChangePush{} + if protoimpl.UnsafeEnabled { + mi := &file_items_items_msg_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ItemsChangePush) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ItemsChangePush) ProtoMessage() {} + +func (x *ItemsChangePush) ProtoReflect() protoreflect.Message { + mi := &file_items_items_msg_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ItemsChangePush.ProtoReflect.Descriptor instead. +func (*ItemsChangePush) Descriptor() ([]byte, []int) { + return file_items_items_msg_proto_rawDescGZIP(), []int{2} +} + +func (x *ItemsChangePush) GetGrids() []*DB_UserItemData { + if x != nil { + return x.Grids + } + return nil +} + //使用物品请求 type ItemsUseItemReq struct { state protoimpl.MessageState @@ -130,7 +178,7 @@ type ItemsUseItemReq struct { func (x *ItemsUseItemReq) Reset() { *x = ItemsUseItemReq{} if protoimpl.UnsafeEnabled { - mi := &file_items_items_msg_proto_msgTypes[2] + mi := &file_items_items_msg_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -143,7 +191,7 @@ func (x *ItemsUseItemReq) String() string { func (*ItemsUseItemReq) ProtoMessage() {} func (x *ItemsUseItemReq) ProtoReflect() protoreflect.Message { - mi := &file_items_items_msg_proto_msgTypes[2] + mi := &file_items_items_msg_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -156,7 +204,7 @@ func (x *ItemsUseItemReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ItemsUseItemReq.ProtoReflect.Descriptor instead. func (*ItemsUseItemReq) Descriptor() ([]byte, []int) { - return file_items_items_msg_proto_rawDescGZIP(), []int{2} + return file_items_items_msg_proto_rawDescGZIP(), []int{3} } func (x *ItemsUseItemReq) GetGridId() string { @@ -190,7 +238,7 @@ type ItemsUseItemResp struct { func (x *ItemsUseItemResp) Reset() { *x = ItemsUseItemResp{} if protoimpl.UnsafeEnabled { - mi := &file_items_items_msg_proto_msgTypes[3] + mi := &file_items_items_msg_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -203,7 +251,7 @@ func (x *ItemsUseItemResp) String() string { func (*ItemsUseItemResp) ProtoMessage() {} func (x *ItemsUseItemResp) ProtoReflect() protoreflect.Message { - mi := &file_items_items_msg_proto_msgTypes[3] + mi := &file_items_items_msg_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -216,7 +264,7 @@ func (x *ItemsUseItemResp) ProtoReflect() protoreflect.Message { // Deprecated: Use ItemsUseItemResp.ProtoReflect.Descriptor instead. func (*ItemsUseItemResp) Descriptor() ([]byte, []int) { - return file_items_items_msg_proto_rawDescGZIP(), []int{3} + return file_items_items_msg_proto_rawDescGZIP(), []int{4} } //出售道具请求sailitem @@ -233,7 +281,7 @@ type ItemsSellItemReq struct { func (x *ItemsSellItemReq) Reset() { *x = ItemsSellItemReq{} if protoimpl.UnsafeEnabled { - mi := &file_items_items_msg_proto_msgTypes[4] + mi := &file_items_items_msg_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -246,7 +294,7 @@ func (x *ItemsSellItemReq) String() string { func (*ItemsSellItemReq) ProtoMessage() {} func (x *ItemsSellItemReq) ProtoReflect() protoreflect.Message { - mi := &file_items_items_msg_proto_msgTypes[4] + mi := &file_items_items_msg_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -259,7 +307,7 @@ func (x *ItemsSellItemReq) ProtoReflect() protoreflect.Message { // Deprecated: Use ItemsSellItemReq.ProtoReflect.Descriptor instead. func (*ItemsSellItemReq) Descriptor() ([]byte, []int) { - return file_items_items_msg_proto_rawDescGZIP(), []int{4} + return file_items_items_msg_proto_rawDescGZIP(), []int{5} } func (x *ItemsSellItemReq) GetGridId() string { @@ -293,7 +341,7 @@ type ItemsSellItemResp struct { func (x *ItemsSellItemResp) Reset() { *x = ItemsSellItemResp{} if protoimpl.UnsafeEnabled { - mi := &file_items_items_msg_proto_msgTypes[5] + mi := &file_items_items_msg_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -306,7 +354,7 @@ func (x *ItemsSellItemResp) String() string { func (*ItemsSellItemResp) ProtoMessage() {} func (x *ItemsSellItemResp) ProtoReflect() protoreflect.Message { - mi := &file_items_items_msg_proto_msgTypes[5] + mi := &file_items_items_msg_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -319,7 +367,7 @@ func (x *ItemsSellItemResp) ProtoReflect() protoreflect.Message { // Deprecated: Use ItemsSellItemResp.ProtoReflect.Descriptor instead. func (*ItemsSellItemResp) Descriptor() ([]byte, []int) { - return file_items_items_msg_proto_rawDescGZIP(), []int{5} + return file_items_items_msg_proto_rawDescGZIP(), []int{6} } var File_items_items_msg_proto protoreflect.FileDescriptor @@ -334,22 +382,25 @@ var file_items_items_msg_proto_rawDesc = []byte{ 0x65, 0x74, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x05, 0x47, 0x72, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x47, 0x72, 0x69, - 0x64, 0x73, 0x22, 0x59, 0x0a, 0x0f, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x55, 0x73, 0x65, 0x49, 0x74, - 0x65, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, - 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x12, 0x0a, - 0x10, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, - 0x70, 0x22, 0x5a, 0x0a, 0x10, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, - 0x65, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, - 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, - 0x11, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, - 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x64, 0x73, 0x22, 0x39, 0x0a, 0x0f, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x26, 0x0a, 0x05, 0x47, 0x72, 0x69, 0x64, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x49, 0x74, + 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x47, 0x72, 0x69, 0x64, 0x73, 0x22, 0x59, 0x0a, + 0x0f, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, + 0x12, 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x49, 0x74, 0x65, 0x6d, + 0x73, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x22, 0x5a, 0x0a, 0x10, + 0x49, 0x74, 0x65, 0x6d, 0x73, 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, + 0x12, 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x49, 0x74, 0x65, 0x6d, + 0x73, 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -364,23 +415,25 @@ func file_items_items_msg_proto_rawDescGZIP() []byte { return file_items_items_msg_proto_rawDescData } -var file_items_items_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_items_items_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_items_items_msg_proto_goTypes = []interface{}{ (*ItemsGetlistReq)(nil), // 0: ItemsGetlistReq (*ItemsGetlistResp)(nil), // 1: ItemsGetlistResp - (*ItemsUseItemReq)(nil), // 2: ItemsUseItemReq - (*ItemsUseItemResp)(nil), // 3: ItemsUseItemResp - (*ItemsSellItemReq)(nil), // 4: ItemsSellItemReq - (*ItemsSellItemResp)(nil), // 5: ItemsSellItemResp - (*DB_UserItemData)(nil), // 6: DB_UserItemData + (*ItemsChangePush)(nil), // 2: ItemsChangePush + (*ItemsUseItemReq)(nil), // 3: ItemsUseItemReq + (*ItemsUseItemResp)(nil), // 4: ItemsUseItemResp + (*ItemsSellItemReq)(nil), // 5: ItemsSellItemReq + (*ItemsSellItemResp)(nil), // 6: ItemsSellItemResp + (*DB_UserItemData)(nil), // 7: DB_UserItemData } var file_items_items_msg_proto_depIdxs = []int32{ - 6, // 0: ItemsGetlistResp.Grids:type_name -> DB_UserItemData - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 7, // 0: ItemsGetlistResp.Grids:type_name -> DB_UserItemData + 7, // 1: ItemsChangePush.Grids:type_name -> DB_UserItemData + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_items_items_msg_proto_init() } @@ -415,7 +468,7 @@ func file_items_items_msg_proto_init() { } } file_items_items_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ItemsUseItemReq); i { + switch v := v.(*ItemsChangePush); i { case 0: return &v.state case 1: @@ -427,7 +480,7 @@ func file_items_items_msg_proto_init() { } } file_items_items_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ItemsUseItemResp); i { + switch v := v.(*ItemsUseItemReq); i { case 0: return &v.state case 1: @@ -439,7 +492,7 @@ func file_items_items_msg_proto_init() { } } file_items_items_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ItemsSellItemReq); i { + switch v := v.(*ItemsUseItemResp); i { case 0: return &v.state case 1: @@ -451,6 +504,18 @@ func file_items_items_msg_proto_init() { } } file_items_items_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ItemsSellItemReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_items_items_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ItemsSellItemResp); i { case 0: return &v.state @@ -469,7 +534,7 @@ func file_items_items_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_items_items_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/proto/items/items_msg.proto b/pb/proto/items/items_msg.proto index 83f52391c..820f2e23f 100644 --- a/pb/proto/items/items_msg.proto +++ b/pb/proto/items/items_msg.proto @@ -12,6 +12,11 @@ message ItemsGetlistResp { repeated DB_UserItemData Grids = 1; //用户背包列表 } +//背包变化推送 +message ItemsChangePush { + repeated DB_UserItemData Grids = 1; //变化数据 +} + //使用物品请求 message ItemsUseItemReq { string GridId = 1; //格子Id