Example #1
0
    static void Main(string[] args)
    {
        Logger.Init();
        Logger.Info("game service start...");
        string confPath = System.AppDomain.CurrentDomain.BaseDirectory;

        string confFile = System.IO.Path.Combine(confPath, "conf/gs.json");

        GameServer gameServer = new GameServer();

        gameServer.Init(confFile);
        RoomManager  roomManager = new RoomManager(confFile);
        FightHandler fight       = new FightHandler(gameServer, roomManager);

        //var confData = JsonUtils.DecodeCps(confFile);
        //fight.CreateRoom(new Stream.CreateRoom() { GameID = confData.RegConf.GameID, SvcName = confData.RegConf.SvcName, PodName = confData.RegConf.PodName, RoomInfo = new Stream.RoomInfo() {

        //}, Ttl = 86400, WatchSetting = new WatchSetting() { } });
        gameServer.Bind(fight);

        int pid = System.Diagnostics.Process.GetCurrentProcess().Id;

        File.WriteAllText(System.IO.Path.Combine(confPath, "gameServer.dll_pid"), pid.ToString());

        Logger.Info("game service run...");
        gameServer.Run();
        gameServer.WaitOver();
        Logger.Info("game service over...");
    }
Example #2
0
    static void Main(string[] args)
    {
        Logger.Init();
        Logger.Info("game service start...");

        string confPath = System.AppDomain.CurrentDomain.BaseDirectory;
        string confFile = System.IO.Path.Combine(confPath, "conf/gs.json");

        GameServer gameServer = new GameServer();

        gameServer.Init(confFile);
        RoomManager  roomManager = new RoomManager(confFile);
        Metrics      metrics     = new Metrics(confFile);
        FightHandler fight       = new FightHandler(gameServer, roomManager, metrics);

        gameServer.Bind(fight, metrics);

        int pid = System.Diagnostics.Process.GetCurrentProcess().Id;

        File.WriteAllText(System.IO.Path.Combine(confPath, "gameServer.dll_pid"), pid.ToString());

        Logger.Info("game service run...");
        gameServer.Run();
        gameServer.WaitOver();
        Logger.Info("game service over...");
    }