|
|
|
@ -23,7 +23,8 @@ namespace Models.Game
|
|
|
|
|
[DataMember]
|
|
|
|
|
[Ignore]
|
|
|
|
|
public ReadOnlyObservableCollection<Cell> Boards { get; private set; }
|
|
|
|
|
ObservableCollection<Cell> board = new ObservableCollection<Cell>();
|
|
|
|
|
|
|
|
|
|
private readonly ObservableCollection<Cell> _board = new ObservableCollection<Cell>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// It is the backgrond image of the map
|
|
|
|
@ -36,7 +37,8 @@ namespace Models.Game
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataMember]
|
|
|
|
|
public ReadOnlyObservableCollection<OperationCell> OperationGrid { get; private set; }
|
|
|
|
|
ObservableCollection<OperationCell> operationGrid = new ObservableCollection<OperationCell>();
|
|
|
|
|
|
|
|
|
|
private readonly ObservableCollection<OperationCell> _operationGrid = new ObservableCollection<OperationCell>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// It is a list of a list containing user's rope paths in the current game
|
|
|
|
@ -53,15 +55,16 @@ namespace Models.Game
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the Map class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name"></param>
|
|
|
|
|
/// <param name="background">The background of the map.</param>
|
|
|
|
|
public Map(string name, string background)
|
|
|
|
|
{
|
|
|
|
|
Name = name;
|
|
|
|
|
Background = background;
|
|
|
|
|
Boards = new ReadOnlyObservableCollection<Cell>(board);
|
|
|
|
|
InitializeBoards(board);
|
|
|
|
|
OperationGrid = new ReadOnlyObservableCollection<OperationCell>(operationGrid);
|
|
|
|
|
InitializeOperationGrid(operationGrid);
|
|
|
|
|
Boards = new ReadOnlyObservableCollection<Cell>(_board);
|
|
|
|
|
InitializeBoards(_board);
|
|
|
|
|
OperationGrid = new ReadOnlyObservableCollection<OperationCell>(_operationGrid);
|
|
|
|
|
InitializeOperationGrid(_operationGrid);
|
|
|
|
|
RopePaths = new List<List<Cell>>();
|
|
|
|
|
Zones = new List<List<Cell>>();
|
|
|
|
|
}
|
|
|
|
@ -138,26 +141,12 @@ namespace Models.Game
|
|
|
|
|
|
|
|
|
|
public bool IsCellInZones(Cell cell)
|
|
|
|
|
{
|
|
|
|
|
foreach (var zone in Zones)
|
|
|
|
|
{
|
|
|
|
|
if (zone.Contains(cell))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
return Zones.Any(zone => zone.Contains(cell));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsCellInRopePath(Cell cell)
|
|
|
|
|
{
|
|
|
|
|
foreach (var path in RopePaths)
|
|
|
|
|
{
|
|
|
|
|
if (path.Contains(cell))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
return RopePaths.Any(path => path.Contains(cell));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|