Пример #1
0
 public void Destroy()
 {
     if (!IsDestroyed)
     {
         IsDestroyed = true;
         OnDestroyEvent?.Invoke(this);
         NetworkBehavior.IdentityDestroy(this);
     }
 }
Пример #2
0
 internal static void NetworkMethodInvoke(NetworkIdentity identity, MethodPacket methodPacket, bool shouldInvokeSynchronously)
 {
     if (methodsByType.TryGetValue(identity.GetType(), out Dictionary <string, NetworkMethodExecuter> d))
     {
         if (d.TryGetValue(methodPacket.MethodName, out NetworkMethodExecuter memberExecuter))
         {
             memberExecuter.InvokeMemberFromNetwork(identity, shouldInvokeSynchronously, methodPacket.MethodArgs);
             return;
         }
     }
     NetworkBehavior.PrintWarning("No location with name: {0} was not found", methodPacket.MethodName);
 }
Пример #3
0
 internal static void NetworkSyncVarInvoke(NetworkIdentity identity, SyncVarPacket syncVarPacket, bool shouldInvokeSynchronously)
 {
     if (locationByType.TryGetValue(identity.GetType(), out Dictionary <string, NetworkLocationExecuter> d))
     {
         if (d.TryGetValue(syncVarPacket.LocationName, out NetworkLocationExecuter memberExecuter))
         {
             memberExecuter.InvokeMemberFromNetwork(identity, shouldInvokeSynchronously, syncVarPacket.LocationValue);
             return;
         }
     }
     NetworkBehavior.PrintWarning("No location with name: {0} was not found", syncVarPacket.LocationName);
 }
Пример #4
0
 public void InvokeSyncVarNetworkly(string locationName, object value, NetworkInterfaceType networkInterface = NetworkInterfaceType.TCP)
 {
     if (locationByType.TryGetValue(GetType(), out Dictionary <string, NetworkLocationExecuter> d))
     {
         if (d.TryGetValue(locationName, out NetworkLocationExecuter networkMemberExecuter))
         {
             networkMemberExecuter.InvokeMemberFromLocal(this, () =>
             {
                 OnInvokeLocationNetworkly.Invoke(this, networkInterface, locationName, Operations.GetObjectAsValue(value));
             });
             return;
         }
     }
     NetworkBehavior.PrintWarning("No location with name: {0} was not found", locationName);
 }
Пример #5
0
 public void InvokeCommandMethodNetworkly(string methodName, NetworkInterfaceType networkInterface = NetworkInterfaceType.TCP, bool?shouldInvokeSynchronously = null, EndPointId?targetId = null, params object[] args)
 {
     if (methodsByType.TryGetValue(GetType(), out Dictionary <string, NetworkMethodExecuter> d))
     {
         methodName = methodName + ":" + args.Length;
         if (d.TryGetValue(methodName, out NetworkMethodExecuter networkMemberExecuter))
         {
             networkMemberExecuter.InvokeMemberFromLocal(this, () =>
             {
                 List <object> methodArgs = new List <object>();
                 foreach (object o in args)
                 {
                     methodArgs.Add(Operations.GetObjectAsValue(o));
                 }
                 OnInvokeCommandMethodNetworkly.Invoke(this, networkInterface, methodName, methodArgs.ToArray(), shouldInvokeSynchronously, targetId);
             });
             return;
         }
     }
     NetworkBehavior.PrintWarning("No method with name: {0} was not found", methodName);
 }