本文整理汇总了C#中AgentData.Pack方法的典型用法代码示例。如果您正苦于以下问题:C# AgentData.Pack方法的具体用法?C# AgentData.Pack怎么用?C# AgentData.Pack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AgentData
的用法示例。
在下文中一共展示了AgentData.Pack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: 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);
}