This commit is contained in:
aozhiwei 2023-09-07 12:53:44 +08:00
parent 4235dd3935
commit 33c2d6a622
6 changed files with 24 additions and 23 deletions

View File

@ -2,9 +2,8 @@ package app
import ( import (
"f5" "f5"
"mt"
"q5" "q5"
_ "main/initialize" "mt"
. "main/common" . "main/common"
) )
@ -20,20 +19,9 @@ func (this *app) Init() {
this.netMsgQueue.Init() this.netMsgQueue.Init()
f5.LoadMetaTable(mt.Table) f5.LoadMetaTable(mt.Table)
this.registerDataSources() this.registerDataSources()
//handlerMgr.init()
//playerMgr.init()
//wspListener.init()
//httpListener.init()
//roomMgr.init()
} }
func (this *app) UnInit() { func (this *app) UnInit() {
//roomMgr.unInit()
//httpListener.unInit()
//playerMgr.unInit()
//handlerMgr.unInit()
//wspListener.unInit()
} }
func (this *app) Update() { func (this *app) Update() {

View File

@ -1,14 +1,21 @@
package initialize package initialize
import ( import (
"f5"
"main/global" "main/global"
"main/room" "main/room"
"main/player" "main/player"
"main/listener" "main/listener"
"main/app"
) )
func init() { func Init() {
global.SetRoomMgr(room.GetRoomMgr()) app.GetApp().Init()
listener.GetHandlerMgr().Init()
global.SetPlayerMgr(player.GetPlayerMgr()) global.SetPlayerMgr(player.GetPlayerMgr())
global.SetRoomMgr(room.GetRoomMgr())
global.SetWspListener(listener.GetWspListener()) global.SetWspListener(listener.GetWspListener())
listener.GetHttpListener().Init()
f5.Run(app.GetApp())
} }

View File

@ -3,3 +3,11 @@ package listener
func GetWspListener() *WSPListener { func GetWspListener() *WSPListener {
return nil return nil
} }
func GetHandlerMgr() *HandlerMgr {
return nil
}
func GetHttpListener() *httpListener {
return nil
}

View File

@ -10,7 +10,7 @@ import (
type HandlerMgr struct { type HandlerMgr struct {
} }
func (this *HandlerMgr) init() { func (this *HandlerMgr) Init() {
ss.RegHandlerId(int(ss.SSMessageIdE__SS_Ping), WSP_LISTENER_HANDLER_ID) ss.RegHandlerId(int(ss.SSMessageIdE__SS_Ping), WSP_LISTENER_HANDLER_ID)
ss.RegHandlerId(int(ss.SSMessageIdE__SS_WSP_SocketDisconnect), WSP_LISTENER_HANDLER_ID) ss.RegHandlerId(int(ss.SSMessageIdE__SS_WSP_SocketDisconnect), WSP_LISTENER_HANDLER_ID)
@ -18,5 +18,5 @@ func (this *HandlerMgr) init() {
cs.RegHandlerId(int(cs.CMMessageIdE__CMLogin), PLAYER_MGR_HANDLER_ID) cs.RegHandlerId(int(cs.CMMessageIdE__CMLogin), PLAYER_MGR_HANDLER_ID)
} }
func (this *HandlerMgr) unInit() { func (this *HandlerMgr) UnInit() {
} }

View File

@ -9,11 +9,11 @@ type httpListener struct {
httpServer *f5.HttpServer httpServer *f5.HttpServer
} }
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("imserver.httplistener", 1000 * 10)
this.httpServer.Start(mt.Table.HallCluster.GetHttpListenPort()) this.httpServer.Start(mt.Table.HallCluster.GetHttpListenPort())
} }
func (this *httpListener) unInit() { func (this *httpListener) UnInit() {
} }

View File

@ -1,11 +1,9 @@
package main package main
import ( import (
"f5" "main/initialize"
"main/app"
) )
func main() { func main() {
f5.Run(app.GetApp()) initialize.Init()
} }