mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
[server] Handle viewport updates sent by clients
This commit is contained in:
parent
ac0d947e31
commit
a7fd57d1e6
3 changed files with 34 additions and 1 deletions
21
Nibriboard/Client/Messages/ViewportUpdateMessage.cs
Normal file
21
Nibriboard/Client/Messages/ViewportUpdateMessage.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using SBRL.Utilities;
|
||||||
|
|
||||||
|
namespace Nibriboard.Client.Messages
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an update from the client on the new size of their viewport.
|
||||||
|
/// </summary>
|
||||||
|
public class ViewportUpdateMessage : Message
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The new dimensions of the client's viewport.
|
||||||
|
/// </summary>
|
||||||
|
public Rectangle NewViewport { get; set; }
|
||||||
|
|
||||||
|
public ViewportUpdateMessage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -57,7 +57,8 @@ namespace Nibriboard.Client
|
||||||
["ChunkUpdateRequest"] = typeof(ChunkUpdateRequestMessage),
|
["ChunkUpdateRequest"] = typeof(ChunkUpdateRequestMessage),
|
||||||
["LineStart"] = typeof(LineStartMessage),
|
["LineStart"] = typeof(LineStartMessage),
|
||||||
["LinePart"] = typeof(LinePartMessage),
|
["LinePart"] = typeof(LinePartMessage),
|
||||||
["LineComplete"] = typeof(LineCompleteMessage)
|
["LineComplete"] = typeof(LineCompleteMessage),
|
||||||
|
["ViewportUpdate"] = typeof(ViewportUpdateMessage)
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -386,6 +387,16 @@ namespace Nibriboard.Client
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles viewport updates from the remote client.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">The viewport update message to handle.</param>
|
||||||
|
protected Task handleViewportUpdateMessage(ViewportUpdateMessage message) {
|
||||||
|
CurrentViewPort = message.NewViewport;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles line start events from the client.
|
/// Handles line start events from the client.
|
||||||
/// These messages are currently only required to let other clients know about
|
/// These messages are currently only required to let other clients know about
|
||||||
|
|
|
@ -110,6 +110,7 @@
|
||||||
<Compile Include="Utilities\CalcPaths.cs" />
|
<Compile Include="Utilities\CalcPaths.cs" />
|
||||||
<Compile Include="RippleSpace\PlaneInfo.cs" />
|
<Compile Include="RippleSpace\PlaneInfo.cs" />
|
||||||
<Compile Include="Utilities\BinaryIO.cs" />
|
<Compile Include="Utilities\BinaryIO.cs" />
|
||||||
|
<Compile Include="Client\Messages\ViewportUpdateMessage.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="ClientFiles\index.html" />
|
<EmbeddedResource Include="ClientFiles\index.html" />
|
||||||
|
|
Loading…
Reference in a new issue