Example #1
0
        private void SendDataToAll()
        {
            // 3 раза в секунду
            if (_sendAllCounter++ != 20)
            {
                return;
            }

            List <Character> list = new List <Character>();

            foreach (var item in _players)
            {
                list.Add(item.Value);
            }

            Packet packet = new Packet
            {
                Type       = MessageType.ALL_PLAYER_STATES,
                Characters = list
            };

            if (list.Count > 0)
            {
                AsyncSocketListener.SendToAll(packet);
            }

            Console.WriteLine("Send");
            _sendAllCounter = 0;
        }
Example #2
0
        private static void Main(string[] args)
        {
            ServerManager serverManager = new ServerManager();

            AsyncSocketListener.StartListening(serverManager);

            serverManager.Run();

            Console.WriteLine("\nPress ENTER to continue...");
            Console.ReadLine();
        }