本文整理汇总了C#中Aurora.Framework.Services.GridRegion类的典型用法代码示例。如果您正苦于以下问题:C# GridRegion类的具体用法?C# GridRegion怎么用?C# GridRegion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GridRegion类属于Aurora.Framework.Services命名空间,在下文中一共展示了GridRegion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:35,代码来源:ExternalCapsHandler.cs
示例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;
}
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:28,代码来源:LocalSimulationServiceConnector.cs
示例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;
}
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:31,代码来源:SimulationServiceConnector.cs
示例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;
}
开发者ID:samiam123,项目名称:sam2Aurora,代码行数:8,代码来源:SimulationServiceConnector.cs
示例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;
}
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:11,代码来源:LocalSimulationServiceConnector.cs
示例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;
}
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:11,代码来源:AuthorizationService.cs
示例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();
}
}
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:16,代码来源:ExternalCapsHandler.cs
示例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);
}
开发者ID:emperorstarfinder,项目名称:My-Aurora-Sim,代码行数:20,代码来源:RegisterRegionWithGrid.cs
示例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;
}
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:23,代码来源:MapCAPS.cs
示例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;
}
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:13,代码来源:LocalSimulationServiceConnector.cs
示例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;
}
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:34,代码来源:LLLoginService.cs
示例12: SuccessfulCrossingTransit
public void SuccessfulCrossingTransit(GridRegion crossingRegion)
{
m_inTransit = false;
//We got there fine, remove it
m_failedNeighborCrossing.Remove(crossingRegion.RegionID);
}
开发者ID:emperorstarfinder,项目名称:My-Aurora-Sim,代码行数:6,代码来源:ScenePresence.cs
示例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;
}
开发者ID:emperorstarfinder,项目名称:My-Aurora-Sim,代码行数:43,代码来源:LLLoginResponse.cs
示例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)
//.........这里部分代码省略.........
开发者ID:keverw,项目名称:Aurora-Sim,代码行数:101,代码来源:LLLoginService.cs
示例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();
}
开发者ID:emperorstarfinder,项目名称:My-Aurora-Sim,代码行数:30,代码来源:ScenePresence.cs
示例16: MakeAgent
protected AgentCircuitData MakeAgent(GridRegion region, UserAccount account,
UUID session, UUID secureSession, uint circuit,
Vector3 position, IPEndPoint clientIP)
{
return new AgentCircuitData
{
AgentID = account.PrincipalID,
IsChildAgent = false,
CircuitCode = circuit,
SecureSessionID = secureSession,
SessionID = session,
StartingPosition = position,
IPAddress = clientIP.Address.ToString()
};
}
开发者ID:keverw,项目名称:Aurora-Sim,代码行数:15,代码来源:LLLoginService.cs
示例17: SendGridInstantMessageViaXMLRPCAsync
/// <summary>
/// Recursive SendGridInstantMessage over XMLRPC method.
/// This is called from within a dedicated thread.
/// The first time this is called, prevRegionHandle will be 0 Subsequent times this is called from
/// itself, prevRegionHandle will be the last region handle that we tried to send.
/// If the handles are the same, we look up the user's location using the grid.
/// If the handles are still the same, we end. The send failed.
/// </summary>
/// <param name="im"></param>
/// <param name="prevRegion">
/// Pass in 0 the first time this method is called. It will be called recursively with the last
/// regionhandle tried
/// </param>
protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im,
GridRegion prevRegion)
{
UUID toAgentID = im.ToAgentID;
string HTTPPath = "";
lock (IMUsersCache)
{
if (!IMUsersCache.TryGetValue(toAgentID, out HTTPPath))
HTTPPath = "";
}
if (HTTPPath != "")
{
//We've tried to send an IM to them before, pull out their info
//Send the IM to their last location
if (!doIMSending(HTTPPath, im))
{
//If this fails, the user has either moved from their stored location or logged out
//Since it failed, let it look them up again and rerun
lock (IMUsersCache)
{
IMUsersCache.Remove(toAgentID);
}
//Clear the path and let it continue trying again.
HTTPPath = "";
}
else
{
//Send the IM, and it made it to the user, return true
return;
}
}
//Now query the grid server for the agent
List<string> AgentLocations = m_agentInfoService.GetAgentsLocations(im.FromAgentID.ToString(),
new List<string>(new[] {toAgentID.ToString()}));
if (AgentLocations.Count > 0)
{
//No agents, so this user is offline
if (AgentLocations[0] == "NotOnline")
{
lock (IMUsersCache)
{
//Remove them so we keep testing against the db
IMUsersCache.Remove(toAgentID);
}
MainConsole.Instance.Info("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
HandleUndeliveredMessage(im, "User is not set as online by presence service.");
return;
}
if (AgentLocations[0] == "NonExistant")
{
IMUsersCache.Remove(toAgentID);
MainConsole.Instance.Info("[GRID INSTANT MESSAGE]: Unable to deliver an instant message to " +
toAgentID +
", user does not exist");
HandleUndeliveredMessage(im, "User does not exist.");
return;
}
HTTPPath = AgentLocations[0];
}
//We found the agent's location, now ask them about the user
if (HTTPPath != "")
{
if (!doIMSending(HTTPPath, im))
{
//It failed, stop now
lock (IMUsersCache)
{
//Remove them so we keep testing against the db
IMUsersCache.Remove(toAgentID);
}
MainConsole.Instance.Info(
"[GRID INSTANT MESSAGE]: Unable to deliver an instant message as the region could not be found");
HandleUndeliveredMessage(im, "Failed to send IM to destination.");
return;
}
else
{
//Add to the cache
if (!IMUsersCache.ContainsKey(toAgentID))
IMUsersCache.Add(toAgentID, HTTPPath);
//Send the IM, and it made it to the user, return true
return;
}
//.........这里部分代码省略.........
开发者ID:emperorstarfinder,项目名称:My-Aurora-Sim,代码行数:101,代码来源:MessageTransferModule.cs
示例18: service_OnMessageReceived
OSDMap service_OnMessageReceived(OSDMap message)
{
string method = message["Method"];
if (method != "GetCaps" && method != "RemoveCaps")
return null;
UUID AgentID = message["AgentID"];
GridRegion region = new GridRegion();
region.FromOSD((OSDMap)message["Region"]);
OSDMap map = new OSDMap();
switch (method)
{
case "GetCaps":
foreach (var h in GetHandlers(AgentID, region.RegionID))
{
if (m_allowedCapsModules.Contains(h.Name))
h.IncomingCapsRequest(AgentID, region, m_registry.RequestModuleInterface<ISimulationBase>(), ref map);
}
return map;
case "RemoveCaps":
foreach (var h in GetHandlers(AgentID, region.RegionID))
{
if (m_allowedCapsModules.Contains(h.Name))
h.IncomingCapsDestruction();
}
return map;
}
return null;
}
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:28,代码来源:ExternalCapsHandler.cs
示例19: FillOutRegionData
private void FillOutRegionData(AgentCircuitData circuitData, GridRegion destination)
{
IPEndPoint endPoint = destination.ExternalEndPoint;
//We don't need this anymore, we set this from what we get from the region
//endPoint = Util.ResolveAddressForClient (endPoint, circuitData.ClientIPEndPoint);
SimAddress = endPoint.Address.ToString();
SimPort = (uint) circuitData.RegionUDPPort;
RegionX = (uint) destination.RegionLocX;
RegionY = (uint) destination.RegionLocY;
RegionSizeX = destination.RegionSizeX;
RegionSizeY = destination.RegionSizeY;
}
开发者ID:emperorstarfinder,项目名称:My-Aurora-Sim,代码行数:12,代码来源:LLLoginResponse.cs
示例20: FillOutHomeData
private void FillOutHomeData(Framework.Services.UserInfo pinfo, GridRegion home)
{
int x = 1000*Constants.RegionSize, y = 1000*Constants.RegionSize;
if (home != null)
{
x = home.RegionLocX;
y = home.RegionLocY;
}
Home = string.Format(
"{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
x,
y,
pinfo.HomePosition.X, pinfo.HomePosition.Y, pinfo.HomePosition.Z,
pinfo.HomeLookAt.X, pinfo.HomeLookAt.Y, pinfo.HomeLookAt.Z);
}
开发者ID:emperorstarfinder,项目名称:My-Aurora-Sim,代码行数:16,代码来源:LLLoginResponse.cs
注:本文中的Aurora.Framework.Services.GridRegion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论