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