diff --git a/comm/imodule.go b/comm/imodule.go index d1b49bfc8..41299d8b0 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -6,8 +6,8 @@ import ( ) type ( - //红点接口 - IReddot interface { + //红点获取接口 + IGetReddot interface { Reddot(session IUserSession, rid ...ReddotType) (reddot map[ReddotType]bool) } //埋点中心更新通知 @@ -44,7 +44,7 @@ type ( SendMailByCid(session IUserSession, cid string, res []*pb.UserAssets) bool SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服 SendMailByUID(uid string, cid string, res []*cfg.Gameatn, Param []string) bool - IReddot + IGetReddot } //道具背包接口 IItems interface { @@ -214,7 +214,7 @@ type ( // 校验主线是否通关 CheckCommpleteStage(uid string, stageId int32) (b bool) ///红点 - IReddot + IGetReddot } //任务 ITask interface { @@ -231,11 +231,9 @@ type ( // 获取已完成的日任务列表 GetTaskDayFinished(uid string) []*pb.TaskData ///红点 - IReddot + IGetReddot } - - //好友 IFriend interface { // 重置点赞列表和每日友情点 @@ -304,7 +302,7 @@ type ( // Check Rtype84 Rtype85 Rtype86 CheckPagodaMaxFloor(uid string, pagodaType int32) int32 // 查询塔通关难度type 1 表示普通塔 2 赛季塔 ///红点 - IReddot + IGetReddot } IHeroFetter interface { @@ -326,7 +324,7 @@ type ( IViking interface { CompleteAllLevel(session IUserSession) (errdata *pb.ErrorData) CheckUserBaseVikingInfo(uid string) (data []*pb.DBVikingRank) // 查询玩家最佳通关记录 - IReddot + IGetReddot // 自动购买门票 AutoBuyTicket(session IUserSession, bossId, difficulty int32) (errdata *pb.ErrorData) // 自动战斗 战斗信息 @@ -337,7 +335,7 @@ type ( IHunting interface { CompleteAllLevel(session IUserSession) (errdata *pb.ErrorData) CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) // 查询玩家最佳通关记录 - IReddot + IGetReddot } // 公会 ISociaty interface { @@ -355,14 +353,14 @@ type ( // 任务条件达成通知 // TaskcondNotify(uid string, condIds []int32) error // 红点 - IReddot + IGetReddot } //星座图 IHoroscope interface { //计算新作图属性 ComputeHeroNumeric(uid string, hero ...*pb.DBHero) ///红点 - IReddot + IGetReddot } IPrivilege interface { // 创建一个新的特权卡 @@ -384,7 +382,7 @@ type ( //武馆 IMartialhall interface { ///红点 - IReddot + IGetReddot } // 世界任务 IWorldtask interface { @@ -408,7 +406,7 @@ type ( //竞技场 IArena interface { ///红点 - IReddot + IGetReddot //设置用户积分 SetUserIntegral(session IUserSession, Integral int32) (err error) //获取匹配战斗角色列表 @@ -416,7 +414,7 @@ type ( } IGourmet interface { ///红点 - IReddot + IGetReddot } ILibrary interface { @@ -451,7 +449,7 @@ type ( ISmithy interface { CheckActivateAtlasCollect(uid string, id string) - IReddot // 铁匠铺红点 + IGetReddot // 铁匠铺红点 } IPandaAtlas interface { @@ -510,4 +508,9 @@ type ( //完成任务并校验接口 FinishConditionAndCheck(uid string, finishcondiIds []int32, condiIds ...int32) (condis []*pb.ConIProgress, err error) } + //红点模块接口 + IReddot interface { + //推送红点 + PushReddot(session IUserSession, reddot ...ReddotType) (errdata *pb.ErrorData) + } ) diff --git a/modules/reddot/module.go b/modules/reddot/module.go index 6e3ad40fc..560906b5d 100644 --- a/modules/reddot/module.go +++ b/modules/reddot/module.go @@ -5,6 +5,7 @@ import ( "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" "go_dreamfactory/modules" + "go_dreamfactory/pb" ) /* @@ -103,3 +104,16 @@ func (this *Reddot) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp) } + +//推送红点 +func (this *Reddot) PushReddot(session comm.IUserSession, reddot ...comm.ReddotType) (errdata *pb.ErrorData) { + if len(reddot) <= 0 { + return + } + rids := make([]int32, len(reddot)) + for i, v := range reddot { + rids[i] = int32(v) + } + session.SendMsg(string(this.GetType()), "change", &pb.ReddotChangePush{Rids: rids}) + return +} diff --git a/pb/reddot_msg.pb.go b/pb/reddot_msg.pb.go index b35001ef4..8f2e9b3ad 100644 --- a/pb/reddot_msg.pb.go +++ b/pb/reddot_msg.pb.go @@ -201,6 +201,54 @@ func (x *ReddotGetResp) GetReddot() map[int32]bool { return nil } +//推送红点改变 +type ReddotChangePush struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Rids []int32 `protobuf:"varint,1,rep,packed,name=rids,proto3" json:"rids"` +} + +func (x *ReddotChangePush) Reset() { + *x = ReddotChangePush{} + if protoimpl.UnsafeEnabled { + mi := &file_reddot_reddot_msg_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReddotChangePush) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReddotChangePush) ProtoMessage() {} + +func (x *ReddotChangePush) ProtoReflect() protoreflect.Message { + mi := &file_reddot_reddot_msg_proto_msgTypes[4] + 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 ReddotChangePush.ProtoReflect.Descriptor instead. +func (*ReddotChangePush) Descriptor() ([]byte, []int) { + return file_reddot_reddot_msg_proto_rawDescGZIP(), []int{4} +} + +func (x *ReddotChangePush) GetRids() []int32 { + if x != nil { + return x.Rids + } + return nil +} + var File_reddot_reddot_msg_proto protoreflect.FileDescriptor var file_reddot_reddot_msg_proto_rawDesc = []byte{ @@ -225,8 +273,10 @@ var file_reddot_reddot_msg_proto_rawDesc = []byte{ 0x52, 0x65, 0x64, 0x64, 0x6f, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x26, 0x0a, 0x10, 0x52, 0x65, 0x64, 0x64, 0x6f, + 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x72, + 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x72, 0x69, 0x64, 0x73, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -241,18 +291,19 @@ func file_reddot_reddot_msg_proto_rawDescGZIP() []byte { return file_reddot_reddot_msg_proto_rawDescData } -var file_reddot_reddot_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_reddot_reddot_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_reddot_reddot_msg_proto_goTypes = []interface{}{ (*ReddotGetAllReq)(nil), // 0: ReddotGetAllReq (*ReddotGetAllResp)(nil), // 1: ReddotGetAllResp (*ReddotGetReq)(nil), // 2: ReddotGetReq (*ReddotGetResp)(nil), // 3: ReddotGetResp - nil, // 4: ReddotGetAllResp.ReddotEntry - nil, // 5: ReddotGetResp.ReddotEntry + (*ReddotChangePush)(nil), // 4: ReddotChangePush + nil, // 5: ReddotGetAllResp.ReddotEntry + nil, // 6: ReddotGetResp.ReddotEntry } var file_reddot_reddot_msg_proto_depIdxs = []int32{ - 4, // 0: ReddotGetAllResp.reddot:type_name -> ReddotGetAllResp.ReddotEntry - 5, // 1: ReddotGetResp.reddot:type_name -> ReddotGetResp.ReddotEntry + 5, // 0: ReddotGetAllResp.reddot:type_name -> ReddotGetAllResp.ReddotEntry + 6, // 1: ReddotGetResp.reddot:type_name -> ReddotGetResp.ReddotEntry 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 @@ -314,6 +365,18 @@ func file_reddot_reddot_msg_proto_init() { return nil } } + file_reddot_reddot_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReddotChangePush); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -321,7 +384,7 @@ func file_reddot_reddot_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_reddot_reddot_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 0, },