Skip to content

Commit 96d4a2a

Browse files
committed
Added public constructors
1 parent 7ce738c commit 96d4a2a

File tree

3 files changed

+62
-3
lines changed

3 files changed

+62
-3
lines changed

MLAPI/Data/NetworkedCollections/NetworkedDictionary.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Collections.Generic;
44
using MLAPI.MonoBehaviours.Core;
55
using MLAPI.NetworkingManagerComponents.Binary;
6-
using MLAPI.NetworkingManagerComponents.Core;
76

87
namespace MLAPI.Data.NetworkedCollections
98
{
@@ -41,6 +40,27 @@ internal enum NetworkedListEventType
4140
private readonly IDictionary<TKey, TValue> dictionary = new Dictionary<TKey, TValue>();
4241
private NetworkedBehaviour networkedBehaviour;
4342
private readonly List<NetworkedDictionaryEvent<TKey, TValue>> dirtyEvents = new List<NetworkedDictionaryEvent<TKey, TValue>>();
43+
44+
public NetworkedDictionary()
45+
{
46+
47+
}
48+
49+
public NetworkedDictionary(NetworkedVarSettings settings)
50+
{
51+
this.Settings = settings;
52+
}
53+
54+
public NetworkedDictionary(NetworkedVarSettings settings, IDictionary<TKey, TValue> value)
55+
{
56+
this.Settings = settings;
57+
this.dictionary = value;
58+
}
59+
60+
public NetworkedDictionary(IDictionary<TKey, TValue> value)
61+
{
62+
this.dictionary = value;
63+
}
4464

4565
/// <inheritdoc />
4666
public void ResetDirty()

MLAPI/Data/NetworkedCollections/NetworkedList.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,28 @@ internal enum NetworkedListEventType
4141
/// </summary>
4242
public readonly NetworkedVarSettings Settings = new NetworkedVarSettings();
4343

44+
45+
public NetworkedList()
46+
{
47+
48+
}
49+
50+
public NetworkedList(NetworkedVarSettings settings)
51+
{
52+
this.Settings = settings;
53+
}
54+
55+
public NetworkedList(NetworkedVarSettings settings, IList<T> value)
56+
{
57+
this.Settings = settings;
58+
this.list = value;
59+
}
60+
61+
public NetworkedList(IList<T> value)
62+
{
63+
this.list = value;
64+
}
65+
4466
/// <inheritdoc />
4567
public void ResetDirty()
4668
{

MLAPI/Data/NetworkedVar.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,26 @@ public class NetworkedVar<T> : INetworkedVar
3434
/// </summary>
3535
public OnValueChangedDelegate OnValueChanged;
3636
private NetworkedBehaviour networkedBehaviour;
37-
38-
internal NetworkedVar()
37+
38+
public NetworkedVar()
39+
{
40+
41+
}
42+
43+
public NetworkedVar(NetworkedVarSettings settings)
44+
{
45+
this.Settings = settings;
46+
}
47+
48+
public NetworkedVar(NetworkedVarSettings settings, T value)
49+
{
50+
this.Settings = settings;
51+
this.InternalValue = value;
52+
}
53+
54+
public NetworkedVar(T value)
3955
{
56+
this.InternalValue = value;
4057
}
4158

4259
private T InternalValue;

0 commit comments

Comments
 (0)