Beispiel #1
0
		public static void Main(string[] args)
		{
			var ioProvider = new ConsoleIOProvider();
			var player = new Player();
			var field = new Field();

			var gameUISettngs = new DefaultUIEngineSettings<ConsoleIOProvider>(ioProvider, player);
			var gameUI = new UIEngine<ConsoleIOProvider>(gameUISettngs);
			var gameEngineSettings = new GameEngineSettings<IDefaultUIEngine, IIntegerStats>(gameUI, field, player, InFileScores.Instance);
			var gameEngine = new GameEngine(gameEngineSettings);
			gameEngine.Start();
		}
		private void MainForm_Load(object sender, EventArgs e)
		{
			var ioProvider = new WindowsFormsIOProvider(this);
			var player = new Player();
			var field = new Field();

			var gameUISettngs = new DefaultUIEngineSettings<WindowsFormsIOProvider>(
				ioProvider,
				player,
				ioProviderSettings: new WindowsFormsIOProviderSettings(),
				startRenderer: new StartWindowRenderer<WindowsFormsIOProvider>(),
				exitRenderer: new ExitWindowRenderer<WindowsFormsIOProvider>(),
				chooseDifficultyRenderer: new ChooseDifficultyWindowRenderer<WindowsFormsIOProvider>(),
				helpDisplayRenderer: new HelpDisplayWindowRenderer<WindowsFormsIOProvider>(),
				fieldRenderer: new FieldWindowsRenderer<WindowsFormsIOProvider>());

			var gameUI = new UIEngine<WindowsFormsIOProvider>(gameUISettngs);
			var gameEngineSettings = new GameEngineSettings<IDefaultUIEngine, IIntegerStats>(gameUI, field, player, InMemoryScores.Instance);
			var gameEngine = new GameEngine(gameEngineSettings);
			this._gameEngine = gameEngine;

			Task.Run(() => gameEngine.Start());
		}