@@ -685,6 +685,18 @@ protected void SendToServer(string messageType, string channelName, byte[] data)
685
685
NetworkingManager . singleton . Send ( NetworkingManager . singleton . serverClientId , messageType , channelName , data ) ;
686
686
}
687
687
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
+
688
700
/// <summary>
689
701
/// Sends a buffer to the server from client. Only handlers on this NetworkedBehaviour will get invoked
690
702
/// </summary>
@@ -706,6 +718,18 @@ protected void SendToServerTarget(string messageType, string channelName, byte[]
706
718
NetworkingManager . singleton . Send ( NetworkingManager . singleton . serverClientId , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
707
719
}
708
720
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
+
709
733
/// <summary>
710
734
/// Sends a buffer to the server from client
711
735
/// </summary>
@@ -727,6 +751,18 @@ protected void SendToLocalClient(string messageType, string channelName, byte[]
727
751
NetworkingManager . singleton . Send ( ownerClientId , messageType , channelName , data ) ;
728
752
}
729
753
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
+
730
766
/// <summary>
731
767
/// Sends a buffer to the client that owns this object from the server. Only handlers on this NetworkedBehaviour will get invoked
732
768
/// </summary>
@@ -748,6 +784,18 @@ protected void SendToLocalClientTarget(string messageType, string channelName, b
748
784
NetworkingManager . singleton . Send ( ownerClientId , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
749
785
}
750
786
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
+
751
799
/// <summary>
752
800
/// Sends a buffer to all clients except to the owner object from the server
753
801
/// </summary>
@@ -769,6 +817,18 @@ protected void SendToNonLocalClients(string messageType, string channelName, byt
769
817
NetworkingManager . singleton . Send ( messageType , channelName , data , ownerClientId ) ;
770
818
}
771
819
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
+
772
832
/// <summary>
773
833
/// Sends a buffer to all clients except to the owner object from the server. Only handlers on this NetworkedBehaviour will get invoked
774
834
/// </summary>
@@ -790,6 +850,18 @@ protected void SendToNonLocalClientsTarget(string messageType, string channelNam
790
850
NetworkingManager . singleton . Send ( messageType , channelName , data , ownerClientId , networkId , networkedObject . GetOrderIndex ( this ) ) ;
791
851
}
792
852
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
+
793
865
/// <summary>
794
866
/// Sends a buffer to a client with a given clientId from Server
795
867
/// </summary>
@@ -812,6 +884,19 @@ protected void SendToClient(int clientId, string messageType, string channelName
812
884
NetworkingManager . singleton . Send ( clientId , messageType , channelName , data ) ;
813
885
}
814
886
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
+
815
900
/// <summary>
816
901
/// Sends a buffer to a client with a given clientId from Server. Only handlers on this NetworkedBehaviour gets invoked
817
902
/// </summary>
@@ -834,6 +919,19 @@ protected void SendToClientTarget(int clientId, string messageType, string chann
834
919
NetworkingManager . singleton . Send ( clientId , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
835
920
}
836
921
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
+
837
935
/// <summary>
838
936
/// Sends a buffer to multiple clients from the server
839
937
/// </summary>
@@ -856,6 +954,19 @@ protected void SendToClients(int[] clientIds, string messageType, string channel
856
954
NetworkingManager . singleton . Send ( clientIds , messageType , channelName , data ) ;
857
955
}
858
956
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
+
859
970
/// <summary>
860
971
/// Sends a buffer to multiple clients from the server. Only handlers on this NetworkedBehaviour gets invoked
861
972
/// </summary>
@@ -878,6 +989,19 @@ protected void SendToClientsTarget(int[] clientIds, string messageType, string c
878
989
NetworkingManager . singleton . Send ( clientIds , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
879
990
}
880
991
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
+
881
1005
/// <summary>
882
1006
/// Sends a buffer to multiple clients from the server
883
1007
/// </summary>
@@ -900,6 +1024,19 @@ protected void SendToClients(List<int> clientIds, string messageType, string cha
900
1024
NetworkingManager . singleton . Send ( clientIds , messageType , channelName , data ) ;
901
1025
}
902
1026
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
+
903
1040
/// <summary>
904
1041
/// Sends a buffer to multiple clients from the server. Only handlers on this NetworkedBehaviour gets invoked
905
1042
/// </summary>
@@ -922,6 +1059,11 @@ protected void SendToClientsTarget(List<int> clientIds, string messageType, stri
922
1059
NetworkingManager . singleton . Send ( clientIds , messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
923
1060
}
924
1061
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
+
925
1067
/// <summary>
926
1068
/// Sends a buffer to all clients from the server
927
1069
/// </summary>
@@ -943,6 +1085,18 @@ protected void SendToClients(string messageType, string channelName, byte[] data
943
1085
NetworkingManager . singleton . Send ( messageType , channelName , data ) ;
944
1086
}
945
1087
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
+
946
1100
/// <summary>
947
1101
/// Sends a buffer to all clients from the server. Only handlers on this NetworkedBehaviour will get invoked
948
1102
/// </summary>
@@ -963,6 +1117,18 @@ protected void SendToClientsTarget(string messageType, string channelName, byte[
963
1117
}
964
1118
NetworkingManager . singleton . Send ( messageType , channelName , data , networkId , networkedObject . GetOrderIndex ( this ) ) ;
965
1119
}
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
+ }
966
1132
#endregion
967
1133
968
1134
/// <summary>
0 commit comments