Skip to content

Commit 5a24af8

Browse files
committed
refactor: Moved NetworkedVar classes to own files
1 parent 73e00e5 commit 5a24af8

3 files changed

Lines changed: 76 additions & 73 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using System.IO;
1+
using System.IO;
22

33
namespace MLAPI.NetworkedVar
44
{
5-
65
/// <summary>
76
/// Interface for networked value containers
87
/// </summary>
@@ -61,74 +60,4 @@ public interface INetworkedVar
6160
/// <param name="behaviour">The behaviour the container behaves to</param>
6261
void SetNetworkedBehaviour(NetworkedBehaviour behaviour);
6362
}
64-
65-
/// <summary>
66-
/// The settings class used by the build in NetworkVar implementations
67-
/// </summary>
68-
public class NetworkedVarSettings
69-
{
70-
/// <summary>
71-
/// Defines the read permissions for this var
72-
/// </summary>
73-
public NetworkedVarPermission WritePermission = NetworkedVarPermission.ServerOnly;
74-
/// <summary>
75-
/// Defines the write permissions for this var
76-
/// </summary>
77-
public NetworkedVarPermission ReadPermission = NetworkedVarPermission.Everyone;
78-
/// <summary>
79-
/// The delegate used to evaluate write permission when the "Custom" mode is used
80-
/// </summary>
81-
public NetworkedVarPermissionsDelegate WritePermissionCallback = null;
82-
/// <summary>
83-
/// The delegate used to evaluate read permission when the "Custom" mode is used
84-
/// </summary>
85-
public NetworkedVarPermissionsDelegate ReadPermissionCallback = null;
86-
/// <summary>
87-
/// The maximum times per second this var will be synced.
88-
/// Less than or equal to 0 will cause the variable to sync as soon as possible after being changed.
89-
/// </summary>
90-
public float SendTickrate = 0;
91-
/// <summary>
92-
/// The name of the channel to use for this variable.
93-
/// Variables with different channels will be split into different packets
94-
/// </summary>
95-
public string SendChannel = "MLAPI_INTERNAL";
96-
97-
/// <summary>
98-
/// Constructs a new NetworkedVarSettings instance
99-
/// </summary>
100-
public NetworkedVarSettings()
101-
{
102-
103-
}
104-
}
105-
106-
/// <summary>
107-
/// Delegate type for permission checking
108-
/// </summary>
109-
/// <param name="clientId">The clientId whose permissions to check</param>
110-
public delegate bool NetworkedVarPermissionsDelegate(ulong clientId);
111-
112-
/// <summary>
113-
/// Permission type
114-
/// </summary>
115-
public enum NetworkedVarPermission
116-
{
117-
/// <summary>
118-
/// Everyone
119-
/// </summary>
120-
Everyone,
121-
/// <summary>
122-
/// Server-only operation
123-
/// </summary>
124-
ServerOnly,
125-
/// <summary>
126-
/// Owner-ownly
127-
/// </summary>
128-
OwnerOnly,
129-
/// <summary>
130-
/// Custom delegate
131-
/// </summary>
132-
Custom
133-
}
134-
}
63+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace MLAPI.NetworkedVar
2+
{
3+
/// <summary>
4+
/// Permission type
5+
/// </summary>
6+
public enum NetworkedVarPermission
7+
{
8+
/// <summary>
9+
/// Everyone
10+
/// </summary>
11+
Everyone,
12+
/// <summary>
13+
/// Server-only operation
14+
/// </summary>
15+
ServerOnly,
16+
/// <summary>
17+
/// Owner-ownly
18+
/// </summary>
19+
OwnerOnly,
20+
/// <summary>
21+
/// Custom delegate
22+
/// </summary>
23+
Custom
24+
}
25+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
namespace MLAPI.NetworkedVar
2+
{
3+
/// <summary>
4+
/// Delegate type for permission checking
5+
/// </summary>
6+
/// <param name="clientId">The clientId whose permissions to check</param>
7+
public delegate bool NetworkedVarPermissionsDelegate(ulong clientId);
8+
9+
/// <summary>
10+
/// The settings class used by the build in NetworkVar implementations
11+
/// </summary>
12+
public class NetworkedVarSettings
13+
{
14+
/// <summary>
15+
/// Defines the read permissions for this var
16+
/// </summary>
17+
public NetworkedVarPermission WritePermission = NetworkedVarPermission.ServerOnly;
18+
/// <summary>
19+
/// Defines the write permissions for this var
20+
/// </summary>
21+
public NetworkedVarPermission ReadPermission = NetworkedVarPermission.Everyone;
22+
/// <summary>
23+
/// The delegate used to evaluate write permission when the "Custom" mode is used
24+
/// </summary>
25+
public NetworkedVarPermissionsDelegate WritePermissionCallback = null;
26+
/// <summary>
27+
/// The delegate used to evaluate read permission when the "Custom" mode is used
28+
/// </summary>
29+
public NetworkedVarPermissionsDelegate ReadPermissionCallback = null;
30+
/// <summary>
31+
/// The maximum times per second this var will be synced.
32+
/// Less than or equal to 0 will cause the variable to sync as soon as possible after being changed.
33+
/// </summary>
34+
public float SendTickrate = 0;
35+
/// <summary>
36+
/// The name of the channel to use for this variable.
37+
/// Variables with different channels will be split into different packets
38+
/// </summary>
39+
public string SendChannel = "MLAPI_INTERNAL";
40+
41+
/// <summary>
42+
/// Constructs a new NetworkedVarSettings instance
43+
/// </summary>
44+
public NetworkedVarSettings()
45+
{
46+
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)