示例#1
0
    public void Run()
    {
        while (true)
        {
            try
            {
                _webSocketCore.GetNewConnections();

                _connectionService.HandleDeadPlayers();

                var socketMessages = _webSocketCore.PollMessages();
                var playerMessages = _connectionService.ConvertToMessages(socketMessages);

                _loginSystem.Run(playerMessages);
                _commandSystem.Run(playerMessages);
                _movementSystem.Run(playerMessages);
                _chatSystem.Run(playerMessages);
                _storeSystem.Run(playerMessages);
                _combatSystem.Run(playerMessages);
                _inventorySystem.Run(playerMessages);

                _locationSender.Execute();
                _chatSender.Execute();
                _joinSender.Execute();


                Thread.Sleep(1);
            }
            catch (Exception e)
            {
                Console.WriteLine("===== EXCEPTION =====");
                Console.WriteLine(e.ToString());
                Console.WriteLine("=====================");
            }
        }
    }