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


C# GridRegion.FromOSD方法代码示例

本文整理汇总了C#中Universe.Framework.Services.GridRegion.FromOSD方法的典型用法代码示例。如果您正苦于以下问题:C# GridRegion.FromOSD方法的具体用法?C# GridRegion.FromOSD怎么用?C# GridRegion.FromOSD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Universe.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 (method == "LogoutRegionAgents")
            {
                LogOutAllAgentsForRegion(requestingRegion);
            }
            else if (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
                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 (method == "ArrivedAtDestination")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                //Received 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 (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 (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);
                    });
                }
//.........这里部分代码省略.........
开发者ID:VirtualReality,项目名称:Universe,代码行数:101,代码来源:AgentProcessing.cs

示例2: FromOSD

 public override void FromOSD(OSDMap map)
 {
     AgentID = map["AgentID"];
     Destination = new GridRegion();
     Destination.FromOSD((OSDMap)map["Destination"]);
     AgentIsLeaving = map["AgentIsLeaving"];
 }
开发者ID:VirtualReality,项目名称:Universe,代码行数:7,代码来源:ISimulationService.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:emperorstarfinder,项目名称:Virtual-Universe,代码行数:28,代码来源:ExternalCapsHandler.cs

示例4: 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:VirtualReality,项目名称:Universe,代码行数:21,代码来源:IGridService.cs


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