本文整理汇总了C#中libsecondlife.Simulator类的典型用法代码示例。如果您正苦于以下问题:C# Simulator类的具体用法?C# Simulator怎么用?C# Simulator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Simulator类属于libsecondlife命名空间,在下文中一共展示了Simulator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
}
开发者ID:BackupTheBerlios,项目名称:libsecondlife-svn,代码行数:25,代码来源:frmPrimImporter.cs
示例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();
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:12,代码来源:Caps.cs
示例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); }
}
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:9,代码来源:SoundManager.cs
示例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); }
}
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:9,代码来源:SoundManager.cs
示例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();
}
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:9,代码来源:ActivateGroupCommand.cs
示例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();
}
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:9,代码来源:frmGroupManager.cs
示例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();
}
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:13,代码来源:FindObjectsCommand.cs
示例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); }
}
}
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:15,代码来源:SoundManager.cs
示例9: OnPacket
private void OnPacket(Packet packet, Simulator simulator)
{
lock (Packets)
{
if (Count >= Total)
{
Done = true;
}
else
{
Packets.Add(packet);
Count++;
}
}
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:15,代码来源:PacketLogCommand.cs
示例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");
}
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:16,代码来源:DetectBotCommand.cs
示例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);
}
}
}
}
}
开发者ID:BackupTheBerlios,项目名称:libsecondlife-svn,代码行数:47,代码来源:IA_TestAsyncImage.cs
示例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();
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:17,代码来源:ParcelInfoCommand.cs
示例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();
}
}
开发者ID:BackupTheBerlios,项目名称:libsecondlife-svn,代码行数:43,代码来源:frmPrimImporter.cs
示例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;
}
开发者ID:BackupTheBerlios,项目名称:libsecondlife-svn,代码行数:20,代码来源:name2key.cs
示例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);
}
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:26,代码来源:EventDictionary.cs
示例16: Terrain_OnLandPatch
void Terrain_OnLandPatch(Simulator simulator, int x, int y, int width, float[] data)
{
if (x >= 16 || y >= 16)
{
Console.WriteLine("Bad patch coordinates, x = " + x + ", y = " + y);
return;
}
if (width != 16)
{
Console.WriteLine("Unhandled patch size " + width + "x" + width);
return;
}
Bitmap patch = new Bitmap(16, 16, PixelFormat.Format24bppRgb);
for (int yp = 0; yp < 16; yp++)
{
for (int xp = 0; xp < 16; xp++)
{
float height = data[yp * 16 + xp];
int colorVal = Helpers.FloatToByte(height, 0.0f, 60.0f);
int lesserVal = (int)((float)colorVal * 0.75f);
Color color;
if (height >= simulator.WaterHeight)
color = Color.FromArgb(lesserVal, colorVal, lesserVal);
else
color = Color.FromArgb(lesserVal, lesserVal, colorVal);
patch.SetPixel(xp, yp, color);
}
}
Boxes[x, y].Image = (Image)patch;
}
开发者ID:RavenB,项目名称:gridsearch,代码行数:36,代码来源:HeightmapInterface.cs
示例17: UpdateCreateInventoryItemHandler
/// <summary>
/// UpdateCreateInventoryItem packets are received when a new inventory item
/// is created. This may occur when an object that's rezzed in world is
/// taken into inventory, when an item is created using the CreateInventoryItem
/// packet, or when an object is purchased
/// </summary>
private void UpdateCreateInventoryItemHandler(Packet packet, Simulator simulator)
{
UpdateCreateInventoryItemPacket reply = packet as UpdateCreateInventoryItemPacket;
foreach (UpdateCreateInventoryItemPacket.InventoryDataBlock dataBlock in reply.InventoryData)
{
if (dataBlock.InvType == (sbyte)InventoryType.Folder)
{
_Client.Log("Received InventoryFolder in an UpdateCreateInventoryItem packet, this should not happen!",
Helpers.LogLevel.Error);
continue;
}
InventoryItem item = CreateInventoryItem((InventoryType)dataBlock.InvType,dataBlock.ItemID);
item.AssetType = (AssetType)dataBlock.Type;
item.AssetUUID = dataBlock.AssetID;
item.CreationDate = Helpers.UnixTimeToDateTime(dataBlock.CreationDate);
item.CreatorID = dataBlock.CreatorID;
item.Description = Helpers.FieldToUTF8String(dataBlock.Description);
item.Flags = dataBlock.Flags;
item.GroupID = dataBlock.GroupID;
item.GroupOwned = dataBlock.GroupOwned;
item.Name = Helpers.FieldToUTF8String(dataBlock.Name);
item.OwnerID = dataBlock.OwnerID;
item.ParentUUID = dataBlock.FolderID;
item.Permissions = new Permissions(
dataBlock.BaseMask,
dataBlock.EveryoneMask,
dataBlock.GroupMask,
dataBlock.NextOwnerMask,
dataBlock.OwnerMask);
item.SalePrice = dataBlock.SalePrice;
item.SaleType = (SaleType)dataBlock.SaleType;
// Update the local copy
_Store[item.UUID] = item;
// Look for an "item created" callback
ItemCreatedCallback createdCallback;
if (_ItemCreatedCallbacks.TryGetValue(dataBlock.CallbackID, out createdCallback))
{
_ItemCreatedCallbacks.Remove(dataBlock.CallbackID);
try { createdCallback(true, item); }
catch (Exception e) { _Client.Log(e.ToString(), Helpers.LogLevel.Error); }
}
// TODO: Is this callback even triggered when items are copied?
// Look for an "item copied" callback
ItemCopiedCallback copyCallback;
if (_ItemCopiedCallbacks.TryGetValue(dataBlock.CallbackID, out copyCallback))
{
_ItemCopiedCallbacks.Remove(dataBlock.CallbackID);
try { copyCallback(item); }
catch (Exception e) { _Client.Log(e.ToString(), Helpers.LogLevel.Error); }
}
//This is triggered when an item is received from a task
if (OnTaskItemReceived != null)
{
try { OnTaskItemReceived(item.UUID, dataBlock.FolderID, item.CreatorID, item.AssetUUID,
item.InventoryType); }
catch (Exception e) { _Client.Log(e.ToString(), Helpers.LogLevel.Error); }
}
}
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:73,代码来源:InventoryManager.cs
示例18: InventoryDescendentsHandler
private void InventoryDescendentsHandler(Packet packet, Simulator simulator)
{
InventoryDescendentsPacket reply = (InventoryDescendentsPacket)packet;
if (reply.AgentData.Descendents > 0)
{
// InventoryDescendantsReply sends a null folder if the parent doesnt contain any folders
if (reply.FolderData[0].FolderID != LLUUID.Zero)
{
// Iterate folders in this packet
for (int i = 0; i < reply.FolderData.Length; i++)
{
InventoryFolder folder = new InventoryFolder(reply.FolderData[i].FolderID);
folder.ParentUUID = reply.FolderData[i].ParentID;
folder.Name = Helpers.FieldToUTF8String(reply.FolderData[i].Name);
folder.PreferredType = (AssetType)reply.FolderData[i].Type;
folder.OwnerID = reply.AgentData.OwnerID;
_Store[folder.UUID] = folder;
}
}
// InventoryDescendantsReply sends a null item if the parent doesnt contain any items.
if (reply.ItemData[0].ItemID != LLUUID.Zero)
{
// Iterate items in this packet
for (int i = 0; i < reply.ItemData.Length; i++)
{
if (reply.ItemData[i].ItemID != LLUUID.Zero)
{
InventoryItem item = CreateInventoryItem((InventoryType)reply.ItemData[i].InvType,reply.ItemData[i].ItemID);
item.ParentUUID = reply.ItemData[i].FolderID;
item.CreatorID = reply.ItemData[i].CreatorID;
item.AssetType = (AssetType)reply.ItemData[i].Type;
item.AssetUUID = reply.ItemData[i].AssetID;
item.CreationDate = Helpers.UnixTimeToDateTime((uint)reply.ItemData[i].CreationDate);
item.Description = Helpers.FieldToUTF8String(reply.ItemData[i].Description);
item.Flags = reply.ItemData[i].Flags;
item.Name = Helpers.FieldToUTF8String(reply.ItemData[i].Name);
item.GroupID = reply.ItemData[i].GroupID;
item.GroupOwned = reply.ItemData[i].GroupOwned;
item.Permissions = new Permissions(
reply.ItemData[i].BaseMask,
reply.ItemData[i].EveryoneMask,
reply.ItemData[i].GroupMask,
reply.ItemData[i].NextOwnerMask,
reply.ItemData[i].OwnerMask);
item.SalePrice = reply.ItemData[i].SalePrice;
item.SaleType = (SaleType)reply.ItemData[i].SaleType;
item.OwnerID = reply.AgentData.OwnerID;
_Store[item.UUID] = item;
}
}
}
}
InventoryFolder parentFolder = null;
if (_Store.Contains(reply.AgentData.FolderID) &&
_Store[reply.AgentData.FolderID] is InventoryFolder)
{
parentFolder = _Store[reply.AgentData.FolderID] as InventoryFolder;
}
else
{
_Client.Log("Don't have a reference to FolderID " + reply.AgentData.FolderID.ToString() +
" or it is not a folder", Helpers.LogLevel.Error);
return;
}
if (reply.AgentData.Version < parentFolder.Version)
{
_Client.Log("Got an outdated InventoryDescendents packet for folder " + parentFolder.Name +
", this version = " + reply.AgentData.Version + ", latest version = " + parentFolder.Version,
Helpers.LogLevel.Warning);
return;
}
parentFolder.Version = reply.AgentData.Version;
// FIXME: reply.AgentData.Descendants is not parentFolder.DescendentCount if we didn't
// request items and folders
parentFolder.DescendentCount = reply.AgentData.Descendents;
#region FindObjectsByPath Handling
if (_Searches.Count > 0)
{
lock (_Searches)
{
StartSearch:
// Iterate over all of the outstanding searches
for (int i = 0; i < _Searches.Count; i++)
{
InventorySearch search = _Searches[i];
List<InventoryBase> folderContents = _Store.GetContents(search.Folder);
// Iterate over all of the inventory objects in the base search folder
for (int j = 0; j < folderContents.Count; j++)
//.........这里部分代码省略.........
开发者ID:Belxjander,项目名称:Asuna,代码行数:101,代码来源:InventoryManager.cs
示例19: SaveAssetIntoInventoryHandler
private void SaveAssetIntoInventoryHandler(Packet packet, Simulator simulator)
{
SaveAssetIntoInventoryPacket save = (SaveAssetIntoInventoryPacket)packet;
// FIXME: Find this item in the inventory structure and mark the parent as needing an update
//save.InventoryData.ItemID;
_Client.Log("SaveAssetIntoInventory packet received, someone write this function!",
Helpers.LogLevel.Error);
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:9,代码来源:InventoryManager.cs
示例20: RequestTaskInventory
public void RequestTaskInventory(uint objectLocalID, Simulator simulator)
{
RequestTaskInventoryPacket request = new RequestTaskInventoryPacket();
request.AgentData.AgentID = _Client.Self.AgentID;
request.AgentData.SessionID = _Client.Self.SessionID;
request.InventoryData.LocalID = objectLocalID;
_Client.Network.SendPacket(request, simulator);
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:9,代码来源:InventoryManager.cs
注:本文中的libsecondlife.Simulator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论