本文整理汇总了C#中Item.CanEquip方法的典型用法代码示例。如果您正苦于以下问题:C# Item.CanEquip方法的具体用法?C# Item.CanEquip怎么用?C# Item.CanEquip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item.CanEquip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AllowsItem
/// <summary>
/// Gets whether the <see cref="ItemSlot" /> allows the given <see cref="Item" /> or not.
/// </summary>
/// <param name="it">The <see cref="Item" /> to check.</param>
/// <returns>true if the <see cref="Item" /> can be placed in the <see cref="ItemSlot" />, false otherwise.</returns>
public override bool AllowsItem(Item it)
{
//TomeSkillAttribute attr = null;
//for (int i = 0; i < it.modEntities.Count; i++)
//if ((attr = it.modEntities[i].GetType().GetCustomAttributes(typeof(TomeSkillAttribute), true)
// .FirstOrDefault() /* there should be only one */ as TomeSkillAttribute) != null)
// break;
return base.AllowsItem(it) && ((SkillManager.FromItem(it) != null && it.CanEquip(Main.localPlayer, this)) || it.IsBlank());
}
示例2: EquipItem
public override bool EquipItem( Item item )
{
if( item == null || item.Deleted || !item.CanEquip( this ) )
return false;
if( CheckEquip( item ) && OnEquip( item ) && item.OnEquip( this ) )
{
if( FindItemOnLayer( item.Layer ) != null )
AddToBackpack( FindItemOnLayer( item.Layer ) );
AddItem( item );
return true;
}
return false;
}
示例3: AllowsItem
/// <summary>
/// Gets whether the <see cref="ItemSlot" /> allows the given <see cref="Item" /> or not.
/// </summary>
/// <param name="i">The <see cref="Item" /> to check.</param>
/// <returns>true if the <see cref="Item" /> can be placed in the <see cref="ItemSlot" />, false otherwise.</returns>
public override bool AllowsItem(Item i)
{
return base.AllowsItem(i) && ((i.accessory && i.CanEquip(Main.localPlayer, this)) || i.IsBlank());
}
示例4: CanEquip
/// <summary> Returns if the specified item can be equipped in this slot. </summary>
public bool CanEquip(Item item) {
return ((item != null) && !occupied && item.CanEquip(this));
}