Ejemplo n.º 1
0
        bool IsInputtedExitKey()
        {
            if (!Console.KeyAvailable)
            {
                return(false);
            }

            switch (Console.ReadKey(true).Key)
            {
            default:
                Console.WriteLine("Enter " + EXIT_KEY + " to exit the game.");
                return(false);

            case EXIT_KEY:
                WebSocketServer.Stop();
                Console.WriteLine("Game Server terminated.");
                return(true);
            }
        }
Ejemplo n.º 2
0
        public void RunForever()
        {
            ws.Start();
            Console.WriteLine("Game Server started.");

            try
            {
                while (true)
                {
                    PollKey();
                    UpdateActions();
                    Sync();
                }
            }
            catch (GameExit ex)
            {
            }
            catch (Exception ex)
            {
            }

            ws.Stop();
            Console.WriteLine("Game Server terminated.");
        }