本文整理匯總了C#中libsecondlife.Simulator.SendPacket方法的典型用法代碼示例。如果您正苦於以下問題:C# Simulator.SendPacket方法的具體用法?C# Simulator.SendPacket怎麽用?C# Simulator.SendPacket使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類libsecondlife.Simulator
的用法示例。
在下文中一共展示了Simulator.SendPacket方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SendPacket
/// <summary>
/// Send a raw byte array as a packet to the specified simulator
/// </summary>
/// <param name="payload">Byte array containing a packet</param>
/// <param name="simulator">Simulator to send the packet to</param>
/// <param name="setSequence">Whether to set the second, third, and fourth
/// bytes of the payload to the current sequence number</param>
public void SendPacket(byte[] payload, Simulator simulator, bool setSequence)
{
if (simulator != null)
simulator.SendPacket(payload, setSequence);
}
示例2: SendPacket
/// <summary>
///
/// </summary>
/// <param name="packet"></param>
/// <param name="simulator"></param>
public void SendPacket(Packet packet, Simulator simulator)
{
if (simulator.Connected)
{
simulator.SendPacket(packet, true);
}
}
示例3: ParcelPropertiesHandler
private void ParcelPropertiesHandler(Packet packet, Simulator simulator)
{
ParcelPropertiesPacket properties = (ParcelPropertiesPacket)packet;
byte[] Bitmap = properties.ParcelData.Bitmap;
int LocalID = properties.ParcelData.LocalID;
// Mark this area as downloaded
int x, y, index, subindex;
byte val;
for (x = 0; x < 64; x++)
{
for (y = 0; y < 64; y++)
{
if (simulator.Region.ParcelMarked[y, x] == 0)
{
index = ((x * 64) + y);
subindex = index % 8;
index /= 8;
val = Bitmap[index];
simulator.Region.ParcelMarked[y, x] = ((val >> subindex) & 1) == 1 ? LocalID : 0;
}
}
}
// Fire off the next request, if we are downloading the whole sim
bool hasTriggered = false;
if (simulator.Region.ParcelDownloading)
{
for (x = 0; x < 64; x++)
{
for (y = 0; y < 64; y++)
{
if (simulator.Region.ParcelMarked[x, y] == 0)
{
ParcelPropertiesRequestPacket tPacket = new ParcelPropertiesRequestPacket();
tPacket.AgentData.AgentID = Client.Network.AgentID;
tPacket.AgentData.SessionID = Client.Network.SessionID;
tPacket.ParcelData.SequenceID = -10000;
tPacket.ParcelData.West = (x * 4.0f);
tPacket.ParcelData.South = (y * 4.0f);
tPacket.ParcelData.East = (x * 4.0f) + 4.0f;
tPacket.ParcelData.North = (y * 4.0f) + 4.0f;
simulator.SendPacket((Packet)tPacket, true);
hasTriggered = true;
goto exit;
}
}
}
exit:
;
}
// This map is complete, fire callback
if (!hasTriggered)
{
simulator.Region.FilledParcels();
}
Parcel parcel = null;
lock (simulator.Region.Parcels)
{
if (!simulator.Region.Parcels.ContainsKey(LocalID))
{
simulator.Region.Parcels[LocalID] = new Parcel(simulator);
}
parcel = simulator.Region.Parcels[LocalID];
}
// Save this parcels data
// TODO: Lots of values are not being stored, Parcel needs to be expanded to take all the data.
// August2006: God help me should I have to type this out again... argh.
// October2006: I really shouldnt have typed that.
parcel.RequestResult = properties.ParcelData.RequestResult;
parcel.SequenceID = properties.ParcelData.SequenceID;
parcel.SnapSelection = properties.ParcelData.SnapSelection;
parcel.SelfCount = properties.ParcelData.SelfCount;
parcel.OtherCount = properties.ParcelData.OtherCount;
parcel.PublicCount = properties.ParcelData.PublicCount;
parcel.LocalID = LocalID;
parcel.OwnerID = properties.ParcelData.OwnerID;
parcel.IsGroupOwned = properties.ParcelData.IsGroupOwned;
parcel.AuctionID = properties.ParcelData.AuctionID;
parcel.ReservedNewbie = properties.ParcelData.ReservedNewbie;
parcel.ClaimDate = properties.ParcelData.ClaimDate;
parcel.ClaimPrice = properties.ParcelData.ClaimPrice;
parcel.RentPrice = properties.ParcelData.RentPrice;
parcel.AABBMin = properties.ParcelData.AABBMin;
parcel.AABBMax = properties.ParcelData.AABBMax;
parcel.Bitmap = properties.ParcelData.Bitmap;
parcel.Area = properties.ParcelData.Area;
parcel.Status = properties.ParcelData.Status;
//.........這裏部分代碼省略.........