Exemple #1
0
        private void ShowPingTime()
        {
            double lastPingSec = pingStatisticsStorage.GetLastPingSec();
            int    lastPingMs  = (int)lastPingSec;

            pingText.text = $"ping: {lastPingMs} ms";
        }
 public void NewSnapshotReceived(int tickNumber, float tickMatchTime)
 {
     if (matchStartTime == null)
     {
         float    lastPingSec = pingStatisticsStorage.GetLastPingSec();
         DateTime now         = DateTime.UtcNow;
         // TimeSpan networkCorrection = TimeSpan.FromSeconds(lastPingSec/2);
         TimeSpan matchTimeCorrection     = TimeSpan.FromSeconds(tickMatchTime);
         DateTime estimatedMatchStartTime = now
                                            // - networkCorrection
                                            - matchTimeCorrection
         ;
         matchStartTime = estimatedMatchStartTime;
         log.Info($"Установка времени старта матча {estimatedMatchStartTime.ToLongTimeString()}");
     }
 }