This commit is contained in:
2024-10-11 11:10:38 -05:00
parent 81dd267290
commit f75553a0ad
14 changed files with 616 additions and 514 deletions

View File

@@ -0,0 +1,15 @@
namespace Shogi.Domain.Other;
public interface IRulesLifecycle<TPiece> where TPiece : IRulesLifecycle<TPiece>
{
/// <summary>
/// Invoked by <see cref="BoardRules{TPiece}.ValidateMove(Vector2, Vector2, bool)"/> during the MoveValidation life cycle event.
/// If a move begins or ends outside the board space coordinates, this function is not called.
/// The purpose is to ensure a proposed board move is valid with regard to the moved piece's rules.
/// This event does not worry about check or check-mate, or if a move is legal.
///
/// </summary>
/// <param name="context">A context object with information for you to use to assess whether a move is valid for your implementing piece.</param>
/// <returns>A new <see cref="RulesLifecycleResult"/> object indicating whether or not the move is valid.</returns>
RulesLifecycleResult OnMoveValidation(MoveValidationContext<TPiece> context);
}