當前位置: 首頁>>代碼示例>>C#>>正文


C# SceneObjectGroup.GetPartCount方法代碼示例

本文整理匯總了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.GetPartCount方法的典型用法代碼示例。如果您正苦於以下問題:C# SceneObjectGroup.GetPartCount方法的具體用法?C# SceneObjectGroup.GetPartCount怎麽用?C# SceneObjectGroup.GetPartCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenSim.Region.Framework.Scenes.SceneObjectGroup的用法示例。


在下文中一共展示了SceneObjectGroup.GetPartCount方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddObject

        // NOTE: Call under Taint Lock
        private void AddObject(SceneObjectGroup obj)
        {                       
            if (obj.IsAttachment)
                return;
            if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0))
                return;                       

            Vector3 pos = obj.AbsolutePosition;
            ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y);
            
            // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it
            if (landObject == null)
            {
//                m_log.WarnFormat(
//                    "[PRIM COUNT MODULE]: Found no land object for {0} at position ({1}, {2}) on {3}", 
//                    obj.Name, pos.X, pos.Y, m_Scene.RegionInfo.RegionName);
                
                return;
            }
            
            LandData landData = landObject.LandData;
            
//            m_log.DebugFormat(
//                "[PRIM COUNT MODULE]: Adding object {0} with {1} parts to prim count for parcel {2} on {3}", 
//                obj.Name, obj.Parts.Length, landData.Name, m_Scene.RegionInfo.RegionName);                        
            
//            m_log.DebugFormat(
//                "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", 
//                obj.Name, obj.OwnerID, landData.OwnerID);

            ParcelCounts parcelCounts;
            if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
            {
                UUID landOwner = landData.OwnerID;
                int partCount = obj.GetPartCount();

                m_SimwideCounts[landOwner] += partCount;
                if (parcelCounts.Users.ContainsKey(obj.OwnerID))
                    parcelCounts.Users[obj.OwnerID] += partCount;
                else
                    parcelCounts.Users[obj.OwnerID] = partCount;

                if (obj.IsSelected)
                {
                    parcelCounts.Selected += partCount;                
                }
                else
                {
                    if (landData.IsGroupOwned)
                    {
                        if (obj.OwnerID == landData.GroupID)
                            parcelCounts.Owner += partCount;
                        else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
                            parcelCounts.Group += partCount;
                        else
                            parcelCounts.Others += partCount;
                    }
                    else
                    {
                        if (obj.OwnerID == landData.OwnerID)
                            parcelCounts.Owner += partCount;
                        else
                            parcelCounts.Others += partCount;
                    }
                }
            }
        }
開發者ID:CassieEllen,項目名稱:opensim,代碼行數:68,代碼來源:PrimCountModule.cs


注:本文中的OpenSim.Region.Framework.Scenes.SceneObjectGroup.GetPartCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。