Example #1
0
 public void Execute(GameClient <TPlayer> model, PingRequestMessage message)
 {
     if (model.localPlayer != null)
     {
         model.localPlayer.lastReceivedPingRequest = TimeUtils.CurrentTime();
     }
     model.Send(new PongRequestMessage(message.pingRequestId), Channel.unreliable);
 }
        public void Start(TOutgoingMessage message, NetEndPoint to)
        {
            this.message = message;
            this.to      = to;

            this.retryIndex  = 0;
            this.startedTime = TimeUtils.CurrentTime();
            this.Send();
            this.started = true;
        }
Example #3
0
        public float PongReceived(TPlayer from, long pingRequestId)
        {
            from.lastReceivedPongRequest = TimeUtils.CurrentTime();

            if (this.pingPlayers.TryGetValue(from.playerId, out PingPlayer <TPlayer> pingPlayer))
            {
                pingPlayer.ReceivedPong(pingRequestId);
                return(from.mostRecentPingValue);
            }
            return(0F);
        }
 private void Send()
 {
     this.sender.Send(this.message, this.to);
     this.startedTime = TimeUtils.CurrentTime();
     this.retryIndex++;
 }
Example #5
0
 internal void SendingPing()
 {
     this.pingSent     = true;
     this.pingSentTime = TimeUtils.CurrentTime();
     this.player.Send(new PingRequestMessage(this.pingRequestId++), Channel.unreliable);
 }
Example #6
0
 public Player()
 {
     this.lastReceivedPongRequest = TimeUtils.CurrentTime();
 }