mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-03-24 10:19:10 +00:00
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
63 lines
1.8 KiB
C#
Executable file
63 lines
1.8 KiB
C#
Executable file
using FSO.Common.Serialization;
|
|
using Mina.Core.Buffer;
|
|
using FSO.Common.Enum;
|
|
|
|
namespace FSO.Server.Protocol.Electron.Packets
|
|
{
|
|
public class InstantMessage : AbstractElectronPacket
|
|
{
|
|
public UserReferenceType FromType;
|
|
public uint From;
|
|
public uint To;
|
|
public InstantMessageType Type;
|
|
public string Message;
|
|
public string AckID;
|
|
public InstantMessageFailureReason Reason = InstantMessageFailureReason.NONE;
|
|
public uint Color;
|
|
|
|
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
|
{
|
|
FromType = input.GetEnum<UserReferenceType>();
|
|
From = input.GetUInt32();
|
|
To = input.GetUInt32();
|
|
Type = input.GetEnum<InstantMessageType>();
|
|
Message = input.GetPascalVLCString();
|
|
AckID = input.GetPascalVLCString();
|
|
Reason = input.GetEnum<InstantMessageFailureReason>();
|
|
Color = input.GetUInt32();
|
|
}
|
|
|
|
public override ElectronPacketType GetPacketType()
|
|
{
|
|
return ElectronPacketType.InstantMessage;
|
|
}
|
|
|
|
public override void Serialize(IoBuffer output, ISerializationContext context)
|
|
{
|
|
output.PutEnum(FromType);
|
|
output.PutUInt32(From);
|
|
output.PutUInt32(To);
|
|
output.PutEnum(Type);
|
|
output.PutPascalVLCString(Message);
|
|
output.PutPascalVLCString(AckID);
|
|
output.PutEnum(Reason);
|
|
output.PutUInt32(Color);
|
|
}
|
|
}
|
|
|
|
public enum InstantMessageType
|
|
{
|
|
MESSAGE,
|
|
SUCCESS_ACK,
|
|
FAILURE_ACK
|
|
}
|
|
|
|
public enum InstantMessageFailureReason
|
|
{
|
|
NONE,
|
|
THEY_ARE_OFFLINE,
|
|
THEY_ARE_IGNORING_YOU,
|
|
YOU_ARE_IGNORING_THEM,
|
|
MESSAGE_QUEUE_FULL
|
|
}
|
|
}
|