1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Add ExcecptionMessage

This commit is contained in:
Starbeamrainbowlabs 2017-03-20 18:21:41 +00:00
parent c4947474cd
commit e8beaec1c3
3 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,37 @@
using System;
namespace Nibriboard.Client.Messages
{
/// <summary>
/// Represents a tantrum thrown by either the server or the client.
/// Both act like 2 year olds, apparently :P
/// </summary>
public class ExceptionMessage : Message
{
/// <summary>
/// The number code associated with this exception.
/// </summary>
public uint Code = 0;
/// <summary>
/// The error message.
/// </summary>
public string Message = string.Empty;
/// <summary>
/// Creates a new ExceptionMessage.
/// </summary>
/// <param name="inCode">The exception code.</param>
/// <param name="inMessage">The exception message.</param>
public ExceptionMessage(uint inCode, string inMessage)
{
Code = inCode;
Message = inMessage;
}
/// <summary>
/// Creates a new ExceptionMessage.
/// </summary>
/// <param name="inMessage">The exception message.</param>
public ExceptionMessage(string inMessage) : this(0, inMessage)
{
}
}
}

View file

@ -265,6 +265,20 @@ namespace Nibriboard.Client
return Task.CompletedTask; return Task.CompletedTask;
} }
/// <summary>
/// Handles an incoming plane change request.
/// </summary>
protected Task handlePlaneChangeMessage(PlaneChangeMessage message)
{
if(manager.SpaceManager[message.NewPlaneName] == default(Plane))
throw new NotImplementedException(); // todo create a new plane here
message.IsOK = true;
Send(message);
return Task.CompletedTask;
}
/// <summary> /// <summary>
/// Handles an incoming cursor position message from the client.. /// Handles an incoming cursor position message from the client..

View file

@ -91,6 +91,7 @@
<Compile Include="Client\Messages\HeartbeatMessage.cs" /> <Compile Include="Client\Messages\HeartbeatMessage.cs" />
<Compile Include="Client\Messages\ChunkUpdateMessage.cs" /> <Compile Include="Client\Messages\ChunkUpdateMessage.cs" />
<Compile Include="Client\Messages\PlaneChangeMessage.cs" /> <Compile Include="Client\Messages\PlaneChangeMessage.cs" />
<Compile Include="Client\Messages\ExceptionMessage.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="ClientFiles\index.html" /> <EmbeddedResource Include="ClientFiles\index.html" />