2022-05-03 01:11:31 +00:00
|
|
|
|
using System.Collections.Generic;
|
2019-05-30 04:35:52 +00:00
|
|
|
|
|
2022-05-03 01:11:31 +00:00
|
|
|
|
namespace PKHeX.Core;
|
2019-05-30 04:35:52 +00:00
|
|
|
|
|
2022-05-03 01:11:31 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Legal Move information for a single <see cref="PKM"/>, for indicating if a move is legal or not.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class LegalMoveSource<T>
|
|
|
|
|
{
|
|
|
|
|
public LegalMoveInfo Info { get; } = new();
|
|
|
|
|
public readonly ILegalMoveDisplaySource<T> Display;
|
2019-05-30 04:35:52 +00:00
|
|
|
|
|
2022-05-03 01:11:31 +00:00
|
|
|
|
public LegalMoveSource(ILegalMoveDisplaySource<T> display) => Display = display;
|
2019-05-30 04:35:52 +00:00
|
|
|
|
|
2022-05-03 01:11:31 +00:00
|
|
|
|
public void ReloadMoves(IReadOnlyList<int> moves)
|
|
|
|
|
{
|
|
|
|
|
if (!Info.ReloadMoves(moves))
|
|
|
|
|
return;
|
|
|
|
|
Display.ReloadMoves(Info);
|
|
|
|
|
}
|
2019-05-30 04:35:52 +00:00
|
|
|
|
|
2022-05-03 01:11:31 +00:00
|
|
|
|
public void ChangeMoveSource(IReadOnlyList<T> moves)
|
|
|
|
|
{
|
|
|
|
|
Display.ReloadMoves(moves);
|
2019-05-30 04:35:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|