三消邀请
This commit is contained in:
parent
981fdabdfe
commit
c6141da5a0
@ -687,6 +687,12 @@ type (
|
|||||||
IEntertainment interface {
|
IEntertainment interface {
|
||||||
// 添加三消卡片资源
|
// 添加三消卡片资源
|
||||||
AddXxlCard(session IUserSession, cards map[string]int32, bPush bool) (errdata *pb.ErrorData)
|
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 {
|
IMoonlv interface {
|
||||||
IBuriedUpdateNotify
|
IBuriedUpdateNotify
|
||||||
@ -703,12 +709,4 @@ type (
|
|||||||
IIsland interface {
|
IIsland interface {
|
||||||
IPayDelivery
|
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)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
@ -152,7 +152,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.GameInviteAcceptR
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 5: // 三消类型
|
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{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
@ -56,6 +56,16 @@ func (this *apiComp) AdmitDefeat(session comm.IUserSession, req *pb.GameInviteAd
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
break
|
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{})
|
session.SendMsg(string(this.module.GetType()), "admitdefeat", &pb.GameInviteAdmitDefeatResp{})
|
||||||
return
|
return
|
||||||
|
@ -19,6 +19,7 @@ type GameInvite struct {
|
|||||||
dcolor comm.IDColor
|
dcolor comm.IDColor
|
||||||
caninerabbit comm.ICanineRabbit
|
caninerabbit comm.ICanineRabbit
|
||||||
catchBugs comm.ICatchBugs
|
catchBugs comm.ICatchBugs
|
||||||
|
entertain comm.IEntertainment
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewModule() core.IModule {
|
func NewModule() core.IModule {
|
||||||
@ -63,6 +64,11 @@ func (this *GameInvite) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.catchBugs = module.(comm.ICatchBugs)
|
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)
|
this.service.RegisterFunctionName(string(comm.RPC_GameinviteOffline), this.trusteeship)
|
||||||
event.RegisterGO(comm.EventUserOffline, this.Useroffline)
|
event.RegisterGO(comm.EventUserOffline, this.Useroffline)
|
||||||
return
|
return
|
||||||
@ -108,6 +114,8 @@ func (this *GameInvite) trusteeship(ctx context.Context, req *pb.RPC_GameInviteO
|
|||||||
err = this.caninerabbit.UserOffline(req.Roomid, req.Offuid)
|
err = this.caninerabbit.UserOffline(req.Roomid, req.Offuid)
|
||||||
case 3:
|
case 3:
|
||||||
err = this.dcolor.UserOffline(req.Roomid, req.Offuid)
|
err = this.dcolor.UserOffline(req.Roomid, req.Offuid)
|
||||||
|
// case 5: // 暂不监听
|
||||||
|
// err = this.entertain.UserOffline(req.Roomid, req.Offuid)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user