Skip to content
Snippets Groups Projects
Commit 190bc48f authored by Elias Leinenweber's avatar Elias Leinenweber
Browse files

Avancé dans la map

parent 3c542780
No related merge requests found
...@@ -47,6 +47,11 @@ ...@@ -47,6 +47,11 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="model\Map.cs" />
<Compile Include="model\Terrain.cs" />
<Compile Include="model\Tile.cs" />
<Compile Include="view\Controls\MapView.cs" />
<Compile Include="view\Controls\TileView.cs" />
<Compile Include="view\FormAide.cs"> <Compile Include="view\FormAide.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
......
namespace Wanderer
{
public class Map
{
private Tile[,] _tiles;
public Tile[,] Tiles
{
get => _tiles;
set => _tiles = value;
}
}
}
\ No newline at end of file
namespace Wanderer
{
public enum Terrain
{
Plains,
Hills,
Mountains
}
}
\ No newline at end of file
namespace Wanderer
{
public class Tile
{
public Terrain Terrain { get; set; }
}
}
\ No newline at end of file
using System.Windows.Forms;
namespace Wanderer.view.Controls
{
public class MapView : TableLayoutPanel
{
private TileView[,] tileViews;
public MapView(Map map)
{
for (int i = 0; i < map.Tiles.GetLength(0); ++i)
for (int j = 0; j < map.Tiles.GetLength(1); ++j)
{
tileViews[i, j] = new TileView(map.Tiles[i, j]);
}
}
}
}
\ No newline at end of file
using System.Drawing;
using System.Windows.Forms;
namespace Wanderer.view.Controls
{
public class TileView : Button
{
private Tile model;
public TileView(Tile tile)
{
model = tile;
Image = imageFromTerrain();
}
private Image imageFromTerrain()
{
switch (model.Terrain)
{
case Terrain.Plains:
break;
case Terrain.Hills:
break;
}
return null;
}
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment