Skip to content

Commit 72a22df

Browse files
author
RUBIUS\chebanovdd
committed
Added info mode to terminal game.
1 parent de7b1ae commit 72a22df

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

Match3.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Spacebar/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using Match3.Template.Interfaces;
3+
4+
namespace Terminal.Match3.GameModes
5+
{
6+
public class GameInfoMode : IGameMode, IDeactivatable
7+
{
8+
public event EventHandler Finished;
9+
10+
public void Activate()
11+
{
12+
Console.ForegroundColor = ConsoleColor.DarkYellow;
13+
Console.WriteLine();
14+
Console.WriteLine("Navigation: Arrow keys");
15+
Console.WriteLine("Selection: Spacebar key");
16+
Console.WriteLine("Exit: Enter key");
17+
18+
Console.ForegroundColor = ConsoleColor.Gray;
19+
Console.WriteLine();
20+
Console.WriteLine("Press any key to continue...");
21+
22+
Console.ReadKey(true);
23+
Finished?.Invoke(this, EventArgs.Empty);
24+
}
25+
26+
public void Deactivate()
27+
{
28+
Console.Clear();
29+
}
30+
}
31+
}

samples/Terminal.Match3/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ await Host
2121
.ConfigureServices(services =>
2222
{
2323
services.AddHostedService<GameService>();
24+
services.AddTransient<IGameMode, GameInfoMode>();
2425
services.AddTransient<IGameMode, GameInitMode>();
2526
services.AddTransient<IGameMode, GamePlayMode>();
2627
services.AddInfrastructure();

0 commit comments

Comments
 (0)