三消邀请

This commit is contained in:
meixiongfeng 2023-11-30 10:00:06 +08:00
parent 981fdabdfe
commit c6141da5a0
4 changed files with 25 additions and 9 deletions

View File

@ -687,6 +687,12 @@ type (
IEntertainment interface {
// 添加三消卡片资源
AddXxlCard(session IUserSession, cards map[string]int32, bPush bool) (errdata *pb.ErrorData)
CreateRoom(sessions []IUserSession, rulesStr string) (roomid string, err error)
//用户离线
UserOffline(roomid string, uid string) (err error)
//主动认输
AdmitDefeat(roomid string, uid string) (err error)
}
IMoonlv interface {
IBuriedUpdateNotify
@ -703,12 +709,4 @@ type (
IIsland interface {
IPayDelivery
}
IMentertainment interface { // 三消
CreateRoom(sessions []IUserSession, rulesStr string) (roomid string, err error)
//用户离线
UserOffline(roomid string, uid string) (err error)
//主动认输
AdmitDefeat(roomid string, uid string) (err error)
}
)

View File

@ -152,7 +152,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.GameInviteAcceptR
}
break
case 5: // 三消类型
if roomid, err = this.module.catchBugs.CreateRoom(sessions, req.Rules); err != nil {
if roomid, err = this.module.entertain.CreateRoom(sessions, req.Rules); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),

View File

@ -56,6 +56,16 @@ func (this *apiComp) AdmitDefeat(session comm.IUserSession, req *pb.GameInviteAd
return
}
break
case 5:
if err = this.module.entertain.AdmitDefeat(req.Roomid, session.GetUserId()); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
}
break
}
session.SendMsg(string(this.module.GetType()), "admitdefeat", &pb.GameInviteAdmitDefeatResp{})
return

View File

@ -19,6 +19,7 @@ type GameInvite struct {
dcolor comm.IDColor
caninerabbit comm.ICanineRabbit
catchBugs comm.ICatchBugs
entertain comm.IEntertainment
}
func NewModule() core.IModule {
@ -63,6 +64,11 @@ func (this *GameInvite) Start() (err error) {
return
}
this.catchBugs = module.(comm.ICatchBugs)
if module, err = this.service.GetModule(comm.ModuleEntertainment); err != nil {
return
}
this.entertain = module.(comm.IEntertainment)
this.service.RegisterFunctionName(string(comm.RPC_GameinviteOffline), this.trusteeship)
event.RegisterGO(comm.EventUserOffline, this.Useroffline)
return
@ -108,6 +114,8 @@ func (this *GameInvite) trusteeship(ctx context.Context, req *pb.RPC_GameInviteO
err = this.caninerabbit.UserOffline(req.Roomid, req.Offuid)
case 3:
err = this.dcolor.UserOffline(req.Roomid, req.Offuid)
// case 5: // 暂不监听
// err = this.entertain.UserOffline(req.Roomid, req.Offuid)
}
return
}