當前位置: 首頁>>代碼示例>>C#>>正文


C# AvatarAppearance.DetachAttachment方法代碼示例

本文整理匯總了C#中OpenSim.Framework.AvatarAppearance.DetachAttachment方法的典型用法代碼示例。如果您正苦於以下問題:C# AvatarAppearance.DetachAttachment方法的具體用法?C# AvatarAppearance.DetachAttachment怎麽用?C# AvatarAppearance.DetachAttachment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenSim.Framework.AvatarAppearance的用法示例。


在下文中一共展示了AvatarAppearance.DetachAttachment方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FixCurrentOutFitFolder


//.........這裏部分代碼省略.........
            List<UUID> OtherStuff = new List<UUID>();
            List<AvatarWearable> wearables = avappearance.GetWearables();
            foreach (var i in ic)
            {
                InventoryItemBase linkedItem = null;
                try {
                    linkedItem = inventoryService.GetItem(i.AssetID, UUID.Zero);
                } catch (InventoryStorageException) {
                    linkedItem = null;
                }
                if (linkedItem == null)
                    brokenLinks.Add(i);
                else if (linkedItem.ID == AvatarWearable.DEFAULT_EYES_ITEM ||
                         linkedItem.ID == AvatarWearable.DEFAULT_BODY_ITEM ||
                         linkedItem.ID == AvatarWearable.DEFAULT_HAIR_ITEM ||
                         linkedItem.ID == AvatarWearable.DEFAULT_PANTS_ITEM ||
                         linkedItem.ID == AvatarWearable.DEFAULT_SHIRT_ITEM ||
                         linkedItem.ID == AvatarWearable.DEFAULT_SKIN_ITEM)
                    brokenLinks.Add(i); //Default item link, needs removed
                else if (wearables.Find((w)=>w.ItemID == i.AssetID) == null)
                    brokenLinks.Add(i);
                else if (!OtherStuff.Contains(i.AssetID))
                    OtherStuff.Add(i.AssetID);
                else
                    brokenLinks.Add(i);
            }

            foreach (AvatarWearable wearable in wearables)
            {
                if (wearable.ItemID == UUID.Zero) continue;
                if (!OtherStuff.Contains(wearable.ItemID))
                {
                    InventoryItemBase linkedItem = null;
                    try
                    {
                        linkedItem = inventoryService.GetItem(wearable.ItemID, UUID.Zero);
                    }
                    catch (InventoryStorageException)
                    {
                        linkedItem = null;
                    }
                    if (linkedItem != null)
                    {
                        InventoryItemBase linkedItem3 = (InventoryItemBase)linkedItem.Clone();
                        linkedItem3.AssetID = linkedItem.ID;
                        linkedItem3.AssetType = (int)AssetType.Link;
                        linkedItem3.ID = UUID.Random();
                        linkedItem3.CurrentPermissions = linkedItem.NextPermissions;
                        linkedItem3.EveryOnePermissions = linkedItem.NextPermissions;
                        linkedItem3.Folder = CurrentOutfitFolder.ID;
                        inventoryService.CreateItem(linkedItem3);
                        changed = true;
                    }
                }
            }

            List<UUID> items2UnAttach = new List<UUID>();
            foreach (int ap in avappearance.GetAttachedPoints())
            {
                foreach (AvatarAttachment attachment in avappearance.GetAttachmentsAtPoint(ap))
                {
                    if (attachment.ItemID == UUID.Zero) continue;
                    if (!OtherStuff.Contains(attachment.ItemID))
                    {
                        changed = true;
                        InventoryItemBase linkedItem = null;
                        try
                        {
                            linkedItem = inventoryService.GetItem(attachment.ItemID, UUID.Zero);
                        }
                        catch (InventoryStorageException)
                        {
                            linkedItem = null;
                        }
                        if(linkedItem != null)
                        {
                            InventoryItemBase linkedItem3 = (InventoryItemBase)linkedItem.Clone();
                            linkedItem3.AssetID = linkedItem.ID;
                            linkedItem3.AssetType = (int)AssetType.Link;
                            linkedItem3.ID = UUID.Random();
                            linkedItem3.CurrentPermissions = linkedItem.NextPermissions;
                            linkedItem3.EveryOnePermissions = linkedItem.NextPermissions;
                            linkedItem3.Folder = CurrentOutfitFolder.ID;
                            inventoryService.CreateItem(linkedItem3);
                        }
                        else
                            items2UnAttach.Add(attachment.ItemID);
                    }
                }
            }

            foreach (UUID uuid in items2UnAttach)
            {
                avappearance.DetachAttachment(uuid);
            }

            if (brokenLinks.Count != 0)
                inventoryService.PurgeItems(brokenLinks);
            return changed || brokenLinks.Count > 0;
        }
開發者ID:BogusCurry,項目名稱:halcyon,代碼行數:101,代碼來源:LoginService.cs


注:本文中的OpenSim.Framework.AvatarAppearance.DetachAttachment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。