Skip to content

Commit

Permalink
Moved NetworkManager to a singleton pattern.
Browse files Browse the repository at this point in the history
  • Loading branch information
vchelaru committed Mar 12, 2019
1 parent 3699f5b commit 14bbbba
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static NetworkManager Self
{
if(self == null)
{
throw new InvalidOperationException("NetworkManager must first be constructed in a class such as Game1");
self = new NetworkManager();
}
return self;
}
Expand Down Expand Up @@ -159,14 +159,19 @@ public INetworkArena GameArena
private INetworkArena mGameArena;


NetworkManager()
{

}

/// <summary>
/// Instantiate the Network.
/// WARNING: If no logger is provided, all messages will be swallowed.
/// </summary>
/// <param name="config">Configuration for networking</param>
/// <param name="arena">The game arena</param>
/// <param name="log">An ILogger to write messages to</param>
public NetworkManager(NetworkConfiguration config, ILogger log = null)
public void Initialize(NetworkConfiguration config, ILogger log = null)
{
self = this;
Configuration = config;
Expand Down

0 comments on commit 14bbbba

Please sign in to comment.