本文整理汇总了C#中Sledge.Editor.Documents.Document.GetUsedTexturePackages方法的典型用法代码示例。如果您正苦于以下问题:C# Document.GetUsedTexturePackages方法的具体用法?C# Document.GetUsedTexturePackages怎么用?C# Document.GetUsedTexturePackages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sledge.Editor.Documents.Document
的用法示例。
在下文中一共展示了Document.GetUsedTexturePackages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveCordonMap
private string SaveCordonMap(Document document, string folder)
{
var filename = Path.ChangeExtension(document.MapFileName, ".map");
var map = document.Map;
if (document.Map.Cordon)
{
map = new Map();
map.WorldSpawn.EntityData = document.Map.WorldSpawn.EntityData.Clone();
var entities = document.Map.WorldSpawn.GetAllNodesContainedWithin(document.Map.CordonBounds);
foreach (var mo in entities)
{
var clone = mo.Clone();
clone.SetParent(map.WorldSpawn);
}
var outside = new Box(map.WorldSpawn.GetChildren().Select(x => x.BoundingBox).Union(new[] { document.Map.CordonBounds }));
outside = new Box(outside.Start - Coordinate.One, outside.End + Coordinate.One);
var inside = document.Map.CordonBounds;
var brush = new Brushes.BlockBrush();
var cordon = (Solid) brush.Create(map.IDGenerator, outside, null, 0).First();
var carver = (Solid) brush.Create(map.IDGenerator, inside, null, 0).First();
cordon.Faces.ForEach(x => x.Texture.Name = "BLACK");
// Do a carve (TODO: move carve into helper method?)
foreach (var plane in carver.Faces.Select(x => x.Plane))
{
Solid back, front;
if (!cordon.Split(plane, out back, out front, map.IDGenerator)) continue;
front.SetParent(map.WorldSpawn);
cordon = back;
}
if (document.MapFileName.EndsWith(".map"))
{
filename = Path.GetFileNameWithoutExtension(filename) + "_cordon.map";
}
}
map.WorldSpawn.EntityData.SetPropertyValue("wad", string.Join(";", document.GetUsedTexturePackages().Select(x => x.PackageRoot).Where(x => x.EndsWith(".wad"))));
filename = Path.Combine(folder, filename);
MapProvider.SaveMapToFile(filename, map);
return filename;
}