本文整理匯總了C#中libsecondlife.Simulator類的典型用法代碼示例。如果您正苦於以下問題:C# Simulator類的具體用法?C# Simulator怎麽用?C# Simulator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Simulator類屬於libsecondlife命名空間,在下文中一共展示了Simulator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ObjectAddHandler
public void ObjectAddHandler(Packet packet, Simulator simulator)
{
LLVector3 position = null;
if (WaitingOnUpdate)
{
CurrentPrimMutex.WaitOne();
foreach (Block block in packet.Blocks())
{
foreach (Field field in block.Fields)
{
if (field.Layout.Name == "RayEnd")
{
position = (LLVector3)field.Data;
}
}
}
txtLog.AppendText("Received an ObjectAdd, setting CurrentPrim position to " + position.ToString());
CurrentPrim.Position = position;
CurrentPrimMutex.ReleaseMutex();
}
}
示例2: Caps
/// <summary>
/// Default constructor
/// </summary>
/// <param name="simulator"></param>
/// <param name="seedcaps"></param>
internal Caps(Simulator simulator, string seedcaps)
{
Simulator = simulator;
_SeedCapsURI = seedcaps;
MakeSeedRequest();
}
示例3: AttachedSoundHandler
protected void AttachedSoundHandler(Packet packet, Simulator simulator)
{
AttachedSoundPacket sound = (AttachedSoundPacket)packet;
if (OnAttachSound != null)
{
try { OnAttachSound(sound.DataBlock.SoundID, sound.DataBlock.OwnerID, sound.DataBlock.ObjectID, sound.DataBlock.Gain, sound.DataBlock.Flags); }
catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
}
}
示例4: AttachedSoundGainChangeHandler
protected void AttachedSoundGainChangeHandler(Packet packet, Simulator simulator)
{
AttachedSoundGainChangePacket change = (AttachedSoundGainChangePacket)packet;
if (OnAttachSoundGainChange != null)
{
try { OnAttachSoundGainChange(change.DataBlock.ObjectID, change.DataBlock.Gain); }
catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
}
}
示例5: AgentDataUpdateHandler
private void AgentDataUpdateHandler(Packet packet, Simulator sim)
{
AgentDataUpdatePacket p = (AgentDataUpdatePacket)packet;
if (p.AgentData.AgentID == Client.Self.AgentID)
{
activeGroup = Helpers.FieldToUTF8String(p.AgentData.GroupName) + " ( " + Helpers.FieldToUTF8String(p.AgentData.GroupTitle) + " )";
GroupsEvent.Set();
}
}
示例6: Network_OnEventQueueRunning
void Network_OnEventQueueRunning(Simulator simulator)
{
if (simulator == Client.Network.CurrentSim)
{
Console.WriteLine("Event queue connected for the primary simulator, requesting group info");
Client.Groups.RequestCurrentGroups();
}
}
示例7: Objects_OnObjectProperties
void Objects_OnObjectProperties(Simulator simulator, LLObject.ObjectProperties properties)
{
lock (PrimsWaiting) {
Primitive prim;
if (PrimsWaiting.TryGetValue(properties.ObjectID, out prim)) {
prim.Properties = properties;
}
PrimsWaiting.Remove(properties.ObjectID);
if (PrimsWaiting.Count == 0)
AllPropertiesReceived.Set();
}
}
示例8: PreloadSoundHandler
protected void PreloadSoundHandler(Packet packet, Simulator simulator)
{
PreloadSoundPacket preload = (PreloadSoundPacket)packet;
if (OnPreloadSound != null)
{
foreach (PreloadSoundPacket.DataBlockBlock data in preload.DataBlock)
{
try
{
OnPreloadSound(data.SoundID, data.OwnerID, data.ObjectID);
}
catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
}
}
}
示例9: OnPacket
private void OnPacket(Packet packet, Simulator simulator)
{
lock (Packets)
{
if (Count >= Total)
{
Done = true;
}
else
{
Packets.Add(packet);
Count++;
}
}
}
示例10: AvatarAppearanceHandler
private void AvatarAppearanceHandler(Packet packet, Simulator simulator)
{
AvatarAppearancePacket appearance = (AvatarAppearancePacket)packet;
LLObject.TextureEntry te = new LLObject.TextureEntry(appearance.ObjectData.TextureEntry, 0,
appearance.ObjectData.TextureEntry.Length);
if (IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.EyesBaked] ) &&
IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.HeadBaked]) &&
IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.LowerBaked]) &&
IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.SkirtBaked]) &&
IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.UpperBaked]))
{
Console.WriteLine("Avatar " + appearance.Sender.ID.ToString() + " may be a bot");
}
}
示例11: Objects_OnNewAvatar
private void Objects_OnNewAvatar(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
{
if (imgManager == null)
{
Console.WriteLine("ImageManager not ready yet, queueing Avatar textures.");
TextureQueue.Enqueue(avatar.FirstLifeImage);
TextureQueue.Enqueue(avatar.ProfileImage);
foreach (TextureEntryFace tef in avatar.Textures.FaceTextures.Values)
{
TextureQueue.Enqueue(tef.TextureID);
}
}
else
{
if (avatar.FirstLifeImage != null)
{
if (imgManager.isCachedImage(avatar.FirstLifeImage) == false)
{
imgManager.RequestImageAsync(avatar.FirstLifeImage);
}
}
if (avatar.ProfileImage != null)
{
if (imgManager.isCachedImage(avatar.FirstLifeImage) == false)
{
imgManager.RequestImageAsync(avatar.ProfileImage);
}
}
if (avatar.Textures != null)
{
foreach (TextureEntryFace tef in avatar.Textures.FaceTextures.Values)
{
if (imgManager.isCachedImage(tef.TextureID) == false)
{
imgManager.RequestImageAsync(tef.TextureID);
}
else
{
Console.WriteLine("Already cached: " + tef.TextureID);
}
}
}
}
}
示例12: Parcels_OnParcelsDownloaded
void Parcels_OnParcelsDownloaded(Simulator simulator, Dictionary<int, Parcel> Parcels, int[,] map)
{
foreach (KeyValuePair<int, Parcel> parcel in Parcels)
{
WaterType type = ParcelDownloader.GetWaterType(map, parcel.Value.LocalID);
float delta = ParcelDownloader.GetHeightRange(map, parcel.Value.LocalID);
int deviation = ParcelDownloader.GetRectangularDeviation(parcel.Value.AABBMin, parcel.Value.AABBMax,
parcel.Value.Area);
Console.WriteLine("Parcels[{0}]: Name: \"{1}\", Description: \"{2}\" ACL Count: {3}, " +
"Location: {4}, Height Range: {5}, Shape Deviation: {6}", parcel.Key, parcel.Value.Name,
parcel.Value.Desc, parcel.Value.AccessList.Count, type.ToString(), delta, deviation);
}
ParcelCount = Parcels.Count;
ParcelsDownloaded.Set();
}
示例13: ObjectUpdateHandler
public void ObjectUpdateHandler(Packet packet, Simulator simulator)
{
uint id = 0;
LLUUID uuid = null;
if (WaitingOnUpdate)
{
CurrentPrimMutex.WaitOne();
foreach (Block block in packet.Blocks())
{
foreach (Field field in block.Fields)
{
if (field.Layout.Name == "ID")
{
id = (uint)field.Data;
}
else if (field.Layout.Name == "FullID")
{
uuid = (LLUUID)field.Data;
}
else if (field.Layout.Name == "ObjectData")
{
byte[] byteArray = (byte[])field.Data;
LLVector3 position = new LLVector3(byteArray, 0);
if (CurrentPrim != null && position != CurrentPrim.Position)
{
txtLog.AppendText(position.ToString() + " doesn't match CurrentPrim.Position " +
CurrentPrim.Position.ToString() + "\n"/* + ", ignoring"*/);
//return;
}
}
}
}
CurrentPrim.ID = id;
CurrentPrim.UUID = uuid;
WaitingOnUpdate = false;
CurrentPrimMutex.ReleaseMutex();
}
}
示例14: QueryHandler
public static void QueryHandler(Packet packet, Simulator simulator)
{
DirPeopleReplyPacket reply = (DirPeopleReplyPacket)packet;
if (reply.QueryReplies.Length < 1)
{
Console.WriteLine("ERROR: Got an empty reply");
}
else
{
if (reply.QueryReplies.Length > 1)
{
Console.WriteLine("ERROR: Ambiguous name. Returning first match");
}
Console.WriteLine("UUID: " + reply.QueryReplies[0].AgentID.ToString());
}
waiting = false;
}
示例15: RaiseEvent
/// <summary>
/// Fire the events registered for this packet type synchronously
/// </summary>
/// <param name="packetType">Incoming packet type</param>
/// <param name="packet">Incoming packet</param>
/// <param name="simulator">Simulator this packet was received from</param>
internal void RaiseEvent(PacketType packetType, Packet packet, Simulator simulator)
{
NetworkManager.PacketCallback callback;
if (_EventTable.TryGetValue(packetType, out callback))
{
try
{
callback(packet, simulator);
}
catch (Exception ex)
{
Client.Log("Packet Event Handler: " + ex.ToString(), Helpers.LogLevel.Error);
}
}
else if (packetType != PacketType.Default && packetType != PacketType.PacketAck)
{
Client.Log("No handler registered for packet event " + packetType, Helpers.LogLevel.Debug);
}
}