summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-03-25 00:35:31 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-03-25 00:35:31 -0400
commitb77eab6e0a09099998aa806302694e82216e79f8 (patch)
tree34e396c1c22761594845d0f14db9aaff6aeb9d63 /src/SMAPI/Events
parent2b0ce2bb4d6690b7d00da0a243855db9bffffbf0 (diff)
downloadSMAPI-b77eab6e0a09099998aa806302694e82216e79f8.tar.gz
SMAPI-b77eab6e0a09099998aa806302694e82216e79f8.tar.bz2
SMAPI-b77eab6e0a09099998aa806302694e82216e79f8.zip
add AssetReady content event (#766)
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r--src/SMAPI/Events/AssetReadyEventArgs.cs25
-rw-r--r--src/SMAPI/Events/IContentEvents.cs7
2 files changed, 30 insertions, 2 deletions
diff --git a/src/SMAPI/Events/AssetReadyEventArgs.cs b/src/SMAPI/Events/AssetReadyEventArgs.cs
new file mode 100644
index 00000000..946c9173
--- /dev/null
+++ b/src/SMAPI/Events/AssetReadyEventArgs.cs
@@ -0,0 +1,25 @@
+using System;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for an <see cref="IContentEvents.AssetReady"/> event.</summary>
+ public class AssetReadyEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The name of the asset being requested.</summary>
+ public IAssetName Name { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="name">The name of the asset being requested.</param>
+ internal AssetReadyEventArgs(IAssetName name)
+ {
+ this.Name = name;
+ }
+ }
+}
diff --git a/src/SMAPI/Events/IContentEvents.cs b/src/SMAPI/Events/IContentEvents.cs
index ede9ea23..abbaaf33 100644
--- a/src/SMAPI/Events/IContentEvents.cs
+++ b/src/SMAPI/Events/IContentEvents.cs
@@ -1,5 +1,4 @@
using System;
-using StardewValley;
namespace StardewModdingAPI.Events
{
@@ -8,7 +7,7 @@ namespace StardewModdingAPI.Events
{
/// <summary>Raised when an asset is being requested from the content pipeline.</summary>
/// <remarks>
- /// The asset isn't necessarily being loaded yet (e.g. the game may be checking if it exists). Mods can register the changes they want to apply using methods on the <paramref name="e"/> parameter. These will be applied when the asset is actually loaded.
+ /// The asset isn't necessarily being loaded yet (e.g. the game may be checking if it exists). Mods can register the changes they want to apply using methods on the event arguments. These will be applied when the asset is actually loaded.
///
/// If the asset is requested multiple times in the same tick (e.g. once to check if it exists and once to load it), SMAPI might only raise the event once and reuse the cached result.
/// </remarks>
@@ -16,5 +15,9 @@ namespace StardewModdingAPI.Events
/// <summary>Raised after one or more assets were invalidated from the content cache by a mod, so they'll be reloaded next time they're requested. If the assets will be reloaded or propagated automatically, this event is raised before that happens.</summary>
event EventHandler<AssetsInvalidatedEventArgs> AssetsInvalidated;
+
+ /// <summary>Raised after an asset is loaded by the content pipeline, after all mod edits specified via <see cref="AssetRequested"/> have been applied.</summary>
+ /// <remarks>This event is only raised if something requested the asset from the content pipeline. Invalidating an asset from the content cache won't necessarily reload it automatically.</remarks>
+ event EventHandler<AssetReadyEventArgs> AssetReady;
}
}