mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-21 18:55:17 +00:00
Set defaults with constructor to fix an error
This commit is contained in:
parent
bf15f51eb3
commit
b3bcf72283
3 changed files with 15 additions and 9 deletions
|
@ -5,9 +5,11 @@ namespace Shared.Packet.Packets;
|
|||
|
||||
[Packet(PacketType.Connect)]
|
||||
public struct ConnectPacket : IPacket {
|
||||
public ConnectionTypes ConnectionType;
|
||||
public ConnectionTypes ConnectionType = ConnectionTypes.FirstConnection;
|
||||
public string ClientName = "?????";
|
||||
|
||||
public ConnectPacket() { }
|
||||
|
||||
public void Serialize(Span<byte> data) {
|
||||
MemoryMarshal.Write(data, ref ConnectionType);
|
||||
Encoding.UTF8.GetBytes(ClientName).CopyTo(data[4..(4 + Constants.CostumeNameSize)]);
|
||||
|
|
|
@ -8,17 +8,17 @@ namespace Shared.Packet.Packets;
|
|||
public struct PlayerPacket : IPacket {
|
||||
public const int NameSize = 0x20;
|
||||
|
||||
public Vector3 Position;
|
||||
public Quaternion Rotation;
|
||||
public Vector3 Position = default;
|
||||
public Quaternion Rotation = default;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public float[] AnimationBlendWeights;
|
||||
public float[] AnimationBlendWeights = Array.Empty<float>();
|
||||
|
||||
public float AnimationRate;
|
||||
public bool Is2d;
|
||||
public bool ThrowingCap;
|
||||
public bool IsIt;
|
||||
public int ScenarioNum;
|
||||
public float AnimationRate = 0;
|
||||
public bool Is2d = false;
|
||||
public bool ThrowingCap = false;
|
||||
public bool IsIt = false;
|
||||
public int ScenarioNum = 0;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x40)]
|
||||
public string Stage = "";
|
||||
|
@ -32,6 +32,8 @@ public struct PlayerPacket : IPacket {
|
|||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = NameSize)]
|
||||
public string Hack = "";
|
||||
|
||||
public PlayerPacket() { }
|
||||
|
||||
public void Serialize(Span<byte> data) {
|
||||
int offset = 0;
|
||||
MemoryMarshal.Write(data, ref Position);
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
public struct UnhandledPacket : IPacket {
|
||||
public byte[] Data = new byte[Constants.PacketDataSize];
|
||||
|
||||
public UnhandledPacket() { }
|
||||
|
||||
public void Serialize(Span<byte> data) {
|
||||
Data.CopyTo(data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue