本文整理汇总了C#中OpenSim.Framework.AgentCircuitData类的典型用法代码示例。如果您正苦于以下问题:C# AgentCircuitData类的具体用法?C# AgentCircuitData怎么用?C# AgentCircuitData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AgentCircuitData类属于OpenSim.Framework命名空间,在下文中一共展示了AgentCircuitData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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());
}
示例3: 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)
{
}
示例4: 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;
}
示例5: 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);
}
示例6: InPacketTest
/// <summary>
/// More a placeholder, really
/// </summary>
public void InPacketTest()
{
TestHelper.InMethod();
AgentCircuitData agent = new AgentCircuitData();
agent.AgentID = UUID.Random();
agent.firstname = "testfirstname";
agent.lastname = "testlastname";
agent.SessionID = UUID.Zero;
agent.SecureSessionID = UUID.Zero;
agent.circuitcode = 123;
agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero;
agent.startpos = Vector3.Zero;
agent.CapsPath = "http://wibble.com";
TestLLUDPServer testLLUDPServer;
TestLLPacketServer testLLPacketServer;
AgentCircuitManager acm;
IScene scene = new MockScene();
SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
TestClient testClient = new TestClient(agent, scene);
ILLPacketHandler packetHandler
= new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings());
packetHandler.InPacket(new AgentAnimationPacket());
LLQueItem receivedPacket = packetHandler.PacketQueue.Dequeue();
Assert.That(receivedPacket, Is.Not.Null);
Assert.That(receivedPacket.Incoming, Is.True);
Assert.That(receivedPacket.Packet, Is.TypeOf(typeof(AgentAnimationPacket)));
}
示例7: AddNewCircuit
/// <summary>
/// Add information about a new circuit so that later on we can authenticate a new client session.
/// </summary>
/// <param name="circuitCode"></param>
/// <param name="agentData"></param>
public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
{
lock (AgentCircuits)
{
AgentCircuits[circuitCode] = agentData;
}
}
示例8: IsAuthorizedForRegion
public bool IsAuthorizedForRegion(GridRegion region, AgentCircuitData agent, bool isRootAgent, out string reason)
{
SceneManager manager = m_registry.RequestModuleInterface<SceneManager>();
if (manager != null)
{
#if (!ISWIN)
foreach (IScene scene in manager.Scenes)
{
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.Scenes.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;
}
示例9: ArrivedAtDestination
public static OSDMap ArrivedAtDestination(UUID AgentID, int DrawDistance, AgentCircuitData circuit, ulong requestingRegion)
{
OSDMap llsdBody = new OSDMap();
llsdBody.Add("AgentID", AgentID);
llsdBody.Add("DrawDistance", DrawDistance);
llsdBody.Add("Circuit", circuit.PackAgentCircuitData());
return buildEvent("ArrivedAtDestination", llsdBody, AgentID, requestingRegion);
}
示例10: TriggerExpectUser
/// <summary>
///
/// </summary>
/// <param name="agent"></param>
/// <returns></returns>
public virtual bool TriggerExpectUser(AgentCircuitData agent)
{
handlerExpectUser = OnExpectUser;
if (handlerExpectUser != null)
{
handlerExpectUser(agent);
return true;
}
return false;
}
示例11: 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);
}
示例12: AddNewCircuit
/// <summary>
/// Add information about a new circuit so that later on we can authenticate a new client session.
/// </summary>
/// <param name="circuitCode"></param>
/// <param name="agentData"></param>
public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
{
lock (AgentCircuits)
{
if (AgentCircuits.ContainsKey(circuitCode))
{
AgentCircuits[circuitCode] = agentData;
}
else
{
AgentCircuits.Add(circuitCode, agentData);
}
}
}
示例13: CreateNPC
public UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom)
{
NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene);
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
m_log.DebugFormat(
"[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}",
firstname, lastname, npcAvatar.AgentId, position, scene.RegionInfo.RegionName);
AgentCircuitData acd = new AgentCircuitData();
acd.AgentID = npcAvatar.AgentId;
acd.firstname = firstname;
acd.lastname = lastname;
acd.ServiceURLs = new Dictionary<string, object>();
AvatarAppearance originalAppearance = GetAppearance(cloneAppearanceFrom, scene);
AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true);
acd.Appearance = npcAppearance;
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
scene.AddNewClient(npcAvatar);
ScenePresence sp;
if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
{
m_log.DebugFormat(
"[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
// Shouldn't call this - temporary.
sp.CompleteMovement(npcAvatar);
// sp.SendAppearanceToAllOtherAgents();
//
// // Send animations back to the avatar as well
// sp.Animator.SendAnimPack();
}
else
{
m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
}
lock (m_avatars)
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
return npcAvatar.AgentId;
}
示例14: PackData
protected virtual void PackData(OSDMap args, GridRegion source, AgentCircuitData aCircuit, GridRegion destination, uint flags)
{
if (source != null)
{
args["source_x"] = OSD.FromString(source.RegionLocX.ToString());
args["source_y"] = OSD.FromString(source.RegionLocY.ToString());
args["source_name"] = OSD.FromString(source.RegionName);
args["source_uuid"] = OSD.FromString(source.RegionID.ToString());
if (!String.IsNullOrEmpty(source.RawServerURI))
args["source_server_uri"] = OSD.FromString(source.RawServerURI);
}
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());
}
示例15: CreateAgent
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
{
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateAgent start");
reason = String.Empty;
if (destination == null)
{
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null");
return false;
}
string uri = 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 = WebUtil.PostToService(uri, args, 20000);
if (result["Success"].AsBoolean())
return true;
m_log.WarnFormat(
"[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {1}",
aCircuit.firstname, aCircuit.lastname, destination.RegionName);
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;
}