Пример #1
0
        /// <summary>
        /// Sends down batches of data to the clients in order to update their screens
        /// </summary>
        private async Task DrawAsync()
        {
            await _space.CheckIncreaseMapSizeAsync(UserHandler.TotalActiveUsers);

            UserHandler.Update();

            var payloads = _payloadManager.GetGamePayloads(UserHandler.GetUsers(), UserHandler.TotalActiveUsers, GameHandler.BulletManager.Bullets.Count, _space);

            foreach (string connectionID in payloads.Keys)
            {
                await UserHandler.GetUser(connectionID).PushToClientAsync(payloads[connectionID], _gameHub);
            }
        }
Пример #2
0
        /// <summary>
        /// Sends down batches of data to the clients in order to update their screens
        /// </summary>
        private void Draw()
        {
            _space.CheckIncreaseMapSize(UserHandler.TotalActiveUsers);
            UserHandler.Update();

            ConcurrentDictionary <string, object[]> payloads = _payloadManager.GetGamePayloads(UserHandler.GetUsers(), UserHandler.TotalActiveUsers, GameHandler.BulletManager.Bullets.Count, _space);
            IHubContext context = GetContext();

            foreach (string connectionID in payloads.Keys)
            {
                UserHandler.GetUser(connectionID).PushToClient(payloads[connectionID], context);
            }
        }