Beispiel #1
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="mod">The mod applying the edit.</param>
 /// <param name="priority">If there are multiple edits that apply to the same asset, the priority with which this one should be applied.</param>
 /// <param name="onBehalfOf">The content pack on whose behalf the edit is being applied, if any.</param>
 /// <param name="applyEdit">Apply the edit to an asset.</param>
 public AssetEditOperation(IModMetadata mod, AssetEditPriority priority, IModMetadata onBehalfOf, Action <IAssetData> applyEdit)
 {
     this.Mod        = mod;
     this.Priority   = priority;
     this.OnBehalfOf = onBehalfOf;
     this.ApplyEdit  = applyEdit;
 }
 /// <summary>Edit the asset after it's loaded.</summary>
 /// <param name="apply">Apply changes to the asset.</param>
 /// <param name="priority">If there are multiple edits that apply to the same asset, the priority with which this one should be applied.</param>
 /// <param name="onBehalfOf">The content pack ID on whose behalf you're applying the change. This is only valid for content packs for your mod.</param>
 /// <remarks>
 /// Usage notes:
 /// <list type="bullet">
 ///   <item>Editing an asset which doesn't exist has no effect. This is applied after the asset is loaded from the game's <c>Content</c> folder, or from any mod's <see cref="LoadFrom"/> or <see cref="LoadFromModFile{TAsset}"/>.</item>
 ///   <item>You can apply any number of edits to the asset. Each edit will be applied on top of the previous one (i.e. it'll see the merged asset from all previous edits as its input).</item>
 /// </list>
 /// </remarks>
 public void Edit(Action <IAssetData> apply, AssetEditPriority priority = AssetEditPriority.Default, string onBehalfOf = null)
 {
     this.EditOperations.Add(
         new AssetEditOperation(
             mod: this.Mod,
             priority: priority,
             onBehalfOf: this.GetOnBehalfOf(this.Mod, onBehalfOf, "edit assets"),
             apply
             )
         );
 }