當前位置: 首頁>>代碼示例>>C#>>正文


C# AgentData.Pack方法代碼示例

本文整理匯總了C#中OpenSim.Framework.AgentData.Pack方法的典型用法代碼示例。如果您正苦於以下問題:C# AgentData.Pack方法的具體用法?C# AgentData.Pack怎麽用?C# AgentData.Pack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenSim.Framework.AgentData的用法示例。


在下文中一共展示了AgentData.Pack方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: EnableChildAgents

        public static OSD EnableChildAgents(int DrawDistance, GridRegion[] neighbors,
            AgentCircuitData circuit, uint TeleportFlags, AgentData data, byte[] IPAddress, int Port)
        {
            OSDMap llsdBody = new OSDMap();

            llsdBody.Add("DrawDistance", DrawDistance);
            OSDArray regionsArray = new OSDArray();
            foreach (GridRegion r in neighbors)
            {
                regionsArray.Add(r.ToOSD());
            }
            llsdBody.Add("Regions", regionsArray);
            if(IPAddress != null)
                llsdBody.Add("IPAddress", IPAddress);
            if(Port != 0) //0 is the eqivilent of null
                llsdBody.Add("Port", Port);
            llsdBody.Add("Circuit", circuit.PackAgentCircuitData());
            llsdBody.Add("TeleportFlags", TeleportFlags);
            if(data != null)
                llsdBody.Add("AgentData", data.Pack());
            return buildEvent("EnableChildAgents", llsdBody);
        }
開發者ID:KristenMynx,項目名稱:Aurora-Sim,代碼行數:22,代碼來源:EventQueueHelper.cs

示例3: CreateAgent

        public virtual bool CreateAgent(GridRegion destination, ref AgentCircuitData aCircuit, uint teleportFlags,
                                        AgentData data, out int requestedUDPPort, out string reason)
        {
            reason = String.Empty;
            // Try local first
            if (m_localBackend.CreateAgent(destination, ref 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();

                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;
                    //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 results["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:savino1976,項目名稱:Aurora-Sim,代碼行數:66,代碼來源:SimulationServiceConnector.cs

示例4: TeleportAgent

        public static OSDMap TeleportAgent(int DrawDistance, AgentCircuitData circuit,
            AgentData data, uint TeleportFlags,
            GridRegion destination, ulong requestingRegion)
        {
            OSDMap llsdBody = new OSDMap();

            llsdBody.Add("DrawDistance", DrawDistance);
            llsdBody.Add("Circuit", circuit.PackAgentCircuitData());
            llsdBody.Add("TeleportFlags", TeleportFlags);
            llsdBody.Add("AgentData", data.Pack());
            llsdBody.Add("Region", destination.ToOSD());
            return buildEvent("TeleportAgent", llsdBody, circuit.AgentID, requestingRegion);
        }
開發者ID:kow,項目名稱:Aurora-Sim,代碼行數:13,代碼來源:SyncMessageHelper.cs

示例5: CrossAgent

        public static OSDMap CrossAgent(GridRegion crossingRegion, Vector3 pos,
            Vector3 velocity, AgentCircuitData circuit, AgentData cAgent, ulong RequestingRegion)
        {
            OSDMap llsdBody = new OSDMap();

            llsdBody.Add("Pos", pos);
            llsdBody.Add("Vel", velocity);
            llsdBody.Add("Region", crossingRegion.ToOSD());
            llsdBody.Add("Circuit", circuit.PackAgentCircuitData());
            llsdBody.Add("AgentData", cAgent.Pack());
            return buildEvent("CrossAgent", llsdBody, circuit.AgentID, RequestingRegion);
        }
開發者ID:kow,項目名稱:Aurora-Sim,代碼行數:12,代碼來源:SyncMessageHelper.cs


注:本文中的OpenSim.Framework.AgentData.Pack方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。