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


C# Interfaces.GridRegion类代码示例

本文整理汇总了C#中OpenSim.Services.Interfaces.GridRegion的典型用法代码示例。如果您正苦于以下问题:C# GridRegion类的具体用法?C# GridRegion怎么用?C# GridRegion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: FixGridRegion

        private GridRegion FixGridRegion(GridRegion gridRegion)
        {
            if (gridRegion == null)
                return null;
            SceneManager manager = m_registry.RequestModuleInterface<SceneManager>();
            if (manager != null)
            {
#if (!ISWIN)
                foreach (IScene scene in manager.Scenes)
                {
                    if (scene.RegionInfo.RegionID == gridRegion.RegionID)
                    {
                        gridRegion.RegionSizeX = scene.RegionInfo.RegionSizeX;
                        gridRegion.RegionSizeY = scene.RegionInfo.RegionSizeY;
                        return gridRegion;
                    }
                }
#else
                foreach (IScene scene in manager.Scenes.Where(scene => scene.RegionInfo.RegionID == gridRegion.RegionID))
                {
                    gridRegion.RegionSizeX = scene.RegionInfo.RegionSizeX;
                    gridRegion.RegionSizeY = scene.RegionInfo.RegionSizeY;
                    return gridRegion;
                }
#endif
            }
            return gridRegion;
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:28,代码来源:RobustGridServiceConnector.cs

示例2: IsAuthorizedForRegion

        public bool IsAuthorizedForRegion(GridRegion region, AgentCircuitData agent, bool isRootAgent, out string reason)
        {
            ISceneManager manager = m_registry.RequestModuleInterface<ISceneManager>();
            if (manager != null)
            {
#if (!ISWIN)
                foreach (IScene scene in manager.GetAllScenes())
                {
                    if (scene.RegionInfo.RegionID == region.RegionID)
                    {
                        //Found the region, check permissions
                        return scene.Permissions.AllowedIncomingAgent(agent, isRootAgent, out reason);
                    }
                }
#else
                foreach (IScene scene in manager.GetAllScenes().Where(scene => scene.RegionInfo.RegionID == region.RegionID))
                {
                    //Found the region, check permissions
                    return scene.Permissions.AllowedIncomingAgent(agent, isRootAgent, out reason);
                }
#endif
            }
            reason = "Not Authorized as region does not exist.";
            return false;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:25,代码来源:AuthorizationService.cs

示例3: CloseAgent

        public bool CloseAgent(GridRegion destination, UUID id)
        {
            // Try local first
            if (m_localBackend.CloseAgent(destination, id))
                return true;

            // else do the remote thing
            if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
            {
                string uri = MakeUri(destination, true) + id + "/" + destination.RegionID.ToString() + "/";

                try
                {
                    WebUtils.ServiceOSDRequest(uri, null, "DELETE", 10000, false, false, false);
                }
                catch (Exception e)
                {
                    MainConsole.Instance.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}", e);
                }

                return true;
            }

            return false;
        }
开发者ID:andsim,项目名称:Aurora-Sim,代码行数:25,代码来源:SimulationServiceConnector.cs

示例4: RegisterRegion

        public virtual string RegisterRegion(UUID scopeID, GridRegion regionInfo, UUID SecureSessionID, out UUID SessionID)
        {
            SessionID = UUID.Zero;
            Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
            Dictionary<string, object> sendData = new Dictionary<string,object>();
            foreach (KeyValuePair<string, object> kvp in rinfo)
                sendData[kvp.Key] = (string)kvp.Value;

            sendData["SCOPEID"] = scopeID.ToString();
            sendData["SESSIONID"] = SecureSessionID.ToString();
            sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
            sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
            sendData["METHOD"] = "register";

            string reqString = WebUtils.BuildQueryString(sendData);
            // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
            try
            {
                string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        m_ServerURI + "/grid",
                        reqString);
                if (reply != string.Empty)
                {
                    Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                    if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "success"))
                    {
                        if (replyData.ContainsKey("Message"))
                        {
                            SessionID = UUID.Parse(replyData["Message"].ToString());
                        }
                        m_log.Info("[GridService]: Successfully registered region " + regionInfo.RegionName + " at " + regionInfo.RegionLocX + "," + regionInfo.RegionLocY + " to the grid server @ " + m_ServerURI);
                        return String.Empty;
                    }
                    else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure"))
                    {
                        //m_log.DebugFormat("[GRID CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString());
                        return replyData["Message"].ToString();
                    }
                    else if (!replyData.ContainsKey("Result"))
                    {
                        m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field");
                    }
                    else
                    {
                        m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
                        return "Unexpected result "+replyData["Result"].ToString();
                    }
                }
                else
                    m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply from " + m_ServerURI);
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server " + m_ServerURI + " : {0}", e.Message);
            }

            return "Error communicating with grid service";
        }
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:59,代码来源:GridServiceConnector.cs

