1
This commit is contained in:
parent
f7df50f3ab
commit
bf985f9c81
@ -145,6 +145,27 @@ func (this *room) fillMFRoom(pb *cs.MFRoom) {
|
|||||||
this.owner.fillMFMember(pb.Owner)
|
this.owner.fillMFMember(pb.Owner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *room) fillMFCurrentRoom(pb *cs.MFCurrentRoom) {
|
||||||
|
pb.RoomId = proto.String(this.roomId)
|
||||||
|
pb.MapId = proto.Int32(this.config.mapId)
|
||||||
|
pb.ZoneId = proto.Int32(this.config.zoneId)
|
||||||
|
if this.config.passwd != "" {
|
||||||
|
pb.HasPasswd = proto.Int32(1)
|
||||||
|
}
|
||||||
|
pb.PlayerNum = proto.Int32(int32(len(this.members)))
|
||||||
|
pb.PlayerMaxNum = proto.Int32(constant.ROOM_MAX_PLAYER_NUM)
|
||||||
|
pb.TeamNum = proto.Int32(int32(len(this.teamUuidHash)))
|
||||||
|
pb.TeamMaxNum = proto.Int32(constant.ROOM_MAX_TEAM_NUM)
|
||||||
|
pb.Owner = new(cs.MFMember)
|
||||||
|
this.owner.fillMFMember(pb.Owner)
|
||||||
|
q5.NewSlice(&pb.TeamList, 0, 10)
|
||||||
|
for _, t := range(this.teamUuidHash) {
|
||||||
|
pbT := &cs.MFTeam{}
|
||||||
|
t.fillMFTeam(pbT)
|
||||||
|
q5.AppendSlice(&pb.TeamList, pbT)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (this *room) OnPlayerOffline(hum common.Player) {
|
func (this *room) OnPlayerOffline(hum common.Player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,10 @@ func (this *roomMgr) CMGetCurrentRoom(hdr *f5.MsgHdr, msg *cs.CMGetCurrentRoom)
|
|||||||
hum := hdr.Context.(common.Player)
|
hum := hdr.Context.(common.Player)
|
||||||
rspMsg := &cs.SMGetCurrentRoom{}
|
rspMsg := &cs.SMGetCurrentRoom{}
|
||||||
if hum.GetRoom() != nil && hum.GetRoom().GetRoomState() == ROOM_INIT_STATE {
|
if hum.GetRoom() != nil && hum.GetRoom().GetRoomState() == ROOM_INIT_STATE {
|
||||||
|
hum.SendMsg(rspMsg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
rspMsg.Room = new(cs.MFCurrentRoom)
|
||||||
|
hum.GetRoom().(*room).fillMFCurrentRoom(rspMsg.Room)
|
||||||
hum.SendMsg(rspMsg)
|
hum.SendMsg(rspMsg)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package room
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"q5"
|
"q5"
|
||||||
|
"cs"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type team struct {
|
type team struct {
|
||||||
@ -28,6 +30,20 @@ func (this *team) unInit() {
|
|||||||
this.room = nil
|
this.room = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *team) fillMFTeam(pb *cs.MFTeam) {
|
||||||
|
pb.TeamId = proto.Int32(this.teamId)
|
||||||
|
pb.TeamUuid = proto.String(this.teamUuid)
|
||||||
|
q5.NewSlice(&pb.Members, 0, 4)
|
||||||
|
this.members.ForEach(
|
||||||
|
func (data interface{}) bool {
|
||||||
|
m := data.(*member)
|
||||||
|
pbM := &cs.MFMember{}
|
||||||
|
m.fillMFMember(pbM)
|
||||||
|
q5.AppendSlice(&pb.Members, pbM)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (this *team) addMember(m *member) {
|
func (this *team) addMember(m *member) {
|
||||||
m.team = this
|
m.team = this
|
||||||
this.members.AddTail(&m.teamEntry)
|
this.members.AddTail(&m.teamEntry)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user