本文整理汇总了C#中Aurora.Framework.Services.GridRegion类的典型用法代码示例。如果您正苦于以下问题:C# GridRegion类的具体用法?C# GridRegion怎么用?C# GridRegion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GridRegion类属于Aurora.Framework.Services命名空间,在下文中一共展示了GridRegion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetExternalCaps
public OSDMap GetExternalCaps(UUID agentID, GridRegion region)
{
if (m_registry == null) return new OSDMap();
OSDMap resp = new OSDMap();
if (m_registry.RequestModuleInterface<IGridServerInfoService>() != null)
{
m_servers = m_registry.RequestModuleInterface<IGridServerInfoService>().GetGridURIs("SyncMessageServerURI");
OSDMap req = new OSDMap();
req["AgentID"] = agentID;
req["Region"] = region.ToOSD();
req["Method"] = "GetCaps";
List<ManualResetEvent> events = new List<ManualResetEvent>();
foreach (string uri in m_servers)
{
ManualResetEvent even = new ManualResetEvent(false);
m_syncPoster.Get(uri, req, (r) =>
{
if (r == null)
return;
foreach (KeyValuePair<string, OSD> kvp in r)
resp.Add(kvp.Key, kvp.Value);
even.Set();
});
events.Add(even);
}
ManualResetEvent.WaitAll(events.ToArray());
}
foreach (var h in GetHandlers(agentID, region.RegionID))
{
if (m_allowedCapsModules.Contains(h.Name))
h.IncomingCapsRequest(agentID, region, m_registry.RequestModuleInterface<ISimulationBase>(), ref resp);
}
return resp;
}
示例2: CreateAgent
/**
* Agent-related communications
*/
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out CreateAgentResponse response)
{
response = new CreateAgentResponse();
IScene Scene = destination == null ? null : GetScene(destination.RegionID);
if (destination == null || Scene == null)
{
response.Reason = "Given destination was null";
response.Success = false;
return false;
}
if (Scene.RegionInfo.RegionID != destination.RegionID)
{
response.Reason = "Did not find region " + destination.RegionName;;
response.Success = false;
return false;
}
IEntityTransferModule transferModule = Scene.RequestModuleInterface<IEntityTransferModule>();
if (transferModule != null)
return transferModule.NewUserConnection(Scene, aCircuit, teleportFlags, out response);
response.Reason = "Did not find region " + destination.RegionName;
response.Success = false;
return false;
}
示例3: CreateAgent
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out CreateAgentResponse response)
{
response = null;
CreateAgentRequest request = new CreateAgentRequest();
request.CircuitData = aCircuit;
request.Destination = destination;
request.TeleportFlags = teleportFlags;
AutoResetEvent resetEvent = new AutoResetEvent(false);
OSDMap result = null;
m_syncMessagePoster.Get(destination.ServerURI, request.ToOSD(), (osdresp) =>
{
result = osdresp;
resetEvent.Set();
});
bool success = resetEvent.WaitOne(10000);
if (!success || result == null)
{
response = new CreateAgentResponse();
response.Reason = "Could not connect to destination";
response.Success = false;
return false;
}
response = new CreateAgentResponse();
response.FromOSD(result);
if (!response.Success)
return false;
return response.Success;
}
示例4: CloseAgent
public bool CloseAgent(GridRegion destination, UUID agentID)
{
CloseAgentRequest request = new CloseAgentRequest();
request.AgentID = agentID;
request.Destination = destination;
m_syncMessagePoster.Post(destination.ServerURI, request.ToOSD());
return true;
}
示例5: CloseAgent
public bool CloseAgent(GridRegion destination, UUID agentID)
{
IScene Scene = destination == null ? null : GetScene(destination.RegionID);
if (Scene == null || destination == null)
return false;
IEntityTransferModule transferModule = Scene.RequestModuleInterface<IEntityTransferModule>();
if (transferModule != null)
return transferModule.IncomingCloseAgent(Scene, agentID);
return false;
}
示例6: IsAuthorizedForRegion
public bool IsAuthorizedForRegion(GridRegion region, AgentCircuitData agent, bool isRootAgent, out string reason)
{
ISceneManager manager = m_registry.RequestModuleInterface<ISceneManager>();
if (manager != null && manager.Scene != null && manager.Scene.RegionInfo.RegionID == region.RegionID)
{
//Found the region, check permissions
return manager.Scene.Permissions.AllowedIncomingAgent(agent, isRootAgent, out reason);
}
reason = "Not Authorized as region does not exist.";
return false;
}
示例7: RemoveExternalCaps
public void RemoveExternalCaps(UUID agentID, GridRegion region)
{
OSDMap req = new OSDMap();
req["AgentID"] = agentID;
req["Region"] = region.ToOSD();
req["Method"] = "RemoveCaps";
foreach (string uri in m_servers)
m_syncPoster.Post(uri, req);
foreach (var h in GetHandlers(agentID, region.RegionID))
{
if (m_allowedCapsModules.Contains(h.Name))
h.IncomingCapsDestruction();
}
}
示例8: Close
public void Close(IScene scene)
{
//Deregister the interface
scene.UnregisterModuleInterface<IGridRegisterModule>(this);
m_scene = null;
MainConsole.Instance.InfoFormat("[RegisterRegionWithGrid]: Deregistering region {0} from the grid...",
scene.RegionInfo.RegionName);
//Deregister from the grid server
GridRegion r = new GridRegion(scene.RegionInfo);
r.IsOnline = false;
string error = "";
if (scene.RegionInfo.HasBeenDeleted || !m_markRegionsAsOffline)
scene.GridService.DeregisterRegion(r);
else if ((error = scene.GridService.UpdateMap(r, false)) != "")
MainConsole.Instance.WarnFormat(
"[RegisterRegionWithGrid]: Deregister from grid failed for region {0}, {1}",
scene.RegionInfo.RegionName, error);
}
示例9: MapBlockFromGridRegion
protected MapBlockData MapBlockFromGridRegion(GridRegion r, int flag)
{
MapBlockData block = new MapBlockData();
if (r == null)
{
block.Access = (byte) SimAccess.Down;
block.MapImageID = UUID.Zero;
return block;
}
block.Access = r.Access;
if ((flag & 0xffff) == 0)
block.MapImageID = r.TerrainImage;
if ((flag & 0xffff) == 1)
block.MapImageID = r.TerrainMapImage;
if ((flag & 0xffff) == 2)
block.MapImageID = r.ParcelMapImage;
block.Name = r.RegionName;
block.X = (ushort) (r.RegionLocX/Constants.RegionSize);
block.Y = (ushort) (r.RegionLocY/Constants.RegionSize);
block.SizeX = (ushort) (r.RegionSizeX);
block.SizeY = (ushort) (r.RegionSizeY);
return block;
}
示例10: UpdateAgent
public bool UpdateAgent(GridRegion destination, AgentPosition agentData)
{
IScene Scene = destination == null ? null : GetScene(destination.RegionID);
if (Scene == null || destination == null)
return false;
//MainConsole.Instance.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
IEntityTransferModule transferModule = Scene.RequestModuleInterface<IEntityTransferModule>();
if (transferModule != null)
return transferModule.IncomingChildAgentDataUpdate(Scene, agentData);
return false;
}
示例11: TryFindGridRegionForAgentLogin
protected bool TryFindGridRegionForAgentLogin(List<GridRegion> regions, UserAccount account,
UUID session, UUID secureSession,
uint circuitCode, Vector3 position,
IPEndPoint clientIP, AgentCircuitData aCircuit, out string seedCap,
out string reason, out GridRegion destination)
{
LoginAgentArgs args = null;
foreach (GridRegion r in regions)
{
args = m_registry.RequestModuleInterface<IAgentProcessing>().
LoginAgent(r, aCircuit);
if (args.Success)
{
aCircuit = MakeAgent(r, account, session, secureSession, circuitCode, position, clientIP);
destination = r;
reason = args.Reason;
seedCap = args.SeedCap;
return true;
}
m_GridService.SetRegionUnsafe(r.RegionID);
}
if (args != null)
{
seedCap = args.SeedCap;
reason = args.Reason;
}
else
{
seedCap = "";
reason = "";
}
destination = null;
return false;
}
示例12: SuccessfulCrossingTransit
public void SuccessfulCrossingTransit(GridRegion crossingRegion)
{
m_inTransit = false;
//We got there fine, remove it
m_failedNeighborCrossing.Remove(crossingRegion.RegionID);
}
示例13: LLLoginResponse
public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, Framework.Services.UserInfo pinfo,
GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList,
IInventoryService invService, ILibraryService libService,
string where, string startlocation, Vector3 position, Vector3 lookAt,
List<InventoryItemBase> gestures,
GridRegion home, IPEndPoint clientIP, string AdultMax, string AdultRating,
ArrayList eventValues, ArrayList eventNotificationValues, ArrayList classifiedValues,
string seedCap, IConfigSource source,
string DisplayName, string cofversion, IGridInfo info)
: this()
{
m_source = source;
m_gridInfo = info;
SeedCapability = seedCap;
FillOutInventoryData(invSkel, libService, invService);
FillOutActiveGestures(gestures);
CircuitCode = (int) aCircuit.CircuitCode;
Lastname = account.LastName;
Firstname = account.FirstName;
this.DisplayName = DisplayName;
AgentID = account.PrincipalID;
SessionID = aCircuit.SessionID;
SecureSessionID = aCircuit.SecureSessionID;
BuddList = ConvertFriendListItem(friendsList);
StartLocation = where;
AgentAccessMax = AdultMax;
AgentAccess = AdultRating;
eventCategories = eventValues;
eventNotifications = eventNotificationValues;
classifiedCategories = classifiedValues;
COFVersion = cofversion;
FillOutHomeData(pinfo, home);
LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z);
FillOutRegionData(aCircuit, destination);
login = "true";
ErrorMessage = "";
ErrorReason = LoginResponseEnum.OK;
}
示例14: 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)
//.........这里部分代码省略.........
示例15: 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 virtual void MakeChildAgent(GridRegion destination)
{
IsChildAgent = true;
SuccessfullyMadeRootAgent = false;
SuccessfulTransit();
// 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 Animator(this);
else
Animator.ResetAnimations();
MainConsole.Instance.DebugFormat(
"[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
Name, UUID, m_scene.RegionInfo.RegionName);
RemoveFromPhysicalScene();
m_sceneViewer.Reset();
SendScriptEventToAllAttachments(Changed.TELEPORT);
m_scene.EventManager.TriggerOnMakeChildAgent(this, destination);
Reset();
}