Added maps
This commit is contained in:
@@ -1,7 +1,34 @@
|
||||
using DryIoc;
|
||||
using System;
|
||||
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public class Bootstrapper
|
||||
public class BootStrapper
|
||||
{
|
||||
p
|
||||
private static readonly string NoBootstrapperMessage = $"Called {nameof(BootStrapper)} before it existed";
|
||||
|
||||
private static BootStrapper _bootStrapper;
|
||||
private static IContainer _container;
|
||||
|
||||
public static BootStrapper Instance =>
|
||||
_bootStrapper ?? throw new InvalidOperationException(NoBootstrapperMessage);
|
||||
|
||||
public BootStrapper(params IModule[] modules)
|
||||
{
|
||||
_container = new Container();
|
||||
foreach (var module in modules)
|
||||
{
|
||||
module.Register(_container);
|
||||
}
|
||||
foreach (var module in modules)
|
||||
{
|
||||
module.Resolve(_container);
|
||||
}
|
||||
}
|
||||
|
||||
public static BootStrapper BootstrapSystem(params IModule[] modules) =>
|
||||
_bootStrapper = new BootStrapper(modules);
|
||||
|
||||
public T Resolve<T>() => _container.Resolve<T>();
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ namespace ConsoleApp
|
||||
{
|
||||
public interface ISimRunner
|
||||
{
|
||||
void GenerateMaps(int x, int y);
|
||||
void StartSim();
|
||||
void Run();
|
||||
}
|
||||
}
|
||||
7
ConsoleApp/Maps/HexCell.cs
Normal file
7
ConsoleApp/Maps/HexCell.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public class HexCell
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
7
ConsoleApp/Maps/HexMap.cs
Normal file
7
ConsoleApp/Maps/HexMap.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public class HexMap
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
7
ConsoleApp/Maps/IHexCell.cs
Normal file
7
ConsoleApp/Maps/IHexCell.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public interface IHexCell
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
7
ConsoleApp/Maps/IHexMap.cs
Normal file
7
ConsoleApp/Maps/IHexMap.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public interface IHexMap
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,6 @@ namespace ConsoleApp
|
||||
int Height { get; }
|
||||
int Width { get; }
|
||||
SquareMap SquareMap { get; }
|
||||
void GenerateMaps(int x, int y);
|
||||
}
|
||||
}
|
||||
7
ConsoleApp/Maps/ISquareCell.cs
Normal file
7
ConsoleApp/Maps/ISquareCell.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public interface ISquareCell
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
7
ConsoleApp/Maps/ISquareMap.cs
Normal file
7
ConsoleApp/Maps/ISquareMap.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public interface ISquareMap
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,16 @@ namespace ConsoleApp
|
||||
private int _defaultWidth;
|
||||
public int Height { get; protected set; }
|
||||
public int Width { get; protected set; }
|
||||
public SquareMap SquareMap { get; }
|
||||
public HexMap HexMap { get; }
|
||||
|
||||
|
||||
public void GenerateMaps(int x, int y)
|
||||
{
|
||||
Width = x;
|
||||
Height = y;
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public MapFactory()
|
||||
{
|
||||
@@ -14,16 +24,6 @@ namespace ConsoleApp
|
||||
Height = _defaultHeight;
|
||||
Width = _defaultWidth;
|
||||
}
|
||||
|
||||
void CreateMaps(int height, int width)
|
||||
{
|
||||
Height = height;
|
||||
Width = width;
|
||||
}
|
||||
|
||||
void CreateMaps()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
7
ConsoleApp/Maps/SquareCell.cs
Normal file
7
ConsoleApp/Maps/SquareCell.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public class SquareCell
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
7
ConsoleApp/Maps/SquareMap.cs
Normal file
7
ConsoleApp/Maps/SquareMap.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public class SquareMap
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,11 @@ namespace ConsoleApp
|
||||
class Program
|
||||
{
|
||||
private static UserConsole _userConsole;
|
||||
private static BootStrapper _bootstrapper;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
_bootstrapper = new BootStrapper();
|
||||
_userConsole = new UserConsole();
|
||||
StartSimulation();
|
||||
}
|
||||
@@ -30,8 +32,11 @@ namespace ConsoleApp
|
||||
|
||||
private static void RunSimulation(int x,int y)
|
||||
{
|
||||
var bootStrapper = new Bootstrapper
|
||||
var simRunner = new SimRunner();
|
||||
var simRunner = _bootstrapper.Resolve<ISimRunner>();
|
||||
var mapFactory = _bootstrapper.Resolve<IMapFactory>();
|
||||
|
||||
mapFactory.GenerateMaps(x, y);
|
||||
simRunner.Run();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,14 +8,8 @@ namespace ConsoleApp
|
||||
{
|
||||
_mapFactory = mapFactory;
|
||||
}
|
||||
public void GenerateMaps(int x, int y)
|
||||
{
|
||||
_mapFactory.GenerateMaps(x, y);
|
||||
_mapFactory.SquareMap();
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void StartSim()
|
||||
public void Run()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user