mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
mirror can read and write arrays and lists
This commit is contained in:
parent
1f6636065f
commit
f70c8751a1
@ -16,22 +16,13 @@ namespace QSB.EyeOfTheUniverse.ForestOfGalaxies.Messages
|
||||
public override void Serialize(NetworkWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(_deathDelays.Count);
|
||||
foreach (var item in _deathDelays)
|
||||
{
|
||||
writer.Write(item);
|
||||
}
|
||||
writer.WriteList(_deathDelays);
|
||||
}
|
||||
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
var length = reader.Read<int>();
|
||||
_deathDelays = new List<float>(length);
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
_deathDelays.Add(reader.Read<float>());
|
||||
}
|
||||
_deathDelays = reader.ReadList<float>();
|
||||
}
|
||||
|
||||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
|
||||
|
@ -40,11 +40,7 @@ namespace QSB.SaveSync.Messages
|
||||
writer.Write(LaunchCodesGiven);
|
||||
writer.Write(LoopCount);
|
||||
|
||||
writer.Write(KnownFrequencies.Length);
|
||||
foreach (var item in KnownFrequencies)
|
||||
{
|
||||
writer.Write(item);
|
||||
}
|
||||
writer.WriteArray(KnownFrequencies);
|
||||
|
||||
writer.Write(KnownSignals.Count);
|
||||
foreach (var (name, discovered) in KnownSignals)
|
||||
@ -62,12 +58,7 @@ namespace QSB.SaveSync.Messages
|
||||
LaunchCodesGiven = reader.Read<bool>();
|
||||
LoopCount = reader.Read<int>();
|
||||
|
||||
var frequenciesLength = reader.Read<int>();
|
||||
KnownFrequencies = new bool[frequenciesLength];
|
||||
for (var i = 0; i < frequenciesLength; i++)
|
||||
{
|
||||
KnownFrequencies[i] = reader.Read<bool>();
|
||||
}
|
||||
KnownFrequencies = reader.ReadArray<bool>();
|
||||
|
||||
var signalsLength = reader.Read<int>();
|
||||
KnownSignals = new Dictionary<int, bool>(signalsLength);
|
||||
|
@ -21,18 +21,13 @@ namespace QSB.TriggerSync.Messages
|
||||
public override void Serialize(NetworkWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(_playerIds.Length);
|
||||
_playerIds.ForEach(writer.Write);
|
||||
writer.WriteArray(_playerIds);
|
||||
}
|
||||
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
_playerIds = new uint[reader.ReadInt()];
|
||||
for (var i = 0; i < _playerIds.Length; i++)
|
||||
{
|
||||
_playerIds[i] = reader.ReadUInt();
|
||||
}
|
||||
_playerIds = reader.ReadArray<uint>();
|
||||
}
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
|
Loading…
Reference in New Issue
Block a user