51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
public class NetPackageGetServerVariablesRebirth : NetPackage
|
|
{
|
|
private int entityPlayerID;
|
|
private int dayLightLength;
|
|
|
|
public NetPackageGetServerVariablesRebirth Setup(int _entityPlayerID, int _dayLightLength)
|
|
{
|
|
this.entityPlayerID = _entityPlayerID;
|
|
this.dayLightLength = _dayLightLength;
|
|
return this;
|
|
}
|
|
|
|
public override void read(PooledBinaryReader _br)
|
|
{
|
|
this.entityPlayerID = _br.ReadInt32();
|
|
this.dayLightLength = _br.ReadInt32();
|
|
}
|
|
|
|
public override void write(PooledBinaryWriter _bw)
|
|
{
|
|
base.write(_bw);
|
|
_bw.Write(this.entityPlayerID);
|
|
_bw.Write((int)this.dayLightLength);
|
|
}
|
|
|
|
public override int GetLength()
|
|
{
|
|
return 4;
|
|
}
|
|
|
|
public override void ProcessPackage(World _world, GameManager _callbacks)
|
|
{
|
|
if (_world == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
|
|
{
|
|
//Log.Out("NetPackageGetServerVariablesRebirth-ProcessPackage SEND TO CLIENT");
|
|
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageGetServerVariablesRebirth>().Setup(this.entityPlayerID, GamePrefs.GetInt(EnumGamePrefs.DayLightLength)), false, entityPlayerID, -1, -1, null, 192);
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("NetPackageGetServerVariablesRebirth-ProcessPackage this.dayLightLength: " + this.dayLightLength);
|
|
RebirthVariables.DayLightLength = this.dayLightLength;
|
|
}
|
|
}
|
|
}
|
|
|