cleanup, add release note

This commit is contained in:
Jesse Plamondon-Willard 2018-12-04 23:31:39 -05:00
parent dad67e213e
commit 699fc41a7d
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
8 changed files with 24 additions and 17 deletions

View File

@ -11,6 +11,7 @@
* Added `IsLocalPlayer` to new player events.
* Reloading a map asset will now update affected locations.
* Reloading the `Data\NPCDispositions` asset will now update affected NPCs.
* Fixed world events (like `ObjectListChanged`) not working in the mines.
* Fixed some map tilesheets not editable if not playing in English.
* Fixed newlines in most manifest fields not being ignored.
* Fixed `Display.RenderedWorld` event not invoked before overlays are rendered.

View File

@ -47,7 +47,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
{
// define conversion between game time and TimeSpan
TimeSpan ToTimeSpan(int value) => new TimeSpan(0, value / 100, value % 100, 0);
int FromTimeSpan(TimeSpan span) => (int)((span.Hours * 100) + span.Minutes);
int FromTimeSpan(TimeSpan span) => (span.Hours * 100) + span.Minutes;
// transition to new time
int intervals = (int)((ToTimeSpan(time) - ToTimeSpan(Game1.timeOfDay)).TotalMinutes / 10);

View File

@ -4,6 +4,7 @@ using System.Linq;
namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
{
/// <summary>A watcher which detects changes to a collection of values using a specified <see cref="IEqualityComparer{T}"/> instance.</summary>
/// <typeparam name="TValue">The value type within the collection.</typeparam>
internal class ComparableListWatcher<TValue> : BaseDisposableWatcher, ICollectionWatcher<TValue>
{
/*********
@ -18,7 +19,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
/// <summary>The pairs added since the last reset.</summary>
private readonly List<TValue> AddedImpl = new List<TValue>();
/// <summary>The pairs demoved since the last reset.</summary>
/// <summary>The pairs removed since the last reset.</summary>
private readonly List<TValue> RemovedImpl = new List<TValue>();

View File

@ -4,26 +4,27 @@ using System.Collections.Generic;
namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
{
/// <summary>A watcher which detects changes to a value using a specified <see cref="IEqualityComparer{T}"/> instance.</summary>
internal class ComparableWatcher<T> : IValueWatcher<T>
/// <typeparam name="TValue">The comparable value type.</typeparam>
internal class ComparableWatcher<TValue> : IValueWatcher<TValue>
{
/*********
** Properties
*********/
/// <summary>Get the current value.</summary>
private readonly Func<T> GetValue;
private readonly Func<TValue> GetValue;
/// <summary>The equality comparer.</summary>
private readonly IEqualityComparer<T> Comparer;
private readonly IEqualityComparer<TValue> Comparer;
/*********
** Accessors
*********/
/// <summary>The field value at the last reset.</summary>
public T PreviousValue { get; private set; }
public TValue PreviousValue { get; private set; }
/// <summary>The latest value.</summary>
public T CurrentValue { get; private set; }
public TValue CurrentValue { get; private set; }
/// <summary>Whether the value changed since the last reset.</summary>
public bool IsChanged { get; private set; }
@ -35,7 +36,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
/// <summary>Construct an instance.</summary>
/// <param name="getValue">Get the current value.</param>
/// <param name="comparer">The equality comparer which indicates whether two values are the same.</param>
public ComparableWatcher(Func<T> getValue, IEqualityComparer<T> comparer)
public ComparableWatcher(Func<TValue> getValue, IEqualityComparer<TValue> comparer)
{
this.GetValue = getValue;
this.Comparer = comparer;

View File

@ -4,6 +4,7 @@ using Netcode;
namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
{
/// <summary>A watcher which detects changes to a Netcode collection.</summary>
/// <typeparam name="TValue">The value type within the collection.</typeparam>
internal class NetCollectionWatcher<TValue> : BaseDisposableWatcher, ICollectionWatcher<TValue>
where TValue : class, INetObject<INetSerializable>
{
@ -16,7 +17,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
/// <summary>The pairs added since the last reset.</summary>
private readonly List<TValue> AddedImpl = new List<TValue>();
/// <summary>The pairs demoved since the last reset.</summary>
/// <summary>The pairs removed since the last reset.</summary>
private readonly List<TValue> RemovedImpl = new List<TValue>();

View File

@ -20,7 +20,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
/// <summary>The pairs added since the last reset.</summary>
private readonly IDictionary<TKey, TValue> PairsAdded = new Dictionary<TKey, TValue>();
/// <summary>The pairs demoved since the last reset.</summary>
/// <summary>The pairs removed since the last reset.</summary>
private readonly IDictionary<TKey, TValue> PairsRemoved = new Dictionary<TKey, TValue>();
/// <summary>The field being watched.</summary>

View File

@ -3,13 +3,15 @@ using Netcode;
namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
{
/// <summary>A watcher which detects changes to a net value field.</summary>
internal class NetValueWatcher<T, TSelf> : BaseDisposableWatcher, IValueWatcher<T> where TSelf : NetFieldBase<T, TSelf>
/// <typeparam name="TValue">The value type wrapped by the net field.</typeparam>
/// <typeparam name="TNetField">The net field type.</typeparam>
internal class NetValueWatcher<TValue, TNetField> : BaseDisposableWatcher, IValueWatcher<TValue> where TNetField : NetFieldBase<TValue, TNetField>
{
/*********
** Properties
*********/
/// <summary>The field being watched.</summary>
private readonly NetFieldBase<T, TSelf> Field;
private readonly NetFieldBase<TValue, TNetField> Field;
/*********
@ -19,10 +21,10 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
public bool IsChanged { get; private set; }
/// <summary>The field value at the last reset.</summary>
public T PreviousValue { get; private set; }
public TValue PreviousValue { get; private set; }
/// <summary>The latest value.</summary>
public T CurrentValue { get; private set; }
public TValue CurrentValue { get; private set; }
/*********
@ -30,7 +32,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
*********/
/// <summary>Construct an instance.</summary>
/// <param name="field">The field to watch.</param>
public NetValueWatcher(NetFieldBase<T, TSelf> field)
public NetValueWatcher(NetFieldBase<TValue, TNetField> field)
{
this.Field = field;
this.PreviousValue = field.Value;
@ -74,7 +76,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
/// <param name="field">The field being watched.</param>
/// <param name="oldValue">The old field value.</param>
/// <param name="newValue">The new field value.</param>
private void OnValueChanged(TSelf field, T oldValue, T newValue)
private void OnValueChanged(TNetField field, TValue oldValue, TValue newValue)
{
this.CurrentValue = newValue;
this.IsChanged = true;

View File

@ -6,6 +6,7 @@ using System.Linq;
namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
{
/// <summary>A watcher which detects changes to an observable collection.</summary>
/// <typeparam name="TValue">The value type within the collection.</typeparam>
internal class ObservableCollectionWatcher<TValue> : BaseDisposableWatcher, ICollectionWatcher<TValue>
{
/*********
@ -17,7 +18,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers
/// <summary>The pairs added since the last reset.</summary>
private readonly List<TValue> AddedImpl = new List<TValue>();
/// <summary>The pairs demoved since the last reset.</summary>
/// <summary>The pairs removed since the last reset.</summary>
private readonly List<TValue> RemovedImpl = new List<TValue>();