本文整理汇总了C#中System.Entity.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.Count方法的具体用法?C# Entity.Count怎么用?C# Entity.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Entity
的用法示例。
在下文中一共展示了Entity.Count方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateEntity
protected override void UpdateEntity(float dt, Entity entity)
{
var direction = entity.Get<Direction>();
var body = entity.Get<Body>();
var position = entity.Get<Position>();
for (int i = 0; i < entity.Count(); ++i)
{
direction.X[i] = direction.X[i] + dt * body.Friction[i] * (0 - direction.X[i]);
direction.Y[i] += (float)Math.Pow(body.Weight[i], dt);
}
}
示例2: accountDiv
private string accountDiv(Entity[] account)
{
StringBuilder _sbAccount = new StringBuilder();
if (account.Count() > 0)
{
_sbAccount.Append("<ul>");
for (int i = 0; i < account.Count(); i++)
{
var t = account[i];
var _esr = new EntityServiceClient();
var _account = _esr.LoadAccount2(t.EntityID)[0];
if (i != account.Count() - 1)
_sbAccount.AppendFormat("<li id='account{0}'><a onclick='clickSubEntities(this.id)' id='{0}' entitytype='{1}' er='{2}' currency='{3}' parentid='{4}' entityname='{5}' company='{6}' accountname='{7}' password='{8}' accounttype='{9}' bettinglimit='{10}' dateopen='{11}' personnel='{12}' ip='{13}' odds='{14}' issuesconditions='{15}' remarks='{16}' factor='{17}' perbet='{18}' status='{19}' accountid='{20}' islastlevel='{21}'><span>{5}</span></a>",
t.EntityID, t.EntityType, t.ExchangeRate, t.Currency.CurrencyID, t.ParentID, t.EntityName, _account.Company, _account.AccountName, _account.Password, _account.AccountType, _account.BettingLimit, _account.DateOpen, _account.Personnel, _account.IP, _account.Odds, _account.IssuesConditions, _account.RemarksAcc, _account.Factor, _account.Perbet, _account.Status, _account.ID, t.IsLastLevel);
else
_sbAccount.AppendFormat("<li class='last' id='account{0}'><a onclick='clickSubEntities(this.id)' id='{0}' entitytype='{1}' er='{2}' currency='{3}' parentid='{4}' entityname='{5}' company='{6}' accountname='{7}' password='{8}' accounttype='{9}' bettinglimit='{10}' dateopen='{11}' personnel='{12}' ip='{13}' odds='{14}' issuesconditions='{15}' remarks='{16}' factor='{17}' perbet='{18}' status='{19}' accountid='{20}' islastlevel='{21}'><span>{5}</span></a>",
t.EntityID, t.EntityType, t.ExchangeRate, t.Currency.CurrencyID, t.ParentID, t.EntityName, _account.Company, _account.AccountName, _account.Password, _account.AccountType, _account.BettingLimit, _account.DateOpen, _account.Personnel, _account.IP, _account.Odds, _account.IssuesConditions, _account.RemarksAcc, _account.Factor, _account.Perbet, _account.Status, _account.ID, t.IsLastLevel);
}
_sbAccount.Append("</ul>");
}
return _sbAccount.ToString();
}
示例3: GetMetaItemForTag
private static Entity.MetaItem GetMetaItemForTag(Entity.MetaItem[] meta, MetadataItemName tagName, Entity.GalleryItem galleryItem)
{
var tagMi = meta.FirstOrDefault(m => m.MTypeId == (int)tagName);
if (tagMi != null)
{
return tagMi;
}
else
{
// Last item doesn't have a tag. Create one. This code path should be pretty rare.
int galleryId;
if (galleryItem.IsAlbum)
galleryId = AlbumController.LoadAlbumInstance(galleryItem.Id, false).GalleryId;
else
galleryId = Factory.LoadMediaObjectInstance(galleryItem.Id).GalleryId;
bool isEditable = Factory.LoadGallerySetting(galleryId).MetadataDisplaySettings.Find(tagName).IsEditable;
tagMi = new Entity.MetaItem
{
Id = int.MinValue,
MediaId = galleryItem.Id,
GTypeId = galleryItem.ItemType,
MTypeId = (int)tagName,
Desc = tagName.ToString(),
Value = String.Empty,
IsEditable = isEditable
};
Array.Resize(ref meta, meta.Count() + 1);
meta[meta.Length - 1] = tagMi;
return tagMi;
}
}
示例4: HandleCollisions
private void HandleCollisions(Tilemap tilemap, Entity collidable)
{
var position = collidable.Get<Position>();
var prevpos = collidable.Get<PreviousPosition>();
var direction = collidable.Get<Direction>();
var hotspots = collidable.Get<Hotspots>();
if (!prevpos)
{
for (int i = 0; i < collidable.Count(); ++i)
{
hotspots.BottomHit[i] = hotspots.TopHit[i] = hotspots.RightHit[i] = hotspots.LeftHit[i] = false;
if (direction.Y[i] >= 0)
{
hotspots.BottomHit[i] = HandlePointList(tilemap, position.X[i], ref position.Y[i], ref direction.Y[i], hotspots.Bottom[i]);
}
else
{
hotspots.TopHit[i] = HandlePointList(tilemap, position.X[i], ref position.Y[i], ref direction.Y[i], hotspots.Top[i]);
}
if (direction.X[i] >= 0)
{
hotspots.RightHit[i] = HandlePointList(tilemap, ref position.X[i], position.Y[i], ref direction.X[i], hotspots.Right[i]);
}
else if (direction.X[i] <= 0)
{
hotspots.LeftHit[i] = HandlePointList(tilemap, ref position.X[i], position.Y[i], ref direction.X[i], hotspots.Right[i]);
}
}
}
if (prevpos)
{
for (int i = 0; i < collidable.Count(); ++i)
{
hotspots.BottomHit[i] = hotspots.TopHit[i] = hotspots.RightHit[i] = hotspots.LeftHit[i] = false;
if (direction.Y[i] >= 0)
{
hotspots.BottomHit[i] = HandlePointList(tilemap, position.X[i], ref position.Y[i], ref direction.Y[i], prevpos.Y[i], hotspots.Bottom[i]);
}
else
{
hotspots.TopHit[i] = HandlePointList(tilemap, position.X[i], ref position.Y[i], ref direction.Y[i], prevpos.Y[i], hotspots.Top[i]);
}
if (direction.X[i] >= 0)
{
hotspots.RightHit[i] = HandlePointList(tilemap, ref position.X[i], position.Y[i], ref direction.X[i], prevpos.X[i], hotspots.Right[i]);
}
else if (direction.X[i] <= 0)
{
hotspots.LeftHit[i] = HandlePointList(tilemap, ref position.X[i], position.Y[i], ref direction.X[i], prevpos.X[i], hotspots.Right[i]);
}
}
}
}
示例5: nodeDiv
private string nodeDiv(Entity[] nodeEntities, string type)
{
StringBuilder _sbNode = new StringBuilder();
if (nodeEntities.Count() > 0)
{
_sbNode.Append("<ul>");
for (int i = 0; i < nodeEntities.Count(); i++)
{
var t = nodeEntities[i];
if (i != nodeEntities.Count()-1)
_sbNode.AppendFormat("<li id='{0}{1}'><a onclick='clickSubEntities(this.id)' id='{1}' entitytype='{2}' er='{3}' currency='{4}' parentid='{5}' entityname='{6}' sumtype='{7}' islastlevel='{8}'><span>{6}</span></a>", type, t.EntityID, t.EntityType, t.ExchangeRate, t.Currency.CurrencyID, t.ParentID, t.EntityName, t.SumType, t.IsLastLevel);
else
_sbNode.AppendFormat("<li id='{0}{1}' class='last'><a onclick='clickSubEntities(this.id)' id='{1}' entitytype='{2}' er='{3}' currency='{4}' parentid='{5}' entityname='{6}' sumtype='{7}' islastlevel='{8}'><span>{6}</span></a>", type, t.EntityID, t.EntityType, t.ExchangeRate, t.Currency.CurrencyID, t.ParentID, t.EntityName, t.SumType, t.IsLastLevel);
}
_sbNode.Append("</ul>");
}
return _sbNode.ToString();
}