private bool clickBlocks(int x, int y)
{
if (!((x % bsize(1) >= Config.LineSize) ^ (y % bsize(1) >= Config.LineSize)))
{
return(true);
}
int dir = 0;
Tile tile = null;
int tx = 0;
int ty = 0;
if ((x % bsize(1) < Config.LineSize))
{
tx = x / bsize(1);
ty = y / bsize(1);
dir = Directions.West;
if (tx == Width)
{
dir = Directions.East;
tx--;
}
if (ty == Height)
{
ty--;
}
}
else
{
tx = x / bsize(1);
ty = y / bsize(1);
dir = Directions.North;
if (ty == Height)
{
dir = Directions.South;
ty--;
}
}
tile = tiles[tx, ty];
if (lastToggle == -1)
{
if (tile.GetBlock(dir))
{
lastToggle = 0;
}
else
{
lastToggle = 1;
}
}
if (lastToggle == 1 && !tile.GetBlock(dir) || lastToggle == 0 && tile.GetBlock(dir))
{
ChangeToggleBlock change = new ChangeToggleBlock(tx, ty, dir);
apply(change);
}
return(true);
}