mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Local Connection's connectionId is now set to 0 inside of their constructors, instead of doing it in LocalClient
This commit is contained in:
parent
5f7c4d48b4
commit
7836433b4f
@ -13,19 +13,11 @@ sealed class LocalClient : NetworkClient
|
|||||||
internal void InternalConnectLocalServer()
|
internal void InternalConnectLocalServer()
|
||||||
{
|
{
|
||||||
// create local connection to server
|
// create local connection to server
|
||||||
connection = new ULocalConnectionToServer()
|
connection = new ULocalConnectionToServer();
|
||||||
{
|
|
||||||
// local player always has connectionId == 0
|
|
||||||
connectionId = 0
|
|
||||||
};
|
|
||||||
SetHandlers(connection);
|
SetHandlers(connection);
|
||||||
|
|
||||||
// create server connection to local client
|
// create server connection to local client
|
||||||
ULocalConnectionToClient connectionToClient = new ULocalConnectionToClient(this)
|
ULocalConnectionToClient connectionToClient = new ULocalConnectionToClient(this);
|
||||||
{
|
|
||||||
// local player always has connectionId == 0
|
|
||||||
connectionId = 0
|
|
||||||
};
|
|
||||||
NetworkServer.SetLocalConnection(connectionToClient);
|
NetworkServer.SetLocalConnection(connectionToClient);
|
||||||
|
|
||||||
connectState = ConnectState.Connected;
|
connectState = ConnectState.Connected;
|
||||||
|
@ -11,6 +11,9 @@ class ULocalConnectionToClient : NetworkConnection
|
|||||||
public ULocalConnectionToClient(LocalClient localClient) : base ("localClient")
|
public ULocalConnectionToClient(LocalClient localClient) : base ("localClient")
|
||||||
{
|
{
|
||||||
this.localClient = localClient;
|
this.localClient = localClient;
|
||||||
|
|
||||||
|
// local player always has connectionId == 0
|
||||||
|
connectionId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override bool SendBytes(byte[] bytes, int channelId = Channels.DefaultReliable)
|
internal override bool SendBytes(byte[] bytes, int channelId = Channels.DefaultReliable)
|
||||||
@ -24,7 +27,11 @@ internal override bool SendBytes(byte[] bytes, int channelId = Channels.DefaultR
|
|||||||
// send messages on this connection causes the server's handler function to be invoked directly.
|
// send messages on this connection causes the server's handler function to be invoked directly.
|
||||||
internal class ULocalConnectionToServer : NetworkConnection
|
internal class ULocalConnectionToServer : NetworkConnection
|
||||||
{
|
{
|
||||||
public ULocalConnectionToServer() : base("localServer") {}
|
public ULocalConnectionToServer() : base("localServer")
|
||||||
|
{
|
||||||
|
// local player always has connectionId == 0
|
||||||
|
connectionId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
internal override bool SendBytes(byte[] bytes, int channelId = Channels.DefaultReliable)
|
internal override bool SendBytes(byte[] bytes, int channelId = Channels.DefaultReliable)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user