本文整理汇总了C#中Sledge.DataStructures.MapObjects.MapObject.GetEntityData方法的典型用法代码示例。如果您正苦于以下问题:C# MapObject.GetEntityData方法的具体用法?C# MapObject.GetEntityData怎么用?C# MapObject.GetEntityData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sledge.DataStructures.MapObjects.MapObject
的用法示例。
在下文中一共展示了MapObject.GetEntityData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render2D
public void Render2D(Viewport2D viewport, MapObject o)
{
if (viewport.Zoom < 1) return;
var entityData = o.GetEntityData();
if (entityData == null) return;
var start = viewport.WorldToScreen(viewport.Flatten(o.BoundingBox.Start));
var end = viewport.WorldToScreen(viewport.Flatten(o.BoundingBox.End));
if (start.X >= viewport.Width || end.X <= 0 || start.Y >= viewport.Height || end.Y <= 0) return;
var text = entityData.Name;
var nameProp = entityData.GetPropertyValue("targetname");
if (!String.IsNullOrWhiteSpace(nameProp)) text += ": " + nameProp;
_printer.Print(text, _printerFont, o.Colour, new RectangleF((float)start.X + 2, viewport.Height - (float)end.Y - _printerFont.Height - 6, viewport.Width, viewport.Height));
}
示例2: GetNodeText
private string GetNodeText(MapObject mo)
{
if (mo is Solid)
{
return " (" + ((Solid)mo).Faces.Count + " faces)";
}
if (mo is Group)
{
return " (" + mo.Children.Count + " children)";
}
var ed = mo.GetEntityData();
if (ed != null)
{
var targetName = ed.GetPropertyValue("targetname");
return ": " + ed.Name + (String.IsNullOrWhiteSpace(targetName) ? "" : " (" + targetName + ")");
}
return "";
}
示例3: Render2D
public void Render2D(Viewport2D viewport, MapObject o)
{
if (viewport.Zoom < 1) return;
var entityData = o.GetEntityData();
if (entityData == null) return;
var start = viewport.WorldToScreen(viewport.Flatten(o.BoundingBox.Start));
var end = viewport.WorldToScreen(viewport.Flatten(o.BoundingBox.End));
if (start.X >= viewport.Width || end.X <= 0 || start.Y >= viewport.Height || end.Y <= 0) return;
var text = entityData.Name;
var nameProp = entityData.GetPropertyValue("targetname");
if (!String.IsNullOrWhiteSpace(nameProp)) text += ": " + nameProp;
// Center the text horizontally
var wid = _printer.Measure(text, _printerFont, new RectangleF(0, 0, viewport.Width, viewport.Height));
var cx = (float)(start.X + (end.X - start.X) / 2);
var bounds = new RectangleF(cx - wid.BoundingBox.Width / 2, viewport.Height - (float)end.Y - _printerFont.Height - 6, viewport.Width, viewport.Height);
_printer.Print(text, _printerFont, o.Colour, bounds);
}
示例4: AddEntity
public void AddEntity(MapObject obj, EntityData newData)
{
_objects.Add(new EntityReference {ID = obj.ID, Before = obj.GetEntityData().Clone(), After = newData});
}