|
3 | 3 |
|
4 | 4 | namespace Unity.Netcode |
5 | 5 | { |
| 6 | + /// <summary> |
| 7 | + /// Specifies how RPC messages should be handled in terms of local execution timing |
| 8 | + /// </summary> |
6 | 9 | public enum LocalDeferMode |
7 | 10 | { |
| 11 | + /// <summary> |
| 12 | + /// Uses the default behavior for RPC message handling |
| 13 | + /// </summary> |
8 | 14 | Default, |
| 15 | + |
| 16 | + /// <summary> |
| 17 | + /// Defers the local execution of the RPC until the next network tick |
| 18 | + /// </summary> |
9 | 19 | Defer, |
| 20 | + |
| 21 | + /// <summary> |
| 22 | + /// Executes the RPC immediately on the local client without waiting for network synchronization |
| 23 | + /// </summary> |
10 | 24 | SendImmediate |
11 | 25 | } |
| 26 | + |
12 | 27 | /// <summary> |
13 | | - /// Generic RPC |
| 28 | + /// Generic RPC. Defines parameters for sending Remote Procedure Calls (RPCs) in the network system |
14 | 29 | /// </summary> |
15 | 30 | public struct RpcSendParams |
16 | 31 | { |
| 32 | + /// <summary> |
| 33 | + /// Specifies the target that will receive this RPC |
| 34 | + /// </summary> |
17 | 35 | public BaseRpcTarget Target; |
18 | 36 |
|
| 37 | + /// <summary> |
| 38 | + /// Controls how the RPC is handled for local execution timing |
| 39 | + /// </summary> |
19 | 40 | public LocalDeferMode LocalDeferMode; |
20 | 41 |
|
| 42 | + /// <summary> |
| 43 | + /// Implicitly converts a BaseRpcTarget to RpcSendParams |
| 44 | + /// </summary> |
| 45 | + /// <param name="target">The RPC target to convert</param> |
| 46 | + /// <returns>A new RpcSendParams instance with the specified target</returns> |
21 | 47 | public static implicit operator RpcSendParams(BaseRpcTarget target) => new RpcSendParams { Target = target }; |
| 48 | + |
| 49 | + /// <summary> |
| 50 | + /// Implicitly converts a LocalDeferMode to RpcSendParams |
| 51 | + /// </summary> |
| 52 | + /// <param name="deferMode">The defer mode to convert</param> |
| 53 | + /// <returns>A new RpcSendParams instance with the specified defer mode</returns> |
22 | 54 | public static implicit operator RpcSendParams(LocalDeferMode deferMode) => new RpcSendParams { LocalDeferMode = deferMode }; |
23 | 55 | } |
24 | 56 |
|
@@ -51,9 +83,32 @@ public struct RpcParams |
51 | 83 | /// </summary> |
52 | 84 | public RpcReceiveParams Receive; |
53 | 85 |
|
| 86 | + /// <summary> |
| 87 | + /// Implicitly converts RpcSendParams to RpcParams |
| 88 | + /// </summary> |
| 89 | + /// <param name="send">The send parameters to convert</param> |
| 90 | + /// <returns>A new RpcParams instance with the specified send parameters</returns> |
54 | 91 | public static implicit operator RpcParams(RpcSendParams send) => new RpcParams { Send = send }; |
| 92 | + |
| 93 | + /// <summary> |
| 94 | + /// Implicitly converts a BaseRpcTarget to RpcParams |
| 95 | + /// </summary> |
| 96 | + /// <param name="target">The RPC target to convert</param> |
| 97 | + /// <returns>A new RpcParams instance with the specified target in its send parameters</returns> |
55 | 98 | public static implicit operator RpcParams(BaseRpcTarget target) => new RpcParams { Send = new RpcSendParams { Target = target } }; |
| 99 | + |
| 100 | + /// <summary> |
| 101 | + /// Implicitly converts a LocalDeferMode to RpcParams |
| 102 | + /// </summary> |
| 103 | + /// <param name="deferMode">The defer mode to convert</param> |
| 104 | + /// <returns>A new RpcParams instance with the specified defer mode in its send parameters</returns> |
56 | 105 | public static implicit operator RpcParams(LocalDeferMode deferMode) => new RpcParams { Send = new RpcSendParams { LocalDeferMode = deferMode } }; |
| 106 | + |
| 107 | + /// <summary> |
| 108 | + /// Implicitly converts RpcReceiveParams to RpcParams |
| 109 | + /// </summary> |
| 110 | + /// <param name="receive">The receive parameters to convert</param> |
| 111 | + /// <returns>A new RpcParams instance with the specified receive parameters</returns> |
57 | 112 | public static implicit operator RpcParams(RpcReceiveParams receive) => new RpcParams { Receive = receive }; |
58 | 113 | } |
59 | 114 |
|
|
0 commit comments