Fixed the bug where some files would not work, and now you can click on the tiles

This commit is contained in:
2022-10-17 09:23:47 +02:00
parent f1df4162a3
commit 24af23a3a2
5 changed files with 111 additions and 18 deletions
+25 -1
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace NonoGramme
{
@@ -66,6 +67,29 @@ namespace NonoGramme
Data[index].CurrentState = state;
RecalculateHints();
}
public void Click(int index)
{
Tile tile = Data[index];
//MessageBox.Show("Tile pressed :"+tile.CurrentState);
switch (tile.CurrentState)
{
case Tile.State.Empty:
tile.CurrentState = Tile.State.Full;
break;
case Tile.State.Undiscovered:
tile.CurrentState = Tile.State.Discovered;
break;
case Tile.State.Full:
tile.CurrentState = Tile.State.Empty;
break;
case Tile.State.Discovered:
tile.CurrentState = Tile.State.Undiscovered;
break;
default:
//We dont do anything
break;
}
}
public void RecalculateHints()
{
Hints = new List<int>();
@@ -100,7 +124,7 @@ namespace NonoGramme
}
if (currentTile)
{
//if the last tilke is full then we need to add it at the end
//if the last tile is full then we need to add it at the end
Hints.Add(counter);
}
}