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


C# IScene.CreateLocalID方法代码示例

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


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

示例1: DeserializeLinkset

        public static IList<LLPrimitive> DeserializeLinkset(OSDMap linksetMap, IScene destinationScene, IPrimMesher mesher, bool forceNewIDs)
        {
            Dictionary<uint, LLPrimitive> prims = new Dictionary<uint, LLPrimitive>();
            Dictionary<uint, uint> oldToNewIDs = new Dictionary<uint, uint>();

            // Deserialize all of the prims and assign new IDs
            foreach (KeyValuePair<string, OSD> kvp in linksetMap)
            {
                uint localID;
                if (UInt32.TryParse(kvp.Key, out localID) && kvp.Value is OSDMap)
                {
                    OSDMap primMap = (OSDMap)kvp.Value;
                    LLPrimitive prim;
                    try
                    {
                        prim = LLPrimitive.FromOSD(primMap, destinationScene, mesher);

                        if (forceNewIDs || prim.Prim.ID == UUID.Zero || prim.Prim.LocalID == 0)
                        {
                            prim.Prim.ID = UUID.Random();
                            prim.Prim.LocalID = destinationScene.CreateLocalID();
                        }

                        // Clear any attachment point state data
                        prim.Prim.PrimData.AttachmentPoint = AttachmentPoint.Default;

                        prims[prim.LocalID] = prim;
                        oldToNewIDs[localID] = prim.Prim.LocalID;
                    }
                    catch (Exception ex)
                    {
                        m_log.WarnFormat("Invalid prim data in serialized linkset: {0}: {1}", ex.Message, primMap);
                    }
                }
                else
                {
                    m_log.WarnFormat("Invalid key/value pair in serialized linkset: \"{0}\":\"{1}\"", kvp.Key, kvp.Value);
                }
            }

            // Link all of the prims together and update the ParentIDs
            foreach (LLPrimitive prim in prims.Values)
            {
                if (prim.Prim.ParentID != 0)
                {
                    uint newLocalID;
                    if (oldToNewIDs.TryGetValue(prim.Prim.ParentID, out newLocalID))
                    {
                        prim.Prim.ParentID = newLocalID;
                        LLPrimitive parent = prims[newLocalID];
                        prim.SetParent(parent, false, false);
                    }
                    else
                    {
                        m_log.WarnFormat("Failed to locate parent prim {0} for child prim {1}, delinking child", prim.Prim.ParentID, prim.LocalID);
                        prim.Prim.ParentID = 0;
                    }
                }
            }

            return new List<LLPrimitive>(prims.Values);
        }
开发者ID:thoys,项目名称:simian,代码行数:62,代码来源:LLPrimitive.cs

示例2: LLAgent

        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="server">Reference to the UDP server this client is connected to</param>
        /// <param name="rates">Default throttling rates and maximum throttle limits</param>
        /// <param name="parentThrottle">Parent HTB (hierarchical token bucket)
        /// that the child throttles will be governed by</param>
        /// <param name="circuitCode">Circuit code for this connection</param>
        /// <param name="agentID">AgentID for the connected agent</param>
        /// <param name="sessionID">SessionID for the connected agent</param>
        /// <param name="secureSessionID">SecureSessionID for the connected agent</param>
        /// <param name="defaultRTO">Default retransmission timeout, in milliseconds</param>
        /// <param name="maxRTO">Maximum retransmission timeout, in milliseconds</param>
        /// <param name="remoteEndPoint">Remote endpoint for this connection</param>
        /// <param name="isChildAgent">True if this agent is currently simulated by
        /// another simulator, otherwise false</param>
        public LLAgent(LLUDPServer server, ThrottleRates rates, TokenBucket parentThrottle,
            uint circuitCode, UUID agentID, UUID sessionID, UUID secureSessionID, IPEndPoint remoteEndPoint,
            int defaultRTO, int maxRTO, bool isChildAgent)
        {
            m_id = agentID;
            m_udpServer = server;
            m_scene = m_udpServer.Scene;

            PacketArchive = new IncomingPacketHistoryCollection(200);
            NeedAcks = new UnackedPacketCollection();
            PendingAcks = new LocklessQueue<uint>();
            EventQueue = new LLEventQueue();

            m_nextOnQueueEmpty = 1;
            m_defaultRTO = 1000 * 3;
            m_maxRTO = 1000 * 60;

            m_packetOutboxes = new LocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT];
            m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
            m_interestList = new InterestList(this, 200);

            IsChildPresence = isChildAgent;

            m_localID = m_scene.CreateLocalID();

            TextureEntry = new Primitive.TextureEntry(DEFAULT_AVATAR_TEXTURE);

            SessionID = sessionID;
            SecureSessionID = secureSessionID;
            RemoteEndPoint = remoteEndPoint;
            CircuitCode = circuitCode;

            if (defaultRTO != 0)
                m_defaultRTO = defaultRTO;
            if (maxRTO != 0)
                m_maxRTO = maxRTO;

            // Create a token bucket throttle for this client that has the scene token bucket as a parent
            m_throttle = new TokenBucket(parentThrottle, rates.ClientTotalLimit, rates.ClientTotal);
            // Create an array of token buckets for this clients different throttle categories
            m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];

            for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++)
            {
                ThrottleCategory type = (ThrottleCategory)i;

                // Initialize the packet outboxes, where packets sit while they are waiting for tokens
                m_packetOutboxes[i] = new LocklessQueue<OutgoingPacket>();
                // Initialize the token buckets that control the throttling for each category
                m_throttleCategories[i] = new TokenBucket(m_throttle, rates.GetLimit(type), rates.GetRate(type));
            }

            // Default the retransmission timeout to three seconds
            RTO = m_defaultRTO;

            // Initialize this to a sane value to prevent early disconnects
            TickLastPacketReceived = Util.TickCount();

            IsConnected = true;
        }
开发者ID:thoys,项目名称:simian,代码行数:76,代码来源:LLAgent.cs

示例3: LLPrimitive

        /// <summary>
        /// Constructor
        /// </summary>
        public LLPrimitive(Primitive prim, IScene scene, IPrimMesher mesher)
        {
            Prim = prim;
            m_scene = scene;
            m_mesher = mesher;
            Inventory = new PrimInventory(this);

            if (prim.ID == UUID.Zero)
                prim.ID = UUID.Random();

            if (prim.LocalID == 0)
                prim.LocalID = m_scene.CreateLocalID();

            if (prim.ParentID != 0)
            {
                ISceneEntity parent;
                if (scene.TryGetEntity(prim.ParentID, out parent) && parent is ILinkable)
                    SetParent((ILinkable)parent, false, false);
            }

            m_lastUpdated = DateTime.UtcNow;
        }
开发者ID:thoys,项目名称:simian,代码行数:25,代码来源:LLPrimitive.cs


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