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


C# AgentCircuitData.PackAgentCircuitData方法代码示例

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


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

示例1: ArrivedAtDestination

        public static OSDMap ArrivedAtDestination(UUID AgentID, int DrawDistance, AgentCircuitData circuit,
                                                  ulong requestingRegion)
        {
            OSDMap llsdBody = new OSDMap
                                  {
                                      {"AgentID", AgentID},
                                      {"DrawDistance", DrawDistance},
                                      {"Circuit", circuit.PackAgentCircuitData()}
                                  };

            return buildEvent("ArrivedAtDestination", llsdBody, AgentID, requestingRegion);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:12,代码来源:SyncMessageHelper.cs

示例2: 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 ());

                string r = WebUtils.PostToService (uri, args);
                OSDMap unpacked = OSDParser.DeserializeJson(r) as OSDMap;
                if (unpacked != null)
                {
                    reason = unpacked["reason"].AsString();
                    myipaddress = unpacked["your_ip"].AsString();
                    return unpacked["success"].AsBoolean();
                }

                reason = unpacked["Message"] != null ? unpacked["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:KSLcom,项目名称:Aurora-HG-Plugin,代码行数:46,代码来源:GatekeeperServiceConnector.cs

示例3: NewUserConnection

        /// <summary>
        /// Do the work necessary to initiate a new user connection for a particular scene.
        /// At the moment, this consists of setting up the caps infrastructure
        /// The return bool should allow for connections to be refused, but as not all calling paths
        /// take proper notice of it let, we allowed banned users in still.
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="agent">CircuitData of the agent who is connecting</param>
        /// <param name="UDPPort"></param>
        /// <param name="reason">Outputs the reason for the false response on this string,
        /// If the agent was accepted, this will be the Caps SEED for the region</param>
        /// <param name="teleportFlags"></param>
        /// <returns>True if the region accepts this agent.  False if it does not.  False will 
        /// also return a reason.</returns>
        public bool NewUserConnection (IScene scene, AgentCircuitData agent, uint teleportFlags, out int UDPPort, out string reason)
        {
            reason = String.Empty;
            UDPPort = GetUDPPort(scene);
            IScenePresence sp = scene.GetScenePresence(agent.AgentID);

            // Don't disable this log message - it's too helpful
            MainConsole.Instance.TraceFormat (
                "[ConnectionBegin]: Region {0} told of incoming {1} agent {2} (circuit code {3}, teleportflags {4})",
                scene.RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.AgentID,
                agent.circuitcode, teleportFlags);

            if (!AuthorizeUser (scene, agent, out reason))
            {
                OSDMap map = new OSDMap ();
                map["Reason"] = reason;
                map["success"] = false;
                reason = OSDParser.SerializeJsonString (map);
                return false;
            }

            CacheUserInfo(scene, agent.OtherInformation);

            if (sp != null && !sp.IsChildAgent)
            {
                // We have a zombie from a crashed session. 
                // Or the same user is trying to be root twice here, won't work.
                // Kill it.
                MainConsole.Instance.InfoFormat ("[Scene]: Zombie scene presence detected for {0} in {1}", agent.AgentID, scene.RegionInfo.RegionName);
                //Tell everyone about it
                scene.AuroraEventManager.FireGenericEventHandler ("AgentIsAZombie", sp.UUID);
                //Send the killing message (DisableSimulator)
                scene.RemoveAgent (sp, true);
                sp = null;
            }

            OSDMap responseMap = new OSDMap ();
            responseMap["CapsUrls"] = scene.EventManager.TriggerOnRegisterCaps (agent.AgentID);
            responseMap["OurIPForClient"] = MainServer.Instance.HostName;

            // In all cases, add or update the circuit data with the new agent circuit data and teleport flags
            agent.teleportFlags = teleportFlags;

            responseMap["Agent"] = agent.PackAgentCircuitData ();

            object[] obj = new object[2];
            obj[0] = responseMap;
            obj[1] = agent;
            scene.AuroraEventManager.FireGenericEventHandler ("NewUserConnection", obj);

            //Add the circuit at the end
            scene.AuthenticateHandler.AddNewCircuit (agent.circuitcode, agent);

            MainConsole.Instance.InfoFormat (
                "[ConnectionBegin]: Region {0} authenticated and authorized incoming {1} agent {2} (circuit code {3})",
                scene.RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.AgentID,
                agent.circuitcode);

            responseMap["success"] = true;
            reason = OSDParser.SerializeJsonString (responseMap);
            return true;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:76,代码来源:EntityTransferModule.cs

示例4: PackCreateAgentArguments

        protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress)
        {
            OSDMap args = null;
            try
            {
                args = aCircuit.PackAgentCircuitData ();
            }
            catch (Exception e)
            {
                MainConsole.Instance.Debug ("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
            }
            // Add the input arguments
            args["gatekeeper_serveruri"] = OSD.FromString (gatekeeper.ServerURI);
            args["gatekeeper_host"] = OSD.FromString (gatekeeper.ExternalHostName);
            args["gatekeeper_port"] = OSD.FromString (gatekeeper.HttpPort.ToString ());
            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["destination_serveruri"] = OSD.FromString (destination.ServerURI);

            // 10/3/2010
            // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here.
            // This need cleaning elsewhere...
            //if (ipaddress != null)
            //    args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());

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

示例5: CreateAgent

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

            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();

                string resultStr = WebUtils.PostToService(uri, args);
                //Pull out the result and set it as the reason
                if (resultStr == "")
                    return false;
                OSDMap result = OSDParser.DeserializeJson(resultStr) as OSDMap;
                reason = result["reason"] != null ? result["reason"].AsString() : "";
                if (result["success"].AsBoolean())
                {
                    //Not right... don't return true except for opensim combatibility :/
                    if (reason == "" || reason == "authorized")
                        return true;
                    //We were able to contact the region
                    try
                    {
                        //We send the CapsURLs through, so we need these
                        OSDMap responseMap = (OSDMap) OSDParser.DeserializeJson(reason);
                        if (responseMap.ContainsKey("Reason"))
                            reason = responseMap["Reason"].AsString();
                        if (responseMap.ContainsKey("requestedUDPPort"))
                            requestedUDPPort = responseMap["requestedUDPPort"];
                        return result["success"].AsBoolean();
                    }
                    catch
                    {
                        //Something went wrong
                        return false;
                    }
                }

                reason = result.ContainsKey("Message") ? result["Message"].AsString() : "Could not contact the region";
                return false;
            }
            catch (Exception e)
            {
                MainConsole.Instance.Warn("[REMOTE SIMULATION CONNECTOR]: CreateAgent failed with exception: " + e);
                reason = e.Message;
            }

            return false;
        }
开发者ID:rjspence,项目名称:YourSim,代码行数:66,代码来源:SimulationServiceConnector.cs

示例6: TeleportAgent

        public static OSDMap TeleportAgent(int DrawDistance, AgentCircuitData circuit,
                                           AgentData data, uint TeleportFlags,
                                           GridRegion destination, ulong requestingRegion)
        {
            OSDMap llsdBody = new OSDMap
                                  {
                                      {"DrawDistance", DrawDistance},
                                      {"Circuit", circuit.PackAgentCircuitData()},
                                      {"TeleportFlags", TeleportFlags},
                                      {"AgentData", data.Pack()},
                                      {"Region", destination.ToOSD()}
                                  };

            return buildEvent("TeleportAgent", llsdBody, circuit.AgentID, requestingRegion);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:15,代码来源:SyncMessageHelper.cs

示例7: CrossAgent

        public static OSDMap CrossAgent(GridRegion crossingRegion, Vector3 pos,
                                        Vector3 velocity, AgentCircuitData circuit, AgentData cAgent,
                                        ulong RequestingRegion)
        {
            OSDMap llsdBody = new OSDMap
                                  {
                                      {"Pos", pos},
                                      {"Vel", velocity},
                                      {"Region", crossingRegion.ToOSD()},
                                      {"Circuit", circuit.PackAgentCircuitData()},
                                      {"AgentData", cAgent.Pack()}
                                  };

            return buildEvent("CrossAgent", llsdBody, circuit.AgentID, RequestingRegion);
        }
开发者ID:samiam123,项目名称:Aurora-Sim,代码行数:15,代码来源:SyncMessageHelper.cs


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