diff --git a/Nibriboard/Client/LineIncubator.cs b/Nibriboard/Client/LineIncubator.cs
index c79dfb4..6b7d4be 100644
--- a/Nibriboard/Client/LineIncubator.cs
+++ b/Nibriboard/Client/LineIncubator.cs
@@ -5,24 +5,6 @@ using SBRL.Utilities;
namespace Nibriboard.Client
{
- public class LinePartEventArgs : EventArgs
- {
- ///
- /// The client who drew the additional points.
- ///
- public NibriClient DrawingClient;
- ///
- /// The id of the line that justu had some points added to it.
- ///
- public string LineId;
- ///
- /// The new points that got added to the line.
- ///
- public List NewPoints;
- }
-
- public delegate void OnLinePartAddition(object sender, LinePartEventArgs eventArgs);
-
///
/// Manages the construction of lines that the clients are drawing bit by bit.
///
@@ -47,11 +29,6 @@ namespace Nibriboard.Client
}
}
- ///
- /// Fired when points get added to a line in this incubator.
- ///
- public event OnLinePartAddition OnLinePartAddition;
-
public LineIncubator()
{
}
@@ -72,7 +49,7 @@ namespace Nibriboard.Client
///
/// The line id to add the points to.
/// The points to add to the lines.
- public void AddBit(NibriClient drawingClient, string lineId, List points)
+ public void AddBit(string lineId, List points)
{
// Create a new line if one doesn't exist already
if(!currentLines.ContainsKey(lineId))
@@ -80,12 +57,6 @@ namespace Nibriboard.Client
// Add these points to the line
currentLines[lineId].Points.AddRange(points);
-
- OnLinePartAddition(this, new LinePartEventArgs() {
- DrawingClient = drawingClient,
- LineId = lineId,
- NewPoints = points
- });
}
///
diff --git a/Nibriboard/Client/Messages/LinePartReflectionMessage.cs b/Nibriboard/Client/Messages/LinePartReflectionMessage.cs
new file mode 100644
index 0000000..a2f9e59
--- /dev/null
+++ b/Nibriboard/Client/Messages/LinePartReflectionMessage.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+
+using SBRL.Utilities;
+
+namespace Nibriboard.Client.Messages
+{
+ ///
+ /// The reflection of a that's sent to everyone else on the same plane.
+ /// Contains a list of point the client has added to the line they're drawing.
+ ///
+ public class LinePartReflectionMessage : Message
+ {
+ ///
+ /// The id of the client drawing the line.
+ ///
+ public int OtherClientId;
+ ///
+ /// The id of the line to add the points to.
+ ///
+ public string LineId;
+ ///
+ /// The points to add to the line
+ ///
+ public List Points;
+
+ public LinePartReflectionMessage()
+ {
+ }
+ }
+}
diff --git a/Nibriboard/Client/NibriClient.cs b/Nibriboard/Client/NibriClient.cs
index 0661d20..cf2b78c 100644
--- a/Nibriboard/Client/NibriClient.cs
+++ b/Nibriboard/Client/NibriClient.cs
@@ -122,8 +122,6 @@ namespace Nibriboard.Client
manager = inManager;
client = inClient;
- manager.LineIncubator.OnLinePartAddition += handleLinePartAddition;
-
client.DataReceived += async (WebSocket clientSocket, string frame) => {
try
{
@@ -401,6 +399,12 @@ namespace Nibriboard.Client
manager.LineIncubator.AddBit(message.LineId, linePoints);
+ manager.BroadcastPlane(this, new LinePartReflectionMessage() {
+ OtherClientId = Id,
+ LineId = message.LineId,
+ Points = message.Points
+ });
+
return Task.CompletedTask;
}
@@ -448,16 +452,6 @@ namespace Nibriboard.Client
Send(clientNotification);
}
- protected void handleLinePartAddition(object sender, LinePartEventArgs eventArgs)
- {
- // Ignore line part additions for ourselves and for clienst who aren't on the same plane as us
- if(eventArgs.DrawingClient.Id == Id ||
- eventArgs.DrawingClient.CurrentPlane != CurrentPlane)
- return;
-
-
- }
-
#endregion
diff --git a/Nibriboard/Nibriboard.csproj b/Nibriboard/Nibriboard.csproj
index 3e2b8c5..6542174 100644
--- a/Nibriboard/Nibriboard.csproj
+++ b/Nibriboard/Nibriboard.csproj
@@ -101,6 +101,7 @@
+