game_sync/gamesrv/main.go

61 lines
1.8 KiB
Go

package main
import (
"time"
"mongo.games.com/goserver/core"
"mongo.games.com/goserver/core/etcd"
_ "mongo.games.com/goserver/core/i18n"
"mongo.games.com/goserver/core/module"
_ "mongo.games.com/game"
"mongo.games.com/game/common"
_ "mongo.games.com/game/gamesrv/action"
_ "mongo.games.com/game/gamesrv/base"
_ "mongo.games.com/game/gamesrv/transact"
"mongo.games.com/game/model"
"mongo.games.com/game/mq"
_ "mongo.games.com/game/srvdata"
// game
_ "mongo.games.com/game/gamesrv/chess"
_ "mongo.games.com/game/gamesrv/fishing"
_ "mongo.games.com/game/gamesrv/smallrocket"
_ "mongo.games.com/game/gamesrv/thirteen"
_ "mongo.games.com/game/gamesrv/tienlen"
// 拉霸
_ "mongo.games.com/game/gamesrv/avengers"
_ "mongo.games.com/game/gamesrv/caishen"
_ "mongo.games.com/game/gamesrv/easterisland"
_ "mongo.games.com/game/gamesrv/fruits"
_ "mongo.games.com/game/gamesrv/iceage"
_ "mongo.games.com/game/gamesrv/richblessed"
_ "mongo.games.com/game/gamesrv/tamquoc"
)
func main() {
// 自定义配置文件
model.InitGameParam()
model.InitFishingParam()
model.InitNormalParam()
model.InitGMAC()
// package模块
defer core.ClosePackages()
core.LoadPackages("config.json")
// core hook
core.RegisteHook(core.HOOK_BEFORE_START, func() error {
etcd.Start()
model.StartupRPClient(common.CustomConfig.GetString("MgoRpcCliNet"), common.CustomConfig.GetString("MgoRpcCliAddr"), time.Duration(common.CustomConfig.GetInt("MgoRpcCliReconnInterV"))*time.Second)
mq.StartPublisher(common.CustomConfig.GetString("RabbitMQURL"), common.CustomConfig.GetString("RMQExchange"), true, common.CustomConfig.GetInt("RMQPublishBacklog"))
model.InitGameKVData()
return nil
})
core.RegisteHook(core.HOOK_AFTER_STOP, func() error {
return nil
})
// module模块
w := module.Start()
w.Wait("main()")
}