当前位置: 首页>>代码示例>>C#>>正文


C# Scene.GetRootAgentCount方法代码示例

本文整理汇总了C#中OpenSim.Region.Framework.Scenes.Scene.GetRootAgentCount方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.GetRootAgentCount方法的具体用法?C# Scene.GetRootAgentCount怎么用?C# Scene.GetRootAgentCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Region.Framework.Scenes.Scene的用法示例。


在下文中一共展示了Scene.GetRootAgentCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
            }
        }
开发者ID:CCIR,项目名称:opensim,代码行数:47,代码来源:ConciergeModule.cs

示例2: RegionStats

        protected string RegionStats(OSHttpResponse httpResponse, Scene scene)
        {
            int users = scene.GetRootAgentCount();
            int objects = scene.Entities.Count - users;

            RestXmlWriter rxw = new RestXmlWriter(new StringWriter());

            rxw.WriteStartElement(String.Empty, "region", String.Empty);
            rxw.WriteStartElement(String.Empty, "stats", String.Empty);

            rxw.WriteStartElement(String.Empty, "users", String.Empty);
            rxw.WriteString(users.ToString());
            rxw.WriteEndElement();

            rxw.WriteStartElement(String.Empty, "objects", String.Empty);
            rxw.WriteString(objects.ToString());
            rxw.WriteEndElement();

            rxw.WriteEndDocument();

            return rxw.ToString();
        }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:22,代码来源:GETHandler.cs

示例3: AllowTeleport

        public bool AllowTeleport(UUID userID, Scene scene, Vector3 Position, AgentCircuitData ACD, out Vector3 newPosition, out string reason)
        {
            newPosition = Position;
            
            UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID);

            ScenePresence Sp = scene.GetScenePresence(userID);
            if (account == null)
            {
                reason = "Failed authentication.";
                return false; //NO!
            }

            //Check how long its been since the last TP
            if (m_enabledBlockTeleportSeconds && Sp != null && !Sp.IsChildAgent)
            {
                if (TimeSinceLastTeleport.ContainsKey(Sp.Scene.RegionInfo.RegionID))
                {
                    if (TimeSinceLastTeleport[Sp.Scene.RegionInfo.RegionID] > Util.UnixTimeSinceEpoch())
                    {
                        reason = "Too many teleports. Please try again soon.";
                        return false; // Too soon since the last TP
                    }
                }
                TimeSinceLastTeleport[Sp.Scene.RegionInfo.RegionID] = Util.UnixTimeSinceEpoch() + ((int)(SecondsBeforeNextTeleport));
            }

            //Gods tp freely
            if ((Sp != null && Sp.GodLevel != 0) || account.UserLevel != 0)
            {
                reason = "";
                return true;
            }

            //Check whether they fit any ban criteria
            if (Sp != null)
            {
                foreach (string banstr in BanCriteria)
                {
                    if (Sp.Name.Contains(banstr))
                    {
                        reason = "You have been banned from this region.";
                        return false;
                    }
                    else if (((System.Net.IPEndPoint)Sp.ControllingClient.GetClientEP()).Address.ToString().Contains(banstr))
                    {
                        reason = "You have been banned from this region.";
                        return false;
                    }
                }
            }

            EstateSettings ES = scene.RegionInfo.EstateSettings;

            if (scene.RegionInfo.RegionSettings.AgentLimit < scene.GetRootAgentCount() + 1)
            {
                reason = "Too many agents at this time. Please come back later.";
                return false;
            }

            List<EstateBan> EstateBans = new List<EstateBan>(ES.EstateBans);
            int i = 0;
            //Check bans
            foreach (EstateBan ban in EstateBans)
            {
                if (ban.BannedUserID == userID)
                {
                    string banIP = ((System.Net.IPEndPoint)Sp.ControllingClient.GetClientEP()).Address.ToString();

                    if (ban.BannedHostIPMask != banIP) //If it changed, ban them again
                    {
                        //Add the ban with the new hostname
                        ES.AddBan(new EstateBan()
                        {
                            BannedHostIPMask = banIP,
                            BannedUserID = ban.BannedUserID,
                            EstateID = ban.EstateID,
                            BannedHostAddress = ban.BannedHostAddress,
                            BannedHostNameMask = ban.BannedHostNameMask
                        });
                        //Update the database
                        ES.Save();
                    }

                    reason = "Banned from this region.";
                    return false;
                }
                if (ban.BannedHostIPMask == ACD.IPAddress)
                {
                    //Ban the new user
                    ES.AddBan(new EstateBan()
                    {
                        EstateID = ES.EstateID,
                        BannedHostIPMask = ACD.IPAddress,
                        BannedUserID = userID,
                        BannedHostAddress = ACD.IPAddress,
                        BannedHostNameMask = ACD.IPAddress
                    });
                    ES.Save();

//.........这里部分代码省略.........
开发者ID:NickyPerian,项目名称:Aurora,代码行数:101,代码来源:EstateService.cs

示例4: OnClosingClient

        public void OnClosingClient(UUID clientID, Scene scene)
        {
            //Clear out the auth speakers list
            lock (m_authorizedSpeakers)
            {
                if (m_authorizedSpeakers.Contains(clientID))
                    m_authorizedSpeakers.Remove(clientID);
            }

            ScenePresence presence = scene.GetScenePresence(clientID);
            //Announce the closing agent if enabled
            if (m_announceClosedAgents)
            {
                scene.ForEachScenePresence(delegate(ScenePresence SP)
                {
                    if (SP.UUID != clientID && !SP.IsChildAgent)
                    {
                        SP.ControllingClient.SendChatMessage(presence.Name + " has left the region. Total Agents: " + scene.GetRootAgentCount(), 1, SP.AbsolutePosition, "System",
                                                           UUID.Zero, (byte)ChatSourceType.System, (byte)ChatAudibleLevel.Fully);
                    }
                }
                );
            }
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:24,代码来源:AuroraDefaultChatPlugins.cs


注:本文中的OpenSim.Region.Framework.Scenes.Scene.GetRootAgentCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。