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


C# IScene.AddPublicCapability方法代码示例

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


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

示例1: Start

        public void Start(IScene scene)
        {
            m_scene = scene;
            m_lastCameraPositions = new Dictionary<uint, Vector3>();
            m_borderCrossThrottles = new Dictionary<UUID, int>();

            // Create an AABB for this scene that extends beyond the borders by BORDER_CROSS_THRESHOLD
            // that is used to check for border crossings
            m_borderCrossAABB = new AABB(Vector3.Zero, new Vector3(scene.MaxPosition - scene.MinPosition));
            m_borderCrossAABB.Min -= new Vector3(BORDER_CROSS_THRESHOLD, BORDER_CROSS_THRESHOLD, BORDER_CROSS_THRESHOLD);
            m_borderCrossAABB.Max += new Vector3(BORDER_CROSS_THRESHOLD, BORDER_CROSS_THRESHOLD, BORDER_CROSS_THRESHOLD);

            m_scheduler = m_scene.Simian.GetAppModule<IScheduler>();
            if (m_scheduler == null)
            {
                m_log.Warn("Neighbors requires an IScheduler");
                return;
            }

            m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Warn("Neighbors requires an IHttpServer");
                return;
            }

            m_udp = m_scene.GetSceneModule<LLUDP>();
            if (m_udp == null)
            {
                m_log.Warn("Neighbors requires an LLUDP");
                return;
            }

            m_userClient = m_scene.Simian.GetAppModule<IUserClient>();
            if (m_userClient == null)
            {
                m_log.Warn("Neighbors requires an IUserClient");
                return;
            }

            m_gridClient = scene.Simian.GetAppModule<IGridClient>();

            // Add neighbor messaging handlers
            string urlFriendlySceneName = WebUtil.UrlEncode(scene.Name);
            string regionPath = "/regions/" + urlFriendlySceneName;
            m_httpServer.AddHandler("POST", null, regionPath + "/region/online", true, true, RegionOnlineHandler);
            m_httpServer.AddHandler("POST", null, regionPath + "/region/offline", true, true, RegionOfflineHandler);
            m_httpServer.AddHandler("POST", null, regionPath + "/child_avatar/update", true, true, ChildAvatarUpdateHandler);

            m_scene.AddPublicCapability("region/online", m_httpServer.HttpAddress.Combine(regionPath + "/region/online"));
            m_scene.AddPublicCapability("region/offline", m_httpServer.HttpAddress.Combine(regionPath + "/region/offline"));
            m_scene.AddPublicCapability("child_avatar/update", m_httpServer.HttpAddress.Combine(regionPath + "/child_avatar/update"));

            // Track local scenes going up and down
            m_sceneFactory = scene.Simian.GetAppModule<ISceneFactory>();
            if (m_sceneFactory != null)
            {
                m_sceneFactory.OnSceneStart += SceneStartHandler;
                m_sceneFactory.OnSceneStop += SceneStopHandler;
            }

            m_scene.OnPresenceAdd += PresenceAddHandler;
            m_scene.OnEntityAddOrUpdate += EntityAddOrUpdateHandler;

            m_childUpdates = new ThrottledQueue<uint, IScenePresence>(5.0f, 200, true, SendChildUpdate);
            m_childUpdates.Start();
        }
开发者ID:osgrid,项目名称:openmetaverse,代码行数:67,代码来源:Neighbors.cs

示例2: Start

        public void Start(IScene scene)
        {
            m_scene = scene;

            m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
            if (m_httpServer == null)
            {
                m_log.Warn("RezAvatar requires an IHttpServer");
                return;
            }

            m_userClient = m_scene.Simian.GetAppModule<IUserClient>();
            if (m_userClient == null)
            {
                m_log.Warn("RezAvatar requires an IUserClient");
                return;
            }

            m_lludp = scene.GetSceneModule<LLUDP>();
            if (m_lludp == null)
            {
                m_log.Error("Can't create the RegionDomain service without an LLUDP server");
                return;
            }

            string urlFriendlySceneName = WebUtil.UrlEncode(m_scene.Name);
            string regionPath = "/regions/" + urlFriendlySceneName;

            m_httpServer.AddHandler("POST", null, regionPath + "/rez_avatar/request", true, true, RezAvatarRequestHandler);
            m_scene.AddPublicCapability("rez_avatar/request", m_httpServer.HttpAddress.Combine(regionPath + "/rez_avatar/request"));
        }
开发者ID:thoys,项目名称:simian,代码行数:31,代码来源:RezAvatar.cs


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