allow getting all active values from a PerScreen<T> field
This commit is contained in:
parent
a9b99c1206
commit
812251e7ae
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue