Skip to content

Commit 761dc99

Browse files
committed
refactor: Made Obsolete methods not editor browsable
1 parent a13b57f commit 761dc99

8 files changed

Lines changed: 41 additions & 1 deletion

MLAPI/Core/NetworkedBehaviour.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using UnityEngine;
45
using System.Reflection;
56
using System.Linq;
@@ -27,6 +28,7 @@ public abstract partial class NetworkedBehaviour : MonoBehaviour
2728
/// <summary>
2829
/// Gets if the object is the the personal clients player object
2930
/// </summary>
31+
[EditorBrowsable(EditorBrowsableState.Never)]
3032
[Obsolete("Use IsLocalPlayer instead", false)]
3133
public bool isLocalPlayer => IsLocalPlayer;
3234
/// <summary>
@@ -36,6 +38,7 @@ public abstract partial class NetworkedBehaviour : MonoBehaviour
3638
/// <summary>
3739
/// Gets if the object is owned by the local player or if the object is the local player object
3840
/// </summary>
41+
[EditorBrowsable(EditorBrowsableState.Never)]
3942
[Obsolete("Use IsOwner instead", false)]
4043
public bool isOwner => IsOwner;
4144
/// <summary>
@@ -45,6 +48,7 @@ public abstract partial class NetworkedBehaviour : MonoBehaviour
4548
/// <summary>
4649
/// Gets if we are executing as server
4750
/// </summary>
51+
[EditorBrowsable(EditorBrowsableState.Never)]
4852
[Obsolete("Use IsServer instead", false)]
4953
protected bool isServer => IsServer;
5054
/// <summary>
@@ -54,6 +58,7 @@ public abstract partial class NetworkedBehaviour : MonoBehaviour
5458
/// <summary>
5559
/// Gets if we are executing as client
5660
/// </summary>
61+
[EditorBrowsable(EditorBrowsableState.Never)]
5762
[Obsolete("Use IsClient instead")]
5863
protected bool isClient => IsClient;
5964
/// <summary>
@@ -63,6 +68,7 @@ public abstract partial class NetworkedBehaviour : MonoBehaviour
6368
/// <summary>
6469
/// Gets if we are executing as Host, I.E Server and Client
6570
/// </summary>
71+
[EditorBrowsable(EditorBrowsableState.Never)]
6672
[Obsolete("Use IsHost instead", false)]
6773
protected bool isHost => IsHost;
6874
/// <summary>
@@ -73,6 +79,7 @@ public abstract partial class NetworkedBehaviour : MonoBehaviour
7379
/// <summary>
7480
/// Gets wheter or not the object has a owner
7581
/// </summary>
82+
[EditorBrowsable(EditorBrowsableState.Never)]
7683
[Obsolete("Use IsOwnedByServer instead", false)]
7784
public bool isOwnedByServer => IsOwnedByServer;
7885
/// <summary>
@@ -86,6 +93,7 @@ public abstract partial class NetworkedBehaviour : MonoBehaviour
8693
/// <summary>
8794
/// Gets the NetworkedObject that owns this NetworkedBehaviour instance
8895
/// </summary>
96+
[EditorBrowsable(EditorBrowsableState.Never)]
8997
[Obsolete("Use NetworkedObject instead", false)]
9098
public NetworkedObject networkedObject => NetworkedObject;
9199
/// <summary>
@@ -107,6 +115,7 @@ public NetworkedObject NetworkedObject
107115
/// <summary>
108116
/// Gets the NetworkId of the NetworkedObject that owns the NetworkedBehaviour instance
109117
/// </summary>
118+
[EditorBrowsable(EditorBrowsableState.Never)]
110119
[Obsolete("Use NetworkId instead", false)]
111120
public ulong networkId => NetworkId;
112121
/// <summary>

MLAPI/Core/NetworkedObject.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using System.IO;
45
using MLAPI.Configuration;
56
using MLAPI.Exceptions;
@@ -85,6 +86,7 @@ internal set
8586
/// <summary>
8687
/// Gets if this object is a player object
8788
/// </summary>
89+
[EditorBrowsable(EditorBrowsableState.Never)]
8890
[Obsolete("Use IsPlayerObject instead", false)]
8991
public bool isPlayerObject => IsPlayerObject;
9092
/// <summary>
@@ -94,6 +96,7 @@ internal set
9496
/// <summary>
9597
/// Gets if the object is the the personal clients player object
9698
/// </summary>
99+
[EditorBrowsable(EditorBrowsableState.Never)]
97100
[Obsolete("Use IsLocalPlayer instead", false)]
98101
public bool isLocalPlayer => IsLocalPlayer;
99102
/// <summary>
@@ -103,6 +106,7 @@ internal set
103106
/// <summary>
104107
/// Gets if the object is owned by the local player or if the object is the local player object
105108
/// </summary>
109+
[EditorBrowsable(EditorBrowsableState.Never)]
106110
[Obsolete("Use IsOwner instead", false)]
107111
public bool isOwner => IsOwner;
108112
/// <summary>
@@ -112,6 +116,7 @@ internal set
112116
/// <summary>
113117
/// Gets wheter or not the object is owned by anyone
114118
/// </summary>
119+
[EditorBrowsable(EditorBrowsableState.Never)]
115120
[Obsolete("Use IsOwnedByServer instead", false)]
116121
public bool isOwnedByServer => IsOwnedByServer;
117122
/// <summary>
@@ -121,6 +126,7 @@ internal set
121126
/// <summary>
122127
/// Gets if the object has yet been spawned across the network
123128
/// </summary>
129+
[EditorBrowsable(EditorBrowsableState.Never)]
124130
[Obsolete("Use IsSpawned instead", false)]
125131
public bool isSpawned => IsSpawned;
126132
/// <summary>

