protected override void OnCarInfo(MsgCarInfo msg)
        {
            //using (var a = new FileStream("Test.txt", FileMode.Append, FileAccess.Write))
            //using (var b = new StreamWriter(a))
            //{
            //    b.WriteLine($"{DateTime.Now.TimeOfDay}: OnCarInfo Called {msg.CarId}");
            //}

            if (Competitors.Any(driver => driver.DriverGuid == msg.DriverGuid && driver.IsConnected == true) || string.IsNullOrEmpty(msg.DriverGuid))
            {
                return;
            }


            var competitor = new Competitor
            {
                CompetitorId = Guid.NewGuid().ToString(),
                SessionId    = CurrentSession.SessionId,
                CarId        = msg.CarId,
                ConnectionId = msg.CarId,
                CarModel     = msg.CarModel,
                CarSkin      = msg.CarSkin,
                DriverName   = msg.DriverName,
                DriverGuid   = msg.DriverGuid,
                IsConnected  = true
            };

            Competitors.Add(ApiWrapperNet4.Post <Competitor>("competitor/addcompetitor", competitor));
        }
Beispiel #2
0
        protected override void OnCarInfo(MsgCarInfo msg)
        {
            PluginManager.Log(DateTime.Now.TimeOfDay.ToString() + "- CarInfo: " + msg.CarId + ", " + msg.DriverName + "@" + msg.CarModel + ", Connected=" + msg.IsConnected);

            // To prevent a bug in communication we will only send when the Car IsConnected - discos only via the corresponding event please.
            if (msg.IsConnected)
            {
                MRBackend.RandomCarInfoAsync(msg.CarId, msg.CarModel, msg.DriverName, msg.DriverGuid, msg.IsConnected, GetCurrentRaceTimeMS(msg));
            }
        }
Beispiel #3
0
 public void OnCarInfo(MsgCarInfo msg)
 {
     if (msg.CarId >= Leaderboard.Count ||
         Leaderboard[msg.CarId].Driver != null && Leaderboard[msg.CarId].Driver.DriverName == msg.DriverName)
     {
         return;
     }
     // Logging.Debug("New car: " + msg.CarId + ", car: " + msg.CarModel);
     Leaderboard[msg.CarId].Driver = new AcDriverDetails(msg.DriverGuid, msg.DriverName, msg.CarModel, msg.CarSkin);
     Leaderboard[msg.CarId].Reset(true);
 }
Beispiel #4
0
        public void OnCarInfo(MsgCarInfo msg)
        {
            if (msg.CarId >= Leaderboard.Count)
            {
                return;
            }
            var item = Leaderboard[msg.CarId];

            if (item.Driver != null && item.Driver.DriverName == msg.DriverName)
            {
                return;
            }
            // Logging.Debug("New car: " + msg.CarId + ", car: " + msg.CarModel);
            item.SilentFor = 0;
            item.Driver    = new AcDriverDetails(msg.DriverGuid, msg.DriverName, msg.CarModel, msg.CarSkin);
            item.Reset(true);
            ConnectedOnly.Refresh(item);
        }
Beispiel #5
0
 public virtual void OnCarInfo(MsgCarInfo msg)
 {
 }
 protected internal virtual void OnCarInfo(MsgCarInfo msg)
 {
 }