Esempio n. 1
0
        private Event?Process(CSVCMsg_PacketEntities message)
        {
            log.Debug("svc_PacketEntities is_delta: "
                      + message.is_delta
                      + " baseline: " + message.baseline
                      + " update_baseline: " + message.update_baseline
                      + " delta: " + message.delta_from);

            using (var stream = Bitstream.CreateWith(message.entity_data)) {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                client.Baseline = message.baseline;
                return(Event.BASELINE);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        private Events?Handle(CSVCMsg_PacketEntities message)
        {
            using (var stream = Bitstream.CreateWith(message.entity_data))
            {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                var ack = new CCLCMsg_BaselineAck
                {
                    baseline_nr   = state.Baseline,
                    baseline_tick = (int)state.ServerTick
                };
                var ackMsg = DotaGameConnection.ConvertProtoToMessage(
                    (uint)CLC_Messages.clc_BaselineAck,
                    ack);
                connection.SendReliably(ackMsg);
                return(null);
            }
            return(null);
        }
Esempio n. 3
0
        private Event?Process(CSVCMsg_PacketEntities message)
        {
            log.Debug("svc_PacketEntities is_delta: "
                      + message.is_delta
                      + " baseline: " + message.baseline
                      + " update_baseline: " + message.update_baseline
                      + " delta: " + message.delta_from);

            using (var stream = Bitstream.CreateWith(message.entity_data)) {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                var ack = new CCLCMsg_BaselineAck();
                ack.baseline_nr   = client.Baseline;
                ack.baseline_tick = (int)client.ServerTick;
                var ackMsg = Connection.ConvertProtoToMessage <CCLCMsg_BaselineAck>(
                    (uint)CLC_Messages.clc_BaselineAck,
                    ack);
                connection.SendReliably(ackMsg);
                return(null);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            CameraSystem.Move(-1, 0);

            EntityUpdater.Update(gameTime);

            base.Update(gameTime);
        }
Esempio n. 5
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            Debugger.AddDebug(GameStateManager.CurrentGameState.ToString());

            GameKeybaord.Update(gameTime);

            EntityUpdater.Update(gameTime);

            base.Update(gameTime);
        }
Esempio n. 6
0
        private Events?Handle(CSVCMsg_PacketEntities message)
        {
            using (var stream = Bitstream.CreateWith(message.entity_data))
            {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                state.Baseline = message.baseline;
                return(Events.BASELINE);
            }
            return(null);
        }
Esempio n. 7
0
        private void Update(Simulation sim, string sessionInfo, bool updateSessionInfo)
        {
            ((Telemetry)sim.Telemetry).UpdateTelemetryData(sim.Sdk);

            var trackLength = sim.Session.Track.Length;

            if (updateSessionInfo)
            {
                var root = ParseYaml(sessionInfo);

                foreach (var parser in _parsers)
                {
                    parser.Parse(root, sim);
                }

                if (Math.Abs(trackLength - sim.Session.Track.Length) > 10E-6)
                {
                    lock (sim.SharedCollectionLock)
                    {
                        _sectorParser.Parse(root, sim);
                        sim.TimeDelta = new TimeDelta(sim.Session.Track.Length, 300, 64);
                    }
                }
            }

            if (CurrentTime >= PrevTime)
            {
                CurrentTime = sim.Telemetry.SessionTime;
            }
            else
            {
                PrevTime = 0;
            }

            ((Session.Session)sim.Session).Current = sim.Session.SessionResults.FirstOrDefault(r => r.Id == sim.Telemetry.SessionNum);
            ((CameraManager)sim.CameraManager).SetFollowedEntity(sim.Telemetry.CamCarIdx);
            (sim.CameraManager.FollowedEntity?.Results.CurrentResult as EntitySessionResult)?.AddAirTime(CurrentTime - PrevTime);

            if (CurrentTime <= PrevTime)
            {
                return;
            }

            var result = (SessionResult)sim.Session.Current;

            result.SessionTime = sim.Telemetry.SessionTime;
            if (sim.HideSimUI)
            {
                sim.HideUi();
            }

            _sessionTimeUpdater.Update(result, sim);
            if (sim.Telemetry.SessionTime - sim.Telemetry.ReplaySessionTime < 2)
            {
                TimeOffset = sim.Telemetry.ReplayFrameNum - sim.Telemetry.SessionTime * 60;
            }

            _sessionStateUpdater.Update(result, sim);
            _sessionFlagUpdater.Update(result, sim);
            _cameraUpdater.Update(sim);
            _radioUpdater.Update(sim);
            _entityUpdater.Update(result, sim);

            ((TimeDelta)sim.TimeDelta).Update(CurrentTime, sim.Telemetry.CarIdxLapDistPct);
            result.UpdatePosition(sim);
            result.CheckPitStatus();
            result.UpdateEntityLinks(sim);
            _entityResultsUpdater.Update(result, sim);
            PrevTime = CurrentTime;
        }