mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-30 23:23:07 +00:00
Add ChangeStagePacket
This commit is contained in:
parent
51a39fa258
commit
3525ac2099
6 changed files with 26 additions and 6 deletions
|
@ -11,5 +11,6 @@ public enum PacketType : short {
|
||||||
Costume,
|
Costume,
|
||||||
Shine,
|
Shine,
|
||||||
Capture,
|
Capture,
|
||||||
|
ChangeStage,
|
||||||
Command
|
Command
|
||||||
}
|
}
|
|
@ -5,7 +5,6 @@ namespace Shared.Packet.Packets;
|
||||||
|
|
||||||
[Packet(PacketType.Capture)]
|
[Packet(PacketType.Capture)]
|
||||||
public struct CapturePacket : IPacket {
|
public struct CapturePacket : IPacket {
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.CostumeNameSize)]
|
|
||||||
public string ModelName;
|
public string ModelName;
|
||||||
|
|
||||||
public short Size => Constants.CostumeNameSize;
|
public short Size => Constants.CostumeNameSize;
|
||||||
|
|
25
Shared/Packet/Packets/ChangeStagePacket.cs
Normal file
25
Shared/Packet/Packets/ChangeStagePacket.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Shared.Packet.Packets;
|
||||||
|
|
||||||
|
[Packet(PacketType.ChangeStage)]
|
||||||
|
public struct ChangeStagePacket : IPacket {
|
||||||
|
private const int IdSize = 0x10;
|
||||||
|
private const int StageSize = 0x30;
|
||||||
|
public string Stage = "";
|
||||||
|
public string Id = "";
|
||||||
|
public byte Scenario = 0;
|
||||||
|
public byte SubScenarioType = 0;
|
||||||
|
public ChangeStagePacket() { }
|
||||||
|
public short Size => 0x44;
|
||||||
|
public void Serialize(Span<byte> data) {
|
||||||
|
Encoding.UTF8.GetBytes(Stage).CopyTo(data[..StageSize]);
|
||||||
|
Encoding.UTF8.GetBytes(Id).CopyTo(data[StageSize..(IdSize + StageSize)]);
|
||||||
|
MemoryMarshal.Write(data[(IdSize + StageSize)..(IdSize + StageSize + 1)], ref Scenario);
|
||||||
|
MemoryMarshal.Write(data[(IdSize + StageSize + 1)..(IdSize + StageSize + 2)], ref SubScenarioType);
|
||||||
|
}
|
||||||
|
public void Deserialize(Span<byte> data) {
|
||||||
|
throw new NotImplementedException("This packet should not be sent by the client.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,10 +5,7 @@ namespace Shared.Packet.Packets;
|
||||||
|
|
||||||
[Packet(PacketType.Costume)]
|
[Packet(PacketType.Costume)]
|
||||||
public struct CostumePacket : IPacket {
|
public struct CostumePacket : IPacket {
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.CostumeNameSize)]
|
|
||||||
public string BodyName;
|
public string BodyName;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.CostumeNameSize)]
|
|
||||||
public string CapName;
|
public string CapName;
|
||||||
|
|
||||||
public short Size => Constants.CostumeNameSize * 2;
|
public short Size => Constants.CostumeNameSize * 2;
|
||||||
|
|
|
@ -8,7 +8,6 @@ public struct GamePacket : IPacket {
|
||||||
private const int StageSize = 0x30;
|
private const int StageSize = 0x30;
|
||||||
public bool Is2d;
|
public bool Is2d;
|
||||||
public byte ScenarioNum;
|
public byte ScenarioNum;
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = StageSize)]
|
|
||||||
public string Stage = "";
|
public string Stage = "";
|
||||||
|
|
||||||
public GamePacket() {
|
public GamePacket() {
|
||||||
|
|
|
@ -12,7 +12,6 @@ public struct PlayerPacket : IPacket {
|
||||||
public Vector3 Position;
|
public Vector3 Position;
|
||||||
public Quaternion Rotation;
|
public Quaternion Rotation;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
|
||||||
public float[] AnimationBlendWeights = Array.Empty<float>();
|
public float[] AnimationBlendWeights = Array.Empty<float>();
|
||||||
|
|
||||||
public ushort Act;
|
public ushort Act;
|
||||||
|
|
Loading…
Reference in a new issue