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


C# PlayerMobile.Where方法代码示例

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


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

示例1: DisplayStatus

		private static void DisplayStatus(PlayerMobile target, int offset, PlayerMobile[] cams)
		{
			if (target == null || !target.Alive || cams == null || cams.Length == 0)
			{
				return;
			}

			const int red = 44; // lower than green
			const int yellow = 54; // somewhere inbetween green and red
			const int green = 69; // greater than red

			string hLabel = String.Format("{0} / {1}", target.Hits, target.HitsMax); // hits
			int hHue = offset < 0 ? red : offset > 0 ? green : yellow;
				// negative offset = red, positive = green, neutral = yellow

			/*
			double percent = target.Hits / (double)target.HitsMax;

			string pLabel = String.Format("[{0}%]", percent * 100); // percent
			int pHue = (int)(red + (green - red) * percent); // interpolate between two hues
			*/

			if (offset != 0)
			{
				hLabel += String.Format(" ({0}{1:#,0})", offset > 0 ? "+" : String.Empty, offset);
			}

			Timer.DelayCall(
				TimeSpan.FromSeconds(0.5),
				() =>
				{
					foreach (PlayerMobile cam in cams.Where(cam => cam != null && !cam.Deleted && cam.NetState != null))
					{
						target.PrivateOverheadMessage(MessageType.Regular, hHue, true, hLabel, cam.NetState); // hits
						//target.PrivateOverheadMessage(MessageType.Regular, pHue, true, pLabel, cam.NetState); // percent
					}
				});
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:38,代码来源:ActionCams.cs

示例2: DisplayDamage

		private static void DisplayDamage(PlayerMobile target, int damage, PlayerMobile[] cams)
		{
			if (target == null || cams == null || cams.Length == 0)
			{
				return;
			}

			Packet pNew = null;
			Packet pOld = null;

			foreach (PlayerMobile cam in cams.Where(cam => cam != null && !cam.Deleted && cam.NetState != null))
			{
				if (cam.NetState.DamagePacket)
				{
					if (pNew == null)
					{
						pNew = Packet.Acquire(new DamagePacket(target, damage));
					}

					cam.Send(pNew);
				}
				else
				{
					if (pOld == null)
					{
						pOld = Packet.Acquire(new DamagePacketOld(target, damage));
					}

					cam.Send(pOld);
				}
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:32,代码来源:ActionCams.cs


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