Merge pull request #7 from bradybod/Bootstrapper

Added maps
This commit is contained in:
bradybod
2020-12-10 14:45:17 -07:00
committed by GitHub
16 changed files with 137 additions and 31 deletions

View File

@@ -7,10 +7,13 @@
<e p="Bootstrapper.cs" t="Include" />
<e p="ConsoleApp.csproj" t="IncludeRecursive" />
<e p="CoreModule.cs" t="Include" />
<e p="IMapFactory.cs" t="Include" />
<e p="IModule.cs" t="Include" />
<e p="ISimRunner.cs" t="Include" />
<e p="IUserConsole.cs" t="Include" />
<e p="Maps" t="Include">
<e p="IMapFactory.cs" t="Include" />
<e p="MapFactory.cs" t="Include" />
</e>
<e p="Module.cs" t="Include" />
<e p="obj" t="ExcludeRecursive">
<e p="Debug" t="Include">
@@ -20,6 +23,7 @@
</e>
</e>
<e p="Program.cs" t="Include" />
<e p="SimRunner.cs" t="Include" />
<e p="UserConsole.cs" t="Include" />
</e>
<e p="packages" t="ExcludeRecursive" />

View File

@@ -16,10 +16,12 @@
<component name="ChangeListManager">
<list default="true" id="dafcaeb7-80aa-43a3-a480-786fafb78c0b" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/ConsoleApp/Bootstrapper.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/IMapFactory.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/ISimRunner.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/IUserConsole.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/MapFactory.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/Module.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" afterDir="false" />
@@ -58,11 +60,13 @@
<option value="$PROJECT_DIR$/ConsoleApp/IUserConsole.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Module.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/IMapFactory.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/MapFactory.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Program.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Bootstrapper.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/ISimRunner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/IMapFactory.cs" />
</list>
</option>
</component>
@@ -150,15 +154,31 @@
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
</component>
<component name="WindowStateProjectService">
<state width="1158" height="582" key="GridCell.Tab.0.bottom" timestamp="1607636097456">
<screen x="1440" y="-782" width="1200" height="1920" />
</state>
<state width="1158" height="582" key="GridCell.Tab.0.bottom/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607636097456" />
<state width="1158" height="582" key="GridCell.Tab.0.center" timestamp="1607636097453">
<screen x="1440" y="-782" width="1200" height="1920" />
</state>
<state width="1158" height="582" key="GridCell.Tab.0.center/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607636097453" />
<state width="1158" height="582" key="GridCell.Tab.0.left" timestamp="1607636097452">
<screen x="1440" y="-782" width="1200" height="1920" />
</state>
<state width="1158" height="582" key="GridCell.Tab.0.left/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607636097452" />
<state width="1158" height="582" key="GridCell.Tab.0.right" timestamp="1607636097454">
<screen x="1440" y="-782" width="1200" height="1920" />
</state>
<state width="1158" height="582" key="GridCell.Tab.0.right/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607636097454" />
<state x="1640" y="-86" key="Rider.ProjectTemplateDialog.Size" timestamp="1607287214952">
<screen x="1440" y="-782" width="1200" height="1920" />
</state>
<state x="1640" y="-86" key="Rider.ProjectTemplateDialog.Size/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607286605974" />
<state x="1640" y="-86" key="Rider.ProjectTemplateDialog.Size/0.25.1440.798/2640.-757.1200.1895/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607287214952" />
<state x="1860" y="-144" key="RiderGenerateDialog" timestamp="1607634276930">
<state x="1860" y="-144" key="RiderGenerateDialog" timestamp="1607635610011">
<screen x="1440" y="-782" width="1200" height="1920" />
</state>
<state x="1860" y="-144" key="RiderGenerateDialog/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607634276930" />
<state x="1860" y="-144" key="RiderGenerateDialog/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607635610011" />
<state x="1703" y="-333" width="672" height="678" key="search.everywhere.popup" timestamp="1607633696072">
<screen x="1440" y="-782" width="1200" height="1920" />
</state>

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()
{
@@ -15,15 +25,5 @@ namespace ConsoleApp
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();
}