|
1 | 1 | using MLAPI.MonoBehaviours.Core;
|
| 2 | +using MLAPI.NetworkingManagerComponents.Binary; |
2 | 3 |
|
3 | 4 | namespace MLAPI.Data
|
4 | 5 | {
|
| 6 | + |
| 7 | + /// <summary> |
| 8 | + /// Interface for networked value containers |
| 9 | + /// </summary> |
| 10 | + public interface INetworkedVar |
| 11 | + { |
| 12 | + /// <summary> |
| 13 | + /// Returns the name of the channel to be used for syncing |
| 14 | + /// </summary> |
| 15 | + /// <returns>The name of the channel to be used for syncing</returns> |
| 16 | + string GetChannel(); |
| 17 | + /// <summary> |
| 18 | + /// Resets the dirty state and marks the variable as synced / clean |
| 19 | + /// </summary> |
| 20 | + void ResetDirty(); |
| 21 | + /// <summary> |
| 22 | + /// Gets wheter or not the container is dirty |
| 23 | + /// </summary> |
| 24 | + /// <returns>Wheter or not the container is dirty</returns> |
| 25 | + bool IsDirty(); |
| 26 | + /// <summary> |
| 27 | + /// Gets wheter or not a specific client can write to the varaible |
| 28 | + /// </summary> |
| 29 | + /// <param name="clientId">The clientId of the remote client</param> |
| 30 | + /// <returns>Wheter or not the client can write to the variable</returns> |
| 31 | + bool CanClientWrite(uint clientId); |
| 32 | + /// <summary> |
| 33 | + /// Gets wheter or not a specific client can read to the varaible |
| 34 | + /// </summary> |
| 35 | + /// <param name="clientId">The clientId of the remote client</param> |
| 36 | + /// <returns>Wheter or not the client can read to the variable</returns> |
| 37 | + bool CanClientRead(uint clientId); |
| 38 | + /// <summary> |
| 39 | + /// Writes the dirty changes, that is, the changes since the variable was last dirty, to the writer |
| 40 | + /// </summary> |
| 41 | + /// <param name="writer">The writer to write the dirty changes to</param> |
| 42 | + void WriteDelta(BitWriter writer); |
| 43 | + /// <summary> |
| 44 | + /// Writes the complete state of the variable to the writer |
| 45 | + /// </summary> |
| 46 | + /// <param name="writer">The writer to write the state to</param> |
| 47 | + void WriteField(BitWriter writer); |
| 48 | + /// <summary> |
| 49 | + /// Reads the complete state from the reader and applies it |
| 50 | + /// </summary> |
| 51 | + /// <param name="reader">The reader to read the state from</param> |
| 52 | + void ReadField(BitReader reader); |
| 53 | + /// <summary> |
| 54 | + /// Reads delta from the reader and applies them to the internal value |
| 55 | + /// </summary> |
| 56 | + /// <param name="reader">The reader to read the delta from</param> |
| 57 | + void ReadDelta(BitReader reader); |
| 58 | + /// <summary> |
| 59 | + /// Sets NetworkedBehaviour the container belongs to. |
| 60 | + /// </summary> |
| 61 | + /// <param name="behaviour">The behaviour the container behaves to</param> |
| 62 | + void SetNetworkedBehaviour(NetworkedBehaviour behaviour); |
| 63 | + } |
| 64 | + |
5 | 65 | /// <summary>
|
6 | 66 | /// The settings class used by the build in NetworkVar implementations
|
7 | 67 | /// </summary>
|
|
0 commit comments