r2mods/ilspy_dump/ror2_csproj/RoR2/NetworkRuleChoiceMask.cs

69 lines
1.3 KiB
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using JetBrains.Annotations;
using UnityEngine;
using UnityEngine.Networking;
namespace RoR2;
[DefaultExecutionOrder(-1)]
public class NetworkRuleChoiceMask : NetworkBehaviour
{
private const uint maskDirtyBit = 1u;
public RuleChoiceMask ruleChoiceMask { get; private set; }
private void Awake()
{
ruleChoiceMask = new RuleChoiceMask();
}
[Server]
public void SetRuleChoiceMask([NotNull] RuleChoiceMask newRuleChoiceMask)
{
if (!NetworkServer.active)
{
Debug.LogWarning("[Server] function 'System.Void RoR2.NetworkRuleChoiceMask::SetRuleChoiceMask(RoR2.RuleChoiceMask)' called on client");
}
else if (!ruleChoiceMask.Equals(newRuleChoiceMask))
{
SetDirtyBit(1u);
ruleChoiceMask.Copy(newRuleChoiceMask);
}
}
public override bool OnSerialize(NetworkWriter writer, bool initialState)
{
uint num = base.syncVarDirtyBits;
if (initialState)
{
num = 1u;
}
bool num2 = (num & 1) != 0;
writer.Write((byte)num);
if (num2)
{
writer.Write(ruleChoiceMask);
}
if (!initialState)
{
return num != 0;
}
return false;
}
public override void OnDeserialize(NetworkReader reader, bool initialState)
{
if (((uint)reader.ReadByte() & (true ? 1u : 0u)) != 0)
{
reader.ReadRuleChoiceMask(ruleChoiceMask);
}
}
private void UNetVersion()
{
}
public override void PreStartClient()
{
}
}