本文整理汇总了C#中Sector.GetObjects方法的典型用法代码示例。如果您正苦于以下问题:C# Sector.GetObjects方法的具体用法?C# Sector.GetObjects怎么用?C# Sector.GetObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sector
的用法示例。
在下文中一共展示了Sector.GetObjects方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SectorRenderer
public SectorRenderer(Application application, Level level, Sector sector)
{
this.application = application;
this.level = level;
this.sector = sector;
Layer layer = new Layer();
foreach(IDrawableLayer IDrawableLayer in sector.GetObjects(typeof(IDrawableLayer))) {
Node node = IDrawableLayer.GetSceneGraphNode();
if (IDrawableLayer is Tilemap) //Special handling for tilemaps
node = new TilemapNode((Tilemap) IDrawableLayer, level.Tileset);
ColorNode colorNode = new ColorNode(node, new Color(1f, 1f, 1f, 1f), true);
layer.Add(IDrawableLayer.Layer, colorNode);
colors[IDrawableLayer] = colorNode;
}
objectsNode = new NodeWithChilds();
objectsColorNode = new ColorNode(objectsNode, new Color(1f, 1f, 1f, 1f));
layer.Add(1, objectsColorNode);
foreach(IObject Object in sector.GetObjects(typeof(IObject))) {
Node node = Object.GetSceneGraphNode();
if(node != null)
objectsNode.AddChild(node);
}
// fill remaining place with one color
sectorFill = new SceneGraph.Rectangle();
sectorFill.Fill = true;
ColorNode color = new ColorNode(sectorFill, new Drawing.Color(0.4f, 0.3f, 0.4f));
layer.Add(-10000, color);
// draw border around sector...
sectorBBox = new SceneGraph.Rectangle();
sectorBBox.Fill = false;
color = new ColorNode(sectorBBox, new Drawing.Color(1, 0.3f, 1));
layer.Add(1000, color);
// draw border around selected layer...
color = new ColorNode(new TilemapBorder(application), new Drawing.Color(1, 1, 0));
layer.Add(1001, color);
OnSizeChanged(sector);
this.SceneGraphRoot = layer;
sector.ObjectAdded += OnObjectAdded;
sector.ObjectRemoved += OnObjectRemoved;
sector.SizeChanged += OnSizeChanged;
application.TilemapChanged += OnTilemapChanged;
//TODO: It should be possible to iterate over all (currently present?) types that implements ILayer.. How?
FieldOrProperty.AnyFieldChanged += OnFieldChanged;
}
示例2: SectorRenderer
public SectorRenderer(Level level, Sector sector)
{
this.level = level;
Layer layer = new Layer();
backgroundNode = new NodeWithChilds();
backgroundColorNode = new ColorNode(backgroundNode, new Color(1f, 1f, 1f, 1f));
layer.Add(-900, backgroundColorNode);
foreach(Background background in sector.GetObjects(typeof(Background))) {
Node node = background.GetSceneGraphNode();
if(node == null) continue;
backgroundNode.AddChild(node);
}
foreach(Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) {
Node node = new TilemapNode(tilemap, level.Tileset);
ColorNode colorNode = new ColorNode(node, new Color(1f, 1f, 1f, 1f));
layer.Add(tilemap.ZPos, colorNode);
colors[tilemap] = colorNode;
}
objectsNode = new NodeWithChilds();
objectsColorNode = new ColorNode(objectsNode, new Color(1f, 1f, 1f, 1f));
layer.Add(1, objectsColorNode);
foreach(IObject Object in sector.GetObjects(typeof(IObject))) {
Node node = Object.GetSceneGraphNode();
if(node != null)
objectsNode.AddChild(node);
}
// draw border around sector...
sectorFill = new SceneGraph.Rectangle();
sectorFill.Fill = true;
ColorNode color = new ColorNode(sectorFill, new Drawing.Color(0.4f, 0.3f, 0.4f));
layer.Add(-10000, color);
sectorBBox = new SceneGraph.Rectangle();
sectorBBox.Fill = false;
color = new ColorNode(sectorBBox, new Drawing.Color(1, 0.3f, 1));
layer.Add(1000, color);
OnSizeChanged(sector);
this.SceneGraphRoot = layer;
sector.ObjectAdded += OnObjectAdded;
sector.ObjectRemoved += OnObjectRemoved;
sector.SizeChanged += OnSizeChanged;
Drag.DestSet(this, DestDefaults.All, ObjectListWidget.DragTargetEntries, Gdk.DragAction.Default);
DragMotion += OnDragMotion;
}
示例3: ResizeDialog
public ResizeDialog(Sector sector, IEditorApplication app)
{
this.sector = sector;
application = app;
Glade.XML gxml = new Glade.XML("editor.glade", "resizeDialog");
gxml.Autoconnect(this);
if(resizeDialog == null || WidthEntry == null || HeightEntry == null)
throw new Exception("Couldn't load resize Dialog");
uint width = 0;
uint height = 0;
foreach(Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) {
if(tilemap.Width > width)
width = tilemap.Width;
if(tilemap.Height > height)
height = tilemap.Height;
}
WidthEntry.Text = width.ToString();
HeightEntry.Text = height.ToString();
resizeDialog.ShowAll();
}
示例4: CheckIds
public static void CheckIds(Application application, Sector sector, bool AlertGood)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder("These tilemaps have bad ids in sector " + sector.Name + ":");
List<int> invalidtiles;
// Any bad found yet?
bool bad = false;
foreach (Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) {
invalidtiles = CheckIds(tilemap, application.CurrentLevel.Tileset);
if (invalidtiles.Count != 0) {
bad = true;
if (String.IsNullOrEmpty(tilemap.Name))
sb.Append(Environment.NewLine + "Tilemap (" + tilemap.Layer + ")");
else
sb.Append(Environment.NewLine + tilemap.Name + " (" + tilemap.Layer + ")");
}
}
MessageType msgtype;
string message;
if (! bad) {
if (! AlertGood)
return;
msgtype = MessageType.Info;
message = "No invalid tile ids in any tilemap in sector " + sector.Name + ".";
} else {
msgtype = MessageType.Warning;
message = sb.ToString();
}
MessageDialog md = new MessageDialog(null, DialogFlags.DestroyWithParent,
msgtype, ButtonsType.Close, message);
md.Run();
md.Destroy();
}
示例5: OnSizeChanged
public void OnSizeChanged(Sector sector)
{
uint width = 0;
uint height = 0;
foreach(Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) {
if(tilemap.Width > width)
width = tilemap.Width;
if(tilemap.Height > height)
height = tilemap.Height;
}
sectorBBox.Rect = new RectangleF(-1, -1,
width * Tileset.TILE_WIDTH + 1,
height * Tileset.TILE_HEIGHT + 1);
sectorFill.Rect = new RectangleF(-1, -1,
width * Tileset.TILE_WIDTH + 1,
height * Tileset.TILE_HEIGHT + 1);
}