40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"mongo.games.com/goserver/core"
|
|
"mongo.games.com/goserver/core/module"
|
|
|
|
_ "mongo.games.com/game"
|
|
"mongo.games.com/game/common"
|
|
"mongo.games.com/game/model"
|
|
"mongo.games.com/game/robot/base"
|
|
_ "mongo.games.com/game/robot/base"
|
|
_ "mongo.games.com/game/robot/chess"
|
|
_ "mongo.games.com/game/robot/thirteen"
|
|
_ "mongo.games.com/game/robot/tienlen"
|
|
_ "mongo.games.com/game/srvdata"
|
|
)
|
|
|
|
func main() {
|
|
// 自定义配置文件
|
|
model.InitGameParam()
|
|
// package模块
|
|
defer core.ClosePackages()
|
|
core.LoadPackages("config.json")
|
|
// core hook
|
|
core.RegisteHook(core.HOOK_BEFORE_START, func() error {
|
|
model.StartupRPClient(common.CustomConfig.GetString("MgoRpcCliNet"), common.CustomConfig.GetString("MgoRpcCliAddr"), time.Duration(common.CustomConfig.GetInt("MgoRpcCliReconnInterV"))*time.Second)
|
|
base.InitAccountData()
|
|
return nil
|
|
})
|
|
core.RegisteHook(core.HOOK_AFTER_STOP, func() error {
|
|
model.ShutdownRPClient()
|
|
return nil
|
|
})
|
|
// module模块
|
|
waiter := module.Start()
|
|
waiter.Wait("main()")
|
|
}
|