void RegistPacketHandler(LobbyServer serverNetwork)
        {
            CommonPacketHandler.Init(serverNetwork, UserMgr);
            CommonPacketHandler.RegistPacketHandler(PacketHandlerMap);

            LobbyPacketHandler.Init(serverNetwork, UserMgr);
            LobbyPacketHandler.SetLobbyList(LobbyList);
            LobbyPacketHandler.RegistPacketHandler(PacketHandlerMap);
        }
        //TODO MainServer를 인자로 주지말고, func을 인자로 넘겨주는 것이 좋다
        public void CreateAndStart(List <Lobby> lobbyList, LobbyServer mainServer)
        {
            var maxUserCount = LobbyServer.ServerOpt.LobbyMaxCount * LobbyServer.ServerOpt.LobbyMaxUserCount;

            UserMgr.Init(maxUserCount);

            LobbyList = lobbyList;
            var minlobbyNum = LobbyList[0].Number;
            var maxlobbyNum = LobbyList[0].Number + LobbyList.Count() - 1;

            LobbyNumberRange = new Tuple <int, int>(minlobbyNum, maxlobbyNum);

            RegistPacketHandler(mainServer);

            IsThreadRunning = true;
            ProcessThread   = new System.Threading.Thread(this.Process);
            ProcessThread.Start();
        }
        //dotnet LobbyServer.dll --uniqueID 1 --roomMaxCount 16 --roomMaxUserCount 4 --roomStartNumber 1 --maxUserCount 100
        static void Main(string[] args)
        {
            System.AppDomain.CurrentDomain.UnhandledException +=
                new UnhandledExceptionEventHandler(UnhandledException);
            var serverOption = ParseCommandLine(args);

            if (serverOption == null)
            {
                return;
            }


            var serverApp = new LobbyServer();

            serverApp.InitConfig(serverOption);

            serverApp.CreateStartServer();

            LobbyServer.MainLogger.Info("Press q to shut down the server");

            while (true)
            {
                System.Threading.Thread.Sleep(128);

                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.KeyChar == 'q')
                {
                    Console.WriteLine("Server Stop ~~~");
                    serverApp.StopServer();
                    break;
                }
                else
                {
                    Console.WriteLine($"Preessed key:{key.KeyChar}");
                }
            }

            Console.WriteLine("Server Terminate ~~~");
        }
 public void Init(LobbyServer serverNetwork, UserManager userMgr)
 {
     ServerNetwork = serverNetwork;
     UserMgr       = userMgr;
 }