mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
Add references to the ripple space manager to allow the nibri clients to interact with it.
This commit is contained in:
parent
8572ed6d52
commit
f3c2806243
3 changed files with 33 additions and 3 deletions
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using Nibriboard.Client.Messages;
|
||||
using System.Threading;
|
||||
using Nibriboard.RippleSpace;
|
||||
|
||||
namespace Nibriboard.Client
|
||||
{
|
||||
|
@ -13,6 +14,11 @@ namespace Nibriboard.Client
|
|||
/// </summary>
|
||||
public class NibriClientManager : IWebSocketRequestHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// The ripple space manager that this client manager is connected to.
|
||||
/// </summary>
|
||||
public RippleSpaceManager SpaceManager;
|
||||
|
||||
private ClientSettings clientSettings;
|
||||
public List<NibriClient> Clients = new List<NibriClient>();
|
||||
|
||||
|
@ -35,10 +41,12 @@ namespace Nibriboard.Client
|
|||
}
|
||||
}
|
||||
|
||||
public NibriClientManager(ClientSettings inClientSettings, CancellationToken inCancellationToken)
|
||||
public NibriClientManager(ClientSettings inClientSettings, RippleSpaceManager inSpaceManager, CancellationToken inCancellationToken)
|
||||
{
|
||||
clientSettings = inClientSettings;
|
||||
canceller = inCancellationToken;
|
||||
|
||||
spaceManager = inSpaceManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Nibriboard
|
|||
private RippleSpaceManager planeManager = new RippleSpaceManager();
|
||||
|
||||
private readonly CancellationTokenSource clientManagerCanceller = new CancellationTokenSource();
|
||||
private NibriClientManager clientManager;
|
||||
|
||||
public readonly int Port = 31586;
|
||||
|
||||
|
@ -52,9 +53,15 @@ namespace Nibriboard
|
|||
);
|
||||
|
||||
// Websocket setup
|
||||
clientManager = new NibriClientManager(
|
||||
clientSettings,
|
||||
|
||||
clientManagerCanceller.Token
|
||||
);
|
||||
httpServer.AddWebSocketRequestHandler(
|
||||
clientSettings.WebsocketPath,
|
||||
new NibriClientManager(clientSettings, clientManagerCanceller.Token)
|
||||
|
||||
clientManager
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,22 @@ namespace Nibriboard.RippleSpace
|
|||
Log.WriteLine("[RippleSpace] New blank ripplespace initialised.");
|
||||
}
|
||||
|
||||
public Plane GetById(string targetName)
|
||||
/// <summary>
|
||||
/// Gets the plane with the specified name from this RippleSpace.
|
||||
/// </summary>
|
||||
/// <param name="planeName">The plane name to retrieve.</param>
|
||||
public Plane this[string planeName] {
|
||||
get {
|
||||
return GetById(planeName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plane with the specified name from this RippleSpace.
|
||||
/// </summary>
|
||||
/// <param name="targetName">The plane name to retrieve.</param>
|
||||
/// <returns>The plane wwith the specified name.</returns>
|
||||
protected Plane GetById(string targetName)
|
||||
{
|
||||
foreach (Plane plane in Planes)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue