quantum-space-buddies/QSB/Events/LeaveMessage.cs
AmazingAlek f239acd724
cleanup after disconnected players (#62)
* * removed need for NetPlayer
* split JoinPlayer into JoinPlayer and LeavePlayer
* cleanup of player and ship in LeavePlayer

* null checks in anim mirror

* it kinda works

* resetting some more stuff when DCing

* cleaning up ship

* removed some unused code

* cleanup

* cleaning up all client owned objects

* resetting (mostly) anim stuff when leaving

* setting local instance on player transform sync right away

Co-authored-by: Ricardo Lopes <Raicuparta@users.noreply.github.com>
2020-03-07 16:42:43 +01:00

27 lines
716 B
C#

using System;
using System.Linq;
using QSB.Messaging;
using UnityEngine.Networking;
namespace QSB.Events
{
public class LeaveMessage : NameMessage
{
public override MessageType MessageType => MessageType.Leave;
public uint[] ObjectIds { get; set; }
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
ObjectIds = reader.ReadString().Split(',').Select(x => Convert.ToUInt32(x)).ToArray();
}
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(string.Join(",", ObjectIds.Select(x => x.ToString()).ToArray()));
}
}
}