本文整理汇总了C#中OpenSim.Region.Framework.Scenes.Scene.ForEachRootScenePresence方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.ForEachRootScenePresence方法的具体用法?C# Scene.ForEachRootScenePresence怎么用?C# Scene.ForEachRootScenePresence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.Scene
的用法示例。
在下文中一共展示了Scene.ForEachRootScenePresence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateBroker
protected void UpdateBroker(Scene scene)
{
if (String.IsNullOrEmpty(m_brokerURI))
return;
string uri = String.Format(m_brokerURI, scene.RegionInfo.RegionName, scene.RegionInfo.RegionID);
// create XML sniplet
StringBuilder list = new StringBuilder();
list.Append(String.Format("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\">\n",
scene.GetRootAgentCount(), scene.RegionInfo.RegionName,
scene.RegionInfo.RegionID,
DateTime.UtcNow.ToString("s")));
scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
list.Append(String.Format(" <avatar name=\"{0}\" uuid=\"{1}\" />\n", sp.Name, sp.UUID));
list.Append("</avatars>");
});
string payload = list.ToString();
// post via REST to broker
HttpWebRequest updatePost = WebRequest.Create(uri) as HttpWebRequest;
updatePost.Method = "POST";
updatePost.ContentType = "text/xml";
updatePost.ContentLength = payload.Length;
updatePost.UserAgent = "OpenSim.Concierge";
BrokerState bs = new BrokerState(uri, payload, updatePost);
bs.Timer = new Timer(delegate(object state)
{
BrokerState b = state as BrokerState;
b.Poster.Abort();
b.Timer.Dispose();
m_log.Debug("[Concierge]: async broker POST abort due to timeout");
}, bs, m_brokerUpdateTimeout * 1000, Timeout.Infinite);
try
{
updatePost.BeginGetRequestStream(UpdateBrokerSend, bs);
m_log.DebugFormat("[Concierge] async broker POST to {0} started", uri);
}
catch (WebException we)
{
m_log.ErrorFormat("[Concierge] async broker POST to {0} failed: {1}", uri, we.Status);
}
}