From f6f3bbbc5b7741ad0db3c88a398cfc3943988529 Mon Sep 17 00:00:00 2001 From: "Ramaekers,Aldrik A.N" Date: Wed, 16 Sep 2020 09:42:04 +0200 Subject: work --- Events/GameFinishedEvent.cs | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Events/GameFinishedEvent.cs (limited to 'Events/GameFinishedEvent.cs') diff --git a/Events/GameFinishedEvent.cs b/Events/GameFinishedEvent.cs new file mode 100644 index 0000000..22cf26a --- /dev/null +++ b/Events/GameFinishedEvent.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Chess.Events +{ + public enum GameFinishedReason + { + CheckMate, + InsufficientMaterial, + Stalemate, + + /// + /// Not implemented from here on. + /// + Resignation, + Move75, + Repetition, + Agreement, + } + + public class GameFinishedEvent : EventArgs + { + public Player Winner { get; } + public GameFinishedReason Reason { get; set; } + + public GameFinishedEvent(Player winner, GameFinishedReason reason) + { + Winner = winner; + Reason = reason; + } + + public string GetWinnerName() + { + if (Winner != null) + { + return Winner.IsWhite ? "White" : "Black"; + } + + return ""; + } + + public string GetFinishReason() + { + return Reason.ToString(); + } + } +} -- cgit v1.2.3-70-g09d2