当前位置: 首页>>代码示例>>C#>>正文


C# AvatarAppearance.GetWearables方法代码示例

本文整理汇总了C#中OpenSim.Framework.AvatarAppearance.GetWearables方法的典型用法代码示例。如果您正苦于以下问题:C# AvatarAppearance.GetWearables方法的具体用法?C# AvatarAppearance.GetWearables怎么用?C# AvatarAppearance.GetWearables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Framework.AvatarAppearance的用法示例。


在下文中一共展示了AvatarAppearance.GetWearables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemapWornItems

        private void RemapWornItems(UUID botID, AvatarAppearance appearance)
        {
            // save before Clear calls
            List<AvatarWearable> wearables = appearance.GetWearables();
            List<AvatarAttachment> attachments = appearance.GetAttachments();
            appearance.ClearWearables();
            appearance.ClearAttachments();

            // Remap bot outfit with new item IDs
            foreach (AvatarWearable w in wearables)
            {
                AvatarWearable newWearable = new AvatarWearable(w);
                // store a reversible back-link to the original inventory item ID.
                newWearable.ItemID = w.ItemID ^ botID;
                appearance.SetWearable(newWearable);
            }

            foreach (AvatarAttachment a in attachments)
            {
                // store a reversible back-link to the original inventory item ID.
                UUID itemID = a.ItemID ^ botID;
                appearance.SetAttachment(a.AttachPoint, true, itemID, a.AssetID);
            }
        }
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:24,代码来源:BotManager.cs

示例2: FixCurrentOutFitFolder

        protected bool FixCurrentOutFitFolder(UUID user, ref AvatarAppearance avappearance)
        {
            IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get<IInventoryProviderSelector>();
            IInventoryStorage inventoryService = inventorySelect.GetProvider(user);
            InventoryFolderBase CurrentOutfitFolder = null;
            bool changed = false;

            try
            {
                CurrentOutfitFolder = inventoryService.FindFolderForType(user, AssetType.CurrentOutfitFolder);
            }
            catch (InventoryStorageException)
            {
                // could not find it by type. load root and try to find it by name.
                InventorySubFolderBase foundFolder = null;
                InventoryFolderBase rootFolder = inventoryService.FindFolderForType(user, AssetType.RootFolder);
                foreach (var subfolder in rootFolder.SubFolders)
                {
                    if (subfolder.Name == COF_NAME)
                    {
                        foundFolder = subfolder;
                        break;
                    }
                }
                if (foundFolder != null)
                {
                    CurrentOutfitFolder = inventoryService.GetFolder(foundFolder.ID);
                    if (CurrentOutfitFolder != null)
                    {
                        CurrentOutfitFolder.Level = InventoryFolderBase.FolderLevel.TopLevel;
                        inventoryService.SaveFolder(CurrentOutfitFolder);
                    }
                }
            }
            if (CurrentOutfitFolder == null) return false;
            List<InventoryItemBase> ic = inventoryService.GetFolder(CurrentOutfitFolder.ID).Items;
            List<InventoryItemBase> brokenLinks = new List<InventoryItemBase>();
            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))
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:halcyon,代码行数:101,代码来源:LoginService.cs

示例3: AvatarAppearance

        public AvatarAppearance(AvatarAppearance appearance, bool copyWearables)
        {
//            m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");

            m_attachments = new Dictionary<int, List<AvatarAttachment>>();
            m_wearables = new Dictionary<int, AvatarWearable>(); 

            if (appearance == null)
            {
                m_serial = VERSION_INITIAL;
                m_owner = UUID.Zero;
                SetDefaultWearables();
                SetDefaultTexture();
                SetDefaultParams();
                SetHeight();
                return;
            }

            m_owner = appearance.Owner;
            m_serial = appearance.Serial;

            if (copyWearables == true)
            {
                ClearWearables();
                SetWearables(appearance.GetWearables());
            }
            else
                SetDefaultWearables();

            m_texture = null;
            if (appearance.Texture != null)
            {
                byte[] tbytes = appearance.Texture.GetBytes();
                m_texture = new Primitive.TextureEntry(tbytes, 0, tbytes.Length);
            }
            else
            {
                SetDefaultTexture();
            }

            m_visualparams = null;
            if (appearance.VisualParams != null)
                m_visualparams = (byte[])appearance.VisualParams.Clone();
            else
                SetDefaultParams();

            IsBotAppearance = appearance.IsBotAppearance;

            SetHeight();

            SetAttachments(appearance.GetAttachments());
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:52,代码来源:AvatarAppearance.cs


注:本文中的OpenSim.Framework.AvatarAppearance.GetWearables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。