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


C# Scene.GetFormatsOffered方法代码示例

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


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

示例1: GetDestination

        // Given a position relative to the current region (which has previously been tested to
        //    see that it is actually outside the current region), find the new region that the
        //    point is actually in.
        // Returns the coordinates and information of the new region or 'null' of it doesn't exist.
        public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
                                            out string version, out Vector3 newpos, out string failureReason)
        {
            version = String.Empty;
            newpos = pos;
            failureReason = string.Empty;
            string homeURI = scene.GetAgentHomeURI(agentID);

//            m_log.DebugFormat(
//                "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);

            // Compute world location of the object's position
            double presenceWorldX = (double)scene.RegionInfo.WorldLocX + pos.X;
            double presenceWorldY = (double)scene.RegionInfo.WorldLocY + pos.Y;

            // Call the grid service to lookup the region containing the new position.
            GridRegion neighbourRegion = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID,
                                                        presenceWorldX, presenceWorldY, 
                                                        Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));

            if (neighbourRegion != null)
            {
                // Compute the entity's position relative to the new region
                newpos = new Vector3((float)(presenceWorldX - (double)neighbourRegion.RegionLocX),
                                      (float)(presenceWorldY - (double)neighbourRegion.RegionLocY),
                                      pos.Z);

                if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID))
                {
                    failureReason = "Cannot region cross into banned parcel";
                    neighbourRegion = null;
                }
                else
                {
                    // If not banned, make sure this agent is not in the list.
                    m_bannedRegionCache.Remove(neighbourRegion.RegionHandle, agentID);
                }

                // Check to see if we have access to the target region.
                string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
                if (neighbourRegion != null
                    && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, scene.GetFormatsOffered(), out version, out failureReason))
                {
                    // remember banned
                    m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
                    neighbourRegion = null;
                }
            }
            else
            {
                // The destination region just doesn't exist
                failureReason = "Cannot cross into non-existent region";
            }

            if (neighbourRegion == null)
                m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}",
                    LogHeader, scene.RegionInfo.RegionName,
                    scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
                    scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY,
                    pos);
            else
                m_log.DebugFormat("{0} GetDestination: new region={1} at <{2},{3}> of size <{4},{5}>, newpos=<{6},{7}>",
                    LogHeader, neighbourRegion.RegionName,
                    neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY,
                    newpos.X, newpos.Y);

            return neighbourRegion;
        }
开发者ID:bitzend,项目名称:opensimulator,代码行数:72,代码来源:EntityTransferModule.cs


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