MLAPI/Core/NetworkingManager.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4+
using System.ComponentModel;
45
using UnityEngine;
56
using System.Linq;
67
using MLAPI.Logging;
@@ -52,6 +53,7 @@ public class NetworkingManager : MonoBehaviour
5253
/// <summary>
5354
/// The singleton instance of the NetworkingManager
5455
/// </summary>
56+
[EditorBrowsable(EditorBrowsableState.Never)]
5557
[Obsolete("Use Singleton instead", false)]
5658
public static NetworkingManager singleton => Singleton;
5759
/// <summary>
@@ -93,6 +95,7 @@ internal set
9395
/// <summary>
9496
/// Gets wheter or not a server is running
9597
/// </summary>
98+
[EditorBrowsable(EditorBrowsableState.Never)]
9699
[Obsolete("Use IsServer instead", false)]
97100
public bool isServer => IsServer;
98101
/// <summary>
@@ -102,6 +105,7 @@ internal set
102105
/// <summary>
103106
/// Gets wheter or not a client is running
104107
/// </summary>
108+
[EditorBrowsable(EditorBrowsableState.Never)]
105109
[Obsolete("Use IsClient instead", false)]
106110
public bool isClient => IsClient;
107111
/// <summary>
@@ -111,6 +115,7 @@ internal set
111115
/// <summary>
112116
/// Gets if we are running as host
113117
/// </summary>
118+
[EditorBrowsable(EditorBrowsableState.Never)]
114119
[Obsolete("Use IsHost instead", false)]
115120
public bool isHost => IsHost;
116121
/// <summary>
@@ -120,6 +125,7 @@ internal set
120125
/// <summary>
121126
/// Gets wheter or not we are listening for connections
122127
/// </summary>
128+
[EditorBrowsable(EditorBrowsableState.Never)]
123129
[Obsolete("Use IsListening instead", false)]
124130
public bool isListening => IsListening;
125131
/// <summary>
@@ -129,6 +135,7 @@ internal set
129135
/// <summary>
130136
/// Gets if we are connected as a client
131137
/// </summary>
138+
[EditorBrowsable(EditorBrowsableState.Never)]
132139
[Obsolete("Use IsConnectedClient instead", false)]
133140
public bool isConnectedClients => IsConnectedClient;
134141
/// <summary>

