private void EventsOnBodiesBeginCollide(RigidBody body1, RigidBody body2)
        {
            if (body1.Tag != null && body2.Tag != null)
            {
                var node1 = _hierarchy.Lookup(body1.Tag);
                var node2 = _hierarchy.Lookup(body2.Tag);

                if (node1 == null)
                {
                    _consoleHandle.LogWarning("Unable to find hierarchy node for physics rigid body: " + body1.Tag);
                }

                if (node2 == null)
                {
                    _consoleHandle.LogWarning("Unable to find hierarchy node for physics rigid body: " + body2.Tag);
                }

                if (node1 != null && node2 != null)
                {
                    // TODO: This is pretty silly.  It should just be the nodes, not their parents.
                    var parent1 = node1.Parent ?? node1;
                    var parent2 = node2.Parent ?? node2;

                    var owner1 = parent1.UntypedValue;
                    var owner2 = parent2.UntypedValue;

                    var @event = new PhysicsCollisionBeginEvent(_gameContext, _serverContext, _updateContext, body1,
                                                                body2, owner1, owner2);

                    _physicsEventEngine.Fire(_physicsEventContext, @event);
                }
            }
        }
Beispiel #2
0
        private void FlushLogs()
        {
            var logs = _logShipping.GetAndFlushLogs();

            foreach (var l in logs)
            {
                switch (l.LogLevel)
                {
                case ConsoleLogLevel.Debug:
                    _consoleHandle.LogDebug(l.Message);
                    break;

                case ConsoleLogLevel.Info:
                    _consoleHandle.LogInfo(l.Message);
                    break;

                case ConsoleLogLevel.Warning:
                    _consoleHandle.LogWarning(l.Message);
                    break;

                case ConsoleLogLevel.Error:
                    _consoleHandle.LogError(l.Message);
                    break;
                }
            }
        }
Beispiel #3
0
        public void Render(IGameContext gameContext, IRenderContext renderContext)
        {
#if PLATFORM_WINDOWS
            Microsoft.Xna.Framework.Graphics.GraphicsDebugMessage message;

            if (renderContext.GraphicsDevice.GraphicsDebug != null)
            {
                while (renderContext.GraphicsDevice.GraphicsDebug.TryDequeueMessage(out message))
                {
                    switch (message.Severity)
                    {
                    case "Corruption":
                    case "Error":
                        _consoleHandle.LogError("DX11 ({0}) ({1}, {2}): {3}", message.Severity, message.Category, message.IdName, message.Message);
                        break;

                    case "Warning":
                        _consoleHandle.LogWarning("DX11 ({0}) ({1}, {2}): {3}", message.Severity, message.Category, message.IdName, message.Message);
                        break;

                    case "Information":
                        _consoleHandle.LogDebug("DX11 ({0}) ({1}, {2}): {3}", message.Severity, message.Category, message.IdName, message.Message);
                        break;
                    }
                }
            }
#endif
        }
 public override Task<LogResponse> LogWarn(LogRequest request, ServerCallContext context)
 {
     return Task.Run(() =>
     {
         _consoleHandle.LogWarning(request.Message);
         return Task.FromResult(_logResponse);
     });
 }
 public void QueueEvent(Event @event)
 {
     if (_gameHostClient != null)
     {
         try
         {
             using (var memory = new MemoryStream())
             {
                 _formatter.Serialize(memory, @event);
                 var bytes = new byte[memory.Position];
                 memory.Seek(0, SeekOrigin.Begin);
                 memory.Read(bytes, 0, bytes.Length);
                 _gameHostClient.QueueSerializedEvent(new QueueSerializedEventRequest
                 {
                     SerializedEvent = ByteString.CopyFrom(bytes)
                 });
             }
         }
         catch (Exception ex)
         {
             _consoleHandle.LogWarning(ex.Message + Environment.NewLine + ex.StackTrace);
         }
     }
 }
        private void StartProtobuild(string args, Action callback)
        {
            var processStartInfo = new ProcessStartInfo
            {
                FileName               = Path.Combine(_project.ProjectPath.FullName, "Protobuild.exe"),
                Arguments              = args,
                WorkingDirectory       = _project.ProjectPath.FullName,
                UseShellExecute        = false,
                CreateNoWindow         = true,
                RedirectStandardOutput = true,
                RedirectStandardError  = true
            };

            try
            {
                _process         = Process.Start(processStartInfo);
                _process.Exited += (sender, e) =>
                {
                    _process = null;
                    callback?.Invoke();
                };
                _process.EnableRaisingEvents = true;
                _process.OutputDataReceived += (sender, e) =>
                {
                    _consoleHandle.LogDebug(e.Data);
                };
                _process.ErrorDataReceived += (sender, e) =>
                {
                    _consoleHandle.LogWarning(e.Data);
                };
                _process.BeginOutputReadLine();
                _process.BeginErrorReadLine();
                if (_process.HasExited)
                {
                    _process = null;
                }
            }
            catch (Exception ex)
            {
                _process = null;
                throw;
            }
        }
 public void LogWarning(string messageFormat)
 {
     _realImpl.LogWarning(messageFormat);
 }
Beispiel #8
0
 public void Warning(string message)
 {
     _consoleHandle.LogWarning(message);
 }
 public void LogWarning(string messageFormat)
 {
     _consoleHandle.LogWarning(messageFormat);
 }