Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Scripts/Network/NetPackageUpdatePurgeDisplay.cs
Nathaniel Cosford e06f2bd282 Add All Mods
2025-05-29 23:33:28 +09:30

127 lines
6.6 KiB
C#

public class NetPackageUpdatePurgeDisplay : NetPackage
{
private string prefabName;
private float posX;
private float posY;
private float posZ;
private int currentSleeperEntityCount;
private int currentSleeperVolumeCount;
private int maxSleeperVolumeCount;
private float currentSleeperVolumePerc;
private int clearedSleeperVolumeCount;
private int totalSleeperVolumeCount;
private int currentPOITier;
public NetPackageUpdatePurgeDisplay Setup(string _prefabName, float _posX, float _posY, float _posZ, int _currentSleeperEntityCount, int _currentSleeperVolumeCount, int _maxSleeperVolumeCount, float _currentSleeperVolumePerc, int _clearedSleeperVolumeCount, int _totalSleeperVolumeCount, int _currentPOITier)
{
this.prefabName = _prefabName;
this.posX = _posX;
this.posY = _posY;
this.posZ = _posZ;
this.currentSleeperEntityCount = _currentSleeperEntityCount;
this.currentSleeperVolumeCount = _currentSleeperVolumeCount;
this.maxSleeperVolumeCount = _maxSleeperVolumeCount;
this.currentSleeperVolumePerc = _currentSleeperVolumePerc;
this.clearedSleeperVolumeCount = _clearedSleeperVolumeCount;
this.totalSleeperVolumeCount = _totalSleeperVolumeCount;
this.currentPOITier = _currentPOITier;
return this;
}
public override void read(PooledBinaryReader _br)
{
this.prefabName = _br.ReadString();
this.posX = _br.ReadSingle();
this.posY = _br.ReadSingle();
this.posZ = _br.ReadSingle();
this.currentSleeperEntityCount = _br.ReadInt32();
this.currentSleeperVolumeCount = _br.ReadInt32();
this.maxSleeperVolumeCount = _br.ReadInt32();
this.currentSleeperVolumePerc = _br.ReadSingle();
this.clearedSleeperVolumeCount = _br.ReadInt32();
this.totalSleeperVolumeCount = _br.ReadInt32();
this.currentPOITier = _br.ReadInt32();
}
public override void write(PooledBinaryWriter _bw)
{
base.write(_bw);
_bw.Write(this.prefabName);
_bw.Write(this.posX);
_bw.Write(this.posY);
_bw.Write(this.posZ);
_bw.Write(this.currentSleeperEntityCount);
_bw.Write(this.currentSleeperVolumeCount);
_bw.Write(this.maxSleeperVolumeCount);
_bw.Write(this.currentSleeperVolumePerc);
_bw.Write(this.clearedSleeperVolumeCount);
_bw.Write(this.totalSleeperVolumeCount);
_bw.Write(this.currentPOITier);
}
public override int GetLength()
{
return 14;
}
public override void ProcessPackage(World _world, GameManager _callbacks)
{
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage START");
if (_world == null)
{
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage 1");
return;
}
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.purgePrefabName: " + RebirthVariables.purgePrefabName);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.purgePrefabPosition: " + RebirthVariables.purgePrefabPosition);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.prefabName: " + this.prefabName);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage new Vector3(this.posX, this.posY, this.posZ): " + new Vector3(this.posX, this.posY, this.posZ));
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.currentSleeperEntityCount: " + this.currentSleeperEntityCount);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.currentSleeperVolumeCount: " + this.currentSleeperVolumeCount);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.maxSleeperVolumeCount: " + this.maxSleeperVolumeCount);
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
if (primaryPlayer != null)
{
if (RebirthVariables.purgePrefabName == this.prefabName &&
RebirthVariables.purgePrefabPosition == new Vector3(this.posX, this.posY, this.posZ))
{
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage 2");
RebirthVariables.currentSleeperEntityCount = this.currentSleeperEntityCount;
RebirthVariables.currentSleeperVolumeCount = this.currentSleeperVolumeCount;
RebirthVariables.maxSleeperVolumeCount = this.maxSleeperVolumeCount;
RebirthVariables.currentSleeperVolumePerc = this.currentSleeperVolumePerc;
RebirthVariables.clearedSleeperVolumeCount = this.clearedSleeperVolumeCount;
RebirthVariables.totalSleeperVolumeCount = this.totalSleeperVolumeCount;
RebirthVariables.currentPOITier = this.currentPOITier;
}
else
{
if (RebirthVariables.purgePrefabName == "")
{
RebirthVariables.currentSleeperEntityCount = this.currentSleeperEntityCount;
RebirthVariables.currentSleeperVolumeCount = this.currentSleeperVolumeCount;
RebirthVariables.maxSleeperVolumeCount = this.maxSleeperVolumeCount;
RebirthVariables.currentSleeperVolumePerc = this.currentSleeperVolumePerc;
RebirthVariables.clearedSleeperVolumeCount = this.clearedSleeperVolumeCount;
RebirthVariables.totalSleeperVolumeCount = this.totalSleeperVolumeCount;
RebirthVariables.purgeDisplay = false;
RebirthVariables.currentPOITier = this.currentPOITier;
}
}
}
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.currentPOITier: " + this.currentPOITier);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.currentPOITier: " + RebirthVariables.currentPOITier);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.totalSleeperVolumeCount: " + RebirthVariables.totalSleeperVolumeCount);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.currentSleeperVolumeCount: " + RebirthVariables.currentSleeperVolumeCount);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.maxSleeperVolumeCount: " + RebirthVariables.maxSleeperVolumeCount);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.currentSleeperEntityCount: " + RebirthVariables.currentSleeperEntityCount);
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.currentSleeperVolumePerc: " + RebirthVariables.currentSleeperVolumePerc);
}
}