1
This commit is contained in:
parent
f948ec0697
commit
17dbe4c8b7
@ -19,6 +19,7 @@ type RoomMgr interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Player interface {
|
type Player interface {
|
||||||
|
GetRoom() Room
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlayerMgr interface {
|
type PlayerMgr interface {
|
||||||
|
@ -40,30 +40,3 @@ func (this *player) onOffline(){
|
|||||||
this.room.OnPlayerOffline(this)
|
this.room.OnPlayerOffline(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) CMCreateRoom(hdr *f5.MsgHdr, msg *cs.CMCreateRoom) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *player) CMRoomList(hdr *f5.MsgHdr, msg *cs.CMRoomList) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *player) CMJoinRoom(hdr *f5.MsgHdr, msg *cs.CMJoinRoom) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *player) CMDisbandRoom(hdr *f5.MsgHdr, msg *cs.CMDisbandRoom) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *player) CMLeaveRoom(hdr *f5.MsgHdr, msg *cs.CMLeaveRoom) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *player) CMModifyRoom(hdr *f5.MsgHdr, msg *cs.CMModifyRoom) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *player) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *player) CMSetPrepare(hdr *f5.MsgHdr, msg *cs.CMSetPrepare) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *player) CMKickout(hdr *f5.MsgHdr, msg *cs.CMKickout) {
|
|
||||||
}
|
|
||||||
|
@ -2,9 +2,39 @@ package room
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"cs"
|
"cs"
|
||||||
|
"f5"
|
||||||
|
"main/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Room struct {
|
type room struct {
|
||||||
cs.MsgHandlerImpl
|
cs.MsgHandlerImpl
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *room) OnPlayerOffline(hum common.Player) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *room) CMRoomList(hdr *f5.MsgHdr, msg *cs.CMRoomList) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *room) CMJoinRoom(hdr *f5.MsgHdr, msg *cs.CMJoinRoom) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *room) CMDisbandRoom(hdr *f5.MsgHdr, msg *cs.CMDisbandRoom) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *room) CMLeaveRoom(hdr *f5.MsgHdr, msg *cs.CMLeaveRoom) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *room) CMModifyRoom(hdr *f5.MsgHdr, msg *cs.CMModifyRoom) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *room) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *room) CMSetPrepare(hdr *f5.MsgHdr, msg *cs.CMSetPrepare) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *room) CMKickout(hdr *f5.MsgHdr, msg *cs.CMKickout) {
|
||||||
|
}
|
||||||
|
@ -10,11 +10,11 @@ import (
|
|||||||
type roomMgr struct {
|
type roomMgr struct {
|
||||||
cs.MsgHandlerImpl
|
cs.MsgHandlerImpl
|
||||||
currRoomId int32
|
currRoomId int32
|
||||||
idHash map[int32]*Room
|
idHash map[int32]*room
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *roomMgr) Init() {
|
func (this *roomMgr) Init() {
|
||||||
this.idHash = make(map[int32]*Room)
|
this.idHash = make(map[int32]*room)
|
||||||
this.currRoomId = 10000
|
this.currRoomId = 10000
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,11 +23,16 @@ 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.PLAYER_MGR_HANDLER_ID:
|
case constant.ROOM_MGR_HANDLER_ID:
|
||||||
cs.DispatchMsg(handler, hdr, this)
|
cs.DispatchMsg(handler, hdr, this)
|
||||||
case constant.PLAYER_HANDLER_ID:
|
case constant.ROOM_HANDLER_ID:
|
||||||
player := GetPlayerMgr().GetPlayerBySocket(hdr.GetSocket())
|
hum := GetPlayerMgr().GetPlayerBySocket(hdr.GetSocket())
|
||||||
if player != nil {
|
if hum != nil && hum.GetRoom() != nil {
|
||||||
|
hdr.Context = hum
|
||||||
|
cs.DispatchMsg(handler, hdr, hum.GetRoom().(*room))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *roomMgr) CMCreateRoom(hdr *f5.MsgHdr, msg *cs.CMCreateRoom) {
|
||||||
|
}
|
||||||
|
2
third_party/f5
vendored
2
third_party/f5
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 35c7b1024790889a4dbc4d98b92e7585b23b291c
|
Subproject commit 4c371afe631d4818ca8b8f6ba36451b334eb498a
|
2
third_party/q5
vendored
2
third_party/q5
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 50a75088aebb09787ee13deb3b6bae6f68c9ab51
|
Subproject commit a28a913a908b850f10791d8b1f8434a1e2cd308b
|
Loading…
x
Reference in New Issue
Block a user