本文整理汇总了C#中IEntity类的典型用法代码示例。如果您正苦于以下问题:C# IEntity类的具体用法?C# IEntity怎么用?C# IEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IEntity类属于命名空间,在下文中一共展示了IEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HitBoxMessage
public HitBoxMessage(IEntity source, List<CollisionBox> newboxes, HashSet<string> enable, bool clear)
{
Source = source;
AddBoxes = newboxes;
EnableBoxes = enable;
Clear = clear;
}
示例2: OnEntityAdded
public override void OnEntityAdded(IEntity entity)
{
base.OnEntityAdded(entity);
var polygon = entity.GetComponent<HexagonComponent>();
var mesh = polygon.Renderer.Mesh;
var vertices = mesh.vertices;
polygon.Points = new List<PolygonPoint>(vertices.Length);
polygon.Segments = new List<PolygonSegment>(vertices.Length);
polygon.Contour = new PolygonContour();
for (int i = 0; i < vertices.Length - 1; i++)
polygon.Points.Add(new PolygonPoint { Shape = polygon, Index = i });
for (int i = 0; i < polygon.Points.Count; i++)
{
var pointA = polygon.Points[i];
var pointB = polygon.Points[(i + 1) % polygon.Points.Count];
var segment = new PolygonSegment { Shape = polygon, Index = i, PointA = pointA, PointB = pointB };
pointA.SegmentB = segment;
pointB.SegmentA = segment;
polygon.Segments.Add(segment);
polygon.Contour.Segments.Add(segment);
}
}
示例3: GetModifier
string GetModifier(IEntity decoration)
{
string ret = "";
if (IncludeHtmlMarkup) {
ret += "<i>";
}
if (decoration.IsStatic) {
ret += "static ";
} else if (decoration.IsSealed) {
ret += "sealed ";
} else if (decoration.IsVirtual) {
ret += "virtual ";
} else if (decoration.IsOverride) {
ret += "override ";
} else if (decoration.IsNew) {
ret += "new ";
}
if (IncludeHtmlMarkup) {
ret += "</i>";
}
return ret;
}
示例4: IsAccessible
/// <summary>
/// Gets whether <paramref name="entity"/> is accessible in the current class.
/// </summary>
/// <param name="entity">The entity to test</param>
/// <param name="allowProtectedAccess">Whether protected access is allowed.
/// True if the type of the reference is derived from the current class.</param>
public bool IsAccessible(IEntity entity, bool allowProtectedAccess)
{
if (entity == null)
throw new ArgumentNullException("entity");
// C# 4.0 spec, §3.5.2 Accessiblity domains
switch (entity.Accessibility) {
case Accessibility.None:
return false;
case Accessibility.Private:
return entity.DeclaringTypeDefinition == currentTypeDefinition;
case Accessibility.Public:
return true;
case Accessibility.Protected:
return allowProtectedAccess && IsProtectedAccessible(entity.DeclaringTypeDefinition);
case Accessibility.Internal:
return IsInternalAccessible(entity.ProjectContent);
case Accessibility.ProtectedOrInternal:
return (allowProtectedAccess && IsProtectedAccessible(entity.DeclaringTypeDefinition))
|| IsInternalAccessible(entity.ProjectContent);
case Accessibility.ProtectedAndInternal:
return (allowProtectedAccess && IsProtectedAccessible(entity.DeclaringTypeDefinition))
&& IsInternalAccessible(entity.ProjectContent);
default:
throw new Exception("Invalid value for Accessibility");
}
}
示例5: Insert
/// <summary>插入</summary>
/// <param name="entity"></param>
/// <returns></returns>
public virtual Int32 Insert(IEntity entity)
{
// 添加数据前,处理Guid
SetGuid(entity);
DbParameter[] dps = null;
String sql = SQL(entity, DataObjectMethodType.Insert, ref dps);
if (String.IsNullOrEmpty(sql)) return 0;
Int32 rs = 0;
IEntityOperate op = EntityFactory.CreateOperate(entity.GetType());
//检查是否有标识列,标识列需要特殊处理
FieldItem field = op.Table.Identity;
if (field != null && field.IsIdentity)
{
Int64 res = dps != null && dps.Length > 0 ? op.InsertAndGetIdentity(sql, CommandType.Text, dps) : op.InsertAndGetIdentity(sql);
if (res > 0) entity[field.Name] = res;
rs = res > 0 ? 1 : 0;
}
else
{
rs = dps != null && dps.Length > 0 ? op.Execute(sql, CommandType.Text, dps) : op.Execute(sql);
}
//清除脏数据,避免连续两次调用Save造成重复提交
if (entity.Dirtys != null) entity.Dirtys.Clear();
return rs;
}
示例6: GetIdForm
internal GetIdForm(IEntity ent, IdHandle idh)
{
InitializeComponent();
m_Entity = ent;
m_IdHandle = idh;
}
示例7: EntityCompletionData
ICompletionData ICompletionDataFactory.CreateEntityCompletionData(IEntity entity, string text)
{
return new EntityCompletionData(entity) {
CompletionText = text,
DisplayText = text
};
}
示例8: Init
public override void Init(IEntity entity)
{
base.Init(entity);
DropDownPanel = _uiFactory.GetPanel(entity.ID + "_Panel", new EmptyImage(1f, 1f), 0f, 0f);
DropDownPanel.Visible = false;
_tree = entity.GetComponent<IInObjectTree>();
}
示例9: TowerEntity
public TowerEntity(ITile location, Texture2D texture, Color color,
bool isBlocked, float layerDepth, IEntity owner)
: base(location)
{
this.destinationRectangle = new Rectangle
{
X = location.Rectangle.X,
Y = location.Rectangle.Y,
Height = location.Rectangle.Height,
Width = location.Rectangle.Width
};
this.enabled = true;
this.isBlocked = true;
this.texture = texture;
this.color = color;
this.layerDepth = layerDepth;
this.owner = owner;
this.timer = 5.0f;
this.IsEnemy = false;
this.Intensity = 70.0f;
this.HP = 150;
this.Damage = 100;
this.attackRate = 50;
}
示例10: GetModifier
string GetModifier(IEntity decoration)
{
StringBuilder builder = new StringBuilder();
if (IncludeHtmlMarkup) {
builder.Append("<i>");
}
if (decoration.IsStatic) {
builder.Append("Shared ");
}
if (decoration.IsAbstract) {
builder.Append("MustOverride ");
} else if (decoration.IsSealed) {
builder.Append("NotOverridable ");
}
if (decoration.IsVirtual) {
builder.Append("Overridable ");
} else if (decoration.IsOverride) {
builder.Append("Overrides ");
}
if (decoration.IsNew) {
builder.Append("Shadows ");
}
if (IncludeHtmlMarkup) {
builder.Append("</i>");
}
return builder.ToString();
}
示例11: NavigateToEntity
public bool NavigateToEntity(IEntity entity)
{
if (entity == null)
throw new ArgumentNullException("entity");
// Get the underlying entity for generic instance members
while ((entity is IMember) && ((IMember)entity).GenericMember != null)
entity = ((IMember)entity).GenericMember;
IClass declaringType = (entity as IClass) ?? entity.DeclaringType;
if (declaringType == null)
return false;
// get the top-level type
while (declaringType.DeclaringType != null)
declaringType = declaringType.DeclaringType;
ReflectionProjectContent rpc = entity.ProjectContent as ReflectionProjectContent;
if (rpc != null) {
string assemblyLocation = ILSpyController.GetAssemblyLocation(rpc);
if (!string.IsNullOrEmpty(assemblyLocation) && File.Exists(assemblyLocation)) {
NavigateTo(assemblyLocation, declaringType.DotNetName, ((AbstractEntity)entity).DocumentationTag);
return true;
}
}
return false;
}
示例12: FindReferencesAsync
/// <summary>
/// Finds all references to the specified entity.
/// The results are reported using the callback.
/// FindReferences may internally use parallelism, and may invoke the callback on multiple
/// threads in parallel.
/// </summary>
public static async Task FindReferencesAsync(IEntity entity, IProgressMonitor progressMonitor, Action<SearchedFile> callback)
{
if (entity == null)
throw new ArgumentNullException("entity");
if (progressMonitor == null)
throw new ArgumentNullException("progressMonitor");
if (callback == null)
throw new ArgumentNullException("callback");
SD.MainThread.VerifyAccess();
if (SD.ParserService.LoadSolutionProjectsThread.IsRunning) {
progressMonitor.ShowingDialog = true;
MessageService.ShowMessage("${res:SharpDevelop.Refactoring.LoadSolutionProjectsThreadRunning}");
progressMonitor.ShowingDialog = false;
return;
}
double totalWorkAmount;
List<ISymbolSearch> symbolSearches = PrepareSymbolSearch(entity, progressMonitor.CancellationToken, out totalWorkAmount);
double workDone = 0;
ParseableFileContentFinder parseableFileContentFinder = new ParseableFileContentFinder();
foreach (ISymbolSearch s in symbolSearches) {
progressMonitor.CancellationToken.ThrowIfCancellationRequested();
using (var childProgressMonitor = progressMonitor.CreateSubTask(s.WorkAmount / totalWorkAmount)) {
await s.FindReferencesAsync(new SymbolSearchArgs(childProgressMonitor, parseableFileContentFinder), callback);
}
workDone += s.WorkAmount;
progressMonitor.Progress = workDone / totalWorkAmount;
}
}
示例13: Template
public Template(IEntity templateEntity)
{
if(templateEntity == null)
throw new Exception("Template entity is null");
_templateEntity = templateEntity;
}
示例14: Delete
/// <summary>
/// Deletes the provided entity.
/// </summary>
/// <param name="entity">The entity to delete.</param>
public override void Delete(IEntity entity)
{
if (entity == null)
throw new ArgumentNullException("entity");
using (LogGroup logGroup = LogGroup.StartDebug("Deleting provided '" + entity.ShortTypeName + "' entity."))
{
Db4oDataStore store = (Db4oDataStore)GetDataStore(entity);
if (DataAccess.Data.IsStored(entity))
{
using (Batch batch = BatchState.StartBatch())
{
IDataReader reader = Provider.InitializeDataReader();
reader.AutoRelease = false;
entity = reader.GetEntity(entity);
if (entity == null)
throw new Exception("The entity wasn't found.");
// PreDelete must be called to ensure all references are correctly managed
PreDelete(entity);
// Delete the entity
if (entity != null)
{
store.ObjectContainer.Delete(entity);
store.Commit();
}
}
}
}
}
示例15: Init
public override void Init(IEntity entity)
{
base.Init(entity);
_transform = entity.GetComponent<ITranslateComponent>();
_uiEvents = entity.GetComponent<IUIEvents>();
_uiEvents.MouseDown.Subscribe(onMouseDown);
}