本文整理汇总了C#中IEntity.TypeEquals方法的典型用法代码示例。如果您正苦于以下问题:C# IEntity.TypeEquals方法的具体用法?C# IEntity.TypeEquals怎么用?C# IEntity.TypeEquals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntity
的用法示例。
在下文中一共展示了IEntity.TypeEquals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProgress
protected virtual int GetProgress(ConquestState state, IEntity obj)
{
if (state.User == null)
return 0;
if (obj == null)
{
return 0;
}
if (Object.IsNotNull && !obj.TypeEquals(Object, ObjectChildren))
{
if (ObjectChangeReset)
{
return -state.Progress;
}
return 0;
}
double amount;
if (obj is Item)
{
var item = (Item)obj;
if (!String.IsNullOrWhiteSpace(ObjectNameReq) &&
!ObjectNameSearch.Execute(item.ResolveName(), ObjectNameReq, ObjectNameIgnoreCaps))
{
if (ObjectNameChangeReset)
{
return -state.Progress;
}
return 0;
}
if (ObjectHueReq > -1 && ObjectHueReq != item.Hue)
{
if (ObjectHueChangeReset)
{
return -state.Progress;
}
return 0;
}
// Start with the otained item itself.
amount = ((item.RootParent == state.User || item.HeldBy == state.User) ? item.Amount : 0);
// add all the amounts of the same item type from banks.
amount +=
state.User.BankBoxes.Sum(
bank =>
bank.FindItemsByType(Object, true)
.Where(i => i != null && i != item && (i.RootParent == state.User || i.HeldBy == state.User))
.Not(i => Object.IsNotNull && !i.TypeEquals(Object, ObjectChildren))
.Not(
i =>
!String.IsNullOrWhiteSpace(ObjectNameReq) &&
!ObjectNameSearch.Execute(i.ResolveName(), ObjectNameReq, ObjectNameIgnoreCaps))
.Not(i => ObjectHueReq > -1 && ObjectHueReq != i.Hue)
.Sum(i => (double)i.Amount));
// add all the amounts of the same item type from pack.
amount +=
state.User.Backpacks.Sum(
pack =>
pack.FindItemsByType(Object, true)
.Where(i => i != null && i != item && (i.RootParent == state.User || i.HeldBy == state.User))
.Not(i => Object.IsNotNull && !i.TypeEquals(Object, ObjectChildren))
.Not(
i =>
!String.IsNullOrWhiteSpace(ObjectNameReq) &&
!ObjectNameSearch.Execute(i.ResolveName(), ObjectNameReq, ObjectNameIgnoreCaps))
.Not(i => ObjectHueReq > -1 && ObjectHueReq != i.Hue)
.Sum(i => (double)i.Amount));
}
else if (obj is BaseCreature)
{
var pet = (BaseCreature)obj;
if (!String.IsNullOrWhiteSpace(ObjectNameReq) &&
!ObjectNameSearch.Execute(pet.Name, ObjectNameReq, ObjectNameIgnoreCaps))
{
if (ObjectNameChangeReset)
{
return -state.Progress;
}
return 0;
}
if (ObjectHueReq > -1 && ObjectHueReq != pet.Hue)
{
if (ObjectHueChangeReset)
{
return -state.Progress;
}
//.........这里部分代码省略.........