示例5: CreateAgent

        public virtual bool CreateAgent(GridRegion destination, ref AgentCircuitData aCircuit, uint teleportFlags, AgentData data, out string reason)
        {
            reason = String.Empty;
            // Try local first
            if (m_localBackend.CreateAgent(destination, ref aCircuit, teleportFlags, data, out reason))
                return true;

            reason = String.Empty;

            string uri = MakeUri(destination, true) + aCircuit.AgentID + "/";

            try
            {
                OSDMap args = aCircuit.PackAgentCircuitData();

                args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
                args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
                args["destination_name"] = OSD.FromString(destination.RegionName);
                args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
                args["teleport_flags"] = OSD.FromString(teleportFlags.ToString());
                if(data != null)
                    args["agent_data"] = data.Pack();

                OSDMap result = WebUtils.PostToService (uri, args, true, false);
                OSDMap results = WebUtils.GetOSDMap(result["_RawResult"].AsString());
                //Pull out the result and set it as the reason
                if (results == null)
                    return false;
                reason = results["reason"] != null ? results["reason"].AsString() : "";
                if (result["Success"].AsBoolean())
                {
                    //Not right... don't return true except for opensim combatibility :/
                    if (reason == "")
                        return true;
                    try
                    {
                        OSDMap responseMap = (OSDMap)OSDParser.DeserializeJson(reason);
                        if (responseMap.ContainsKey("Reason"))
                            reason = responseMap["Reason"].AsString();
                        return responseMap["Success"].AsBoolean();
                    }
                    catch
                    {
                        //Not right... don't return true except for opensim combatibility :/
                        return true;
                    }
                }

                reason = result["Message"] != null ? result["Message"].AsString() : "error";
                return false;
            }
            catch (Exception e)
            {
                m_log.Warn("[REMOTE SIMULATION CONNECTOR]: CreateAgent failed with exception: " + e.ToString());
                reason = e.Message;
            }

            return false;
        }
开发者ID:rknop,项目名称:Aurora-Sim,代码行数:59,代码来源:SimulationServiceConnector.cs

示例6: RexLoginResponse

 public RexLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
     GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
     string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
     GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL)
     : base(account, aCircuit, pinfo, destination, invSkel, friendsList, libService, where, startlocation,
     position, lookAt, gestures, message, home, clientIP, mapTileURL, searchURL)
 {
 }
开发者ID:jonnenauha,项目名称:ModreX,代码行数:8,代码来源:RexLoginResponse.cs

示例7: PackData

 protected virtual void PackData(OSDMap args, AgentCircuitData aCircuit, GridRegion destination, uint flags)
 {
         args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
         args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
         args["destination_name"] = OSD.FromString(destination.RegionName);
         args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
         args["teleport_flags"] = OSD.FromString(flags.ToString());
 }
开发者ID:AkiraSonoda,项目名称:akisim,代码行数:8,代码来源:SimulationServiceConnector.cs

