本文整理汇总了C#中OpenSim.Framework.Capabilities.OSDMap.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# OSDMap.ContainsKey方法的具体用法?C# OSDMap.ContainsKey怎么用?C# OSDMap.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Framework.Capabilities.OSDMap
的用法示例。
在下文中一共展示了OSDMap.ContainsKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMessageReceived
protected OSDMap OnMessageReceived(OSDMap message)
{
if (!message.ContainsKey("Method"))
return null;
UUID AgentID = message["AgentID"].AsUUID();
ulong requestingRegion = message["RequestingRegion"].AsULong();
ICapsService capsService = m_registry.RequestModuleInterface<ICapsService>();
if (capsService == null)
{
//m_log.Info("[AgentProcessing]: Failed OnMessageReceived ICapsService is null");
return new OSDMap();
}
IClientCapsService clientCaps = capsService.GetClientCapsService(AgentID);
IRegionClientCapsService regionCaps = null;
if (clientCaps != null)
regionCaps = clientCaps.GetCapsService(requestingRegion);
if (message["Method"] == "LogoutRegionAgents")
{
LogOutAllAgentsForRegion(requestingRegion);
}
else if (message["Method"] == "RegionIsOnline") //This gets fired when the scene is fully finished starting up
{
//Log out all the agents first, then add any child agents that should be in this region
LogOutAllAgentsForRegion(requestingRegion);
IGridService GridService = m_registry.RequestModuleInterface<IGridService>();
if (GridService != null)
{
int x, y;
Util.UlongToInts(requestingRegion, out x, out y);
GridRegion requestingGridRegion = GridService.GetRegionByPosition(UUID.Zero, x, y);
if (requestingGridRegion != null)
EnableChildAgentsForRegion(requestingGridRegion);
}
}
else if (message["Method"] == "DisableSimulator")
{
//KILL IT!
if (regionCaps == null || clientCaps == null)
return null;
IEventQueueService eventQueue = m_registry.RequestModuleInterface<IEventQueueService> ();
eventQueue.DisableSimulator (regionCaps.AgentID, regionCaps.RegionHandle);
//regionCaps.Close();
//clientCaps.RemoveCAPS(requestingRegion);
}
else if (message["Method"] == "ArrivedAtDestination")
{
if (regionCaps == null || clientCaps == null)
return null;
//Recieved a callback
if (clientCaps.InTeleport) //Only set this if we are in a teleport,
// otherwise (such as on login), this won't check after the first tp!
clientCaps.CallbackHasCome = true;
regionCaps.Disabled = false;
//The agent is getting here for the first time (eg. login)
OSDMap body = ((OSDMap)message["Message"]);
//Parse the OSDMap
int DrawDistance = body["DrawDistance"].AsInteger();
AgentCircuitData circuitData = new AgentCircuitData();
circuitData.UnpackAgentCircuitData((OSDMap)body["Circuit"]);
//Now do the creation
EnableChildAgents(AgentID, requestingRegion, DrawDistance, circuitData);
}
else if (message["Method"] == "CancelTeleport")
{
if (regionCaps == null || clientCaps == null)
return null;
//Only the region the client is root in can do this
IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService ();
if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
{
//The user has requested to cancel the teleport, stop them.
clientCaps.RequestToCancelTeleport = true;
regionCaps.Disabled = false;
}
}
else if (message["Method"] == "AgentLoggedOut")
{
//ONLY if the agent is root do we even consider it
if (regionCaps != null)
{
if (regionCaps.RootAgent)
{
LogoutAgent(regionCaps);
}
}
}
else if (message["Method"] == "SendChildAgentUpdate")
{
if (regionCaps == null || clientCaps == null)
return null;
IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService ();
if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
{
//.........这里部分代码省略.........
示例2: DispatchWindLightSettings
private Hashtable DispatchWindLightSettings(Hashtable m_dhttpMethod, UUID agentID)
{
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = "";
IScenePresence SP = m_scene.GetScenePresence(agentID);
if(SP == null)
return responsedata; //They don't exist
m_log.Info("[WindLightSettings]: Got a request to update WindLight from " + SP.Name);
OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml((string)m_dhttpMethod["requestbody"]);
RegionLightShareData lsd = new RegionLightShareData();
lsd.FromOSD(rm);
lsd.regionID = SP.Scene.RegionInfo.RegionID;
bool remove = false;
if (rm.ContainsKey("remove"))
remove = rm["remove"].AsBoolean();
if (remove)
{
if (lsd.type == 0) //Region
{
if (!SP.Scene.Permissions.CanIssueEstateCommand(SP.UUID, false))
return responsedata; // No permissions
bool found = false;
foreach (RegionLightShareData regionLSD in m_WindlightSettings.Values)
{
if (lsd.minEffectiveAltitude == regionLSD.minEffectiveAltitude &&
lsd.maxEffectiveAltitude == regionLSD.maxEffectiveAltitude)
{
//it exists
found = true;
break;
}
}
//Set to default
if(found)
SaveWindLightSettings(lsd.minEffectiveAltitude, new RegionLightShareData());
}
else if (lsd.type == 1) //Parcel
{
IParcelManagementModule parcelManagement = SP.Scene.RequestModuleInterface<IParcelManagementModule>();
if (parcelManagement != null)
{
ILandObject land = parcelManagement.GetLandObject((int)SP.AbsolutePosition.X, (int)SP.AbsolutePosition.Y);
if (!SP.Scene.Permissions.GenericParcelPermission(SP.UUID, land, (ulong)GroupPowers.LandOptions))
return responsedata; // No permissions
IOpenRegionSettingsModule ORSM = SP.Scene.RequestModuleInterface<IOpenRegionSettingsModule>();
if (ORSM == null || !ORSM.AllowParcelWindLight)
{
SP.ControllingClient.SendAlertMessage("Parcel WindLight is disabled in this region.");
return responsedata;
}
OSDMap map = land.LandData.GenericDataMap;
OSDMap innerMap = new OSDMap();
if (land.LandData.GenericDataMap.ContainsKey("WindLight"))
innerMap = (OSDMap)map["WindLight"];
if (innerMap.ContainsKey(lsd.minEffectiveAltitude.ToString()))
{
innerMap.Remove(lsd.minEffectiveAltitude.ToString());
}
land.LandData.AddGenericData("WindLight", innerMap);
//Update the client
SendProfileToClient(SP, false);
}
}
}
else
{
if (lsd.type == 0) //Region
{
if (!SP.Scene.Permissions.CanIssueEstateCommand(SP.UUID, false))
return responsedata; // No permissions
foreach (RegionLightShareData regionLSD in m_WindlightSettings.Values)
{
string message = "";
if (checkAltitude(lsd, regionLSD, out message))
{
SP.ControllingClient.SendAlertMessage(message);
return responsedata;
}
}
SaveWindLightSettings(lsd.minEffectiveAltitude, lsd);
}
else if (lsd.type == 1) //Parcel
{
IParcelManagementModule parcelManagement = SP.Scene.RequestModuleInterface<IParcelManagementModule>();
if (parcelManagement != null)
{
//.........这里部分代码省略.........