mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkClient.connection: use explicit type NetworkConnectionToServer to reduce chance of bugs
This commit is contained in:
parent
2277d66cea
commit
6bc974618a
@ -52,7 +52,7 @@ public static partial class NetworkClient
|
||||
new Dictionary<uint, NetworkIdentity>();
|
||||
|
||||
/// <summary>Client's NetworkConnection to server.</summary>
|
||||
public static NetworkConnection connection { get; internal set; }
|
||||
public static NetworkConnectionToServer connection { get; internal set; }
|
||||
|
||||
/// <summary>True if client is ready (= joined world).</summary>
|
||||
// TODO redundant state. point it to .connection.isReady instead (& test)
|
||||
|
@ -9,4 +9,10 @@ public FakeNetworkConnectionToClient() : base(1) {}
|
||||
public override void Disconnect() {}
|
||||
internal override void Send(ArraySegment<byte> segment, int channelId = 0) {}
|
||||
}
|
||||
|
||||
public class FakeNetworkConnectionToServer : NetworkConnectionToServer
|
||||
{
|
||||
public override void Disconnect() {}
|
||||
internal override void Send(ArraySegment<byte> segment, int channelId = 0) {}
|
||||
}
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ public void ApplyPayload_LocalPlayerAddsIdentityToConnection()
|
||||
payload = default,
|
||||
};
|
||||
|
||||
NetworkClient.connection = new FakeNetworkConnectionToClient();
|
||||
NetworkClient.connection = new FakeNetworkConnectionToServer();
|
||||
NetworkClient.ready = true;
|
||||
NetworkClient.ApplySpawnPayload(identity, msg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user