pushing for zac
This commit is contained in:
7
ConsoleApp/Bootstrapper.cs
Normal file
7
ConsoleApp/Bootstrapper.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public class Bootstrapper
|
||||
{
|
||||
p
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,20 @@
|
||||
using System.Threading;
|
||||
using ConsoleApp;
|
||||
using DryIoc;
|
||||
using Module = ConsoleApp.Module;
|
||||
|
||||
namespace Final
|
||||
{
|
||||
public class CoreModule
|
||||
public class CoreModule : Module
|
||||
{
|
||||
|
||||
public virtual void Register(IContainer container, ExecutionContext executionContext)
|
||||
{
|
||||
//container.Register<IUserConsole, UserConsole>(Reuse.Singleton);
|
||||
}
|
||||
|
||||
public virtual void Resolve(IContainer container)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
8
ConsoleApp/ISimRunner.cs
Normal file
8
ConsoleApp/ISimRunner.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public interface ISimRunner
|
||||
{
|
||||
void GenerateMaps(int x, int y);
|
||||
void StartSim();
|
||||
}
|
||||
}
|
||||
7
ConsoleApp/IUserConsole.cs
Normal file
7
ConsoleApp/IUserConsole.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public interface IUserConsole
|
||||
{
|
||||
void PrintStartMenu();
|
||||
}
|
||||
}
|
||||
11
ConsoleApp/Maps/IMapFactory.cs
Normal file
11
ConsoleApp/Maps/IMapFactory.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Dynamic;
|
||||
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public interface IMapFactory
|
||||
{
|
||||
int Height { get; }
|
||||
int Width { get; }
|
||||
SquareMap SquareMap { get; }
|
||||
}
|
||||
}
|
||||
29
ConsoleApp/Maps/MapFactory.cs
Normal file
29
ConsoleApp/Maps/MapFactory.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public class MapFactory : IMapFactory
|
||||
{
|
||||
private int _defaultHeight;
|
||||
private int _defaultWidth;
|
||||
public int Height { get; protected set; }
|
||||
public int Width { get; protected set; }
|
||||
|
||||
public MapFactory()
|
||||
{
|
||||
_defaultHeight = 0;
|
||||
_defaultWidth = 0;
|
||||
Height = _defaultHeight;
|
||||
Width = _defaultWidth;
|
||||
}
|
||||
|
||||
void CreateMaps(int height, int width)
|
||||
{
|
||||
Height = height;
|
||||
Width = width;
|
||||
}
|
||||
|
||||
void CreateMaps()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
21
ConsoleApp/Module.cs
Normal file
21
ConsoleApp/Module.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using DryIoc;
|
||||
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public abstract class Module : IModule
|
||||
{
|
||||
public virtual void Register(IContainer container)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Resolve(IContainer container)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,35 @@ namespace ConsoleApp
|
||||
{
|
||||
class Program
|
||||
{
|
||||
private static UserConsole _userConsole;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
_userConsole = new UserConsole();
|
||||
StartSimulation();
|
||||
}
|
||||
|
||||
private static void StartSimulation()
|
||||
{
|
||||
_userConsole.PrintStartMenu();
|
||||
var input = _userConsole.GetUserInput();
|
||||
if (input == "1")
|
||||
{
|
||||
var (x,y) = _userConsole.GetMapDimensions();
|
||||
RunSimulation(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
_userConsole.PrintInvalidInput();
|
||||
StartSimulation();
|
||||
}
|
||||
}
|
||||
|
||||
private static void RunSimulation(int x,int y)
|
||||
{
|
||||
var bootStrapper = new Bootstrapper
|
||||
var simRunner = new SimRunner();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
23
ConsoleApp/SimRunner.cs
Normal file
23
ConsoleApp/SimRunner.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public class SimRunner : ISimRunner
|
||||
{
|
||||
private IMapFactory _mapFactory;
|
||||
|
||||
public SimRunner(IMapFactory mapFactory)
|
||||
{
|
||||
_mapFactory = mapFactory;
|
||||
}
|
||||
public void GenerateMaps(int x, int y)
|
||||
{
|
||||
_mapFactory.GenerateMaps(x, y);
|
||||
_mapFactory.SquareMap();
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void StartSim()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
45
ConsoleApp/UserConsole.cs
Normal file
45
ConsoleApp/UserConsole.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace ConsoleApp
|
||||
{
|
||||
public class UserConsole : IUserConsole
|
||||
{
|
||||
private IMapFactory _mapFactory;
|
||||
|
||||
public UserConsole()
|
||||
{
|
||||
}
|
||||
|
||||
public void PrintStartMenu()
|
||||
{
|
||||
Console.WriteLine($"Make a selection: \n" +
|
||||
$"\t 1: Auto generate maps. \n" +
|
||||
$"\t 2: Load custom map. \n");
|
||||
}
|
||||
|
||||
public string GetUserInput() => Console.ReadLine();
|
||||
|
||||
public void PrintInvalidInput()
|
||||
{
|
||||
Console.WriteLine($"Invalid input try again \n");
|
||||
}
|
||||
|
||||
public (int width, int height) GetMapDimensions()
|
||||
{
|
||||
Console.WriteLine($"Enter Dimensions of map/area to clear as (x, y)");
|
||||
var input = GetUserInput();
|
||||
var numbers = input.Split();
|
||||
if (numbers.Length != 4)
|
||||
{
|
||||
PrintInvalidInput();
|
||||
GetMapDimensions();
|
||||
}
|
||||
|
||||
var parsedNumbers = numbers.Where(x => !(x.Equals("(") || x.Equals(")"))).ToList();
|
||||
int.TryParse(parsedNumbers[0], out var width);
|
||||
int.TryParse(parsedNumbers[1], out var height);
|
||||
return (width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user