Hashtable fields = new Hashtable();
fields["RegionHandle"] = regionHandle;
fields["LookAt"] = lookAt;
fields["Position"] = position;
blocks[fields] = "Info";
fields = new Hashtable();
fields["AgentID"] = Client.Network.AgentID;
fields["SessionID"] = Client.Network.SessionID;
blocks[fields] = "AgentData";
Packet packet = PacketBuilder.BuildPacket("TeleportLocationRequest", Client.Protocol, blocks);
teleportlocationrequest.RegionHandle = regionHandle;
teleportlocationrequest.LookAt = lookAt;
teleportlocationrequest.Position = position;
teleportlocationrequest.AgentID = Client.Network.AgentID;
teleportlocationrequest.SessionID = Client.Network.SessionID;
Packet packet = BinaryMarshaller.Marshall( teleportlocationrequest );
public class TeleportLocationRequest
{
[BlockInfo]
public U64 RegionHandle;
[BlockInfo]
public LLVector3 LookAt = new LLVector3();
[BlockInfo]
public LLVector3 Position = new LLVector3();
[BlockAgentData]
public LLUUID AgentID = new LLUUID();
[BlockAgentData]
public LLUUID SessionID = new LLUUID();
}
Pretty easy to do, the attributes are fairly easy to read?
Method 2: use classes for each block
teleportlocationrequest.Info.RegionHandle = regionHandle;
teleportlocationrequest.Info.LookAt = lookAt;
teleportlocationrequest.Info.Position = position;
teleportlocationrequest.AgentData.AgentID = Client.Network.AgentID;
teleportlocationrequest.AgentData.SessionID = Client.Network.SessionID;
Packet packet = BinaryMarshaller.Marshall( teleportlocationrequest );
public class TeleportLocationRequest
{
public class _Info
{
public U64 RegionHandle;
public LLVector3 LookAt = new LLVector3();
public LLVector3 Position = new LLVector3();
}
public class _AgentData
{
public LLUUID AgentID = new LLUUID();
public LLUUID SessionID = new LLUUID();
}
public _Info Info = new _Info();
public _AgentData AgentData = new _AgentData();
}
... or possibly some other variant on naming, to avoid using underscores.
Again, fairly easy to do, so unclear which is better.
_______________________________________________ libsecondlife-dev mailing list [email protected] https://mail.gna.org/listinfo/libsecondlife-dev
