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


C# AvatarAppearance.SetWearables方法代码示例

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


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

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