コード例 #1
0
ファイル: App.cs プロジェクト: nikolay-radkov/Telerik-Academy
		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();
		}
コード例 #2
0
		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());
		}