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


C# AvatarAppearance.GetAttachments方法代码示例

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


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

示例1: CopyWearablesAndAttachments

        /// <summary>
        /// This method is called by establishAppearance to do a copy all inventory items
        /// worn or attached to the Clothing inventory folder of the receiving avatar.
        /// In parallel the avatar wearables and attachments are updated.
        /// </summary>

        private void CopyWearablesAndAttachments(UUID destination, UUID source, AvatarAppearance avatarAppearance)
        {
            IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService;

            // Get Clothing folder of receiver
            InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, AssetType.Clothing);

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

            // Missing destination folder? This should *never* be the case
            if (destinationFolder.Type != (short)AssetType.Clothing)
            {
                destinationFolder = new InventoryFolderBase();
                
                destinationFolder.ID       = UUID.Random();
                destinationFolder.Name     = "Clothing";
                destinationFolder.Owner    = destination;
                destinationFolder.Type     = (short)AssetType.Clothing;
                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);
            }

            // Wearables
            AvatarWearable[] wearables = avatarAppearance.Wearables;
            AvatarWearable wearable;

            for (int i=0; i<wearables.Length; i++)
            {
                wearable = wearables[i];
                if (wearable[0].ItemID != UUID.Zero)
                {
                    // Get inventory item and copy it
                    InventoryItemBase item = new InventoryItemBase(wearable[0].ItemID, source);
                    item = inventoryService.GetItem(item);

                    if (item != null)
                    {
                        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 = destinationFolder.ID;
                        ApplyNextOwnerPermissions(destinationItem);

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

                        // Wear item
                        AvatarWearable newWearable = new AvatarWearable();
                        newWearable.Wear(destinationItem.ID, wearable[0].AssetID);
                        avatarAppearance.SetWearable(i, newWearable);
                    }
                    else
                    {
                        m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable[0].ItemID, destinationFolder.ID);
                    }
                }
            }

            // Attachments
            List<AvatarAttachment> attachments = avatarAppearance.GetAttachments();

            foreach (AvatarAttachment attachment in attachments)
            {
                int attachpoint = attachment.AttachPoint;
                UUID itemID = attachment.ItemID;

                if (itemID != UUID.Zero)
                {
                    // Get inventory item and copy it
                    InventoryItemBase item = new InventoryItemBase(itemID, source);
                    item = inventoryService.GetItem(item);

                    if (item != null)
//.........这里部分代码省略.........
开发者ID:NovaGrid,项目名称:opensim,代码行数:101,代码来源:RemoteAdminPlugin.cs

示例2: AvatarAppearance

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

            if (appearance == null)
            {
                m_serial = 1;
                m_owner = UUID.Zero;

                SetDefaultWearables();
                SetDefaultTexture();
                SetDefaultParams();
                SetHeight();

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

                return;
            }

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

            m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
            for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
                m_wearables[i] = new AvatarWearable();
            if (copyWearables && (appearance.Wearables != null))
            {
                for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
                    SetWearable(i, appearance.Wearables[i]);
            }

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

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

            // Copy the attachment, force append mode since that ensures consistency
            m_attachments = new Dictionary<int, List<AvatarAttachment>>();
            foreach (AvatarAttachment attachment in appearance.GetAttachments())
                AppendAttachment(new AvatarAttachment(attachment));
        }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:47,代码来源:AvatarAppearance.cs

示例3: UpdateUserAppearance

        /// <summary>
        /// Update a user appearence into database
        /// </summary>
        /// <param name="user">the used UUID</param>
        /// <param name="appearance">the appearence</param>
        override public void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
        {
            string sql = @"DELETE FROM avatarappearance WHERE [email protected]; 
                        INSERT INTO avatarappearance 
                           (owner, serial, visual_params, texture, avatar_height, 
                            body_item, body_asset, skin_item, skin_asset, hair_item, 
                            hair_asset, eyes_item, eyes_asset, shirt_item, shirt_asset, 
                            pants_item, pants_asset, shoes_item, shoes_asset, socks_item, 
                            socks_asset, jacket_item, jacket_asset, gloves_item, gloves_asset, 
                            undershirt_item, undershirt_asset, underpants_item, underpants_asset, 
                            skirt_item, skirt_asset) 
                        VALUES
                           (@owner, @serial, @visual_params, @texture, @avatar_height, 
                            @body_item, @body_asset, @skin_item, @skin_asset, @hair_item, 
                            @hair_asset, @eyes_item, @eyes_asset, @shirt_item, @shirt_asset, 
                            @pants_item, @pants_asset, @shoes_item, @shoes_asset, @socks_item, 
                            @socks_asset, @jacket_item, @jacket_asset, @gloves_item, @gloves_asset, 
                            @undershirt_item, @undershirt_asset, @underpants_item, @underpants_asset, 
                            @skirt_item, @skirt_asset)";

            using (AutoClosingSqlCommand cmd = database.Query(sql))
            {
                cmd.Parameters.Add(database.CreateParameter("@owner", appearance.Owner));
                cmd.Parameters.Add(database.CreateParameter("@serial", appearance.Serial));
                cmd.Parameters.Add(database.CreateParameter("@visual_params", appearance.VisualParams));
                cmd.Parameters.Add(database.CreateParameter("@texture", appearance.Texture.GetBytes()));
                cmd.Parameters.Add(database.CreateParameter("@avatar_height", appearance.AvatarHeight));
                cmd.Parameters.Add(database.CreateParameter("@body_item", appearance.BodyItem));
                cmd.Parameters.Add(database.CreateParameter("@body_asset", appearance.BodyAsset));
                cmd.Parameters.Add(database.CreateParameter("@skin_item", appearance.SkinItem));
                cmd.Parameters.Add(database.CreateParameter("@skin_asset", appearance.SkinAsset));
                cmd.Parameters.Add(database.CreateParameter("@hair_item", appearance.HairItem));
                cmd.Parameters.Add(database.CreateParameter("@hair_asset", appearance.HairAsset));
                cmd.Parameters.Add(database.CreateParameter("@eyes_item", appearance.EyesItem));
                cmd.Parameters.Add(database.CreateParameter("@eyes_asset", appearance.EyesAsset));
                cmd.Parameters.Add(database.CreateParameter("@shirt_item", appearance.ShirtItem));
                cmd.Parameters.Add(database.CreateParameter("@shirt_asset", appearance.ShirtAsset));
                cmd.Parameters.Add(database.CreateParameter("@pants_item", appearance.PantsItem));
                cmd.Parameters.Add(database.CreateParameter("@pants_asset", appearance.PantsAsset));
                cmd.Parameters.Add(database.CreateParameter("@shoes_item", appearance.ShoesItem));
                cmd.Parameters.Add(database.CreateParameter("@shoes_asset", appearance.ShoesAsset));
                cmd.Parameters.Add(database.CreateParameter("@socks_item", appearance.SocksItem));
                cmd.Parameters.Add(database.CreateParameter("@socks_asset", appearance.SocksAsset));
                cmd.Parameters.Add(database.CreateParameter("@jacket_item", appearance.JacketItem));
                cmd.Parameters.Add(database.CreateParameter("@jacket_asset", appearance.JacketAsset));
                cmd.Parameters.Add(database.CreateParameter("@gloves_item", appearance.GlovesItem));
                cmd.Parameters.Add(database.CreateParameter("@gloves_asset", appearance.GlovesAsset));
                cmd.Parameters.Add(database.CreateParameter("@undershirt_item", appearance.UnderShirtItem));
                cmd.Parameters.Add(database.CreateParameter("@undershirt_asset", appearance.UnderShirtAsset));
                cmd.Parameters.Add(database.CreateParameter("@underpants_item", appearance.UnderPantsItem));
                cmd.Parameters.Add(database.CreateParameter("@underpants_asset", appearance.UnderPantsAsset));
                cmd.Parameters.Add(database.CreateParameter("@skirt_item", appearance.SkirtItem));
                cmd.Parameters.Add(database.CreateParameter("@skirt_asset", appearance.SkirtAsset));

                try
                {
                    cmd.ExecuteNonQuery();
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat("[USER DB] Error updating user appearance, error: {0}", e.Message);
                }
            }
            UpdateUserAttachments(user, appearance.GetAttachments());
        }
开发者ID:ChrisD,项目名称:opensim,代码行数:70,代码来源:MSSQLUserData.cs

示例4: AvatarAppearance

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

            if (appearance == null)
            {
                m_serial = 0;
                SetDefaultWearables();
                SetDefaultTexture();
                SetDefaultParams();
//                SetHeight();
                SetSize(new Vector3(0.45f, 0.6f, 1.9f));
                m_attachments = new Dictionary<int, List<AvatarAttachment>>();

                return;
            }

            m_serial = appearance.Serial;

            if (copyWearables && (appearance.Wearables != null))
            {
                m_wearables = new AvatarWearable[appearance.Wearables.Length];
                for (int i = 0; i < appearance.Wearables.Length; i++)
                {
                    m_wearables[i] = new AvatarWearable();
                    AvatarWearable wearable = appearance.Wearables[i];
                    for (int j = 0; j < wearable.Count; j++)
                            m_wearables[i].Add(wearable[j].ItemID, wearable[j].AssetID);                       
                 }
            }
            else
                ClearWearables();

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

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

//            m_avatarHeight = appearance.m_avatarHeight;
            SetSize(appearance.AvatarSize);

            // Copy the attachment, force append mode since that ensures consistency
            m_attachments = new Dictionary<int, List<AvatarAttachment>>();
            foreach (AvatarAttachment attachment in appearance.GetAttachments())
                AppendAttachment(new AvatarAttachment(attachment));
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:56,代码来源:AvatarAppearance.cs

示例5: CheckAttachmentCount

        public bool CheckAttachmentCount(UUID botID, AvatarAppearance appearance, ILandObject parcel, UUID originalOwner, out string reason)
        {
            int landImpact = 0;
            foreach (AvatarAttachment attachment in appearance.GetAttachments())
            {
                // get original itemID
                UUID origItemID = attachment.ItemID ^ botID;
                if (origItemID == UUID.Zero)
                    continue;

                IInventoryProviderSelector inventorySelect = ProviderRegistry.Instance.Get<IInventoryProviderSelector>();
                var provider = inventorySelect.GetProvider(originalOwner);
                InventoryItemBase item = provider.GetItem(origItemID, UUID.Zero);

                SceneObjectGroup grp = m_scene.GetObjectFromItem(item);
                if (grp != null)
                {
                    if ((grp.GetEffectivePermissions(true) & (uint)PermissionMask.Copy) != (uint)PermissionMask.Copy)
                        continue;//No copy objects cannot be attached
                    landImpact += grp.LandImpact;
                }
            }

            if (!m_scene.CheckLandImpact(parcel, landImpact, out reason))
            {
                //Cannot create bot on a parcel that does not allow for rezzing an object
                reason = "Attachments exceed the land impact limit for this " + reason + ".";
                return false;
            }

            reason = null;
            return true;
        }
开发者ID:MatthewBeardmore,项目名称:halcyon,代码行数:33,代码来源:BotManager.cs

示例6: AvatarData

        public AvatarData(AvatarAppearance appearance)
        {
            AvatarType = 1; // SL avatars
            Data = new Dictionary<string, string>();

            Data["Serial"] = appearance.Serial.ToString();
            // Wearables
            Data["AvatarHeight"] = appearance.AvatarHeight.ToString();

            for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++)
            {
                for (int j = 0 ; j < appearance.Wearables[i].Count ; j++)
                {
                    string fieldName = String.Format("Wearable {0}:{1}", i, j);
                    Data[fieldName] = String.Format("{0}:{1}",
                            appearance.Wearables[i][j].ItemID.ToString(),
                            appearance.Wearables[i][j].AssetID.ToString());
                }
            }

            // Visual Params
            string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT];
            byte[] binary = appearance.VisualParams;

            for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++)
            {
                vps[i] = binary[i].ToString();
            }

            Data["VisualParams"] = String.Join(",", vps);

            // Attachments
            List<AvatarAttachment> attachments = appearance.GetAttachments();
            foreach (AvatarAttachment attach in attachments)
            {
                Data["_ap_" + attach.AttachPoint] = attach.ItemID.ToString();
            }
        }
