2022-01-14 07:38:45 +00:00
|
|
|
|
using Mirror;
|
|
|
|
|
using QSB.Messaging;
|
2021-12-23 09:50:09 +00:00
|
|
|
|
using QSB.OrbSync.WorldObjects;
|
2020-12-07 18:49:51 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
namespace QSB.OrbSync.Messages;
|
2021-12-23 09:50:09 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public class OrbSlotMessage : QSBWorldObjectMessage<QSBOrb, int>
|
|
|
|
|
{
|
|
|
|
|
private bool _playAudio;
|
2021-12-23 09:50:09 +00:00
|
|
|
|
|
2022-03-11 01:57:50 +00:00
|
|
|
|
public OrbSlotMessage(int slotIndex, bool playAudio) : base(slotIndex) =>
|
2022-03-03 03:46:33 +00:00
|
|
|
|
_playAudio = playAudio;
|
2022-02-25 06:04:54 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public override void Serialize(NetworkWriter writer)
|
|
|
|
|
{
|
|
|
|
|
base.Serialize(writer);
|
|
|
|
|
writer.Write(_playAudio);
|
|
|
|
|
}
|
2022-02-27 12:40:44 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public override void Deserialize(NetworkReader reader)
|
|
|
|
|
{
|
|
|
|
|
base.Deserialize(reader);
|
|
|
|
|
_playAudio = reader.Read<bool>();
|
2022-02-27 12:40:44 +00:00
|
|
|
|
}
|
2022-03-03 03:46:33 +00:00
|
|
|
|
|
|
|
|
|
public override void OnReceiveRemote() => WorldObject.SetSlot(Data, _playAudio);
|
2022-02-25 06:04:54 +00:00
|
|
|
|
}
|