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


C# AvatarAppearance.SetVisualParams方法代码示例

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


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

示例1: Unpack


//.........这里部分代码省略.........
                Groups = new AgentGroupData[groups.Count];
                int i = 0;
                foreach (OSD o in groups)
                {
                    if (o.Type == OSDType.Map)
                    {
                        Groups[i++] = new AgentGroupData((OSDMap)o);
                    }
                }
            }

            if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
            {
                OSDArray anims = (OSDArray)(args["animations"]);
                Anims = new Animation[anims.Count];
                int i = 0;
                foreach (OSD o in anims)
                {
                    if (o.Type == OSDType.Map)
                    {
                        Anims[i++] = new Animation((OSDMap)o);
                    }
                }
            }

            //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
            //{
            //    OSDArray textures = (OSDArray)(args["agent_textures"]);
            //    AgentTextures = new UUID[textures.Count];
            //    int i = 0;
            //    foreach (OSD o in textures)
            //        AgentTextures[i++] = o.AsUUID();
            //}

            Appearance = new AvatarAppearance(AgentID);

            // The code to unpack textures, visuals, wearables and attachments
            // should be removed; packed appearance contains the full appearance
            // This is retained for backward compatibility only
            if (args["texture_entry"] != null)
            {
                byte[] rawtextures = args["texture_entry"].AsBinary();
                Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
                List<UUID> changed = new List<UUID>();
                Appearance.SetTextureEntries(textures, out changed);
            }

            if (args["visual_params"] != null)
                Appearance.SetVisualParams(args["visual_params"].AsBinary());

            if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
            {
                OSDArray wears = (OSDArray)(args["wearables"]);
                for (int i = 0; i < wears.Count / 2; i++)
                {
                    AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
                    Appearance.SetWearable(i, awear);
                }
            }

            if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
            {
                OSDArray attachs = (OSDArray)(args["attachments"]);
                foreach (OSD o in attachs)
                {
                    if (o.Type == OSDType.Map)
                    {
                        // We know all of these must end up as attachments so we
                        // append rather than replace to ensure multiple attachments
                        // per point continues to work
                        Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
                    }
                }
            }
            // end of code to remove

            if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
                Appearance = new AvatarAppearance(AgentID, (OSDMap)args["packed_appearance"]);
            // DEBUG ON
            else
                m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
            // DEBUG OFF

            if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
            {
                OSDArray controls = (OSDArray)(args["controllers"]);
                Controllers = new ControllerData[controls.Count];
                int i = 0;
                foreach (OSD o in controls)
                {
                    if (o.Type == OSDType.Map)
                    {
                        Controllers[i++] = new ControllerData((OSDMap)o);
                    }
                }
            }

            if (args["callback_uri"] != null)
                CallbackURI = args["callback_uri"].AsString();
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:101,代码来源:ChildAgentDataUpdate.cs

示例2: Unpack


//.........这里部分代码省略.........
                Anims = new Animation[anims.Count];
                int i = 0;
                foreach (OSD o in anims)
                {
                    if (o.Type == OSDType.Map)
                    {
                        Anims[i++] = new Animation((OSDMap)o);
                    }
                }
            }

            //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
            //{
            //    OSDArray textures = (OSDArray)(args["agent_textures"]);
            //    AgentTextures = new UUID[textures.Count];
            //    int i = 0;
            //    foreach (OSD o in textures)
            //        AgentTextures[i++] = o.AsUUID();
            //}

            Appearance = new AvatarAppearance();

            // The code to unpack textures, visuals, wearables and attachments
            // should be removed; packed appearance contains the full appearance
            // This is retained for backward compatibility only
            if (args["texture_entry"] != null)
            {
                byte[] rawtextures = args["texture_entry"].AsBinary();
                Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length);
                Appearance.SetTextureEntries(textures);
            }

            if (args["visual_params"] != null)
                Appearance.SetVisualParams(args["visual_params"].AsBinary());

            if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
            {
                OSDArray wears = (OSDArray)(args["wearables"]);
                for (int i = 0; i < wears.Count / 2; i++) 
                {
                    AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
                    Appearance.SetWearable(i,awear);
                }
            }

            if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
            {
                OSDArray attachs = (OSDArray)(args["attachments"]);
                foreach (OSD o in attachs)
                {
                    if (o.Type == OSDType.Map)
                    {
                        // We know all of these must end up as attachments so we
                        // append rather than replace to ensure multiple attachments
                        // per point continues to work
//                        m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
                        Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
                    }
                }
            }
            // end of code to remove

            if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
                Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
            else
                m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
开发者ID:4U2NV,项目名称:opensim,代码行数:67,代码来源:ChildAgentDataUpdate.cs

示例3: Unpack


