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


C# AvatarAppearance.GetAttachpoint方法代码示例

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


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

示例1: CloneFolder

        private bool CloneFolder(List<InventoryFolderBase> avatarInventory, UUID avID, UUID parentFolder, AvatarAppearance appearance, InventoryFolderBase templateFolder, List<InventoryFolderBase> templateFolders, bool modifyPermissions)
        {
            bool success = false;
            UUID templateFolderId = templateFolder.ID;
            if (templateFolderId != UUID.Zero)
            {
                InventoryFolderBase toFolder = FindFolder(templateFolder.Name, parentFolder.Guid, avatarInventory);
                if (toFolder == null)
                {
                    //create new folder
                    toFolder = new InventoryFolderBase();
                    toFolder.ID = UUID.Random();
                    toFolder.Name = templateFolder.Name;
                    toFolder.Owner = avID;
                    toFolder.Type = templateFolder.Type;
                    toFolder.Version = 1;
                    toFolder.ParentID = parentFolder;
                    if (!SynchronousRestObjectRequester.MakeRequest<InventoryFolderBase, bool>(
                "POST", m_inventoryServerUrl + "CreateFolder/", toFolder))
                    {
                        m_log.InfoFormat("[AvatarApperance] Couldn't make new folder {0} in users inventory", toFolder.Name);
                        return false;
                    }
                    else
                    {
                        // m_log.InfoFormat("made new folder {0} in users inventory", toFolder.Name);
                    }
                }

                List<InventoryItemBase> templateItems = SynchronousRestObjectRequester.MakeRequest<Guid, List<InventoryItemBase>>(
               "POST", m_inventoryServerUrl + "GetItems/", templateFolderId.Guid);
                if ((templateItems != null) && (templateItems.Count > 0))
                {
                    List<ClothesAttachment> wornClothes = new List<ClothesAttachment>();
                    List<ClothesAttachment> attachedItems = new List<ClothesAttachment>();

                    foreach (InventoryItemBase item in templateItems)
                    {

                        UUID clonedItemId = CloneInventoryItem(avID, toFolder.ID, item, modifyPermissions);
                        if (clonedItemId != UUID.Zero)
                        {
                            int appearanceType = ItemIsPartOfAppearance(item, appearance);
                            if (appearanceType >= 0)
                            {
                               // UpdateAvatarAppearance(avID, appearanceType, clonedItemId, item.AssetID);
                                wornClothes.Add(new ClothesAttachment(appearanceType, clonedItemId, item.AssetID));
                            }

                            if (appearance != null)
                            {
                                int attachment = appearance.GetAttachpoint(item.ID);
                                if (attachment > 0)
                                {
                                    //UpdateAvatarAttachment(avID, attachment, clonedItemId, item.AssetID);
                                    attachedItems.Add(new ClothesAttachment(attachment, clonedItemId, item.AssetID));
                                }
                            }
                            success = true;
                        }
                    }

                    if ((wornClothes.Count > 0) || (attachedItems.Count > 0))
                    {
                        //Update the worn clothes and attachments
                        AvatarAppearance targetAppearance = GetAppearance(avID);
                        if (targetAppearance != null)
                        {
                            foreach (ClothesAttachment wornItem in wornClothes)
                            {
                                targetAppearance.Wearables[wornItem.Type].AssetID = wornItem.AssetID;
                                targetAppearance.Wearables[wornItem.Type].ItemID = wornItem.ItemID;
                            }

                            foreach (ClothesAttachment wornItem in attachedItems)
                            {
                                targetAppearance.SetAttachment(wornItem.Type, wornItem.ItemID, wornItem.AssetID);
                            }

                            m_userDataBaseService.UpdateUserAppearance(avID, targetAppearance);
                            wornClothes.Clear();
                            attachedItems.Clear();
                        }
                    }
                }
                else if ((templateItems != null) && (templateItems.Count == 0))
                {
                   // m_log.Info("[AvatarAppearance]Folder being cloned was empty");
                    success = true;
                }

                List<InventoryFolderBase> subFolders = FindSubFolders(templateFolder.ID.Guid, templateFolders);
                foreach (InventoryFolderBase subFolder in subFolders)
                {
                    if (subFolder.Name.ToLower() != "trash")
                    {
                        success = CloneFolder(avatarInventory, avID, toFolder.ID, appearance, subFolder, templateFolders, modifyPermissions);
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:101,代码来源:AvatarCreationModule.cs

示例2: CopyInventoryFolders


//.........这里部分代码省略.........
            InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, assetType);

            if (sourceFolder == null || destinationFolder == null)
                throw new Exception("Cannot locate folder(s)");

            // Missing source folder? This should *never* be the case
            if (sourceFolder.Type != (short)assetType)
            {
                sourceFolder = new InventoryFolderBase();
                sourceFolder.ID       = UUID.Random();
                if (assetType == AssetType.Clothing) {
                    sourceFolder.Name     = "Clothing";
                } else {
                    sourceFolder.Name     = "Body Parts";
                }
                sourceFolder.Owner    = source;
                sourceFolder.Type     = (short)assetType;
                sourceFolder.ParentID = inventoryService.GetRootFolder(source).ID;
                sourceFolder.Version  = 1;
                inventoryService.AddFolder(sourceFolder);     // store base record
                m_log.ErrorFormat("[RADMIN] Created folder for source {0}", source);
            }

            // Missing destination folder? This should *never* be the case
            if (destinationFolder.Type != (short)assetType)
            {
                destinationFolder = new InventoryFolderBase();
                destinationFolder.ID       = UUID.Random();
                if (assetType == AssetType.Clothing) {
                    destinationFolder.Name  = "Clothing";
                } else {
                    destinationFolder.Name  = "Body Parts";
                }
                destinationFolder.Owner    = destination;
                destinationFolder.Type     = (short)assetType;
                destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
                destinationFolder.Version  = 1;
                inventoryService.AddFolder(destinationFolder);     // store base record
                m_log.ErrorFormat("[RADMIN]: Created folder for destination {0}", source);
            }

            InventoryFolderBase extraFolder;
            List<InventoryFolderBase> folders = inventoryService.GetFolderContent(source, sourceFolder.ID).Folders;

            foreach (InventoryFolderBase folder in folders)
            {

                extraFolder = new InventoryFolderBase();
                extraFolder.ID = UUID.Random();
                extraFolder.Name = folder.Name;
                extraFolder.Owner = destination;
                extraFolder.Type = folder.Type;
                extraFolder.Version = folder.Version;
                extraFolder.ParentID = destinationFolder.ID;
                inventoryService.AddFolder(extraFolder);

                m_log.DebugFormat("[RADMIN]: Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID);

                List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items;

                foreach (InventoryItemBase item in items)
                {
                    InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
                    destinationItem.Name = item.Name;
                    destinationItem.Owner = destination;
                    destinationItem.Description = item.Description;
                    destinationItem.InvType = item.InvType;
                    destinationItem.CreatorId = item.CreatorId;
                    destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
                    destinationItem.CreatorData = item.CreatorData;
                    destinationItem.NextPermissions = item.NextPermissions;
                    destinationItem.CurrentPermissions = item.CurrentPermissions;
                    destinationItem.BasePermissions = item.BasePermissions;
                    destinationItem.EveryOnePermissions = item.EveryOnePermissions;
                    destinationItem.GroupPermissions = item.GroupPermissions;
                    destinationItem.AssetType = item.AssetType;
                    destinationItem.AssetID = item.AssetID;
                    destinationItem.GroupID = item.GroupID;
                    destinationItem.GroupOwned = item.GroupOwned;
                    destinationItem.SalePrice = item.SalePrice;
                    destinationItem.SaleType = item.SaleType;
                    destinationItem.Flags = item.Flags;
                    destinationItem.CreationDate = item.CreationDate;
                    destinationItem.Folder = extraFolder.ID;
                    ApplyNextOwnerPermissions(destinationItem);

                    m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
                    inventoryMap.Add(item.ID, destinationItem.ID);
                    m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);

                    // Attach item, if original is attached
                    int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
                    if (attachpoint != 0)
                    {
                        avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
                        m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
                    }
                }
            }
        }
开发者ID:NovaGrid,项目名称:opensim,代码行数:101,代码来源:RemoteAdminPlugin.cs

示例3: CopyInventoryFolders


//.........这里部分代码省略.........
            InventoryFolderBase sourceFolder = inventoryService.GetFolderForType(source, InventoryType.Unknown, assetType);
            InventoryFolderBase destinationFolder = inventoryService.GetFolderForType (destination, InventoryType.Unknown, assetType);

            if (sourceFolder == null || destinationFolder == null)
                throw new Exception("Cannot locate folder(s)");

            // Missing source folder? This should *never* be the case
            if (sourceFolder.Type != (short)assetType)
            {
                sourceFolder = new InventoryFolderBase
                                   {
                                       ID = UUID.Random(),
                                       Name = assetType == AssetType.Clothing ? "Clothing" : "Body Parts",
                                       Owner = source,
                                       Type = (short) assetType,
                                       ParentID = inventoryService.GetRootFolder(source).ID,
                                       Version = 1
                                   };
                inventoryService.AddFolder(sourceFolder);     // store base record
                MainConsole.Instance.ErrorFormat("[RADMIN] Created folder for source {0}", source);
            }

            // Missing destination folder? This should *never* be the case
            if (destinationFolder.Type != (short)assetType)
            {
                destinationFolder = new InventoryFolderBase
                                        {
                                            ID = UUID.Random(),
                                            Name = assetType.ToString(),
                                            Owner = destination,
                                            Type = (short) assetType,
                                            ParentID = inventoryService.GetRootFolder(destination).ID,
                                            Version = 1
                                        };
                inventoryService.AddFolder(destinationFolder);     // store base record
                MainConsole.Instance.ErrorFormat("[RADMIN] Created folder for destination {0}", source);
            }

            List<InventoryFolderBase> folders = inventoryService.GetFolderContent(source, sourceFolder.ID).Folders;

            foreach (InventoryFolderBase folder in folders)
            {

                InventoryFolderBase extraFolder = new InventoryFolderBase
                                                      {
                                                          ID = UUID.Random(),
                                                          Name = folder.Name,
                                                          Owner = destination,
                                                          Type = folder.Type,
                                                          Version = folder.Version,
                                                          ParentID = destinationFolder.ID
                                                      };
                inventoryService.AddFolder(extraFolder);

                MainConsole.Instance.DebugFormat("[RADMIN] Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID);

                List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items;

                foreach (InventoryItemBase item in items)
                {
                    InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination)
                                                            {
                                                                Name = item.Name,
                                                                Description = item.Description,
                                                                InvType = item.InvType,
                                                                CreatorId = item.CreatorId,
                                                                CreatorData = item.CreatorData,
                                                                CreatorIdAsUuid = item.CreatorIdAsUuid,
                                                                NextPermissions = item.NextPermissions,
                                                                CurrentPermissions = item.CurrentPermissions,
                                                                BasePermissions = item.BasePermissions,
                                                                EveryOnePermissions = item.EveryOnePermissions,
                                                                GroupPermissions = item.GroupPermissions,
                                                                AssetType = item.AssetType,
                                                                AssetID = item.AssetID,
                                                                GroupID = item.GroupID,
                                                                GroupOwned = item.GroupOwned,
                                                                SalePrice = item.SalePrice,
                                                                SaleType = item.SaleType,
                                                                Flags = item.Flags,
                                                                CreationDate = item.CreationDate,
                                                                Folder = extraFolder.ID
                                                            };

                    ILLClientInventory inventoryModule = manager.CurrentOrFirstScene.RequestModuleInterface<ILLClientInventory>();
                    if (inventoryModule != null)
                        inventoryModule.AddInventoryItem(destinationItem);
                    inventoryMap.Add(item.ID, destinationItem.ID);
                    MainConsole.Instance.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);

                    // Attach item, if original is attached
                    int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
                    if (attachpoint != 0)
                    {
                        avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
                        MainConsole.Instance.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
                    }
                }
            }
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:101,代码来源:RemoteAdminPlugin.cs


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