玩家等级变化公告

This commit is contained in:
wh_zcy 2022-11-28 14:50:44 +08:00
parent 91a9c65d03
commit 60d8ec19b2
2 changed files with 12 additions and 1 deletions

View File

@ -192,6 +192,15 @@ func (this *ModelUser) ChangeLevel(event interface{}, next func(event interface{
ul.session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush, ul.session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush,
&pb.UserLvChangedPush{Uid: ul.session.GetUserId(), Exp: ul.exp, Lv: ul.lv}) &pb.UserLvChangedPush{Uid: ul.session.GetUserId(), Exp: ul.exp, Lv: ul.lv})
this.module.DispenseRes(ul.session, rewards, true) this.module.DispenseRes(ul.session, rewards, true)
mc, err := this.module.service.GetModule(comm.ModuleChat)
if err != nil {
return
}
if chat, ok := mc.(comm.IChat); ok {
chat.SendSysChatToUser(ul.session, comm.ChatSystem12, ul.lv, 0, ul.name)
}
} }
} }
@ -202,4 +211,5 @@ type UserListen struct {
session comm.IUserSession session comm.IUserSession
exp int64 exp int64
lv int32 lv int32
name string
} }

View File

@ -246,7 +246,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
userEx *pb.DBUserExpand userEx *pb.DBUserExpand
err error err error
) )
user = this.GetUser(uid) user = this.GetUser(uid)
userEx, err = this.GetUserExpand(uid) userEx, err = this.GetUserExpand(uid)
if err != nil { if err != nil {
@ -409,6 +409,7 @@ func (this *User) EventUserChanged(session comm.IUserSession) {
ul.session = session ul.session = session
ul.exp = user.Exp ul.exp = user.Exp
ul.lv = user.Lv ul.lv = user.Lv
ul.name = user.Name
} }
this.modelUser.EventApp.Dispatch(comm.EventUserChanged, ul) this.modelUser.EventApp.Dispatch(comm.EventUserChanged, ul)
} }