本文整理汇总了C#中BuildContext.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# BuildContext.CopyTo方法的具体用法?C# BuildContext.CopyTo怎么用?C# BuildContext.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BuildContext
的用法示例。
在下文中一共展示了BuildContext.CopyTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
/// <summary>
/// Builds asset
/// </summary>
/// <param name="buildContext"></param>
public override void Build ( BuildContext buildContext )
{
string tempFileName = buildContext.GetTempFileName( AssetPath, ".fnt" );
string resolvedPath = buildContext.Resolve( SourceFile );
// Launch 'bmfont.com' with temporary output file :
buildContext.RunTool( @"bmfont.com", string.Format("-c \"{0}\" -o \"{1}\"", resolvedPath, tempFileName ) );
// load temporary output :
SpriteFont.FontFile font;
using ( var stream = File.OpenRead( tempFileName ) ) {
font = SpriteFont.FontLoader.Load( stream );
}
// perform some checks :
if (font.Common.Pages!=1) {
throw new ContentException("Only one page of font image is supported");
}
// patch font description and add children (e.g. "secondary") content :
using ( var stream = buildContext.OpenTargetStream( this ) ) {
using ( var sw = new BinaryWriter( stream ) ) {
var xml = SpriteFont.FontLoader.SaveToString( font );
sw.Write( xml );
// write pages :
foreach (var p in font.Pages) {
var pageFile = Path.Combine( Path.GetDirectoryName( tempFileName ), p.File );
if ( Path.GetExtension( pageFile ).ToLower() == ".dds" ) {
buildContext.CopyTo( pageFile, sw );
} else {
ImageFileTextureAsset.RunNVCompress( buildContext, pageFile, pageFile + ".dds", true, false, false, true, true, false, ImageFileTextureAsset.TextureCompression.RGB );
buildContext.CopyTo( pageFile + ".dds", sw );
}
}
}
}
}
示例2: Build
/// <summary>
/// Builds asset
/// </summary>
/// <param name="buildContext"></param>
public override void Build ( BuildContext buildContext )
{
var resolvedPath = buildContext.Resolve( SourceFile );
var destPath = buildContext.GetTempFileName( Hash, ".scene" );
var cmdLine = string.Format("\"{0}\" /out:\"{1}\" /merge:{2} {4} {5}",
resolvedPath, destPath,
MergeTolerance,
null,
ImportAnimation ? "/anim":"",
ImportGeometry ? "/geom":""
);
buildContext.RunTool( "Native.Fbx.exe", cmdLine );
using ( var target = buildContext.OpenTargetStream( this ) ) {
buildContext.CopyTo( destPath, target );
}
}
示例3: Build
/// <summary>
///
/// </summary>
/// <param name="buildContext"></param>
public override void Build( BuildContext buildContext )
{
using ( var target = buildContext.TargetStream( this ) ) {
buildContext.CopyTo( SourceFile, target );
}
}
示例4: Build
public override void Build( BuildContext buildContext )
{
var src = buildContext.Resolve( SourceFile );
var dst = buildContext.GetTempFileName( Hash, ".dds", true );
RunNVCompress( buildContext, src, dst, NoMips, Fast, ToNormal, Color, Alpha, Normal, Compression );
using ( var target = buildContext.TargetStream( this ) ) {
buildContext.CopyTo( dst, target );
}
}