Ejemplo n.º 1
0
 public static void Start(int port)
 {
     LemonServer = new LemonServer();
     LemonServer.Start(port, new JsonSerialize());
     LemonServer.GetServer().SetOnConnectEvent(s =>
     {
         LogHelper.Log("游戏有个连接连接上来了");
     });
     LemonServer.GetServer().SetOnDisconnectEvent(s =>
     {
         LogHelper.Log("游戏有个连接断开了 ID:" + s.ConnectID);
     });
     LemonServer.GetServer().SetOnErrorEvent((s, e) =>
     {
         LogHelper.LogError("连接ID:" + s.ConnectID + " 游戏出错了:" + e.Message + " " + e.StackTrace);
     });
     LogHelper.Log("game start port " + port);
 }
Ejemplo n.º 2
0
        public void Start(int port)
        {
            //清除所有的战斗状态
            new BattleService().ClearBattleAllState();
            LogHelper.Log("清除所有的战斗状态完成");
            BattleAIServerManager.Instance.Start();

            Server = new LemonServer();
            Server.Start(port, new JsonSerialize());
            Server.GetServer().SetOnConnectEvent(s =>
            {
                LogHelper.Log("mahjong有个连接连接上来了");
            });
            Server.GetServer().SetOnDisconnectEvent(s =>
            {
                LogHelper.Log("mahjong有个连接断开了 ID:" + s.ConnectID);
            });
            Server.GetServer().SetOnErrorEvent((s, e) =>
            {
                LogHelper.LogError("连接ID:" + s.ConnectID + " mahjong出错了:" + e.Message + " " + e.StackTrace);
            });
            LogHelper.Log("mahjong start port " + port);
        }