1
This commit is contained in:
parent
8b5932e123
commit
35740b3891
@ -4,7 +4,10 @@ import (
|
|||||||
"f5"
|
"f5"
|
||||||
"q5"
|
"q5"
|
||||||
"mt"
|
"mt"
|
||||||
|
"cs"
|
||||||
|
"ss"
|
||||||
. "main/common"
|
. "main/common"
|
||||||
|
. "main/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
type app struct {
|
type app struct {
|
||||||
@ -35,7 +38,6 @@ func (this *app) UnInit() {
|
|||||||
|
|
||||||
func (this *app) Update() {
|
func (this *app) Update() {
|
||||||
this.netMsgQueue.Fetch()
|
this.netMsgQueue.Fetch()
|
||||||
/*
|
|
||||||
for !this.netMsgQueue.WorkList.Empty() {
|
for !this.netMsgQueue.WorkList.Empty() {
|
||||||
next := this.netMsgQueue.WorkList.Next()
|
next := this.netMsgQueue.WorkList.Next()
|
||||||
hdr, ok := next.GetData().(*f5.MsgHdr)
|
hdr, ok := next.GetData().(*f5.MsgHdr)
|
||||||
@ -45,7 +47,7 @@ func (this *app) Update() {
|
|||||||
if handler != nil {
|
if handler != nil {
|
||||||
switch handler.HandlerId {
|
switch handler.HandlerId {
|
||||||
case WSP_LISTENER_HANDLER_ID:
|
case WSP_LISTENER_HANDLER_ID:
|
||||||
ss.DispatchMsg(handler, hdr, wspListener)
|
GetWspListener().ProcessSSMMsg(handler, hdr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -53,18 +55,14 @@ func (this *app) Update() {
|
|||||||
if handler != nil {
|
if handler != nil {
|
||||||
switch handler.HandlerId {
|
switch handler.HandlerId {
|
||||||
case PLAYER_MGR_HANDLER_ID:
|
case PLAYER_MGR_HANDLER_ID:
|
||||||
cs.DispatchMsg(handler, hdr, playerMgr)
|
|
||||||
case PLAYER_HANDLER_ID:
|
case PLAYER_HANDLER_ID:
|
||||||
player := playerMgr.getPlayerBySocket(hdr.GetSocket())
|
GetPlayerMgr().ProcessCMMsg(handler, hdr)
|
||||||
if player != nil {
|
|
||||||
cs.DispatchMsg(handler, hdr, player)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next.Del()
|
next.Del()
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) addNetMsg(hdr *f5.MsgHdr) {
|
func (this *app) addNetMsg(hdr *f5.MsgHdr) {
|
||||||
|
@ -3,6 +3,10 @@ package common
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
"cs"
|
||||||
|
"ss"
|
||||||
|
"f5"
|
||||||
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,11 +23,16 @@ type RoomMgr interface {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlayerMgr interface {
|
type Player interface {
|
||||||
|
}
|
||||||
|
|
||||||
|
type PlayerMgr interface {
|
||||||
|
ProcessCMMsg(*cs.CsNetMsgHandler, *f5.MsgHdr)
|
||||||
}
|
}
|
||||||
|
|
||||||
type WspListener interface {
|
type WspListener interface {
|
||||||
|
ss.MsgHandler
|
||||||
|
ProcessSSMMsg(*ss.SsNetMsgHandler, *f5.MsgHdr)
|
||||||
SendProxyMsg(net.Conn, uint16, proto.Message);
|
SendProxyMsg(net.Conn, uint16, proto.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,3 +169,7 @@ func (this *WSPListener) SendProxyMsg(conn net.Conn, socketHandle uint16, msg pr
|
|||||||
copy(buff[f5.WSPROXYPACKHEAD_S_SIZE:], msgData[:])
|
copy(buff[f5.WSPROXYPACKHEAD_S_SIZE:], msgData[:])
|
||||||
conn.Write(buff)
|
conn.Write(buff)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this* WSPListener) ProcessSSMMsg(handler *ss.SsNetMsgHandler, hdr *f5.MsgHdr) {
|
||||||
|
ss.DispatchMsg(handler, hdr, this)
|
||||||
|
}
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"cs"
|
"cs"
|
||||||
"f5"
|
"f5"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
. "main/common"
|
"main/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Player struct {
|
type Player struct {
|
||||||
@ -12,7 +12,7 @@ type Player struct {
|
|||||||
socket f5.WspCliConn
|
socket f5.WspCliConn
|
||||||
accountId string
|
accountId string
|
||||||
sessionId string
|
sessionId string
|
||||||
room *Room
|
room *common.Room
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Player) GetAccountId() string {
|
func (this *Player) GetAccountId() string {
|
||||||
@ -23,6 +23,6 @@ func (this *Player) SendMsg(rspMsg proto.Message) {
|
|||||||
//wspListener.sendProxyMsg(this.socket.Conn, this.socket.SocketHandle, rspMsg)
|
//wspListener.sendProxyMsg(this.socket.Conn, this.socket.SocketHandle, rspMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Player) GetRoom() *Room {
|
func (this *Player) GetRoom() *common.Room {
|
||||||
return this.room
|
return this.room
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"mt"
|
"mt"
|
||||||
"q5"
|
"q5"
|
||||||
|
"main/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type playerMgr struct {
|
type playerMgr struct {
|
||||||
@ -136,3 +137,15 @@ func (this *playerMgr) getPlayerBySocket(socket f5.WspCliConn) *Player {
|
|||||||
func (this *playerMgr) addSocketHash(wsp f5.WspCliConn, p *Player) {
|
func (this *playerMgr) addSocketHash(wsp f5.WspCliConn, p *Player) {
|
||||||
this.socketHash[wsp] = p
|
this.socketHash[wsp] = p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this* playerMgr) ProcessCMMsg(handler *cs.CsNetMsgHandler, hdr *f5.MsgHdr) {
|
||||||
|
switch handler.HandlerId {
|
||||||
|
case common.PLAYER_MGR_HANDLER_ID:
|
||||||
|
cs.DispatchMsg(handler, hdr, this)
|
||||||
|
case common.PLAYER_HANDLER_ID:
|
||||||
|
player := this.getPlayerBySocket(hdr.GetSocket())
|
||||||
|
if player != nil {
|
||||||
|
cs.DispatchMsg(handler, hdr, player)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user