public GameScene(MainForm form, Game game, Timer timer) { _game = game; _gameSceneZone = new GameSceneZone(form); _lineTensioner = new LineTensioner(form, game, _gameSceneZone); form.Shown += (s, e) => DrawScene(); _gameSceneZone.Click += GameSceneClick; timer.Tick += (s, e) => DrawScene(); form.ClientSize = new Size(GameScene.Width, GameScene.Height + ButtonsPanel.Height); }
public LineTensioner(MainForm form, Game game, GameSceneZone gameSceneZone) { _game = game; _gameSceneZone = gameSceneZone; form.MouseDown += Form_MouseDown; form.MouseUp += Form_MouseUp; Connected += (fromX, fromY, toX, toY) => { CellSelector.Deselect(); if (gameSceneZone.IsMouseHover()) { var position = gameSceneZone.GetHoverCellCoordinate(); game.Connect(fromX, fromY, toX, toY); } }; }