本文整理汇总了C#中TeleportFlags类的典型用法代码示例。如果您正苦于以下问题:C# TeleportFlags类的具体用法?C# TeleportFlags怎么用?C# TeleportFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TeleportFlags类属于命名空间,在下文中一共展示了TeleportFlags类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TeleportFinish
public static OSDMap TeleportFinish(UUID agentID, int locationID, ulong regionHandle, Uri seedCap, SimAccess simAccess,
IPAddress simIP, int simPort, TeleportFlags teleportFlags)
{
OSDMap info = new OSDMap(8);
info.Add("AgentID", OSD.FromUUID(agentID));
info.Add("LocationID", OSD.FromInteger(locationID)); // Unused by the client
info.Add("RegionHandle", OSD.FromULong(regionHandle));
info.Add("SeedCapability", OSD.FromUri(seedCap));
info.Add("SimAccess", OSD.FromInteger((byte)simAccess));
info.Add("SimIP", OSD.FromBinary(simIP.GetAddressBytes()));
info.Add("SimPort", OSD.FromInteger(simPort));
info.Add("TeleportFlags", OSD.FromUInteger((uint)teleportFlags));
OSDArray infoArray = new OSDArray(1);
infoArray.Add(info);
OSDMap teleport = new OSDMap(1);
teleport.Add("Info", infoArray);
return teleport;
}
示例2: LaunchAgentDirectly
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
{
return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);
}
示例3: LaunchAgentAtGrid
protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarAppearance avatar,
UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0,
IPEndPoint clientIP, TeleportFlags flags, out string where, out string reason, out GridRegion dest)
{
where = currentWhere;
ISimulationService simConnector = null;
reason = string.Empty;
uint circuitCode = 0;
AgentCircuitData aCircuit = null;
if (m_UserAgentService == null)
{
// HG standalones have both a localSimulatonDll and a remoteSimulationDll
// non-HG standalones have just a localSimulationDll
// independent login servers have just a remoteSimulationDll
if (m_LocalSimulationService != null)
simConnector = m_LocalSimulationService;
else if (m_RemoteSimulationService != null)
simConnector = m_RemoteSimulationService;
}
else // User Agent Service is on
{
if (gatekeeper == null) // login to local grid
{
if (hostName == string.Empty)
SetHostAndPort(m_GatekeeperURL);
gatekeeper = new GridRegion(destination);
gatekeeper.ExternalHostName = hostName;
gatekeeper.HttpPort = (uint)port;
gatekeeper.ServerURI = m_GatekeeperURL;
}
m_log.Debug("[LLLOGIN SERVICE]: no gatekeeper detected..... using " + m_GatekeeperURL);
}
bool success = false;
if (m_UserAgentService == null && simConnector != null)
{
circuitCode = (uint)Util.RandomClass.Next(); ;
aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0);
success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason);
if (!success && m_GridService != null)
{
// Try the fallback regions
List<GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY);
if (fallbacks != null)
{
foreach (GridRegion r in fallbacks)
{
success = LaunchAgentDirectly(simConnector, r, aCircuit, flags | TeleportFlags.ViaRegionID, out reason);
if (success)
{
where = "safe";
destination = r;
break;
}
}
}
}
}
if (m_UserAgentService != null)
{
circuitCode = (uint)Util.RandomClass.Next(); ;
aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0);
aCircuit.teleportFlags |= (uint)flags;
success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason);
if (!success && m_GridService != null)
{
// Try the fallback regions
List<GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY);
if (fallbacks != null)
{
foreach (GridRegion r in fallbacks)
{
success = LaunchAgentIndirectly(gatekeeper, r, aCircuit, clientIP, out reason);
if (success)
{
where = "safe";
destination = r;
break;
}
}
}
}
}
dest = destination;
if (success)
return aCircuit;
else
return null;
}
示例4: FindDestination
protected GridRegion FindDestination(
UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation,
GridRegion home, out GridRegion gatekeeper,
out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags)
{
flags = TeleportFlags.ViaLogin;
m_log.DebugFormat(
"[LLOGIN SERVICE]: Finding destination matching start location {0} for {1}",
startLocation, account.Name);
gatekeeper = null;
where = "home";
position = new Vector3(128, 128, 0);
lookAt = new Vector3(0, 1, 0);
if (m_GridService == null)
return null;
if (startLocation.Equals("home"))
{
// logging into home region
if (pinfo == null)
return null;
GridRegion region = null;
bool tryDefaults = false;
if (home == null)
{
tryDefaults = true;
}
else
{
region = home;
position = pinfo.HomePosition;
lookAt = pinfo.HomeLookAt;
flags |= TeleportFlags.ViaHome;
}
if (tryDefaults)
{
List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
if (defaults != null && defaults.Count > 0)
{
region = defaults[0];
where = "safe";
}
else
{
m_log.WarnFormat("[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region",
account.FirstName, account.LastName);
region = FindAlternativeRegion(scopeID);
if (region != null)
where = "safe";
}
}
return region;
}
else if (startLocation.Equals("last"))
{
// logging into last visited region
where = "last";
if (pinfo == null)
return null;
GridRegion region = null;
if (pinfo.LastRegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(scopeID, pinfo.LastRegionID)) == null)
{
List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID);
if (defaults != null && defaults.Count > 0)
{
region = defaults[0];
where = "safe";
}
else
{
m_log.Info("[LLOGIN SERVICE]: Last Region Not Found Attempting to find random region");
region = FindAlternativeRegion(scopeID);
if (region != null)
where = "safe";
}
}
else
{
position = pinfo.LastPosition;
lookAt = pinfo.LastLookAt;
}
return region;
}
else
{
flags |= TeleportFlags.ViaRegionID;
//.........这里部分代码省略.........
示例5: TeleportEventArgs
public TeleportEventArgs(string message, TeleportStatus status, TeleportFlags flags)
{
this.m_Message = message;
this.m_Status = status;
this.m_Flags = flags;
}
示例6: FindDestination
protected GridRegion FindDestination(UserAccount account, UserInfo pinfo, UUID sessionID, string startLocation,
GridRegion home, out TeleportFlags tpFlags, out string where,
out Vector3 position, out Vector3 lookAt)
{
where = "home";
position = new Vector3(128, 128, 25);
lookAt = new Vector3(0, 1, 0);
tpFlags = TeleportFlags.ViaLogin;
if (m_GridService == null)
return null;
if (startLocation.Equals("home"))
{
tpFlags |= TeleportFlags.ViaLandmark;
// logging into home region
if (pinfo == null)
return null;
GridRegion region = null;
bool tryDefaults = false;
if (home == null)
{
MainConsole.Instance.WarnFormat(
"[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set",
account.FirstName, account.LastName);
tryDefaults = true;
}
else
{
region = home;
position = pinfo.HomePosition;
lookAt = pinfo.HomeLookAt;
}
if (tryDefaults)
{
tpFlags &= ~TeleportFlags.ViaLandmark;
List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.AllScopeIDs);
if (defaults != null && defaults.Count > 0)
{
region = defaults[0];
where = "safe";
}
else
{
List<GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.AllScopeIDs, 0, 0);
if (fallbacks != null && fallbacks.Count > 0)
{
region = fallbacks[0];
where = "safe";
}
else
{
//Try to find any safe region
List<GridRegion> safeRegions = m_GridService.GetSafeRegions(account.AllScopeIDs, 0, 0);
if (safeRegions != null && safeRegions.Count > 0)
{
region = safeRegions[0];
where = "safe";
}
else
{
MainConsole.Instance.WarnFormat(
"[LLOGIN SERVICE]: User {0} {1} does not have a valid home and this grid does not have default locations. Attempting to find random region",
account.FirstName, account.LastName);
defaults = m_GridService.GetRegionsByName(account.AllScopeIDs, "", 0, 1);
if (defaults != null && defaults.Count > 0)
{
region = defaults[0];
where = "safe";
}
}
}
}
}
return region;
}
if (startLocation.Equals("last"))
{
tpFlags |= TeleportFlags.ViaLandmark;
// logging into last visited region
where = "last";
if (pinfo == null)
return null;
GridRegion region = null;
if (pinfo.CurrentRegionID.Equals(UUID.Zero) ||
(region = m_GridService.GetRegionByUUID(account.AllScopeIDs, pinfo.CurrentRegionID)) == null)
{
tpFlags &= ~TeleportFlags.ViaLandmark;
List<GridRegion> defaults = m_GridService.GetDefaultRegions(account.AllScopeIDs);
if (defaults != null && defaults.Count > 0)
//.........这里部分代码省略.........
示例7: LaunchAgentAtGrid
protected AgentCircuitData LaunchAgentAtGrid(GridRegion destination, TeleportFlags tpFlags, UserAccount account,
UUID session, UUID secureSession, Vector3 position,
string currentWhere,
IPEndPoint clientIP, List<UUID> friendsToInform, out string where, out string reason,
out string seedCap, out GridRegion dest)
{
where = currentWhere;
reason = string.Empty;
uint circuitCode = 0;
AgentCircuitData aCircuit = null;
dest = destination;
#region Launch Agent
circuitCode = (uint) Util.RandomClass.Next();
aCircuit = MakeAgent(destination, account, session, secureSession, circuitCode, position,
clientIP);
aCircuit.TeleportFlags = (uint) tpFlags;
MainConsole.Instance.DebugFormat("[LoginService]: Attempting to log {0} into {1} at {2}...", account.Name, destination.RegionName, destination.ServerURI);
LoginAgentArgs args = m_registry.RequestModuleInterface<IAgentProcessing>().
LoginAgent(destination, aCircuit, friendsToInform);
aCircuit.CachedUserInfo = args.CircuitData.CachedUserInfo;
aCircuit.RegionUDPPort = args.CircuitData.RegionUDPPort;
reason = args.Reason;
reason = "";
seedCap = args.SeedCap;
bool success = args.Success;
if (!success && m_GridService != null)
{
MainConsole.Instance.DebugFormat("[LoginService]: Failed to log {0} into {1} at {2}...", account.Name, destination.RegionName, destination.ServerURI);
//Remove the landmark flag (landmark is used for ignoring the landing points in the region)
aCircuit.TeleportFlags &= ~(uint) TeleportFlags.ViaLandmark;
m_GridService.SetRegionUnsafe(destination.RegionID);
// Make sure the client knows this isn't where they wanted to land
where = "safe";
// Try the default regions
List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(account.AllScopeIDs);
if (defaultRegions != null)
{
success = TryFindGridRegionForAgentLogin(defaultRegions, account,
session, secureSession, circuitCode, position,
clientIP, aCircuit, friendsToInform,
out seedCap, out reason, out dest);
}
if (!success)
{
// Try the fallback regions
List<GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.AllScopeIDs,
destination.RegionLocX,
destination.RegionLocY);
if (fallbacks != null)
{
success = TryFindGridRegionForAgentLogin(fallbacks, account,
session, secureSession, circuitCode,
position,
clientIP, aCircuit, friendsToInform,
out seedCap, out reason, out dest);
}
if (!success)
{
//Try to find any safe region
List<GridRegion> safeRegions = m_GridService.GetSafeRegions(account.AllScopeIDs,
destination.RegionLocX,
destination.RegionLocY);
if (safeRegions != null)
{
success = TryFindGridRegionForAgentLogin(safeRegions, account,
session, secureSession, circuitCode,
position, clientIP, aCircuit, friendsToInform,
out seedCap, out reason, out dest);
if (!success)
reason = "No Region Found";
}
}
}
}
#endregion
if (success)
{
MainConsole.Instance.DebugFormat("[LoginService]: Successfully logged {0} into {1} at {2}...", account.Name, destination.RegionName, destination.ServerURI);
//Set the region to safe since we got there
m_GridService.SetRegionSafe(destination.RegionID);
return aCircuit;
}
return null;
}
示例8: LaunchAgentDirectly
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
{
string version;
if (
!simConnector.QueryAccess(
region, aCircuit.AgentID, null, true, aCircuit.startpos, "SIMULATION/0.3", out version, out reason))
return false;
return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);
}
示例9: LaunchAgentAtGrid
protected AgentCircuitData LaunchAgentAtGrid(GridRegion destination, TeleportFlags tpFlags, UserAccount account, AvatarAppearance appearance,
UUID session, UUID secureSession, Vector3 position, string currentWhere,
IPEndPoint clientIP, out string where, out string reason, out GridRegion dest)
{
where = currentWhere;
reason = string.Empty;
uint circuitCode = 0;
AgentCircuitData aCircuit = null;
dest = destination;
bool success = false;
#region Launch Agent
circuitCode = (uint)Util.RandomClass.Next(); ;
aCircuit = MakeAgent(destination, account, appearance, session, secureSession, circuitCode, position, clientIP);
aCircuit.teleportFlags = (uint)tpFlags;
success = LaunchAgentDirectly(destination, ref aCircuit, out reason);
if (!success && m_GridService != null)
{
//Remove the landmark flag (landmark is used for ignoring the landing points in the region)
aCircuit.teleportFlags &= ~(uint)TeleportFlags.ViaLandmark;
m_GridService.SetRegionUnsafe(destination.RegionID);
// Make sure the client knows this isn't where they wanted to land
where = "safe";
// Try the default regions
List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(account.ScopeID);
if (defaultRegions != null)
{
success = TryFindGridRegionForAgentLogin(defaultRegions, account,
appearance, session, secureSession, circuitCode, position,
clientIP, aCircuit, out dest);
}
if (!success)
{
// Try the fallback regions
List<GridRegion> fallbacks = m_GridService.GetFallbackRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY);
if (fallbacks != null)
{
success = TryFindGridRegionForAgentLogin(fallbacks, account,
appearance, session, secureSession, circuitCode, position,
clientIP, aCircuit, out dest);
}
if (!success)
{
//Try to find any safe region
List<GridRegion> safeRegions = m_GridService.GetSafeRegions(account.ScopeID, destination.RegionLocX, destination.RegionLocY);
if (safeRegions != null)
{
success = TryFindGridRegionForAgentLogin(safeRegions, account,
appearance, session, secureSession, circuitCode, position,
clientIP, aCircuit, out dest);
if (!success)
reason = "No Region Found";
}
}
}
}
#endregion
if (success)
{
//Set the region to safe since we got there
m_GridService.SetRegionSafe (destination.RegionID);
return aCircuit;
}
else
return null;
}
示例10: Deserialize
/// <summary>
/// Deserialize the message
/// </summary>
/// <param name="map">An <see cref="OSDMap"/> containing the data</param>
public void Deserialize(OSDMap map)
{
OSDArray array = (OSDArray)map["Info"];
OSDMap blockMap = (OSDMap)array[0];
AgentID = blockMap["AgentID"].AsUUID();
LocationID = blockMap["LocationID"].AsInteger();
RegionHandle = blockMap["RegionHandle"].AsULong();
SeedCapability = blockMap["SeedCapability"].AsUri();
SimAccess = (SimAccess)blockMap["SimAccess"].AsInteger();
IP = MessageUtils.ToIP(blockMap["SimIP"]);
Port = blockMap["SimPort"].AsInteger();
Flags = (TeleportFlags)blockMap["TeleportFlags"].AsUInteger();
}
示例11: LaunchAgentDirectly
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
{
EntityTransferContext ctx = new EntityTransferContext();
if (!simConnector.QueryAccess(
region, aCircuit.AgentID, null, true, aCircuit.startpos, new List<UUID>(), ctx, out reason))
return false;
return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, ctx, out reason);
}
示例12: IntroduceClientToScene
/// <summary>
/// Introduce an agent into the scene by adding a new client.
/// </summary>
/// <returns>The scene presence added</returns>
/// <param name='scene'></param>
/// <param name='testClient'></param>
/// <param name='agentData'></param>
/// <param name='tf'></param>
private static ScenePresence IntroduceClientToScene(
Scene scene, IClientAPI client, AgentCircuitData agentData, TeleportFlags tf)
{
string reason;
// Stage 1: tell the scene to expect a new user connection
if (!scene.NewUserConnection(agentData, (uint)tf, null, out reason))
Console.WriteLine("NewUserConnection failed: " + reason);
// Stage 2: add the new client as a child agent to the scene
scene.AddNewAgent(client, PresenceType.User);
return scene.GetScenePresence(client.AgentId);
}
示例13: MakeChildAgent
/// <summary>
/// This turns a root agent into a child agent
/// when an agent departs this region for a neighbor, this gets called.
///
/// It doesn't get called for a teleport. Reason being, an agent that
/// teleports out may not end up anywhere near this region
/// </summary>
public void MakeChildAgent()
{
// Reset these so that teleporting in and walking out isn't seen
// as teleporting back
m_teleportFlags = TeleportFlags.Default;
// It looks like m_animator is set to null somewhere, and MakeChild
// is called after that. Probably in aborted teleports.
if (m_animator == null)
m_animator = new ScenePresenceAnimator(this);
else
Animator.ResetAnimations();
// m_log.DebugFormat(
// "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
// Name, UUID, m_scene.RegionInfo.RegionName);
// Don't zero out the velocity since this can cause problems when an avatar is making a region crossing,
// depending on the exact timing. This shouldn't matter anyway since child agent positions are not updated.
//Velocity = new Vector3(0, 0, 0);
m_isChildAgent = true;
m_scene.SwapRootAgentCount(true);
RemoveFromPhysicalScene();
// FIXME: Set m_rootRegionHandle to the region handle of the scene this agent is moving into
m_scene.EventManager.TriggerOnMakeChildAgent(this);
}
示例14: LaunchAgentDirectly
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
{
string myversion = String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersion);
string version;
if (!simConnector.QueryAccess(
region, aCircuit.AgentID, null, true, aCircuit.startpos, myversion, new List<UUID>(), out version, out reason))
return false;
return simConnector.CreateAgent(null, region, aCircuit, (uint)flags, out reason);
}