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


C# GridRegion.FromOSD方法代码示例

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


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

示例1: OnMessageReceived

        protected virtual OSDMap OnMessageReceived(OSDMap message)
        {
            if (!message.ContainsKey("Method"))
                return null;

            if (m_capsService == null)
                return null;

            string method = message["Method"].AsString();
            if (method != "RegionIsOnline" && method != "LogoutRegionAgents" &&
                method != "ArrivedAtDestination" && method != "CancelTeleport" &&
                method != "AgentLoggedOut" && method != "SendChildAgentUpdate" &&
                method != "TeleportAgent" && method != "CrossAgent")
                return null;

            UUID AgentID = message["AgentID"].AsUUID();
            UUID requestingRegion = message["RequestingRegion"].AsUUID();

            IClientCapsService clientCaps = m_capsService.GetClientCapsService(AgentID);

            IRegionClientCapsService regionCaps = null;
            if (clientCaps != null)
                regionCaps = clientCaps.GetCapsService(requestingRegion);
            if (message["Method"] == "LogoutRegionAgents")
            {
                LogOutAllAgentsForRegion(requestingRegion);
            }
            else if (message["Method"] == "RegionIsOnline")
                //This gets fired when the scene is fully finished starting up
            {
                //Log out all the agents first, then add any child agents that should be in this region
                //Don't do this, we don't need to kill all the clients right now
                //LogOutAllAgentsForRegion(requestingRegion);
                IGridService GridService = m_registry.RequestModuleInterface<IGridService>();
                if (GridService != null)
                {
                    GridRegion requestingGridRegion = GridService.GetRegionByUUID(null, requestingRegion);
                    if (requestingGridRegion != null)
                        Util.FireAndForget((o) => EnableChildAgentsForRegion(requestingGridRegion));
                }
            }
            else if (message["Method"] == "ArrivedAtDestination")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                //Recieved a callback
                if (clientCaps.InTeleport) //Only set this if we are in a teleport,
                    //  otherwise (such as on login), this won't check after the first tp!
                    clientCaps.CallbackHasCome = true;

                regionCaps.Disabled = false;

                //The agent is getting here for the first time (eg. login)
                OSDMap body = ((OSDMap) message["Message"]);

                //Parse the OSDMap
                int DrawDistance = body["DrawDistance"].AsInteger();

                AgentCircuitData circuitData = new AgentCircuitData();
                circuitData.FromOSD((OSDMap)body["Circuit"]);

                //Now do the creation
                EnableChildAgents(AgentID, requestingRegion, DrawDistance, circuitData);
            }
            else if (message["Method"] == "CancelTeleport")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                //Only the region the client is root in can do this
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService();
                if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
                {
                    //The user has requested to cancel the teleport, stop them.
                    clientCaps.RequestToCancelTeleport = true;
                    regionCaps.Disabled = false;
                }
            }
            else if (message["Method"] == "AgentLoggedOut")
            {
                //ONLY if the agent is root do we even consider it
                if (regionCaps != null && regionCaps.RootAgent)
                {
                    OSDMap body = ((OSDMap) message["Message"]);

                    AgentPosition pos = new AgentPosition();
                    pos.FromOSD((OSDMap)body["AgentPos"]);

                    regionCaps.Disabled = true;

                    Util.FireAndForget((o) =>
                                           {
                                               LogoutAgent(regionCaps, false); //The root is killing itself
                                               SendChildAgentUpdate(pos, regionCaps);
                                           });
                }
            }
            else if (message["Method"] == "SendChildAgentUpdate")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
//.........这里部分代码省略.........
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:101,代码来源:AgentProcessing.cs

示例2: FromOSD

 public override void FromOSD(OSDMap map)
 {
     Error = map["Error"];
     OSDArray n = (OSDArray) map["Neighbors"];
     Neighbors = n.ConvertAll<GridRegion>((osd) =>
                                              {
                                                  GridRegion r = new GridRegion();
                                                  r.FromOSD((OSDMap) osd);
                                                  return r;
                                              });
     SessionID = map["SessionID"];
     RegionFlags = map["RegionFlags"];
     if (map.ContainsKey("Region"))
     {
         Region = new GridRegion();
         Region.FromOSD((OSDMap)map["Region"]);
     }
     if (map.ContainsKey("URIs"))
         URIs = ((OSDMap)map["URIs"]).ConvertMap<List<string>>((o)=>((OSDArray)o).ConvertAll<string>((oo)=>oo));
 }
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:20,代码来源:IGridService.cs

示例3: service_OnMessageReceived

        OSDMap service_OnMessageReceived (OSDMap message)
        {
            string method = message ["Method"];
            if (method != "GetCaps" && method != "RemoveCaps")
                return null;
            UUID AgentID = message ["AgentID"];
            GridRegion region = new GridRegion ();
            region.FromOSD ((OSDMap)message ["Region"]);

            OSDMap map = new OSDMap ();
            switch (method)
            {
            case "GetCaps":
                foreach (var h in GetHandlers(AgentID, region.RegionID))
                {
                    if (m_allowedCapsModules.Contains (h.Name))
                        h.IncomingCapsRequest (AgentID, region, m_registry.RequestModuleInterface<ISimulationBase> (), ref map);
                }
                return map;
            case "RemoveCaps":
                foreach (var h in GetHandlers(AgentID, region.RegionID))
                {
                    if (m_allowedCapsModules.Contains (h.Name))
                        h.IncomingCapsDestruction ();
                }
                return map;
            }
            return null;
        }
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:29,代码来源:ExternalCapsHandler.cs

示例4: FromOSD

 public override void FromOSD(OSDMap map)
 {
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     Update = new AgentPosition();
     Update.FromOSD((OSDMap)map["Update"]);
 }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:7,代码来源:ISimulationService.cs


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