1
This commit is contained in:
commit
effe90537f
@ -1,13 +1,13 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"f5"
|
|
||||||
"q5"
|
|
||||||
"mt"
|
|
||||||
"cs"
|
"cs"
|
||||||
"ss"
|
"f5"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
. "main/global"
|
. "main/global"
|
||||||
|
"mt"
|
||||||
|
"q5"
|
||||||
|
"ss"
|
||||||
)
|
)
|
||||||
|
|
||||||
type app struct {
|
type app struct {
|
||||||
@ -82,3 +82,7 @@ func (this *app) AddNetMsg(hdr *f5.MsgHdr) {
|
|||||||
|
|
||||||
func (this *app) registerDataSources() {
|
func (this *app) registerDataSources() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *app) GetHttpListenPort() int32 {
|
||||||
|
return mt.Table.HallCluster.GetHttpListenPort()
|
||||||
|
}
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
|
|
||||||
"cs"
|
"cs"
|
||||||
"ss"
|
|
||||||
"f5"
|
"f5"
|
||||||
|
"ss"
|
||||||
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
@ -42,11 +42,10 @@ type PlayerMgr interface {
|
|||||||
|
|
||||||
type WspListener interface {
|
type WspListener interface {
|
||||||
ProcessSSMMsg(*ss.SsNetMsgHandler, *f5.MsgHdr)
|
ProcessSSMMsg(*ss.SsNetMsgHandler, *f5.MsgHdr)
|
||||||
SendProxyMsg(net.Conn, uint16, proto.Message);
|
SendProxyMsg(net.Conn, uint16, proto.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
type HttpListener interface {
|
type HttpListener interface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type App interface {
|
type App interface {
|
||||||
|
@ -11,7 +11,7 @@ type httpListener struct {
|
|||||||
|
|
||||||
func (this *httpListener) Init() {
|
func (this *httpListener) Init() {
|
||||||
this.httpServer = new(f5.HttpServer)
|
this.httpServer = new(f5.HttpServer)
|
||||||
this.httpServer.Init("imserver.httplistener", 1000 * 10)
|
this.httpServer.Init("hallserver.httplistener", 1000*10)
|
||||||
this.httpServer.Start(mt.Table.HallCluster.GetHttpListenPort())
|
this.httpServer.Start(mt.Table.HallCluster.GetHttpListenPort())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package room
|
package room
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"q5"
|
|
||||||
"f5"
|
|
||||||
"cs"
|
"cs"
|
||||||
"main/common"
|
"f5"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
"main/common"
|
||||||
|
"q5"
|
||||||
)
|
)
|
||||||
|
|
||||||
type member struct {
|
type member struct {
|
||||||
|
@ -2,12 +2,12 @@ package room
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"cs"
|
"cs"
|
||||||
"q5"
|
|
||||||
"f5"
|
"f5"
|
||||||
"mt"
|
"github.com/golang/protobuf/proto"
|
||||||
"main/common"
|
"main/common"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
"github.com/golang/protobuf/proto"
|
"mt"
|
||||||
|
"q5"
|
||||||
)
|
)
|
||||||
|
|
||||||
type room struct {
|
type room struct {
|
||||||
@ -54,8 +54,8 @@ func (this *room) init(roomId string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) unInit() {
|
func (this *room) unInit() {
|
||||||
for ; len(this.teamUuidHash) > 0; {
|
for len(this.teamUuidHash) > 0 {
|
||||||
for _, t := range(this.teamUuidHash) {
|
for _, t := range this.teamUuidHash {
|
||||||
t.unInit()
|
t.unInit()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ func (this *room) fillMFCurrentRoom(pb *cs.MFCurrentRoom) {
|
|||||||
pb.Owner = new(cs.MFMember)
|
pb.Owner = new(cs.MFMember)
|
||||||
this.owner.fillMFMember(pb.Owner)
|
this.owner.fillMFMember(pb.Owner)
|
||||||
q5.NewSlice(&pb.TeamList, 0, 10)
|
q5.NewSlice(&pb.TeamList, 0, 10)
|
||||||
for _, t := range(this.teamUuidHash) {
|
for _, t := range this.teamUuidHash {
|
||||||
pbT := &cs.MFTeam{}
|
pbT := &cs.MFTeam{}
|
||||||
t.fillMFTeam(pbT)
|
t.fillMFTeam(pbT)
|
||||||
q5.AppendSlice(&pb.TeamList, pbT)
|
q5.AppendSlice(&pb.TeamList, pbT)
|
||||||
@ -296,7 +296,7 @@ func (this *room) CMCloseNotify(hdr *f5.MsgHdr, msg *cs.CMCloseNotify) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) broadcastMsg(msg proto.Message) {
|
func (this *room) broadcastMsg(msg proto.Message) {
|
||||||
for _, m := range(this.members) {
|
for _, m := range this.members {
|
||||||
if m.hum.GetRoom() == this {
|
if m.hum.GetRoom() == this {
|
||||||
m.hum.SendMsg(msg)
|
m.hum.SendMsg(msg)
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ func (this *room) doDisband(reason int32) {
|
|||||||
notifyMsg := &cs.SMRoomDisbandNotify{}
|
notifyMsg := &cs.SMRoomDisbandNotify{}
|
||||||
notifyMsg.RoomId = proto.String(this.roomId)
|
notifyMsg.RoomId = proto.String(this.roomId)
|
||||||
notifyMsg.Reason = proto.Int32(reason)
|
notifyMsg.Reason = proto.Int32(reason)
|
||||||
for _, m := range(this.members) {
|
for _, m := range this.members {
|
||||||
if m.hum.GetRoom() == this {
|
if m.hum.GetRoom() == this {
|
||||||
m.hum.SendMsg(notifyMsg)
|
m.hum.SendMsg(notifyMsg)
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ func (this *room) notifyGameStart() {
|
|||||||
if this.gameStartNotifyMsg == nil {
|
if this.gameStartNotifyMsg == nil {
|
||||||
this.genGameStartNotifyMsg()
|
this.genGameStartNotifyMsg()
|
||||||
}
|
}
|
||||||
for _, m := range(this.members) {
|
for _, m := range this.members {
|
||||||
if m.state == MEMBER_READY_STATE &&
|
if m.state == MEMBER_READY_STATE &&
|
||||||
m.hum.GetRoom() == this &&
|
m.hum.GetRoom() == this &&
|
||||||
!m.closeGameStartNotify {
|
!m.closeGameStartNotify {
|
||||||
@ -372,7 +372,10 @@ func (this *room) notifyGameStart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) genGameStartNotifyMsg() {
|
func (this *room) genGameStartNotifyMsg() {
|
||||||
if this.gameStartNotifyMsg == nil {
|
if this.gameStartNotifyMsg != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.gameStartNotifyMsg = &cs.SMRoomGameStartNotify{}
|
this.gameStartNotifyMsg = &cs.SMRoomGameStartNotify{}
|
||||||
this.gameStartNotifyMsg.ZoneId = proto.Int32(this.config.zoneId)
|
this.gameStartNotifyMsg.ZoneId = proto.Int32(this.config.zoneId)
|
||||||
this.gameStartNotifyMsg.NodeId = proto.Int32(this.config.nodeId)
|
this.gameStartNotifyMsg.NodeId = proto.Int32(this.config.nodeId)
|
||||||
@ -395,7 +398,7 @@ func (this *room) genGameStartNotifyMsg() {
|
|||||||
StartTime: int32(this.startTime),
|
StartTime: int32(this.startTime),
|
||||||
}
|
}
|
||||||
q5.NewSlice(&startInfo.TeamList, 0, 10)
|
q5.NewSlice(&startInfo.TeamList, 0, 10)
|
||||||
for _, t := range(this.teamUuidHash) {
|
for _, t := range this.teamUuidHash {
|
||||||
if t.hasAlreadMember() {
|
if t.hasAlreadMember() {
|
||||||
ele := q5.NewSliceElement(&startInfo.TeamList)
|
ele := q5.NewSliceElement(&startInfo.TeamList)
|
||||||
ele.TeamUuid = t.teamUuid
|
ele.TeamUuid = t.teamUuid
|
||||||
@ -413,11 +416,10 @@ func (this *room) genGameStartNotifyMsg() {
|
|||||||
}
|
}
|
||||||
this.gameStartNotifyMsg.CustomRoomPayload = proto.String(q5.EncodeJson(&startInfo))
|
this.gameStartNotifyMsg.CustomRoomPayload = proto.String(q5.EncodeJson(&startInfo))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func (this *room) canStart() bool {
|
func (this *room) canStart() bool {
|
||||||
alreadyNum := 0
|
alreadyNum := 0
|
||||||
for _, t := range(this.teamUuidHash) {
|
for _, t := range this.teamUuidHash {
|
||||||
if t.hasAlreadMember() {
|
if t.hasAlreadMember() {
|
||||||
alreadyNum++
|
alreadyNum++
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@ package room
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"cs"
|
"cs"
|
||||||
"q5"
|
|
||||||
"f5"
|
"f5"
|
||||||
"main/constant"
|
|
||||||
"main/common"
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
"main/common"
|
||||||
|
"main/constant"
|
||||||
. "main/global"
|
. "main/global"
|
||||||
|
"q5"
|
||||||
)
|
)
|
||||||
|
|
||||||
type roomMgr struct {
|
type roomMgr struct {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package room
|
package room
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"q5"
|
|
||||||
"cs"
|
"cs"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
"q5"
|
||||||
)
|
)
|
||||||
|
|
||||||
type team struct {
|
type team struct {
|
||||||
|
@ -28,11 +28,9 @@ func (this *App) Init() {
|
|||||||
chatMgr.init()
|
chatMgr.init()
|
||||||
cacheMgr.init()
|
cacheMgr.init()
|
||||||
wspListener.init()
|
wspListener.init()
|
||||||
httpListener.init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *App) UnInit() {
|
func (this *App) UnInit() {
|
||||||
httpListener.unInit()
|
|
||||||
playerMgr.unInit()
|
playerMgr.unInit()
|
||||||
handlerMgr.unInit()
|
handlerMgr.unInit()
|
||||||
wspListener.unInit()
|
wspListener.unInit()
|
||||||
@ -110,3 +108,7 @@ func (this *App) registerDataSources() {
|
|||||||
mt.Table.FriendDb.GetById(0).GetDatabase(),
|
mt.Table.FriendDb.GetById(0).GetDatabase(),
|
||||||
30)
|
30)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *App) GetHttpListenPort() int32 {
|
||||||
|
return mt.Table.IMCluster.GetHttpListenPort()
|
||||||
|
}
|
||||||
|
@ -4,7 +4,6 @@ var app = new(App)
|
|||||||
var wspListener = new(WSPListener)
|
var wspListener = new(WSPListener)
|
||||||
var playerMgr = new(PlayerMgr)
|
var playerMgr = new(PlayerMgr)
|
||||||
var handlerMgr = new(HandlerMgr)
|
var handlerMgr = new(HandlerMgr)
|
||||||
var httpListener = new(HttpListener)
|
|
||||||
var friendMgr = new(FriendsMgr)
|
var friendMgr = new(FriendsMgr)
|
||||||
var cacheMgr = new(CacheMgr)
|
var cacheMgr = new(CacheMgr)
|
||||||
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"f5"
|
|
||||||
"mt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type HttpListener struct {
|
|
||||||
httpServer *f5.HttpServer
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *HttpListener) init() {
|
|
||||||
this.httpServer = new (f5.HttpServer)
|
|
||||||
this.httpServer.Init("imserver.httplistener", 1000 * 10)
|
|
||||||
this.httpServer.Start(mt.Table.IMCluster.GetHttpListenPort())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *HttpListener) unInit() {
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user