示例8: RegisterRegion

        public virtual string RegisterRegion(GridRegion regionInfo, UUID SecureSessionID, out UUID SessionID,
                                             out List<GridRegion> neighbors)
        {
            neighbors = new List<GridRegion>();
            OSDMap map = new OSDMap();
            map["Region"] = regionInfo.ToOSD();
            map["SecureSessionID"] = SecureSessionID;
            map["Method"] = "Register";

            List<string> serverURIs =
                m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RegistrationURI");
            foreach (string mServerUri in serverURIs)
            {
                OSDMap result = WebUtils.PostToService(mServerUri + "/grid", map, true, false);
                if (result["Success"].AsBoolean())
                {
                    try
                    {
                        OSD r = OSDParser.DeserializeJson(result["_RawResult"]);
                        if (r is OSDMap)
                        {
                            OSDMap innerresult = (OSDMap) r;
                            if (innerresult["Result"].AsString() == "")
                            {
                                object[] o = new object[2];
                                o[0] = regionInfo;
                                o[1] = innerresult;
                                SessionID = innerresult["SecureSessionID"].AsUUID();
                                m_registry.RequestModuleInterface<IConfigurationService>().AddNewUrls(regionInfo.RegionHandle.ToString(), (OSDMap) innerresult["URLs"]);

                                OSDArray array = (OSDArray) innerresult["Neighbors"];
                                foreach (OSD ar in array)
                                {
                                    GridRegion n = new GridRegion();
                                    n.FromOSD((OSDMap) ar);
                                    neighbors.Add(n);
                                }
                                m_registry.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("GridRegionRegistered", o);
                                return "";
                            }
                            else
                            {
                                SessionID = UUID.Zero;
                                return innerresult["Result"].AsString();
                            }
                        }
                    }
                    catch (Exception) //JsonException
                    {
                        MainConsole.Instance.Warn("[GridServiceConnector]: Exception on parsing OSDMap from server, legacy (OpenSim) server?");
                    }
                }
            }
            SessionID = SecureSessionID;
            return OldRegisterRegion(regionInfo);
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:56,代码来源:GridServiceConnector.cs

示例9: OnRegionUp

        private void OnRegionUp(GridRegion otherRegion)
        {
            // This shouldn't happen
            if (otherRegion == null)
                return;

            m_log.DebugFormat("[REGION CACHE]: (on region {0}) Region {1} is up @ {2}-{3}",
                m_scene.RegionInfo.RegionName, otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY);

            m_neighbours[otherRegion.RegionHandle] = otherRegion;
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:11,代码来源:RegionCache.cs

示例10: FriendshipApproved

        public bool FriendshipApproved(GridRegion region, UUID userID, string userName, UUID friendID)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();
            //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
            //sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
            sendData["METHOD"] = "friendship_approved";

            sendData["FromID"] = userID.ToString();
            sendData["FromName"] = userName;
            sendData["ToID"] = friendID.ToString();

            return Call(region, sendData);
        }
开发者ID:4U2NV,项目名称:opensim,代码行数:13,代码来源:FriendsSimConnector.cs

示例11: CreateAgent

        public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
        {
            // MainConsole.Instance.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: CreateAgent start");

            myipaddress = String.Empty;
            reason = String.Empty;

            if (destination == null)
            {
                MainConsole.Instance.Debug ("[GATEKEEPER SERVICE CONNECTOR]: Given destination is null");
                return false;
            }

            string uri = (destination.ServerURI.EndsWith ("/") ? destination.ServerURI : (destination.ServerURI + "/"))
                + AgentPath () + aCircuit.AgentID + "/";

            try
            {
                OSDMap args = aCircuit.PackAgentCircuitData ();

                args["destination_x"] = OSD.FromString (destination.RegionLocX.ToString ());
                args["destination_y"] = OSD.FromString (destination.RegionLocY.ToString ());
                args["destination_name"] = OSD.FromString (destination.RegionName);
                args["destination_uuid"] = OSD.FromString (destination.RegionID.ToString ());
                args["teleport_flags"] = OSD.FromString (flags.ToString ());

                OSDMap result = WebUtils.PostToService (uri, args, true, true);
                if (result["Success"].AsBoolean ())
                {
                    OSDMap unpacked = (OSDMap)result["_Result"];

                    if (unpacked != null)
                    {
                        reason = unpacked["reason"].AsString ();
                        myipaddress = unpacked["your_ip"].AsString ();
                        return unpacked["success"].AsBoolean ();
                    }
                }

                reason = result["Message"] != null ? result["Message"].AsString () : "error";
                return false;
            }
            catch (Exception e)
            {
                MainConsole.Instance.Warn ("[REMOTE SIMULATION CONNECTOR]: CreateAgent failed with exception: " + e.ToString ());
                reason = e.Message;
            }

            return false;
        }
开发者ID:djphil,项目名称:Aurora-HG-Plugin,代码行数:50,代码来源:GatekeeperServiceConnector.cs

示例12: FriendshipOffered

        public bool FriendshipOffered(GridRegion region, UUID userID, UUID friendID, string message)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();
            //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
            //sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
            sendData["METHOD"] = "friendship_offered";

            sendData["FromID"] = userID.ToString();
            sendData["ToID"] = friendID.ToString();
            sendData["Message"] = message;

            return Call(region, sendData);

        }
开发者ID:4U2NV,项目名称:opensim,代码行数:14,代码来源:FriendsSimConnector.cs

示例13: CreateAgent

        public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
        {
            HttpWebRequest AgentCreateRequest = null;
            reason = String.Empty;

            if (SendRequest(destination, aCircuit, flags, out reason, out AgentCreateRequest))
            {
                string response = GetResponse(AgentCreateRequest, out reason);
                bool success = true;
                UnpackResponse(response, out success, out reason);
                return success;
            }

            return false;
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:15,代码来源:SimulationServiceConnector.cs

示例14: FixGridRegion

 private GridRegion FixGridRegion(GridRegion gridRegion)
 {
     if (gridRegion == null)
         return null;
     ISceneManager manager = m_registry.RequestModuleInterface<ISceneManager>();
     if (manager != null)
     {
         foreach (IScene scene in manager.GetAllScenes().Where(scene => scene.RegionInfo.RegionID == gridRegion.RegionID))
         {
             gridRegion.RegionSizeX = scene.RegionInfo.RegionSizeX;
             gridRegion.RegionSizeY = scene.RegionInfo.RegionSizeY;
             return gridRegion;
         }
     }
     return gridRegion;
 }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:16,代码来源:RobustGridServiceConnector.cs

示例15: CreateAgent

 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
 {
     logout = false;
     return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
 }
开发者ID:UbitUmarov,项目名称:Ubit-opensim,代码行数:5,代码来源:EntityTransferModule.cs


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