Added maps

This commit is contained in:
Brady Bodily
2020-12-10 14:44:11 -07:00
parent 1cdf498800
commit 42dd13f7d6
16 changed files with 137 additions and 31 deletions

View File

@@ -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>();
}
}

View File

@@ -2,7 +2,6 @@ namespace ConsoleApp
{
public interface ISimRunner
{
void GenerateMaps(int x, int y);
void StartSim();
void Run();
}
}

View File

@@ -0,0 +1,7 @@
namespace ConsoleApp
{
public class HexCell
{
}
}

View File

@@ -0,0 +1,7 @@
namespace ConsoleApp
{
public class HexMap
{
}
}

View File

@@ -0,0 +1,7 @@
namespace ConsoleApp
{
public interface IHexCell
{
}
}

View File

@@ -0,0 +1,7 @@
namespace ConsoleApp
{
public interface IHexMap
{
}
}

View File

@@ -7,5 +7,6 @@ namespace ConsoleApp
int Height { get; }
int Width { get; }
SquareMap SquareMap { get; }
void GenerateMaps(int x, int y);
}
}

View File

@@ -0,0 +1,7 @@
namespace ConsoleApp
{
public interface ISquareCell
{
}
}

View File

@@ -0,0 +1,7 @@
namespace ConsoleApp
{
public interface ISquareMap
{
}
}

View File

@@ -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()
{
}
}
}

View File

@@ -0,0 +1,7 @@
namespace ConsoleApp
{
public class SquareCell
{
}
}

View File

@@ -0,0 +1,7 @@
namespace ConsoleApp
{
public class SquareMap
{
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}