コード例 #1
0
        private void LogPlayerEvent(IPlayerEvent playerEvent)
        {
            try
            {
                var playerConfig = _scenario.Configuration.PlayerConfiguration.SingleOrDefault(pc => pc.EntityId == playerEvent.PlayerEntityId);
                if (playerConfig != null)
                {
                    var logEvent = new Engine.Logging.Database.Model.Event()
                    {
                        EventCode        = playerEvent.GetType().Name,
                        EventId          = playerEvent.Sequence,
                        Game             = _game,
                        Tick             = playerEvent.Tick,
                        Data             = ConfigurationSerializer.Serialize(playerEvent),
                        PlayerId         = playerConfig.Id,
                        PlayerExternalId = playerConfig.ExternalId
                    };

                    _context.InstanceEvents.Add(logEvent);
                }
            }
            catch (Exception ex)
            {
                // TODO: log
            }
        }
コード例 #2
0
        private void LogEvent(IEvent @event)
        {
            try
            {
                var logEvent = new Engine.Logging.Database.Model.Event()
                {
                    EventCode = @event.GetType().Name,
                    EventId   = @event.Sequence,
                    Game      = _game,
                    Tick      = @event.Tick,
                    Data      = ConfigurationSerializer.Serialize(@event),
                };

                _context.InstanceEvents.Add(logEvent);
            }
            catch (Exception ex)
            {
                // TODO: log
            }
        }