Upload from upload_mods.ps1
This commit is contained in:
51
Scripts/Network/NetPackageChangeNPCName.cs
Normal file
51
Scripts/Network/NetPackageChangeNPCName.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageChangeNPCName : NetPackage
|
||||
{
|
||||
public NetPackageChangeNPCName Setup(int _npcEntityID, string _newName)
|
||||
{
|
||||
this.npcEntityID = _npcEntityID;
|
||||
this.newName = _newName;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.npcEntityID = _reader.ReadInt32();
|
||||
this.newName = _reader.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.npcEntityID);
|
||||
_writer.Write(this.newName);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageChangeNPCName-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageChangeNPCName-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityNPCRebirth npc = _world.GetEntity(this.npcEntityID) as EntityNPCRebirth;
|
||||
|
||||
if (npc != null)
|
||||
{
|
||||
npc.SetEntityName(this.newName);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
private int npcEntityID;
|
||||
private string newName;
|
||||
}
|
||||
Reference in New Issue
Block a user