@@ -685,6 +685,18 @@ protected void SendToServer(string messageType, string channelName, byte[] data)
685685 NetworkingManager . singleton . Send ( NetworkingManager . singleton . serverClientId , messageType , channelName , data ) ;
686686 }
687687
688+ /// <summary>
689+ /// Sends a binary serialized class to the server from client
690+ /// </summary>
691+ /// <typeparam name="T">The class type to send</typeparam>
692+ /// <param name="messageType">User defined messageType</param>
693+ /// <param name="channelName">User defined channelName</param>
694+ /// <param name="instance">The instance to send</param>
695+ protected void SendToServer < T > ( string messageType , string channelName , T instance )
696+ {
697+ SendToServer ( messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
698+ }
699+
688700 /// <summary>
689701 /// Sends a buffer to the server from client. Only handlers on this NetworkedBehaviour will get invoked
690702 /// </summary>
@@ -706,6 +718,18 @@ protected void SendToServerTarget(string messageType, string channelName, byte[]
706718 NetworkingManager . singleton . Send ( NetworkingManager . singleton . serverClientId , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
707719 }
708720
721+ /// <summary>
722+ /// Sends a binary serialized class to the server from client. Only handlers on this NetworkedBehaviour will get invoked
723+ /// </summary>
724+ /// <typeparam name="T">The class type to send</typeparam>
725+ /// <param name="messageType">User defined messageType</param>
726+ /// <param name="channelName">User defined channelName</param>
727+ /// <param name="instance">The instance to send</param>
728+ protected void SendToServerTarget < T > ( string messageType , string channelName , T instance )
729+ {
730+ SendToServerTarget ( messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
731+ }
732+
709733 /// <summary>
710734 /// Sends a buffer to the server from client
711735 /// </summary>
@@ -727,6 +751,18 @@ protected void SendToLocalClient(string messageType, string channelName, byte[]
727751 NetworkingManager . singleton . Send ( ownerClientId , messageType , channelName , data ) ;
728752 }
729753
754+ /// <summary>
755+ /// Sends a binary serialized class to the server from client
756+ /// </summary>
757+ /// <typeparam name="T">The class type to send</typeparam>
758+ /// <param name="messageType">User defined messageType</param>
759+ /// <param name="channelName">User defined channelName</param>
760+ /// <param name="instance">The instance to send</param>
761+ protected void SendToLocalClient < T > ( string messageType , string channelName , T instance )
762+ {
763+ SendToLocalClient ( messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
764+ }
765+
730766 /// <summary>
731767 /// Sends a buffer to the client that owns this object from the server. Only handlers on this NetworkedBehaviour will get invoked
732768 /// </summary>
@@ -748,6 +784,18 @@ protected void SendToLocalClientTarget(string messageType, string channelName, b
748784 NetworkingManager . singleton . Send ( ownerClientId , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
749785 }
750786
787+ /// <summary>
788+ /// Sends a buffer to the client that owns this object from the server. Only handlers on this NetworkedBehaviour will get invoked
789+ /// </summary>
790+ /// <typeparam name="T">The class type to send</typeparam>
791+ /// <param name="messageType">User defined messageType</param>
792+ /// <param name="channelName">User defined channelName</param>
793+ /// <param name="instance">The instance to send</param>
794+ protected void SendToLocalClientTarget < T > ( string messageType , string channelName , T instance )
795+ {
796+ SendToLocalClientTarget ( messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
797+ }
798+
751799 /// <summary>
752800 /// Sends a buffer to all clients except to the owner object from the server
753801 /// </summary>
@@ -769,6 +817,18 @@ protected void SendToNonLocalClients(string messageType, string channelName, byt
769817 NetworkingManager . singleton . Send ( messageType , channelName , data , ownerClientId ) ;
770818 }
771819
820+ /// <summary>
821+ /// Sends a binary serialized class to all clients except to the owner object from the server
822+ /// </summary>
823+ /// <typeparam name="T">The class type to send</typeparam>
824+ /// <param name="messageType">User defined messageType</param>
825+ /// <param name="channelName">User defined channelName</param>
826+ /// <param name="instance">The instance to send</param>
827+ protected void SendToNonLocalClients < T > ( string messageType , string channelName , T instance )
828+ {
829+ SendToNonLocalClients ( messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
830+ }
831+
772832 /// <summary>
773833 /// Sends a buffer to all clients except to the owner object from the server. Only handlers on this NetworkedBehaviour will get invoked
774834 /// </summary>
@@ -790,6 +850,18 @@ protected void SendToNonLocalClientsTarget(string messageType, string channelNam
790850 NetworkingManager . singleton . Send ( messageType , channelName , data , ownerClientId , networkId , networkedObject . GetOrderIndex ( this ) ) ;
791851 }
792852
853+ /// <summary>
854+ /// Sends a binary serialized class to all clients except to the owner object from the server. Only handlers on this NetworkedBehaviour will get invoked
855+ /// </summary>
856+ /// <typeparam name="T">The class type to send</typeparam>
857+ /// <param name="messageType">User defined messageType</param>
858+ /// <param name="channelName">User defined channelName</param>
859+ /// <param name="instance">The instance to send</param>
860+ protected void SendToNonLocalClientsTarget < T > ( string messageType , string channelName , T instance )
861+ {
862+ SendToNonLocalClientsTarget ( messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
863+ }
864+
793865 /// <summary>
794866 /// Sends a buffer to a client with a given clientId from Server
795867 /// </summary>
@@ -812,6 +884,19 @@ protected void SendToClient(int clientId, string messageType, string channelName
812884 NetworkingManager . singleton . Send ( clientId , messageType , channelName , data ) ;
813885 }
814886
887+ /// <summary>
888+ /// Sends a binary serialized class to a client with a given clientId from Server
889+ /// </summary>
890+ /// <typeparam name="T">The class type to send</typeparam>
891+ /// <param name="clientId">The clientId to send the message to</param>
892+ /// <param name="messageType">User defined messageType</param>
893+ /// <param name="channelName">User defined channelName</param>
894+ /// <param name="instance">The instance to send</param>
895+ protected void SendToClient < T > ( int clientId , string messageType , string channelName , T instance )
896+ {
897+ SendToClient ( clientId , messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
898+ }
899+
815900 /// <summary>
816901 /// Sends a buffer to a client with a given clientId from Server. Only handlers on this NetworkedBehaviour gets invoked
817902 /// </summary>
@@ -834,6 +919,19 @@ protected void SendToClientTarget(int clientId, string messageType, string chann
834919 NetworkingManager . singleton . Send ( clientId , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
835920 }
836921
922+ /// <summary>
923+ /// Sends a buffer to a client with a given clientId from Server. Only handlers on this NetworkedBehaviour gets invoked
924+ /// </summary>
925+ /// <typeparam name="T">The class type to send</typeparam>
926+ /// <param name="clientId">The clientId to send the message to</param>
927+ /// <param name="messageType">User defined messageType</param>
928+ /// <param name="channelName">User defined channelName</param>
929+ /// <param name="instance">The instance to send</param>
930+ protected void SendToClientTarget < T > ( int clientId , string messageType , string channelName , T instance )
931+ {
932+ SendToClientTarget ( clientId , messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
933+ }
934+
837935 /// <summary>
838936 /// Sends a buffer to multiple clients from the server
839937 /// </summary>
@@ -856,6 +954,19 @@ protected void SendToClients(int[] clientIds, string messageType, string channel
856954 NetworkingManager . singleton . Send ( clientIds , messageType , channelName , data ) ;
857955 }
858956
957+ /// <summary>
958+ /// Sends a binary serialized class to multiple clients from the server
959+ /// </summary>
960+ /// <typeparam name="T">The class type to send</typeparam>
961+ /// <param name="clientIds">The clientId's to send to</param>
962+ /// <param name="messageType">User defined messageType</param>
963+ /// <param name="channelName">User defined channelName</param>
964+ /// <param name="instance">The instance to send</param>
965+ protected void SendToClients < T > ( int [ ] clientIds , string messageType , string channelName , T instance )
966+ {
967+ SendToClients ( clientIds , messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
968+ }
969+
859970 /// <summary>
860971 /// Sends a buffer to multiple clients from the server. Only handlers on this NetworkedBehaviour gets invoked
861972 /// </summary>
@@ -878,6 +989,19 @@ protected void SendToClientsTarget(int[] clientIds, string messageType, string c
878989 NetworkingManager . singleton . Send ( clientIds , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
879990 }
880991
992+ /// <summary>
993+ /// Sends a buffer to multiple clients from the server. Only handlers on this NetworkedBehaviour gets invoked
994+ /// </summary>
995+ /// <typeparam name="T">The class type to send</typeparam>
996+ /// <param name="clientIds">The clientId's to send to</param>
997+ /// <param name="messageType">User defined messageType</param>
998+ /// <param name="channelName">User defined channelName</param>
999+ /// <param name="instance">The instance to send</param>
1000+ protected void SendToClientsTarget < T > ( int [ ] clientIds , string messageType , string channelName , T instance )
1001+ {
1002+ SendToClientsTarget ( clientIds , messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
1003+ }
1004+
8811005 /// <summary>
8821006 /// Sends a buffer to multiple clients from the server
8831007 /// </summary>
@@ -900,6 +1024,19 @@ protected void SendToClients(List<int> clientIds, string messageType, string cha
9001024 NetworkingManager . singleton . Send ( clientIds , messageType , channelName , data ) ;
9011025 }
9021026
1027+ /// <summary>
1028+ /// Sends a binary serialized class to multiple clients from the server
1029+ /// </summary>
1030+ /// <typeparam name="T">The class type to send</typeparam>
1031+ /// <param name="clientIds">The clientId's to send to</param>
1032+ /// <param name="messageType">User defined messageType</param>
1033+ /// <param name="channelName">User defined channelName</param>
1034+ /// <param name="instance">The instance to send</param>
1035+ protected void SendToClients < T > ( List < int > clientIds , string messageType , string channelName , T instance )
1036+ {
1037+ SendToClients ( clientIds , messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
1038+ }
1039+
9031040 /// <summary>
9041041 /// Sends a buffer to multiple clients from the server. Only handlers on this NetworkedBehaviour gets invoked
9051042 /// </summary>
@@ -922,6 +1059,11 @@ protected void SendToClientsTarget(List<int> clientIds, string messageType, stri
9221059 NetworkingManager . singleton . Send ( clientIds , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
9231060 }
9241061
1062+ protected void SendToClientsTarget < T > ( List < int > clientIds , string messageType , string channelName , T instance )
1063+ {
1064+ SendToClientsTarget ( clientIds , messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
1065+ }
1066+
9251067 /// <summary>
9261068 /// Sends a buffer to all clients from the server
9271069 /// </summary>
@@ -943,6 +1085,18 @@ protected void SendToClients(string messageType, string channelName, byte[] data
9431085 NetworkingManager . singleton . Send ( messageType , channelName , data ) ;
9441086 }
9451087
1088+ /// <summary>
1089+ /// Sends a buffer to all clients from the server
1090+ /// </summary>
1091+ /// <typeparam name="T">The class type to send</typeparam>
1092+ /// <param name="messageType">User defined messageType</param>
1093+ /// <param name="channelName">User defined channelName</param>
1094+ /// <param name="instance">The instance to send</param>
1095+ protected void SendToClients < T > ( string messageType , string channelName , T instance )
1096+ {
1097+ SendToClients ( messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
1098+ }
1099+
9461100 /// <summary>
9471101 /// Sends a buffer to all clients from the server. Only handlers on this NetworkedBehaviour will get invoked
9481102 /// </summary>
@@ -963,6 +1117,18 @@ protected void SendToClientsTarget(string messageType, string channelName, byte[
9631117 }
9641118 NetworkingManager . singleton . Send ( messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
9651119 }
1120+
1121+ /// <summary>
1122+ /// Sends a buffer to all clients from the server. Only handlers on this NetworkedBehaviour will get invoked
1123+ /// </summary>
1124+ /// <typeparam name="T">The class type to send</typeparam>
1125+ /// <param name="messageType">User defined messageType</param>
1126+ /// <param name="channelName">User defined channelName</param>
1127+ /// <param name="instance">The instance to send</param>
1128+ protected void SendToClientsTarget < T > ( string messageType , string channelName , T instance )
1129+ {
1130+ SendToClientsTarget ( messageType , channelName , BinarySerializer . Serialize < T > ( instance ) ) ;
1131+ }
9661132 #endregion
9671133
9681134 /// <summary>
0 commit comments