73 lines
2.0 KiB
C#
73 lines
2.0 KiB
C#
using static EntityDrone;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
|
|
public class NetPackageQuickstackLockedTiles : NetPackage
|
|
{
|
|
private int playerID;
|
|
private bool mine;
|
|
public List<Vector3i> tileList;
|
|
|
|
|
|
public NetPackageQuickstackLockedTiles Setup(int playerID,
|
|
bool mine,
|
|
List<Vector3i> tileList
|
|
)
|
|
{
|
|
this.playerID = playerID;
|
|
this.mine = mine;
|
|
this.tileList = tileList;
|
|
|
|
return this;
|
|
}
|
|
|
|
public override void read(PooledBinaryReader _br)
|
|
{
|
|
this.playerID = _br.ReadInt32();
|
|
this.mine = _br.ReadBoolean();
|
|
this.tileList = new List<Vector3i>();
|
|
int num = _br.ReadInt32();
|
|
for (int index = 0; index < num; ++index)
|
|
this.tileList.Add(StreamUtils.ReadVector3i((BinaryReader)_br));
|
|
}
|
|
|
|
public override void write(PooledBinaryWriter _bw)
|
|
{
|
|
base.write(_bw);
|
|
_bw.Write(this.playerID);
|
|
_bw.Write(this.mine);
|
|
if (this.tileList == null)
|
|
{
|
|
_bw.Write(0);
|
|
}
|
|
else
|
|
{
|
|
_bw.Write(this.tileList.Count);
|
|
for (int index = 0; index < this.tileList.Count; ++index)
|
|
StreamUtils.Write((BinaryWriter)_bw, this.tileList[index]);
|
|
}
|
|
}
|
|
|
|
public override int GetLength()
|
|
{
|
|
return 10;
|
|
}
|
|
|
|
public override void ProcessPackage(World _world, GameManager _callbacks)
|
|
{
|
|
//Log.Out("NetPackageQuickstackLockedTiles-ProcessPackage START");
|
|
if (_world == null)
|
|
{
|
|
//Log.Out("NetPackageQuickstackLockedTiles-ProcessPackage 1");
|
|
return;
|
|
}
|
|
|
|
if (GameManager.Instance.World.GetEntity(this.playerID) is EntityPlayer player)
|
|
{
|
|
//Log.Out("NetPackageQuickstackLockedTiles-ProcessPackage 2");
|
|
RebirthUtilities.QuickStackOnClick(player, mine, tileList);
|
|
}
|
|
}
|
|
}
|
|
|