1
This commit is contained in:
parent
17dbe4c8b7
commit
0810c0847c
@ -20,6 +20,7 @@ type RoomMgr interface {
|
|||||||
|
|
||||||
type Player interface {
|
type Player interface {
|
||||||
GetRoom() Room
|
GetRoom() Room
|
||||||
|
SendMsg(rspMsg proto.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlayerMgr interface {
|
type PlayerMgr interface {
|
||||||
|
@ -12,29 +12,53 @@ type room struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) OnPlayerOffline(hum common.Player) {
|
func (this *room) OnPlayerOffline(hum common.Player) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) CMRoomList(hdr *f5.MsgHdr, msg *cs.CMRoomList) {
|
func (this *room) CMRoomList(hdr *f5.MsgHdr, msg *cs.CMRoomList) {
|
||||||
|
hum := hdr.Context.(common.Player)
|
||||||
|
rspMsg := cs.SMRoomList{}
|
||||||
|
hum.SendMsg(&rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) CMJoinRoom(hdr *f5.MsgHdr, msg *cs.CMJoinRoom) {
|
func (this *room) CMJoinRoom(hdr *f5.MsgHdr, msg *cs.CMJoinRoom) {
|
||||||
|
hum := hdr.Context.(common.Player)
|
||||||
|
rspMsg := cs.SMJoinRoom{}
|
||||||
|
hum.SendMsg(&rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) CMDisbandRoom(hdr *f5.MsgHdr, msg *cs.CMDisbandRoom) {
|
func (this *room) CMDisbandRoom(hdr *f5.MsgHdr, msg *cs.CMDisbandRoom) {
|
||||||
|
hum := hdr.Context.(common.Player)
|
||||||
|
rspMsg := cs.SMDisbandRoom{}
|
||||||
|
hum.SendMsg(&rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) CMLeaveRoom(hdr *f5.MsgHdr, msg *cs.CMLeaveRoom) {
|
func (this *room) CMLeaveRoom(hdr *f5.MsgHdr, msg *cs.CMLeaveRoom) {
|
||||||
|
hum := hdr.Context.(common.Player)
|
||||||
|
rspMsg := cs.SMLeaveRoom{}
|
||||||
|
hum.SendMsg(&rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) CMModifyRoom(hdr *f5.MsgHdr, msg *cs.CMModifyRoom) {
|
func (this *room) CMModifyRoom(hdr *f5.MsgHdr, msg *cs.CMModifyRoom) {
|
||||||
|
hum := hdr.Context.(common.Player)
|
||||||
|
rspMsg := cs.SMModifyRoom{}
|
||||||
|
hum.SendMsg(&rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
|
func (this *room) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
|
||||||
|
hum := hdr.Context.(common.Player)
|
||||||
|
rspMsg := cs.SMStartGame{}
|
||||||
|
hum.SendMsg(&rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) CMSetPrepare(hdr *f5.MsgHdr, msg *cs.CMSetPrepare) {
|
func (this *room) CMSetPrepare(hdr *f5.MsgHdr, msg *cs.CMSetPrepare) {
|
||||||
|
/*hum := hdr.Context.(common.Player)
|
||||||
|
rspMsg := cs.SMSetPrepare{}
|
||||||
|
hum.SendMsg(&rspMsg)*/
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) CMKickout(hdr *f5.MsgHdr, msg *cs.CMKickout) {
|
func (this *room) CMKickout(hdr *f5.MsgHdr, msg *cs.CMKickout) {
|
||||||
|
/*
|
||||||
|
hum := hdr.Context.(common.Player)
|
||||||
|
rspMsg := cs.SMkickout{}
|
||||||
|
hum.SendMsg(&rspMsg)*/
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"cs"
|
"cs"
|
||||||
"f5"
|
"f5"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
|
"main/common"
|
||||||
. "main/global"
|
. "main/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,7 +25,10 @@ func (this *roomMgr) UnInit() {
|
|||||||
func (this *roomMgr) ProcessCMMsg(handler *cs.CsNetMsgHandler, hdr *f5.MsgHdr) {
|
func (this *roomMgr) ProcessCMMsg(handler *cs.CsNetMsgHandler, hdr *f5.MsgHdr) {
|
||||||
switch handler.HandlerId {
|
switch handler.HandlerId {
|
||||||
case constant.ROOM_MGR_HANDLER_ID:
|
case constant.ROOM_MGR_HANDLER_ID:
|
||||||
cs.DispatchMsg(handler, hdr, this)
|
hum := GetPlayerMgr().GetPlayerBySocket(hdr.GetSocket())
|
||||||
|
if hum != nil {
|
||||||
|
cs.DispatchMsg(handler, hdr, this)
|
||||||
|
}
|
||||||
case constant.ROOM_HANDLER_ID:
|
case constant.ROOM_HANDLER_ID:
|
||||||
hum := GetPlayerMgr().GetPlayerBySocket(hdr.GetSocket())
|
hum := GetPlayerMgr().GetPlayerBySocket(hdr.GetSocket())
|
||||||
if hum != nil && hum.GetRoom() != nil {
|
if hum != nil && hum.GetRoom() != nil {
|
||||||
@ -35,4 +39,7 @@ func (this *roomMgr) ProcessCMMsg(handler *cs.CsNetMsgHandler, hdr *f5.MsgHdr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *roomMgr) CMCreateRoom(hdr *f5.MsgHdr, msg *cs.CMCreateRoom) {
|
func (this *roomMgr) CMCreateRoom(hdr *f5.MsgHdr, msg *cs.CMCreateRoom) {
|
||||||
|
hum := hdr.Context.(common.Player)
|
||||||
|
rspMsg := cs.SMCreateRoom{}
|
||||||
|
hum.SendMsg(&rspMsg)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user