You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
923 B
Go

package main
import (
"dcg/config"
"dcg/game/live_logic"
"dcg/game/logic"
"dcg/game/manager"
"dcg/game/msg_transfer"
"dcg/game/svc"
"flag"
"git.noahlan.cn/northlan/ngs"
"git.noahlan.cn/northlan/ngs/serialize/protobuf"
"git.noahlan.cn/northlan/ntools-go/logger"
)
var configFile = flag.String("f", "./config.yml", "the config file")
func main() {
flag.Parse()
config.Init(*configFile)
_ = logger.InitLogger(&config.Config.Log.File, &config.Config.Log.Console)
defer logger.Sync()
ctx := svc.NewServiceContext()
manager.Init(ctx)
logic.Init(ctx)
live_logic.InitLiveManager(ctx)
msg_transfer.Init(ctx)
msg_transfer.Run()
opts := make([]ngs.Option, 0)
opts = append(opts, ngs.WithComponents(logic.GameLogic.Services))
opts = append(opts, ngs.WithSerializer(protobuf.NewSerializer()))
if config.Config.Server.Debug {
ngs.WithDebugMode()
}
ngs.Listen(config.Config.Server.Listen, opts...)
}