本文整理汇总了C#中ISceneEntity.CreateScriptInstances方法的典型用法代码示例。如果您正苦于以下问题:C# ISceneEntity.CreateScriptInstances方法的具体用法?C# ISceneEntity.CreateScriptInstances怎么用?C# ISceneEntity.CreateScriptInstances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISceneEntity
的用法示例。
在下文中一共展示了ISceneEntity.CreateScriptInstances方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindAttachmentPoint
//.........这里部分代码省略.........
itemID = group.RootChild.FromUserInventoryItemID;
group.RootChild.AttachedAvatar = presence.UUID;
List<ISceneChildEntity> parts = group.ChildrenEntities();
for (int i = 0; i < parts.Count; i++)
parts[i].AttachedAvatar = presence.UUID;
if (group.RootChild.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim (group.RootChild.PhysActor);
group.RootChild.PhysActor = null;
}
group.RootChild.AttachedPos = attachPos;
group.RootChild.IsAttachment = true;
group.AbsolutePosition = attachPos;
group.RootChild.SetParentLocalId (presence.LocalId);
group.SetAttachmentPoint(Convert.ToByte(AttachmentPt));
AvatarAttachments attPlugin = presence.RequestModuleInterface<AvatarAttachments>();
if (attPlugin != null)
{
attPlugin.AddAttachment (group);
presence.AddAttachment (group);
}
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (group.IsSelected)
{
foreach (ISceneChildEntity part in group.ChildrenEntities())
{
part.CreateSelected = true;
}
}
//Kill the previous entity so that it will be selected
SendKillEntity(group.RootChild);
//NOTE: This MUST be here, otherwise we limit full updates during attachments when they are selected and it will block the first update.
// So until that is changed, this MUST stay. The client will instantly reselect it, so this value doesn't stay borked for long.
group.IsSelected = false;
if (itemID == UUID.Zero)
{
//Delete the object inworld to inventory
List<ISceneEntity> groups = new List<ISceneEntity> (1) { group };
IInventoryAccessModule inventoryAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (inventoryAccess != null)
inventoryAccess.DeleteToInventory(DeRezAction.AcquireToUserInventory, UUID.Zero,
groups, remoteClient.AgentId, out itemID);
}
else
{
//it came from an item, we need to start the scripts
// Fire after attach, so we don't get messy perms dialogs
// 4 == AttachedRez
group.CreateScriptInstances(0, true, StateSource.AttachedRez, UUID.Zero);
group.ResumeScripts();
}
if (UUID.Zero == itemID)
{
m_log.Error("[ATTACHMENTS MODULE]: Unable to save attachment. Error inventory item ID.");
remoteClient.SendAgentAlertMessage(
"Unable to save attachment. Error inventory item ID.", false);
return;
}
// XXYY!!
if (item == null)
{
item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_scene.InventoryService.GetItem(item);
}
//Update the ItemID with the new item
group.SetFromItemID (itemID);
//If we updated the attachment, we need to save the change
IAvatarAppearanceModule appearance = presence.RequestModuleInterface<IAvatarAppearanceModule> ();
if (appearance.Appearance.SetAttachment ((int)AttachmentPt, itemID, item.AssetID))
AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
// In case it is later dropped again, don't let
// it get cleaned up
group.RootChild.RemFlag(PrimFlags.TemporaryOnRez);
group.HasGroupChanged = false;
//Now recreate it so that it is selected
group.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
m_scene.EventManager.TriggerOnAttach(localID, group.RootChild.FromUserInventoryItemID, remoteClient.AgentId);
}