本文整理汇总了C#中OpenMetaverse.Simulator.SendPacket方法的典型用法代码示例。如果您正苦于以下问题:C# Simulator.SendPacket方法的具体用法?C# Simulator.SendPacket怎么用?C# Simulator.SendPacket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenMetaverse.Simulator
的用法示例。
在下文中一共展示了Simulator.SendPacket方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateOtherCleanTime
/// <summary>
/// Set Autoreturn time
/// </summary>
/// <param name="simulator">Simulator to send the update to</param>
public void UpdateOtherCleanTime(Simulator simulator)
{
ParcelSetOtherCleanTimePacket request = new ParcelSetOtherCleanTimePacket();
request.AgentData.AgentID = simulator.Client.Self.AgentID;
request.AgentData.SessionID = simulator.Client.Self.SessionID;
request.ParcelData.LocalID = this.LocalID;
request.ParcelData.OtherCleanTime = this.OtherCleanTime;
simulator.SendPacket(request);
}
示例2: SendPacket
/// <summary>
/// Send a packet to a specified simulator
/// </summary>
/// <param name="packet">Packet to send</param>
/// <param name="simulator">Simulator to send the packet to</param>
public void SendPacket(Packet packet, Simulator simulator)
{
if (simulator != null)
simulator.SendPacket(packet, true);
}
示例3: Update
/// <summary>
/// Update the simulator with any local changes to this Parcel object
/// </summary>
/// <param name="simulator">Simulator to send updates to</param>
/// <param name="wantReply">Whether we want the simulator to confirm
/// the update with a reply packet or not</param>
public void Update(Simulator simulator, bool wantReply)
{
Uri url = simulator.Caps.CapabilityURI("ParcelPropertiesUpdate");
if (url != null)
{
ParcelPropertiesUpdateMessage req = new ParcelPropertiesUpdateMessage();
req.AuthBuyerID = this.AuthBuyerID;
req.Category = this.Category;
req.Desc = this.Desc;
req.GroupID = this.GroupID;
req.Landing = this.Landing;
req.LocalID = this.LocalID;
req.MediaAutoScale = this.Media.MediaAutoScale;
req.MediaDesc = this.Media.MediaDesc;
req.MediaHeight = this.Media.MediaHeight;
req.MediaID = this.Media.MediaID;
req.MediaLoop = this.Media.MediaLoop;
req.MediaType = this.Media.MediaType;
req.MediaURL = this.Media.MediaURL;
req.MediaWidth = this.Media.MediaWidth;
req.MusicURL = this.MusicURL;
req.Name = this.Name;
req.ObscureMedia = this.ObscureMedia;
req.ObscureMusic = this.ObscureMusic;
req.ParcelFlags = this.Flags;
req.PassHours = this.PassHours;
req.PassPrice = (uint)this.PassPrice;
req.SalePrice = (uint)this.SalePrice;
req.SnapshotID = this.SnapshotID;
req.UserLocation = this.UserLocation;
req.UserLookAt = this.UserLookAt;
OSDMap body = req.Serialize();
CapsClient capsPost = new CapsClient(url);
capsPost.BeginGetResponse(body, OSDFormat.Xml, simulator.Client.Settings.CAPS_TIMEOUT);
}
else
{
ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();
request.AgentData.AgentID = simulator.Client.Self.AgentID;
request.AgentData.SessionID = simulator.Client.Self.SessionID;
request.ParcelData.LocalID = this.LocalID;
request.ParcelData.AuthBuyerID = this.AuthBuyerID;
request.ParcelData.Category = (byte)this.Category;
request.ParcelData.Desc = Utils.StringToBytes(this.Desc);
request.ParcelData.GroupID = this.GroupID;
request.ParcelData.LandingType = (byte)this.Landing;
request.ParcelData.MediaAutoScale = (this.Media.MediaAutoScale) ? (byte)0x1 : (byte)0x0;
request.ParcelData.MediaID = this.Media.MediaID;
request.ParcelData.MediaURL = Utils.StringToBytes(this.Media.MediaURL.ToString());
request.ParcelData.MusicURL = Utils.StringToBytes(this.MusicURL.ToString());
request.ParcelData.Name = Utils.StringToBytes(this.Name);
if (wantReply) request.ParcelData.Flags = 1;
request.ParcelData.ParcelFlags = (uint)this.Flags;
request.ParcelData.PassHours = this.PassHours;
request.ParcelData.PassPrice = this.PassPrice;
request.ParcelData.SalePrice = this.SalePrice;
request.ParcelData.SnapshotID = this.SnapshotID;
request.ParcelData.UserLocation = this.UserLocation;
request.ParcelData.UserLookAt = this.UserLookAt;
simulator.SendPacket(request);
}
UpdateOtherCleanTime(simulator);
}
示例4: SendPacket
/// <summary>
/// Send a packet to a specified simulator
/// </summary>
/// <param name="packet">Packet to send</param>
/// <param name="simulator">Simulator to send the packet to</param>
public void SendPacket(Packet packet, Simulator simulator)
{
if (simulator != null)
{
simulator.SendPacket(packet);
}
else
{
Logger.Log("Packet received before simulator packet processing threads running, make certain you are completely logged in", Helpers.LogLevel.Error);
}
}
示例5: Update
/// <summary>
/// Update the simulator with any local changes to this Parcel object
/// </summary>
/// <param name="simulator">Simulator to send updates to</param>
/// <param name="wantReply">Whether we want the simulator to confirm
/// the update with a reply packet or not</param>
public void Update(Simulator simulator, bool wantReply)
{
Uri url = simulator.Caps.CapabilityURI("ParcelPropertiesUpdate");
if (url != null)
{
OSDMap body = new OSDMap();
body["auth_buyer_id"] = OSD.FromUUID(this.AuthBuyerID);
body["auto_scale"] = OSD.FromInteger(this.Media.MediaAutoScale);
body["category"] = OSD.FromInteger((byte)this.Category);
body["description"] = OSD.FromString(this.Desc);
body["flags"] = OSD.FromBinary(Utils.EmptyBytes);
body["group_id"] = OSD.FromUUID(this.GroupID);
body["landing_type"] = OSD.FromInteger((byte)this.Landing);
body["local_id"] = OSD.FromInteger(this.LocalID);
body["media_desc"] = OSD.FromString(this.Media.MediaDesc);
body["media_height"] = OSD.FromInteger(this.Media.MediaHeight);
body["media_id"] = OSD.FromUUID(this.Media.MediaID);
body["media_loop"] = OSD.FromInteger(this.Media.MediaLoop ? 1 : 0);
body["media_type"] = OSD.FromString(this.Media.MediaType);
body["media_url"] = OSD.FromString(this.Media.MediaURL);
body["media_width"] = OSD.FromInteger(this.Media.MediaWidth);
body["music_url"] = OSD.FromString(this.MusicURL);
body["name"] = OSD.FromString(this.Name);
body["obscure_media"]= OSD.FromInteger(this.ObscureMedia ? 1 : 0);
body["obscure_music"] = OSD.FromInteger(this.ObscureMusic ? 1 : 0);
byte[] flags = Utils.IntToBytes((int)this.Flags); ;
if (BitConverter.IsLittleEndian)
Array.Reverse(flags);
body["parcel_flags"] = OSD.FromBinary(flags);
body["pass_hours"] = OSD.FromReal(this.PassHours);
body["pass_price"] = OSD.FromInteger(this.PassPrice);
body["sale_price"] = OSD.FromInteger(this.SalePrice);
body["snapshot_id"] = OSD.FromUUID(this.SnapshotID);
OSDArray uloc = new OSDArray();
uloc.Add(OSD.FromReal(this.UserLocation.X));
uloc.Add(OSD.FromReal(this.UserLocation.Y));
uloc.Add(OSD.FromReal(this.UserLocation.Z));
body["user_location"] = uloc;
OSDArray ulat = new OSDArray();
ulat.Add(OSD.FromReal(this.UserLocation.X));
ulat.Add(OSD.FromReal(this.UserLocation.Y));
ulat.Add(OSD.FromReal(this.UserLocation.Z));
body["user_look_at"] = ulat;
//Console.WriteLine("OSD REQUEST\n{0}", body.ToString());
byte[] postData = StructuredData.OSDParser.SerializeLLSDXmlBytes(body);
//Console.WriteLine("{0}", OSDParser.SerializeLLSDXmlString(body));
CapsClient capsPost = new CapsClient(url);
capsPost.StartRequest(postData);
}
else
{
ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();
request.AgentData.AgentID = simulator.Client.Self.AgentID;
request.AgentData.SessionID = simulator.Client.Self.SessionID;
request.ParcelData.LocalID = this.LocalID;
request.ParcelData.AuthBuyerID = this.AuthBuyerID;
request.ParcelData.Category = (byte)this.Category;
request.ParcelData.Desc = Utils.StringToBytes(this.Desc);
request.ParcelData.GroupID = this.GroupID;
request.ParcelData.LandingType = (byte)this.Landing;
request.ParcelData.MediaAutoScale = this.Media.MediaAutoScale;
request.ParcelData.MediaID = this.Media.MediaID;
request.ParcelData.MediaURL = Utils.StringToBytes(this.Media.MediaURL);
request.ParcelData.MusicURL = Utils.StringToBytes(this.MusicURL);
request.ParcelData.Name = Utils.StringToBytes(this.Name);
if (wantReply) request.ParcelData.Flags = 1;
request.ParcelData.ParcelFlags = (uint)this.Flags;
request.ParcelData.PassHours = this.PassHours;
request.ParcelData.PassPrice = this.PassPrice;
request.ParcelData.SalePrice = this.SalePrice;
request.ParcelData.SnapshotID = this.SnapshotID;
request.ParcelData.UserLocation = this.UserLocation;
request.ParcelData.UserLookAt = this.UserLookAt;
simulator.SendPacket(request, true);
}
UpdateOtherCleanTime(simulator);
}
示例6: Update
/// <summary>
/// Update the simulator with any local changes to this Parcel object
/// </summary>
/// <param name="simulator">Simulator to send updates to</param>
/// <param name="wantReply">Whether we want the simulator to confirm
/// the update with a reply packet or not</param>
public void Update(Simulator simulator, bool wantReply)
{
ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();
request.AgentData.AgentID = simulator.Client.Self.AgentID;
request.AgentData.SessionID = simulator.Client.Self.SessionID;
request.ParcelData.LocalID = this.LocalID;
request.ParcelData.AuthBuyerID = this.AuthBuyerID;
request.ParcelData.Category = (byte)this.Category;
request.ParcelData.Desc = Utils.StringToBytes(this.Desc);
request.ParcelData.GroupID = this.GroupID;
request.ParcelData.LandingType = (byte)this.Landing;
request.ParcelData.MediaAutoScale = this.Media.MediaAutoScale;
request.ParcelData.MediaID = this.Media.MediaID;
request.ParcelData.MediaURL = Utils.StringToBytes(this.Media.MediaURL);
request.ParcelData.MusicURL = Utils.StringToBytes(this.MusicURL);
request.ParcelData.Name = Utils.StringToBytes(this.Name);
if (wantReply) request.ParcelData.Flags = 1;
request.ParcelData.ParcelFlags = (uint)this.Flags;
request.ParcelData.PassHours = this.PassHours;
request.ParcelData.PassPrice = this.PassPrice;
request.ParcelData.SalePrice = this.SalePrice;
request.ParcelData.SnapshotID = this.SnapshotID;
request.ParcelData.UserLocation = this.UserLocation;
request.ParcelData.UserLookAt = this.UserLookAt;
simulator.SendPacket(request, true);
UpdateOtherCleanTime(simulator);
}
示例7: Update
//.........这里部分代码省略.........
req.MediaAutoScale = this.Media.MediaAutoScale;
req.MediaDesc = this.Media.MediaDesc;
req.MediaHeight = this.Media.MediaHeight;
req.MediaID = this.Media.MediaID;
req.MediaLoop = this.Media.MediaLoop;
req.MediaType = this.Media.MediaType;
req.MediaURL = this.Media.MediaURL;
req.MediaWidth = this.Media.MediaWidth;
req.MusicURL = this.MusicURL;
req.Name = this.Name;
req.ObscureMedia = this.ObscureMedia;
req.ObscureMusic = this.ObscureMusic;
req.ParcelFlags = this.Flags;
req.PassHours = this.PassHours;
req.PassPrice = (uint)this.PassPrice;
req.SalePrice = (uint)this.SalePrice;
req.SnapshotID = this.SnapshotID;
req.UserLocation = this.UserLocation;
req.UserLookAt = this.UserLookAt;
//OSDMap body = new OSDMap();
//body["auth_buyer_id"] = OSD.FromUUID(this.AuthBuyerID);
//body["auto_scale"] = OSD.FromBoolean(this.Media.MediaAutoScale);
//body["category"] = OSD.FromInteger((byte)this.Category);
//body["description"] = OSD.FromString(this.Desc);
//body["flags"] = OSD.FromBinary(Utils.EmptyBytes);
//body["group_id"] = OSD.FromUUID(this.GroupID);
//body["landing_type"] = OSD.FromInteger((byte)this.Landing);
//body["local_id"] = OSD.FromInteger(this.LocalID);
//body["media_desc"] = OSD.FromString(this.Media.MediaDesc);
//body["media_height"] = OSD.FromInteger(this.Media.MediaHeight);
//body["media_id"] = OSD.FromUUID(this.Media.MediaID);
//body["media_loop"] = OSD.FromInteger(this.Media.MediaLoop ? 1 : 0);
//body["media_type"] = OSD.FromString(this.Media.MediaType);
//body["media_url"] = OSD.FromString(this.Media.MediaURL);
//body["media_width"] = OSD.FromInteger(this.Media.MediaWidth);
//body["music_url"] = OSD.FromString(this.MusicURL);
//body["name"] = OSD.FromString(this.Name);
//body["obscure_media"]= OSD.FromInteger(this.ObscureMedia ? 1 : 0);
//body["obscure_music"] = OSD.FromInteger(this.ObscureMusic ? 1 : 0);
//byte[] flags = Utils.IntToBytes((int)this.Flags); ;
//if (BitConverter.IsLittleEndian)
// Array.Reverse(flags);
//body["parcel_flags"] = OSD.FromBinary(flags);
//body["pass_hours"] = OSD.FromReal(this.PassHours);
//body["pass_price"] = OSD.FromInteger(this.PassPrice);
//body["sale_price"] = OSD.FromInteger(this.SalePrice);
//body["snapshot_id"] = OSD.FromUUID(this.SnapshotID);
//OSDArray uloc = new OSDArray();
//uloc.Add(OSD.FromReal(this.UserLocation.X));
//uloc.Add(OSD.FromReal(this.UserLocation.Y));
//uloc.Add(OSD.FromReal(this.UserLocation.Z));
//body["user_location"] = uloc;
//OSDArray ulat = new OSDArray();
//ulat.Add(OSD.FromReal(this.UserLocation.X));
//ulat.Add(OSD.FromReal(this.UserLocation.Y));
//ulat.Add(OSD.FromReal(this.UserLocation.Z));
//body["user_look_at"] = ulat;
OSDMap body = req.Serialize();
CapsClient capsPost = new CapsClient(url);
capsPost.BeginGetResponse(body, OSDFormat.Xml, simulator.Network.CapsTimeout);
}
else
{
ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket();
request.AgentData.AgentID = simulator.Network.AgentID;
request.AgentData.SessionID = simulator.Network.SessionID;
request.ParcelData.LocalID = this.LocalID;
request.ParcelData.AuthBuyerID = this.AuthBuyerID;
request.ParcelData.Category = (byte)this.Category;
request.ParcelData.Desc = Utils.StringToBytes(this.Desc);
request.ParcelData.GroupID = this.GroupID;
request.ParcelData.LandingType = (byte)this.Landing;
request.ParcelData.MediaAutoScale = (this.Media.MediaAutoScale) ? (byte)0x1 : (byte)0x0;
request.ParcelData.MediaID = this.Media.MediaID;
request.ParcelData.MediaURL = Utils.StringToBytes(this.Media.MediaURL.ToString());
request.ParcelData.MusicURL = Utils.StringToBytes(this.MusicURL.ToString());
request.ParcelData.Name = Utils.StringToBytes(this.Name);
if (wantReply) request.ParcelData.Flags = 1;
request.ParcelData.ParcelFlags = (uint)this.Flags;
request.ParcelData.PassHours = this.PassHours;
request.ParcelData.PassPrice = this.PassPrice;
request.ParcelData.SalePrice = this.SalePrice;
request.ParcelData.SnapshotID = this.SnapshotID;
request.ParcelData.UserLocation = this.UserLocation;
request.ParcelData.UserLookAt = this.UserLookAt;
simulator.SendPacket(request);
}
UpdateOtherCleanTime(simulator);
}
示例8: SendPacket
/// <summary>
/// Send a packet to a specified simulator
/// </summary>
/// <param name="packet">Packet to send</param>
/// <param name="simulator">Simulator to send the packet to</param>
public void SendPacket(Packet packet, Simulator simulator)
{
if (simulator != null)
{
simulator.SendPacket(packet);
}
else
{
throw new NotConnectedException("Packet received before simulator packet processing threads running, make certain you are completely logged in");
}
}