private void OnPlayersEvent(PlayersEvent playersEvent) { var worldSize = playersEvent.WorldSize; var eventType = playersEvent.EventType; lock (_playersUpdateQueue) { foreach (var blob in playersEvent.Blobs) { _playersUpdateQueue.Enqueue(new BlobToUpdate(blob, eventType, worldSize)); } } }
private async Task HandlePlayerInternal(string message) { Console.WriteLine(string.Format("Received Players message = {0}", message)); Match match = PlayerCountRegex.Match(message); if (!match.Success) { Console.WriteLine("Error matching PlayerCountRegex."); return; } string players = match.Groups.GetValueOrDefault("players").Value; var playerCount = int.Parse(players); PlayersEvent?.Invoke(this, playerCount); }