//.........这里部分代码省略.........
            //{
            //    OSDArray textures = (OSDArray)(args["agent_textures"]);
            //    AgentTextures = new UUID[textures.Count];
            //    int i = 0;
            //    foreach (OSD o in textures)
            //        AgentTextures[i++] = o.AsUUID();
            //}


            // packed_appearence should contain all appearance information
            if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
            {
                m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance");
                Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
            }
            else
            {
                // if missing try the old pack method
                m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method");

                Appearance = new AvatarAppearance();

                // The code to unpack textures, visuals, wearables and attachments
                // should be removed; packed appearance contains the full appearance
                // This is retained for backward compatibility only
                if (args["texture_entry"] != null)
                {
                    byte[] rawtextures = args["texture_entry"].AsBinary();
                    Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
                    Appearance.SetTextureEntries(textures);
                }

                if (args["visual_params"] != null)
                    Appearance.SetVisualParams(args["visual_params"].AsBinary());

                if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
                {
                    OSDArray wears = (OSDArray)(args["wearables"]);

                    for (int i = 0; i < wears.Count / 2; i++)
                    {
                        AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
                        Appearance.SetWearable(i, awear);
                    }
                }

                if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
                {
                    OSDArray attachs = (OSDArray)(args["attachments"]);
                    foreach (OSD o in attachs)
                    {
                        if (o.Type == OSDType.Map)
                        {
                            // We know all of these must end up as attachments so we
                            // append rather than replace to ensure multiple attachments
                            // per point continues to work
                            //                        m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
                            Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
                        }
                    }
                }
                // end of code to remove
            }
/* moved above
            if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
                Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:67,代码来源:ChildAgentDataUpdate.cs

示例4: Unpack


//.........这里部分代码省略.........
                PreyAgent = args["prey_agent"].AsUUID();

            if (args.ContainsKey("agent_access"))
                Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);

            if (args.ContainsKey("active_group_id"))
                ActiveGroupID = args["active_group_id"].AsUUID();

            if ((args.ContainsKey("groups")) && (args["groups"]).Type == OSDType.Array)
            {
                OSDArray groups = (OSDArray)(args["groups"]);
                Groups = new AgentGroupData[groups.Count];
                int i = 0;
                foreach (OSD o in groups)
                {
                    if (o.Type == OSDType.Map)
                    {
                        Groups[i++] = new AgentGroupData((OSDMap)o);
                    }
                }
            }

            if ((args.ContainsKey("animations")) && (args["animations"]).Type == OSDType.Array)
            {
                OSDArray anims = (OSDArray)(args["animations"]);
                Anims = new Animation[anims.Count];
                int i = 0;
                foreach (OSD o in anims)
                {
                    if (o.Type == OSDType.Map)
                    {
                        Anims[i++] = new Animation((OSDMap)o);
                    }
                }
            }

            // Initialize an Appearance
            Appearance = new AvatarAppearance(AgentID);

            if (args.ContainsKey("texture_entry"))
            {
                byte[] data = args["texture_entry"].AsBinary();
                Primitive.TextureEntry textureEntries = new Primitive.TextureEntry(data, 0, data.Length);
                Appearance.SetTextureEntries(textureEntries);
            }

            if (args.ContainsKey("visual_params"))
            {
                byte[] visualParams = args["visual_params"].AsBinary();
                Appearance.SetVisualParams(visualParams);
            }

            if ((args.ContainsKey("wearables")) && (args["wearables"]).Type == OSDType.Array)
            {
                OSDArray wears = (OSDArray)(args["wearables"]);
                List<AvatarWearable> wearables = new List<AvatarWearable>();

                int offset = 0;
                for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
                {
                    if ((offset + 1) < wears.Count)
                    {
                        UUID itemID = wears[offset++].AsUUID();
                        UUID assetID = wears[offset++].AsUUID();
                        wearables.Add(new AvatarWearable(i, itemID, assetID));
                    }
                    else
                    {
                        break;
                    }
                }

                Appearance.SetWearables(wearables);
            }

            if (args.ContainsKey("callback_uri"))
                CallbackURI = args["callback_uri"].AsString();

            if (args.ContainsKey("avatar_as_a_prim"))
                AvatarAsAPrim = args["avatar_as_a_prim"].AsBoolean();

            if (args.ContainsKey("sat_on_group"))
            {
                SatOnGroup = args["sat_on_group"].AsUUID();
                SatOnPrim = args["sat_on_prim"].AsUUID();
                try
                {
                    // "sit_offset" previously used OSD.FromVector3(vec) was used to store the data.
                    // Other Vector3 storage uses OSD.FromString(vec.ToString()).
                    // If originating from old region code, that will still be the case
                    // and the TryParse will trigger a format exception.
                    Vector3.TryParse(args["sit_offset"].ToString(), out SatOnPrimOffset);
                }
                catch (Exception)
                {
                    // The following is compatible with OSD.FromVector3(vec), since Vector3.TryParse is not.
                    SatOnPrimOffset = args["sit_offset"].AsVector3();
                }
            }
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:101,代码来源:ChildAgentDataUpdate.cs


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