summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Content/AssetEditOperation.cs
blob: 818209fa13e31e354625c09b2b7fe7f2bae128e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using StardewModdingAPI.Events;

namespace StardewModdingAPI.Framework.Content
{
    /// <summary>An edit to apply to an asset when it's requested from the content pipeline.</summary>
    internal class AssetEditOperation
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The mod applying the edit.</summary>
        public IModMetadata Mod { get; }

        /// <summary>If there are multiple edits that apply to the same asset, the priority with which this one should be applied.</summary>
        public AssetEditPriority Priority { get; }

        /// <summary>The content pack on whose behalf the edit is being applied, if any.</summary>
        public IModMetadata OnBehalfOf { get; }

        /// <summary>Apply the edit to an asset.</summary>
        public Action<IAssetData> ApplyEdit { get; }


        /*********
        ** 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;
        }
    }
}