This commit is contained in:
aozhiwei 2023-09-11 18:43:55 +08:00
parent 729058cb84
commit 3dd89a637c
2 changed files with 17 additions and 8 deletions

View File

@ -1,6 +1,8 @@
package room
import (
"q5"
"f5"
"cs"
"main/common"
"github.com/golang/protobuf/proto"
@ -9,9 +11,16 @@ import (
type member struct {
joinTime int64
state int32
entry q5.ListHead
hum common.Player
}
func (this *member) init(hum common.Player) {
m := new(member)
m.hum = hum
m.joinTime = f5.GetApp().GetNowSeconds()
}
func (this *member) fillMFMember(pb *cs.MFMember) {
pb.AccountId = proto.String(this.hum.GetAccountId())
pb.Name = proto.String(this.hum.GetName())
@ -19,3 +28,9 @@ func (this *member) fillMFMember(pb *cs.MFMember) {
pb.State = proto.Int32(this.state)
pb.Ping = proto.Int32(this.hum.GetPing())
}
func newMember(hum common.Player) *member {
m := new(member)
m.init(hum)
return m
}

View File

@ -22,6 +22,7 @@ type room struct {
entry q5.ListHead
config roomConfg
owner *member
teams map[string][]q5.ListHead
members map[string]*member
}
@ -76,7 +77,7 @@ func (this *room) fillMFRoom(pb *cs.MFRoom) {
}
pb.PlayerNum = proto.Int32(int32(len(this.members)))
pb.PlayerMaxNum = proto.Int32(constant.ROOM_MAX_PLAYER_NUM)
//pb.TeamNum = proto.Int32(40)
pb.TeamNum = proto.Int32(int32(len(this.teams)))
pb.TeamMaxNum = proto.Int32(constant.ROOM_MAX_TEAM_NUM)
pb.Owner = new(cs.MFMember)
this.owner.fillMFMember(pb.Owner)
@ -121,10 +122,3 @@ 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
}