mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
use C#7 out variable declaration
This commit is contained in:
parent
505d2b85ad
commit
6018f4d9db
@ -270,8 +270,7 @@ static bool GetInvokerForHash(int cmdHash, UNetInvokeType invokeType, out Invoke
|
|||||||
// InvokeCmd/Rpc/SyncEventDelegate can all use the same function here
|
// InvokeCmd/Rpc/SyncEventDelegate can all use the same function here
|
||||||
internal bool InvokeHandlerDelegate(int cmdHash, UNetInvokeType invokeType, NetworkReader reader)
|
internal bool InvokeHandlerDelegate(int cmdHash, UNetInvokeType invokeType, NetworkReader reader)
|
||||||
{
|
{
|
||||||
Invoker invoker;
|
if (GetInvokerForHash(cmdHash, invokeType, out Invoker invoker) &&
|
||||||
if (GetInvokerForHash(cmdHash, invokeType, out invoker) &&
|
|
||||||
invoker.invokeClass.IsInstanceOfType(this))
|
invoker.invokeClass.IsInstanceOfType(this))
|
||||||
{
|
{
|
||||||
invoker.invokeFunction(this, reader);
|
invoker.invokeFunction(this, reader);
|
||||||
@ -326,8 +325,7 @@ protected GameObject GetSyncVarGameObject(uint netId, ref GameObject gameObjectF
|
|||||||
|
|
||||||
// client always looks up based on netId because objects might get in and out of range
|
// client always looks up based on netId because objects might get in and out of range
|
||||||
// over and over again, which shouldn't null them forever
|
// over and over again, which shouldn't null them forever
|
||||||
NetworkIdentity identity;
|
if (NetworkIdentity.spawned.TryGetValue(netId, out NetworkIdentity identity) && identity != null)
|
||||||
if (NetworkIdentity.spawned.TryGetValue(netId, out identity) && identity != null)
|
|
||||||
return identity.gameObject;
|
return identity.gameObject;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -372,8 +370,7 @@ protected NetworkIdentity GetSyncVarNetworkIdentity(uint netId, ref NetworkIdent
|
|||||||
|
|
||||||
// client always looks up based on netId because objects might get in and out of range
|
// client always looks up based on netId because objects might get in and out of range
|
||||||
// over and over again, which shouldn't null them forever
|
// over and over again, which shouldn't null them forever
|
||||||
NetworkIdentity identity;
|
NetworkIdentity.spawned.TryGetValue(netId, out NetworkIdentity identity);
|
||||||
NetworkIdentity.spawned.TryGetValue(netId, out identity);
|
|
||||||
return identity;
|
return identity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user