MLAPI/Core/RPCMethods/NetworkedBehaviour.BoxedClientRpc.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ public void InvokeClientRpcOnEveryoneExcept<T1, T2, T3, T4, T5, T6, T7, T8, T9,
11071107
{
11081108
SendClientRPCBoxedToEveryoneExcept(clientIdToIgnore, HashMethodName(methodName), channel, security, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15);
11091109
}
1110-
1110+
11111111
public void InvokeClientRpc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(string methodName, List<ulong> clientIds, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
11121112
{
11131113
SendClientRPCBoxed(HashMethodName(methodName), clientIds, channel, security, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16);

MLAPI/Core/RPCMethods/NetworkedBehaviour.PerformanceClientRpc.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using System.IO;
45
using MLAPI.Messaging;
56
using MLAPI.Security;
@@ -10,60 +11,70 @@ namespace MLAPI
1011
public abstract partial class NetworkedBehaviour : MonoBehaviour
1112
{
1213
#pragma warning disable 1591
14+
[EditorBrowsable(EditorBrowsableState.Never)]
1315
[Obsolete("Use InvokeClientRpcPerformance instead")]
1416
public void InvokeClientRpc(RpcDelegate method, List<ulong> clientIds, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
1517
{
1618
SendClientRPCPerformance(HashMethod(method.Method), clientIds, stream, channel, security);
1719
}
1820

21+
[EditorBrowsable(EditorBrowsableState.Never)]
1922
[Obsolete("Use InvokeClientRpcOnOwnerPerformance instead")]
2023
public void InvokeClientRpcOnOwner(RpcDelegate method, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
2124
{
2225
SendClientRPCPerformance(HashMethod(method.Method), OwnerClientId, stream, channel, security);
2326
}
2427

28+
[EditorBrowsable(EditorBrowsableState.Never)]
2529
[Obsolete("Use InvokeClientRpcOnClientPerformance instead")]
2630
public void InvokeClientRpcOnClient(RpcDelegate method, ulong clientId, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
2731
{
2832
SendClientRPCPerformance(HashMethod(method.Method), clientId, stream, channel, security);
2933
}
3034

35+
[EditorBrowsable(EditorBrowsableState.Never)]
3136
[Obsolete("Use InvokeClientRpcOnEveryonePerformance instead")]
3237
public void InvokeClientRpcOnEveryone(RpcDelegate method, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
3338
{
3439
SendClientRPCPerformance(HashMethod(method.Method), null, stream, channel, security);
3540
}
3641

42+
[EditorBrowsable(EditorBrowsableState.Never)]
3743
[Obsolete("Use InvokeClientRpcOnEveryoneExceptPerformance instead")]
3844
public void InvokeClientRpcOnEveryoneExcept(RpcDelegate method, ulong clientIdToIgnore, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
3945
{
4046
SendClientRPCPerformance(HashMethod(method.Method), stream, clientIdToIgnore, channel, security);
4147
}
4248

49+
[EditorBrowsable(EditorBrowsableState.Never)]
4350
[Obsolete("Use InvokeClientRpcPerformance instead")]
4451
public void InvokeClientRpc(string methodName, List<ulong> clientIds, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
4552
{
4653
SendClientRPCPerformance(HashMethodName(methodName), clientIds, stream, channel, security);
4754
}
4855

56+
[EditorBrowsable(EditorBrowsableState.Never)]
4957
[Obsolete("Use InvokeClientRpcOnClientPerformance instead")]
5058
public void InvokeClientRpcOnClient(string methodName, ulong clientId, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
5159
{
5260
SendClientRPCPerformance(HashMethodName(methodName), clientId, stream, channel, security);
5361
}
5462

63+
[EditorBrowsable(EditorBrowsableState.Never)]
5564
[Obsolete("Use InvokeClientRpcOnOwnerPerformance instead")]
5665
public void InvokeClientRpcOnOwner(string methodName, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
5766
{
5867
SendClientRPCPerformance(HashMethodName(methodName), OwnerClientId, stream, channel, security);
5968
}
6069

70+
[EditorBrowsable(EditorBrowsableState.Never)]
6171
[Obsolete("Use InvokeClientRpcOnEveryonePerformance instead")]
6272
public void InvokeClientRpcOnEveryone(string methodName, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
6373
{
6474
SendClientRPCPerformance(HashMethodName(methodName), null, stream, channel, security);
6575
}
6676

77+
[EditorBrowsable(EditorBrowsableState.Never)]
6778
[Obsolete("Use InvokeClientRpcOnEveryoneExceptPerformance instead")]
6879
public void InvokeClientRpcOnEveryoneExcept(string methodName, ulong clientIdToIgnore, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
6980
{

MLAPI/Core/RPCMethods/NetworkedBehaviour.PerformanceServerRpc.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.IO;
34
using MLAPI.Messaging;
45
using MLAPI.Security;
@@ -9,12 +10,14 @@ namespace MLAPI
910
public abstract partial class NetworkedBehaviour : MonoBehaviour
1011
{
1112
#pragma warning disable 1591
13+
[EditorBrowsable(EditorBrowsableState.Never)]
1214
[Obsolete("Use InvokeServerRpcPerformance instead")]
1315
public void InvokeServerRpc(RpcDelegate method, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
1416
{
1517
SendServerRPCPerformance(HashMethod(method.Method), stream, channel, security);
1618
}
1719

20+
[EditorBrowsable(EditorBrowsableState.Never)]
1821
[Obsolete("Use InvokeServerRpcPerformance instead")]
1922
public void InvokeServerRpc(string methodName, Stream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
2023
{

MLAPI/Serialization/BitReader.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#define ARRAY_DIFF_ALLOW_RESIZE // Whether or not to permit writing diffs of differently sized arrays
55

66
using System;
7+
using System.ComponentModel;
78
using System.IO;
89
using System.Text;
910
using MLAPI.Reflection;
@@ -362,6 +363,7 @@ public Quaternion ReadRotationPacked()
362363
/// Reads the rotation from the stream
363364
/// </summary>
364365
/// <returns>The rotation read from the stream</returns>
366+
[EditorBrowsable(EditorBrowsableState.Never)]
365367
[Obsolete("Use ReadRotationPacked instead")]
366368
public Quaternion ReadRotation(int bytesPerAngle)
367369
{

MLAPI/Serialization/BitWriter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#define ARRAY_DIFF_ALLOW_RESIZE // Whether or not to permit writing diffs of differently sized arrays
55

66
using System;
7+
using System.ComponentModel;
78
using System.Diagnostics;
89
using System.IO;
910
using MLAPI.Reflection;
@@ -424,6 +425,7 @@ public void WriteRotationPacked(Quaternion rotation)
424425
/// </summary>
425426
/// <param name="rotation">Rotation to write</param>
426427
/// <param name="bytesPerAngle">Unused</param>
428+
[EditorBrowsable(EditorBrowsableState.Never)]
427429
[Obsolete("Use WriteRotationPacked instead")]
428430
public void WriteRotation(Quaternion rotation, int bytesPerAngle)
429431
{

0 commit comments

Comments
 (0)