Esempio n. 1
0
        public void SendServerTime(long connectionId)
        {
            if (!IsServer)
            {
                return;
            }
            var message = new ServerTimeMessage();

            message.serverTime = ServerTime;
            ServerSendPacket(connectionId, SendOptions.Sequenced, GameMsgTypes.ServerTime, message);
        }
Esempio n. 2
0
        protected virtual void HandleServerTime(LiteNetLibMessageHandler messageHandler)
        {
            // Server time updated at server, if this is host (client and server) then skip it.
            if (IsServer)
            {
                return;
            }
            ServerTimeMessage message = messageHandler.ReadMessage <ServerTimeMessage>();

            ServerUnixTimeOffset = message.serverUnixTime - Timestamp;
            ServerTimeOffset     = message.serverTime - Time.unscaledTime;
        }
Esempio n. 3
0
        public void SendServerTime(long connectionId)
        {
            if (!IsServer)
            {
                return;
            }
            ServerTimeMessage message = new ServerTimeMessage();

            message.serverUnixTime = ServerUnixTime;
            message.serverTime     = ServerTime;
            ServerSendPacket(connectionId, DeliveryMethod.Sequenced, GameMsgTypes.ServerTime, message);
        }