Fixed minor code smell + added swap event to Program.cs
continuous-integration/drone/push Build is passing Details

test_old_branch
Jules LASCRET 11 months ago
parent c7c4742729
commit dc33ff6656

@ -1,6 +1,7 @@
namespace QwirkleClassLibrary.Events;
namespace QwirkleClassLibrary.Events
{
public class SwapTilesNotifiedEventArgs(string reason)
{
public string Reason { get; private set; } = reason;
public string? Reason { get; private set; }
}
}

@ -46,5 +46,14 @@ namespace QwirkleConsoleApp
ResetColor();
}
public void NotificationSwapTile(object? sender, SwapTilesNotifiedEventArgs args)
{
ForegroundColor = ConsoleColor.Magenta;
WriteLine();
WriteLine(args.Reason);
WriteLine();
ResetColor();
}
}
}

@ -129,6 +129,9 @@ static void AddTile(Game game)
static void SwapTile(Game game)
{
var nc = new NotificationClass();
game.SwapTilesNotified += nc.NotificationSwapTile;
var tilesToSwap = new List<Tile>();
bool continueSwap = true;
@ -161,6 +164,7 @@ static void SwapTile(Game game)
}
game.SwapTiles(game.GetPlayingPlayer(), tilesToSwap);
game.SwapTilesNotified -= nc.NotificationSwapTile;
}
static void MenuSwitch(Game game)

Loading…
Cancel
Save