[Add] Basic project architecture
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
namespace Minesweeper.Core
|
||||
{
|
||||
public enum GameState
|
||||
{
|
||||
FieldSelection,
|
||||
Preparing,
|
||||
Playing,
|
||||
Lost,
|
||||
Won
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c06ebf54d6bacdf4888fabbf29bea1cd
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace Minesweeper.Core
|
||||
{
|
||||
public sealed class GameStateService : IGameStateService
|
||||
{
|
||||
public event Action<GameState> StateChanged;
|
||||
|
||||
public GameState Current { get; private set; } = GameState.FieldSelection;
|
||||
|
||||
public void SetState(GameState state)
|
||||
{
|
||||
if (Current == state)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Current = state;
|
||||
StateChanged?.Invoke(Current);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf69805439993c14887ea7bb9b15bd02
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace Minesweeper.Core
|
||||
{
|
||||
public interface IGameStateService
|
||||
{
|
||||
event Action<GameState> StateChanged;
|
||||
|
||||
GameState Current { get; }
|
||||
|
||||
void SetState(GameState state);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7aea04a8c0e8d3a4e8d991a4348430db
|
||||
Reference in New Issue
Block a user