Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
EntityAssetCompiler.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 
4 using System.Threading.Tasks;
5 using SiliconStudio.Assets.Compiler;
6 using SiliconStudio.BuildEngine;
7 using SiliconStudio.Core.IO;
8 using SiliconStudio.Core.Serialization.Assets;
9 
10 namespace SiliconStudio.Paradox.Assets.Model
11 {
12  public class EntityAssetCompiler : AssetCompilerBase<EntityAsset>
13  {
14  protected override void Compile(AssetCompilerContext context, string urlInStorage, UFile assetAbsolutePath, EntityAsset asset, AssetCompilerResult result)
15  {
16  result.BuildSteps = new ListBuildStep { new EntityCombineCommand(urlInStorage, asset) };
17  }
18 
19  private class EntityCombineCommand : AssetCommand<EntityAsset>
20  {
21  public EntityCombineCommand(string url, EntityAsset asset) : base(url, asset)
22  {
23  }
24 
25  protected override Task<ResultStatus> DoCommandOverride(ICommandContext commandContext)
26  {
27  var assetManager = new AssetManager();
28  assetManager.Save(Url, asset.Data);
29 
30  return Task.FromResult(ResultStatus.Successful);
31  }
32  }
33  }
34 }
Result of a compilation of assets when using IAssetCompiler.Compile
A command processing an Asset.
Definition: AssetCommand.cs:11
The context used when compiling an asset in a Package.
override void Compile(AssetCompilerContext context, string urlInStorage, UFile assetAbsolutePath, EntityAsset asset, AssetCompilerResult result)
Defines a normalized file path. See UPath for details. This class cannot be inherited.
Definition: UFile.cs:13