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


C# SceneObjectGroup.ContainsPart方法代码示例

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


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

示例1: MarkWithDifferences

        /// <summary>
        /// Returns true if there was a change between meta entity and the entity group, false otherwise.
        /// If true is returned, it is assumed the metaentity's appearance has changed to reflect the difference (though clients haven't been updated).
        /// </summary>
        public bool MarkWithDifferences(SceneObjectGroup sceneEntityGroup)
        {
            SceneObjectPart sceneEntityPart;
            SceneObjectPart metaEntityPart;
            Diff differences;
            bool changed = false;

            // Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user
            // had originally saved.
            // m_Entity will NOT necessarily be the same entity as the user had saved.
            foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Parts)
            {
                //This is the part that we use to show changes.
                metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum);
                if (sceneEntityGroup.ContainsPart(UnchangedPart.UUID))
                {
                    sceneEntityPart = sceneEntityGroup.GetChildPart(UnchangedPart.UUID);
                    differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart);
                    if (differences != Diff.NONE)
                        metaEntityPart.Text = "CHANGE: " + differences.ToString();
                    if (differences != 0)
                    {
                        // Root Part that has been modified
                        if ((differences & Diff.POSITION) > 0)
                        {
                            // If the position of any part has changed, make sure the RootPart of the
                            // meta entity is pointing with a beam particle system
                            if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
                            {
                                m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
                                m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
                            }
                            BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene,
                                                                          m_UnchangedEntity.RootPart.GetWorldPosition(),
                                                                          MetaEntity.TRANSLUCENT,
                                                                          sceneEntityPart,
                                                                          new Vector3(0, 0, 254)
                                                                          );
                            m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup);
                        }

                        if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
                        {
                            m_AuraEntities[UnchangedPart.UUID].HideFromAll();
                            m_AuraEntities.Remove(UnchangedPart.UUID);
                        }
                        AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
                                                                      UnchangedPart.GetWorldPosition(),
                                                                      MetaEntity.TRANSLUCENT,
                                                                      new Vector3(0, 0, 254),
                                                                      UnchangedPart.Scale
                                                                      );
                        m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
                        SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);

                        DiffersFromSceneGroup = true;
                    }
                    else // no differences between scene part and meta part
                    {
                        if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
                        {
                            m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
                            m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
                        }
                        if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
                        {
                            m_AuraEntities[UnchangedPart.UUID].HideFromAll();
                            m_AuraEntities.Remove(UnchangedPart.UUID);
                        }
                        SetPartTransparency(metaEntityPart, MetaEntity.NONE);
                    }
                }
                else  //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted.
                {
                    if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
                    {
                        m_AuraEntities[UnchangedPart.UUID].HideFromAll();
                        m_AuraEntities.Remove(UnchangedPart.UUID);
                    }
                    AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
                                                                  UnchangedPart.GetWorldPosition(),
                                                                  MetaEntity.TRANSLUCENT,
                                                                  new Vector3(254, 0, 0),
                                                                  UnchangedPart.Scale
                                                                  );
                    m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
                    SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);

                    DiffersFromSceneGroup = true;
                }
            }
            
            return changed;
        }
开发者ID:N3X15,项目名称:VoxelSim,代码行数:98,代码来源:ContentManagementEntity.cs


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