mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Formatting
This commit is contained in:
parent
80b23f029d
commit
712032a0aa
@ -40,7 +40,7 @@ public static partial class NetworkClient
|
||||
public static float catchupNegativeThreshold = -1; // careful, don't want to run out of snapshots
|
||||
|
||||
[Tooltip("Catchup begins when the local timeline is moving too slow and getting too far away from remote time. Threshold is in frames worth of snapshots.\n\nThis needs to be positive.\n\nDon't modify unless you know what you are doing.")]
|
||||
public static float catchupPositiveThreshold = 1;
|
||||
public static float catchupPositiveThreshold = 1;
|
||||
|
||||
[Tooltip("Local timeline acceleration in % while catching up.")]
|
||||
[Range(0, 1)]
|
||||
@ -103,7 +103,7 @@ static void InitTimeInterpolation()
|
||||
// initialize EMA with 'emaDuration' seconds worth of history.
|
||||
// 1 second holds 'sendRate' worth of values.
|
||||
// multiplied by emaDuration gives n-seconds.
|
||||
driftEma = new ExponentialMovingAverage(NetworkServer.sendRate * driftEmaDuration);
|
||||
driftEma = new ExponentialMovingAverage(NetworkServer.sendRate * driftEmaDuration);
|
||||
deliveryTimeEma = new ExponentialMovingAverage(NetworkServer.sendRate * deliveryTimeEmaDuration);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public NetworkConnectionToClient(int networkConnectionId)
|
||||
// initialize EMA with 'emaDuration' seconds worth of history.
|
||||
// 1 second holds 'sendRate' worth of values.
|
||||
// multiplied by emaDuration gives n-seconds.
|
||||
driftEma = new ExponentialMovingAverage(NetworkServer.sendRate * NetworkClient.driftEmaDuration);
|
||||
driftEma = new ExponentialMovingAverage(NetworkServer.sendRate * NetworkClient.driftEmaDuration);
|
||||
deliveryTimeEma = new ExponentialMovingAverage(NetworkServer.sendRate * NetworkClient.deliveryTimeEmaDuration);
|
||||
|
||||
// buffer limit should be at least multiplier to have enough in there
|
||||
@ -119,7 +119,7 @@ void FlushRpcs(NetworkWriter buffer, int channelId)
|
||||
{
|
||||
if (buffer.Position > 0)
|
||||
{
|
||||
Send(new RpcBufferMessage{ payload = buffer }, channelId);
|
||||
Send(new RpcBufferMessage { payload = buffer }, channelId);
|
||||
buffer.Position = 0;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public virtual void Start()
|
||||
StartServer();
|
||||
}
|
||||
// only start server or client, never both
|
||||
else if(autoConnectClientBuild)
|
||||
else if (autoConnectClientBuild)
|
||||
{
|
||||
StartClient();
|
||||
}
|
||||
@ -1267,7 +1267,7 @@ void OnClientSceneInternal(SceneMessage msg)
|
||||
}
|
||||
|
||||
/// <summary>Called on the server when a new client connects.</summary>
|
||||
public virtual void OnServerConnect(NetworkConnectionToClient conn) {}
|
||||
public virtual void OnServerConnect(NetworkConnectionToClient conn) { }
|
||||
|
||||
/// <summary>Called on the server when a client disconnects.</summary>
|
||||
// Called by NetworkServer.OnTransportDisconnect!
|
||||
@ -1307,13 +1307,13 @@ public virtual void OnServerAddPlayer(NetworkConnectionToClient conn)
|
||||
}
|
||||
|
||||
/// <summary>Called on server when transport raises an exception. NetworkConnection may be null.</summary>
|
||||
public virtual void OnServerError(NetworkConnectionToClient conn, TransportError error, string reason) {}
|
||||
public virtual void OnServerError(NetworkConnectionToClient conn, TransportError error, string reason) { }
|
||||
|
||||
/// <summary>Called from ServerChangeScene immediately before SceneManager.LoadSceneAsync is executed</summary>
|
||||
public virtual void OnServerChangeScene(string newSceneName) {}
|
||||
public virtual void OnServerChangeScene(string newSceneName) { }
|
||||
|
||||
/// <summary>Called on server after a scene load with ServerChangeScene() is completed.</summary>
|
||||
public virtual void OnServerSceneChanged(string sceneName) {}
|
||||
public virtual void OnServerSceneChanged(string sceneName) { }
|
||||
|
||||
/// <summary>Called on the client when connected to a server. By default it sets client as ready and adds a player.</summary>
|
||||
public virtual void OnClientConnect()
|
||||
@ -1334,17 +1334,17 @@ public virtual void OnClientConnect()
|
||||
}
|
||||
|
||||
/// <summary>Called on clients when disconnected from a server.</summary>
|
||||
public virtual void OnClientDisconnect() {}
|
||||
public virtual void OnClientDisconnect() { }
|
||||
|
||||
/// <summary>Called on client when transport raises an exception.</summary>
|
||||
public virtual void OnClientError(TransportError error, string reason) {}
|
||||
public virtual void OnClientError(TransportError error, string reason) { }
|
||||
|
||||
/// <summary>Called on clients when a servers tells the client it is no longer ready, e.g. when switching scenes.</summary>
|
||||
public virtual void OnClientNotReady() {}
|
||||
public virtual void OnClientNotReady() { }
|
||||
|
||||
/// <summary>Called from ClientChangeScene immediately before SceneManager.LoadSceneAsync is executed</summary>
|
||||
// customHandling: indicates if scene loading will be handled through overrides
|
||||
public virtual void OnClientChangeScene(string newSceneName, SceneOperation sceneOperation, bool customHandling) {}
|
||||
public virtual void OnClientChangeScene(string newSceneName, SceneOperation sceneOperation, bool customHandling) { }
|
||||
|
||||
/// <summary>Called on clients when a scene has completed loaded, when the scene load was initiated by the server.</summary>
|
||||
// Scene changes can cause player objects to be destroyed. The default
|
||||
@ -1369,22 +1369,22 @@ public virtual void OnClientSceneChanged()
|
||||
// from all versions, so users only need to implement this one case.
|
||||
|
||||
/// <summary>This is invoked when a host is started.</summary>
|
||||
public virtual void OnStartHost() {}
|
||||
public virtual void OnStartHost() { }
|
||||
|
||||
/// <summary>This is invoked when a server is started - including when a host is started.</summary>
|
||||
public virtual void OnStartServer() {}
|
||||
public virtual void OnStartServer() { }
|
||||
|
||||
/// <summary>This is invoked when the client is started.</summary>
|
||||
public virtual void OnStartClient() {}
|
||||
public virtual void OnStartClient() { }
|
||||
|
||||
/// <summary>This is called when a server is stopped - including when a host is stopped.</summary>
|
||||
public virtual void OnStopServer() {}
|
||||
public virtual void OnStopServer() { }
|
||||
|
||||
/// <summary>This is called when a client is stopped.</summary>
|
||||
public virtual void OnStopClient() {}
|
||||
public virtual void OnStopClient() { }
|
||||
|
||||
/// <summary>This is called when a host is stopped.</summary>
|
||||
public virtual void OnStopHost() {}
|
||||
public virtual void OnStopHost() { }
|
||||
|
||||
// keep OnGUI even in builds. useful to debug snap interp.
|
||||
void OnGUI()
|
||||
|
@ -158,7 +158,7 @@ public static void InsertAndAdjust<T>(
|
||||
//
|
||||
// in practice, scramble is rare and won't make much difference
|
||||
double previousLocalTime = buffer.Values[buffer.Count - 2].localTime;
|
||||
double lastestLocalTime = buffer.Values[buffer.Count - 1].localTime;
|
||||
double lastestLocalTime = buffer.Values[buffer.Count - 1].localTime;
|
||||
|
||||
// this is the delivery time since last snapshot
|
||||
double localDeliveryTime = lastestLocalTime - previousLocalTime;
|
||||
@ -178,7 +178,7 @@ public static void InsertAndAdjust<T>(
|
||||
// snapshots may arrive out of order, we can not use last-timeline.
|
||||
// we need to use the inserted snapshot's time - timeline.
|
||||
double latestRemoteTime = snapshot.remoteTime;
|
||||
double timeDiff = latestRemoteTime - localTimeline;
|
||||
double timeDiff = latestRemoteTime - localTimeline;
|
||||
|
||||
// next, calculate average of a few seconds worth of timediffs.
|
||||
// this gives smoother results.
|
||||
@ -240,7 +240,7 @@ public static void Sample<T>(
|
||||
for (int i = 0; i < buffer.Count - 1; ++i)
|
||||
{
|
||||
// is local time between these two?
|
||||
T first = buffer.Values[i];
|
||||
T first = buffer.Values[i];
|
||||
T second = buffer.Values[i + 1];
|
||||
if (localTimeline >= first.remoteTime &&
|
||||
localTimeline <= second.remoteTime)
|
||||
@ -313,7 +313,7 @@ public static void StepInterpolation<T>(
|
||||
|
||||
// save from/to
|
||||
fromSnapshot = buffer.Values[from];
|
||||
toSnapshot = buffer.Values[to];
|
||||
toSnapshot = buffer.Values[to];
|
||||
|
||||
// remove older snapshots that we definitely don't need anymore.
|
||||
// after(!) using the indices.
|
||||
|
@ -41,7 +41,7 @@ public class ClientCube : MonoBehaviour
|
||||
public float catchupNegativeThreshold = -1; // careful, don't want to run out of snapshots
|
||||
|
||||
[Tooltip("Catchup begins when the local timeline is moving too slow and getting too far away from remote time. Threshold is in frames worth of snapshots.\n\nThis needs to be positive.\n\nDon't modify unless you know what you are doing.")]
|
||||
public float catchupPositiveThreshold = 1;
|
||||
public float catchupPositiveThreshold = 1;
|
||||
|
||||
[Tooltip("Local timeline acceleration in % while catching up.")]
|
||||
[Range(0, 1)]
|
||||
@ -92,7 +92,7 @@ public class ClientCube : MonoBehaviour
|
||||
[Header("Debug")]
|
||||
public Color catchupColor = Color.green; // green traffic light = go fast
|
||||
public Color slowdownColor = Color.red; // red traffic light = go slow
|
||||
Color defaultColor;
|
||||
Color defaultColor;
|
||||
|
||||
[Header("Simulation")]
|
||||
bool lowFpsMode;
|
||||
|
Loading…
Reference in New Issue
Block a user