summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md2
-rw-r--r--src/SMAPI/Utilities/PerScreen.cs7
2 files changed, 8 insertions, 1 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index deac0bc8..c36d80ed 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -9,7 +9,7 @@
## Upcoming release
* For modders:
- * Expanded `PerScreen<T>` API: you can now get/set the value for any screen, or clear all values.
+ * Expanded `PerScreen<T>` API: you can now get/set the value for any screen, get all active values, or clear all values.
* Added an option to disable rewriting mods for compatibility (thanks to Bpendragon!). This may prevent older mods from loading, but bypasses a Visual Studio crash when debugging.
* For the Error Handler mod:
diff --git a/src/SMAPI/Utilities/PerScreen.cs b/src/SMAPI/Utilities/PerScreen.cs
index 60406d6b..20b8fbce 100644
--- a/src/SMAPI/Utilities/PerScreen.cs
+++ b/src/SMAPI/Utilities/PerScreen.cs
@@ -47,6 +47,13 @@ namespace StardewModdingAPI.Utilities
this.CreateNewState = createNewState ?? (() => default);
}
+ /// <summary>Get all active values by screen ID. This doesn't initialize the value for a screen ID if it's not created yet.</summary>
+ public IEnumerable<KeyValuePair<int, T>> GetActiveValues()
+ {
+ this.RemoveDeadScreens();
+ return this.States.ToArray();
+ }
+
/// <summary>Get the value for a given screen ID, creating it if needed.</summary>
/// <param name="screenId">The screen ID to check.</param>
public T GetValueForScreen(int screenId)