This commit is contained in:
aozhiwei 2023-09-09 19:16:17 +08:00
parent 4c5220963d
commit b8ecab883e
2 changed files with 19 additions and 1 deletions

View File

@ -19,6 +19,7 @@ type RoomMgr interface {
}
type Player interface {
GetAccountId() string
GetRoom() Room
SendMsg(rspMsg proto.Message)
}

View File

@ -6,14 +6,24 @@ import (
"main/common"
)
type member struct {
joinTime int64
hum common.Player
}
type room struct {
cs.MsgHandlerImpl
roomId int32
owner common.Player
owner *member
members map[string]*member
}
func (this *room) init(roomId int32, owner common.Player) {
this.roomId = roomId
this.owner = newMember(owner)
this.members = map[string]*member{
owner.GetAccountId(): this.owner,
}
}
func (this *room) OnPlayerOffline(hum common.Player) {
@ -67,3 +77,10 @@ func (this *room) CMKickout(hdr *f5.MsgHdr, msg *cs.CMKickout) {
rspMsg := cs.SMkickout{}
hum.SendMsg(&rspMsg)*/
}
func newMember(hum common.Player) *member {
m := new(member)
m.hum = hum
m.joinTime = f5.GetApp().GetNowSeconds()
return m
}