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


C# Item.IsEquipped方法代码示例

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


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

示例1: OnTarget

		protected void OnTarget(Mobile m, Item item)
		{
			if (!this.CheckDoubleClick(m, true, false, 2, true) || item == null || item.Deleted || _Target == null ||
				_Target.User != m)
			{
				return;
			}

			if (!_LayerableTypes.Any(t => item.TypeEquals(t)))
			{
				m.SendMessage(34, "You can not layer that item.");
				return;
			}

			if (item.Layer == TargetLayer)
			{
				m.SendMessage(34, "That sash is already layered.");
				return;
			}

			if (item.RootParent != m)
			{
				m.SendMessage(34, "That sash must be equipped or in your pack to layer it.");
				return;
			}

			if (item.IsEquipped())
			{
				var otherItem = m.FindItemOnLayer(TargetLayer);

				if (otherItem != null)
				{
					m.SendMessage(
						34,
						"You must unequip the {0} in your {1} slot before you can layer that sash.",
						otherItem.ResolveName(m),
						TargetLayer.ToString().ToLower());
					return;
				}
			}

			item.Layer = TargetLayer;

			if (String.IsNullOrWhiteSpace(item.Name))
			{
				item.Name = "a body sash [Layered]";
			}
			else if (!item.Name.EndsWith(" [Layered]"))
			{
				item.Name += " [Layered]";
			}

			m.SendMessage(85, "You successfully layer the sash!");

			Delete();
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:56,代码来源:SashLayerDeed.cs

示例2: GetProperties

		private static void GetProperties(Item item, Mobile viewer, ExtendedOPL list)
		{
			if (!CMOptions.ModuleEnabled || item == null || item.Deleted || !item.Layer.IsEquip() || list == null ||
				World.Loading)
			{
				return;
			}

			if (viewer == null && item.Parent is Mobile)
			{
				viewer = (Mobile)item.Parent;
			}

			if (viewer == null || !viewer.Player)
			{
				return;
			}

			var itemType = item.GetType();
			var equipped = item.IsEquipped();

			var parent = item.Parent as Mobile;

			var npc = parent != null && ((parent is BaseCreature || !parent.Player) && !parent.IsControlled<PlayerMobile>());

			foreach (var set in
				FindSetsFor(itemType)
					.Where(s => s.Display && !s.Parts.Any(p => p.Valid && p.Display && p.IsTypeOf(itemType) && !p.DisplaySet)))
			{
				set.GetProperties(viewer, list, equipped);

				if (npc)
				{
					continue;
				}

				if (set.DisplayParts)
				{
					foreach (var part in set.Parts.Where(p => p.Valid && p.Display))
					{
						part.GetProperties(viewer, list, equipped);
					}
				}

				if (!set.DisplayMods)
				{
					continue;
				}

				foreach (var mod in set.Mods.Where(mod => mod.Valid && mod.Display))
				{
					mod.GetProperties(viewer, list, equipped);
				}
			}
		}
开发者ID:Ravenwolfe,项目名称:Core,代码行数:55,代码来源:EquipmentSets.cs

示例3: GetProperties

		private static void GetProperties(Item item, Mobile viewer, ExtendedOPL list)
		{
			if (!CMOptions.ModuleEnabled || item == null || item.Deleted || !item.Layer.IsEquip() || list == null)
			{
				return;
			}

			if (viewer == null && item.Parent is Mobile)
			{
				viewer = (Mobile)item.Parent;
			}

			if (viewer == null)
			{
				return;
			}

			Type itemType = item.GetType();
			bool equipped = item.IsEquipped();

			foreach (EquipmentSet set in
				FindSetsFor(itemType)
					.Where(s => s.Display && !s.Parts.Any(p => p.Valid && p.Display && p.IsTypeOf(itemType) && !p.DisplaySet)))
			{
				set.GetProperties(viewer, list, equipped);

				if (set.DisplayParts)
				{
					foreach (EquipmentSetPart part in set.Parts.Where(p => p.Valid && p.Display))
					{
						part.GetProperties(viewer, list, equipped);
					}
				}

				if (!set.DisplayMods)
				{
					continue;
				}

				foreach (EquipmentSetMod mod in set.Mods.Where(mod => mod.Valid && mod.Display))
				{
					mod.GetProperties(viewer, list, equipped);
				}
			}
		}
开发者ID:greeduomacro,项目名称:RuneUO,代码行数:45,代码来源:EquipmentSets.cs


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