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


C# IScene.ForEachScenePresence方法代码示例

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


在下文中一共展示了IScene.ForEachScenePresence方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetDebugPacketName

        /// <summary>
        ///     Set the debug packet level on the current scene.  This level governs which packets are printed out to the
        ///     console.
        /// </summary>
        /// <param name="newDebug"></param>
        void SetDebugPacketName(IScene scene, string name, bool remove)
        {
            scene.ForEachScenePresence(scenePresence =>
            {
                if (scenePresence.IsChildAgent) return;
                    MainConsole.Instance.DebugFormat(
                        "Packet debug for {0} {2} to {1}",
                        scenePresence.Name,
                        name, remove ? "removed" : "set");

                    scenePresence.ControllingClient.SetDebugPacketName(name, remove);
            });
        }
开发者ID:emperorstarfinder,项目名称:Virtual-Universe,代码行数:18,代码来源:SceneManager.cs

示例2: SetDebugPacketLevel

        /// <summary>
        ///     Set the debug packet level on the current scene.  This level governs which packets are printed out to the
        ///     console.
        /// </summary>
        /// <param name="newDebug"></param>
        void SetDebugPacketLevel(IScene scene, int newDebug)
        {
            scene.ForEachScenePresence(scenePresence =>
            {
                if (scenePresence.IsChildAgent) return;
                    MainConsole.Instance.DebugFormat(
                        "Packet debug for {0} set to {1}",
                        scenePresence.Name,
                        newDebug);

                scenePresence.ControllingClient.SetDebugPacketLevel(
                    newDebug);
            });
        }
开发者ID:emperorstarfinder,项目名称:Virtual-Universe,代码行数:19,代码来源:SceneManager.cs

示例3: HandleAlertConsoleCommand

		/// <summary>
		///     Handle an alert command from the console.
		/// </summary>
		/// <param name="cmdparams"></param>
		protected void HandleAlertConsoleCommand (IScene scene, string [] cmdparams)
		{
			string message = "";
			string userName = "";
			string cmdType = cmdparams [1].ToLower ();

			if (cmdType.StartsWith ("g", StringComparison.Ordinal) || cmdType.StartsWith ("b", StringComparison.Ordinal)) {
				// general
				if (cmdparams.Length > 2)
					message = Util.CombineParams (cmdparams, 2);
				else
					message = MainConsole.Instance.Prompt ("Message to send?", "");
				if (message == "")
					return;

				if (cmdType.StartsWith ("g", StringComparison.Ordinal)) {
					MainConsole.Instance.InfoFormat ("[DIALOG]: Sending general alert in region {0} with message '{1}'",
						scene.RegionInfo.RegionName, message);

					// send the message
					scene.ForEachScenePresence (delegate (IScenePresence sp) {
						if (!sp.IsChildAgent)
							sp.ControllingClient.SendAlertMessage (message);
					});
				} else {

					MainConsole.Instance.InfoFormat ("[DIALOG]: Sending broadcast alert to all regions with message '{0}'", message);

					// broadcast the message
					foreach (IScene scn in MainConsole.Instance.ConsoleScenes) {
						scn.ForEachScenePresence (delegate (IScenePresence sp) {
							if (!sp.IsChildAgent)
								sp.ControllingClient.SendAlertMessage (message);
						});
					}
				}
				return;
			}

			// user alert
			if (cmdparams.Length >= 4)
				userName = cmdparams [2] + " " + cmdparams [3];
			else
				userName = MainConsole.Instance.Prompt ("User name? (First Last)", "");
			if (userName == "")
				return;

			if (cmdparams.Length > 4)
				message = Util.CombineParams (cmdparams, 4);
			else
				message = MainConsole.Instance.Prompt ("Message to send?", "");
			if (message == "")
				return;


			MainConsole.Instance.InfoFormat ("[DIALOG]: Sending alert in region {0} to {1} with message '{2}'",
				scene.RegionInfo.RegionName, userName, message);

			// send the message to the user
			IScenePresence spc = scene.SceneGraph.GetScenePresence (userName);
			if (spc != null && !spc.IsChildAgent)
				spc.ControllingClient.SendAgentAlertMessage (message, false);

		}
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:68,代码来源:DialogModule.cs

示例4: OnClosingClient

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

            IScenePresence presence = scene.GetScenePresence (clientID);
            //Announce the closing agent if enabled
            if (m_announceClosedAgents)
            {
                scene.ForEachScenePresence(delegate(IScenePresence SP)
                {
                    if (SP.UUID != clientID && !SP.IsChildAgent)
                    {
                        IEntityCountModule entityCountModule = scene.RequestModuleInterface<IEntityCountModule>();
                        if (entityCountModule != null)
                            SP.ControllingClient.SendChatMessage(presence.Name + " has left the region. Total Agents: " + (entityCountModule.RootAgents - 1), 1, SP.AbsolutePosition, "System",
                                                           UUID.Zero, (byte)ChatSourceType.System, (byte)ChatAudibleLevel.Fully);
                    }
                }
                );
            }
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:26,代码来源:AuroraDefaultChatPlugins.cs

示例5: UpdateBroker

        protected void UpdateBroker(IScene 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();
            IEntityCountModule entityCountModule = scene.RequestModuleInterface<IEntityCountModule>();
            if (entityCountModule != null)
            {
                list.Append(String.Format("<avatars count=\"{0}\" region_name=\"{1}\" region_uuid=\"{2}\" timestamp=\"{3}\">\n",
                                         entityCountModule.RootAgents, scene.RegionInfo.RegionName,
                                         scene.RegionInfo.RegionID,
                                         DateTime.UtcNow.ToString("s")));
            }
            scene.ForEachScenePresence(delegate(IScenePresence sp)
            {
                if (!sp.IsChildAgent)
                {
                    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 = "WhiteCore.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();
                    MainConsole.Instance.Debug("[Concierge]: async broker POST abort due to timeout");
                                 }, bs, m_brokerUpdateTimeout * 1000, Timeout.Infinite);

            try
            {
                updatePost.BeginGetRequestStream(UpdateBrokerSend, bs);
                MainConsole.Instance.DebugFormat("[Concierge] async broker POST to {0} started", uri);
            }
            catch (WebException we)
            {
                MainConsole.Instance.ErrorFormat("[Concierge] async broker POST to {0} failed: {1}", uri, we.Status);
            }
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Optional-Modules,代码行数:53,代码来源:ConciergeModule.cs


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