开发者ID:NovaGrid,项目名称:opensim,代码行数:38,代码来源:IAvatarService.cs

示例7: AvatarData

        public AvatarData(AvatarAppearance appearance)
        {
            AvatarType = 1; // SL avatars
            Data = new Dictionary<string, string>();

            Data["Serial"] = appearance.Serial.ToString();
            // Wearables
            Data["AvatarHeight"] = appearance.AvatarHeight.ToString();
            Data["BodyItem"] = appearance.BodyItem.ToString();
            Data["EyesItem"] = appearance.EyesItem.ToString();
            Data["GlovesItem"] = appearance.GlovesItem.ToString();
            Data["HairItem"] = appearance.HairItem.ToString();
            Data["JacketItem"] = appearance.JacketItem.ToString();
            Data["PantsItem"] = appearance.PantsItem.ToString();
            Data["ShirtItem"] = appearance.ShirtItem.ToString();
            Data["ShoesItem"] = appearance.ShoesItem.ToString();
            Data["SkinItem"] = appearance.SkinItem.ToString();
            Data["SkirtItem"] = appearance.SkirtItem.ToString();
            Data["SocksItem"] = appearance.SocksItem.ToString();
            Data["UnderPantsItem"] = appearance.UnderPantsItem.ToString();
            Data["UnderShirtItem"] = appearance.UnderShirtItem.ToString();

            Data["BodyAsset"] = appearance.BodyAsset.ToString();
            Data["EyesAsset"] = appearance.EyesAsset.ToString();
            Data["GlovesAsset"] = appearance.GlovesAsset.ToString();
            Data["HairAsset"] = appearance.HairAsset.ToString();
            Data["JacketAsset"] = appearance.JacketAsset.ToString();
            Data["PantsAsset"] = appearance.PantsAsset.ToString();
            Data["ShirtAsset"] = appearance.ShirtAsset.ToString();
            Data["ShoesAsset"] = appearance.ShoesAsset.ToString();
            Data["SkinAsset"] = appearance.SkinAsset.ToString();
            Data["SkirtAsset"] = appearance.SkirtAsset.ToString();
            Data["SocksAsset"] = appearance.SocksAsset.ToString();
            Data["UnderPantsAsset"] = appearance.UnderPantsAsset.ToString();
            Data["UnderShirtAsset"] = appearance.UnderShirtAsset.ToString();

            Data["AlphaAsset"] = appearance.AlphaAsset.ToString();
            Data["AlphaItem"] = appearance.AlphaItem.ToString();
            Data["TattooAsset"] = appearance.TattooAsset.ToString();
            Data["TattooItem"] = appearance.TattooItem.ToString();

            // Attachments
            Hashtable attachs = appearance.GetAttachments();
            if (attachs != null)
                foreach (DictionaryEntry dentry in attachs)
                {
                    if (dentry.Value != null)
                    {
                        Hashtable tab = (Hashtable)dentry.Value;
                        if (tab.ContainsKey("item") && tab["item"] != null)
                            Data["_ap_" + dentry.Key] = tab["item"].ToString();
                    }
                }
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:54,代码来源:IAvatarService.cs

示例8: 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

示例9: CopyWearablesAndAttachments

        /// <summary>
        /// This method is called by establishAppearance to do a copy all inventory items
        /// worn or attached to the Clothing inventory folder of the receiving avatar.
        /// In parallel the avatar wearables and attachments are updated.
        /// </summary>

        private void CopyWearablesAndAttachments(UUID destination, UUID source, AvatarAppearance avatarAppearance)
        {
            IInventoryService inventoryService = manager.CurrentOrFirstScene.InventoryService;

            // Get Clothing folder of receiver
            InventoryFolderBase destinationFolder = inventoryService.GetFolderForType (destination, InventoryType.Wearable, AssetType.Clothing);

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

            // Missing destination folder? This should *never* be the case
            if (destinationFolder.Type != (short)AssetType.Clothing)
            {
                destinationFolder = new InventoryFolderBase
                                        {
                                            ID = UUID.Random(),
                                            Name = "Clothing",
                                            Owner = destination,
                                            Type = (short) AssetType.Clothing,
                                            ParentID = inventoryService.GetRootFolder(destination).ID,
                                            Version = 1
                                        };

                inventoryService.AddFolder(destinationFolder);     // store base record
                MainConsole.Instance.ErrorFormat("[RADMIN] Created folder for destination {0}", source);
            }

            // Wearables
            AvatarWearable[] wearables = avatarAppearance.Wearables;

            for (int i = 0; i < wearables.Length; i++)
            {
                AvatarWearable wearable = wearables[i];
                if (wearable[0].ItemID != UUID.Zero)
                {
                    // Get inventory item and copy it
                    InventoryItemBase item = new InventoryItemBase(wearable[0].ItemID, source);
                    item = inventoryService.GetItem(item);

                    if (item != null)
                    {
                        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 = destinationFolder.ID
                                                                };
                        ILLClientInventory inventoryModule = manager.CurrentOrFirstScene.RequestModuleInterface<ILLClientInventory>();
                        if (inventoryModule != null)
                            inventoryModule.AddInventoryItem(destinationItem);
                        MainConsole.Instance.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);

                        // Wear item
                        AvatarWearable newWearable = new AvatarWearable();
                        newWearable.Wear(destinationItem.ID, wearable[0].AssetID);
                        avatarAppearance.SetWearable(i, newWearable);
                    }
                    else
                    {
                        MainConsole.Instance.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable[0].ItemID, destinationFolder.ID);
                    }
                }
            }

            // Attachments
            List<AvatarAttachment> attachments = avatarAppearance.GetAttachments();

            foreach (AvatarAttachment attachment in attachments)
            {
                int attachpoint = attachment.AttachPoint;
                UUID itemID = attachment.ItemID;

                if (itemID != UUID.Zero)
                {
                    // Get inventory item and copy it
                    InventoryItemBase item = new InventoryItemBase(itemID, source);
                    item = inventoryService.GetItem(item);
//.........这里部分代码省略.........
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:101,代码来源:RemoteAdminPlugin.cs

示例10: AvatarAppearance

        public AvatarAppearance(AvatarAppearance appearance, bool copyWearables)
        {
			if (m_log.IsDebugEnabled) {
				m_log.DebugFormat ("{0} called", System.Reflection.MethodBase.GetCurrentMethod ().Name);
                m_log.WarnFormat("create from an existing appearance CopyWearables={0}", copyWearables);
			}


            if (appearance == null)
            {
                m_serial = 0;
                SetDefaultWearables();
                SetDefaultTexture();
                SetDefaultParams();
                SetHeight();
                m_attachments = new Dictionary<int, List<AvatarAttachment>>();

                ResetTextureHashes();
                
                return;
            }

            m_serial = appearance.Serial;

            m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
            for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
                m_wearables[i] = new AvatarWearable();

            if (copyWearables && (appearance.Wearables != null))
            {
                for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
                    SetWearable(i,appearance.Wearables[i]);
            }

            m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
            for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
                m_texturehashes[i] = new UUID(appearance.m_texturehashes[i]);

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

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

            m_avatarHeight = appearance.m_avatarHeight;

            // Copy the attachment, force append mode since that ensures consistency
            m_attachments = new Dictionary<int, List<AvatarAttachment>>();
            foreach (AvatarAttachment attachment in appearance.GetAttachments())
                AppendAttachment(new AvatarAttachment(attachment));
        }
开发者ID:AkiraSonoda,项目名称:akisim,代码行数:56,代码来源:AvatarAppearance.cs

示例11: AddOrUpdateBotOutfit

 /// <summary>
 /// Adds an outfit into the database
 /// </summary>
 /// <param name="user">The user UUID</param>
 /// <param name="appearance">The avatar appearance</param>
 // override
 public override void AddOrUpdateBotOutfit(UUID userID, string outfitName, AvatarAppearance appearance)
 {
     try
     {
         appearance.Owner = userID;
         this.insertBotAppearanceRow(outfitName, appearance);
         UpdateBotAttachments(userID, outfitName, appearance.GetAttachments());
     }
     catch (Exception e)
     {
         m_log.Error(e.ToString());
     }
 }
开发者ID:digitalmystic,项目名称:halcyon,代码行数:19,代码来源:MySQLUserData.cs

示例12: UpdateUserAppearance

 /// <summary>
 /// Updates an avatar appearence
 /// </summary>
 /// <param name="user">The user UUID</param>
 /// <param name="appearance">The avatar appearance</param>
 // override
 public override void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
 {
     try
     {
         appearance.Owner = user;
         this.insertAppearanceRow(appearance);
         UpdateUserAttachments(user, appearance.GetAttachments());
     }
     catch (Exception e)
     {
         m_log.Error(e.ToString());
     }
 }
开发者ID:digitalmystic,项目名称:halcyon,代码行数:19,代码来源:MySQLUserData.cs

示例13: AvatarData

        public AvatarData(AvatarAppearance appearance)
        {
            AvatarType = 1; // SL avatars
            Data = new Dictionary<string, string>();

            Data["Serial"] = appearance.Serial.ToString();
            // Wearables
            Data["AvatarHeight"] = appearance.AvatarHeight.ToString();

            // TODO: With COF, is this even needed?
            for (int i = 0 ; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES ; i++)
            {
                for (int j = 0 ; j < appearance.Wearables[i].Count ; j++)
                {
                    string fieldName = String.Format("Wearable {0}:{1}", i, j);
                    Data[fieldName] = String.Format("{0}:{1}",
                            appearance.Wearables[i][j].ItemID.ToString(),
                            appearance.Wearables[i][j].AssetID.ToString());
                }
            }

            // Visual Params
            //string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT];
            //byte[] binary = appearance.VisualParams;

            //            for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++)

            byte[] binary = appearance.VisualParams;
            string[] vps = new string[binary.Length];

            for (int i = 0; i < binary.Length; i++)
            {
                vps[i] = binary[i].ToString();
            }

            Data["VisualParams"] = String.Join(",", vps);

            // Attachments
            List<AvatarAttachment> attachments = appearance.GetAttachments();
            Dictionary<int, List<string>> atts = new Dictionary<int, List<string>>();
            foreach (AvatarAttachment attach in attachments)
            {
                if (attach.ItemID != UUID.Zero)
                {
                    if (!atts.ContainsKey(attach.AttachPoint))
                        atts[attach.AttachPoint] = new List<string>();
                    atts[attach.AttachPoint].Add(attach.ItemID.ToString());
                }
            }
            foreach (KeyValuePair<int, List<string>> kvp in atts)
                Data["_ap_" + kvp.Key] = string.Join(",", kvp.Value.ToArray());
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:52,代码来源:IAvatarService.cs

示例14: UpdateUserAppearance

        /// <summary>
        /// Updates an avatar appearence
        /// </summary>
        /// <param name="user">The user UUID</param>
        /// <param name="appearance">The avatar appearance</param>
        // override
        public override void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
        {
            MySQLSuperManager dbm = GetLockedConnection("UpdateUserAppearance");
            try
            {
                appearance.Owner = user;
                dbm.Manager.insertAppearanceRow(appearance);

                UpdateUserAttachments(user, appearance.GetAttachments());
            }
            catch (Exception e)
            {
                dbm.Manager.Reconnect();
                m_log.Error(e.Message, e);
            }
            finally
            {
                dbm.Release();
            }
        }
开发者ID:intari,项目名称:OpenSimMirror,代码行数:26,代码来源:MySQLUserData.cs

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