本文整理汇总了C#中OpenSim.Region.Framework.Scenes.Scene.AddNewClient方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.AddNewClient方法的具体用法?C# Scene.AddNewClient怎么用?C# Scene.AddNewClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.Scene
的用法示例。
在下文中一共展示了Scene.AddNewClient方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNPC
public UUID CreateNPC(
string firstname,
string lastname,
Vector3 position,
UUID owner,
bool senseAsAgent,
Scene scene,
AvatarAppearance appearance)
{
NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, owner, senseAsAgent, scene);
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
m_log.DebugFormat(
"[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, 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 npcAppearance = new AvatarAppearance(appearance, true);
acd.Appearance = npcAppearance;
// for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++)
// {
// m_log.DebugFormat(
// "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}",
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
// }
lock (m_avatars)
{
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
scene.AddNewClient(npcAvatar, PresenceType.Npc);
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);
sp.CompleteMovement(npcAvatar, false);
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
return npcAvatar.AgentId;
}
else
{
m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
return UUID.Zero;
}
}
}
示例2: 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;
}
示例3: AddRootAgent
/// <summary>
/// Add a root agent.
/// </summary>
///
/// This function
///
/// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the
/// userserver if grid) would give initial login data back to the client and separately tell the scene that the
/// agent was coming.
///
/// 2) Connects the agent with the scene
///
/// This function performs actions equivalent with notifying the scene that an agent is
/// coming and then actually connecting the agent to the scene. The one step missed out is the very first
///
/// <param name="scene"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData)
{
string reason;
// We emulate the proper login sequence here by doing things in three stages
// Stage 1: simulate login by telling the scene to expect a new user connection
scene.NewUserConnection(agentData, out reason);
// Stage 2: add the new client as a child agent to the scene
TestClient client = new TestClient(agentData, scene);
scene.AddNewClient(client);
// Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance,
// inventory, etc.)
//scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
scp.MakeRootAgent(new Vector3(90,90,90), true);
return client;
}
示例4: IntroduceClientToScene
private static ScenePresence IntroduceClientToScene(Scene scene, AgentCircuitData agentData, TeleportFlags tf)
{
string reason;
// Stage 1: tell the scene to expect a new user connection
if (!scene.NewUserConnection(agentData, (uint)tf, out reason))
Console.WriteLine("NewUserConnection failed: " + reason);
// Stage 2: add the new client as a child agent to the scene
TestClient client = new TestClient(agentData, scene);
scene.AddNewClient(client, PresenceType.User);
return scene.GetScenePresence(agentData.AgentID);
}
示例5: AddRootAgent
/// <summary>
/// Add a root agent.
/// </summary>
///
/// This function
///
/// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the
/// userserver if grid) would give initial login data back to the client and separately tell the scene that the
/// agent was coming.
///
/// 2) Connects the agent with the scene
///
/// This function performs actions equivalent with notifying the scene that an agent is
/// coming and then actually connecting the agent to the scene. The one step missed out is the very first
///
/// <param name="scene"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData)
{
string reason;
// We emulate the proper login sequence here by doing things in four stages
// Stage 0: log the presence
scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
// Stage 1: simulate login by telling the scene to expect a new user connection
if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
Console.WriteLine("NewUserConnection failed: " + reason);
// Stage 2: add the new client as a child agent to the scene
TestClient client = new TestClient(agentData, scene);
scene.AddNewClient(client);
// Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance,
// inventory, etc.)
//scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
scp.MakeRootAgent(new Vector3(90, 90, 90), true);
return client;
}
示例6: AddScenePresence
/// <summary>
/// Add a root agent.
/// </summary>
/// <remarks>
/// This function
///
/// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the
/// userserver if grid) would give initial login data back to the client and separately tell the scene that the
/// agent was coming.
///
/// 2) Connects the agent with the scene
///
/// This function performs actions equivalent with notifying the scene that an agent is
/// coming and then actually connecting the agent to the scene. The one step missed out is the very first
/// </remarks>
/// <param name="scene"></param>
/// <param name="agentData"></param>
/// <returns></returns>
public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData)
{
string reason;
// We emulate the proper login sequence here by doing things in four stages
// Stage 0: log the presence
scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
// Stage 1: simulate login by telling the scene to expect a new user connection
if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
Console.WriteLine("NewUserConnection failed: " + reason);
// Stage 2: add the new client as a child agent to the scene
TestClient client = new TestClient(agentData, scene);
scene.AddNewClient(client, PresenceType.User);
// Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
scp.CompleteMovement(client, true);
//scp.MakeRootAgent(new Vector3(90, 90, 90), true);
return scp;
}