public EditorForm()
        {
            InitializeComponent();

            PlayFieldEditor = new PinballEditControl();
            EditorContainer = new WPFContainer(PlayFieldEditor);
            playFieldPanel.Controls.Add(EditorContainer);

            TitleLabel.Font = new Font(FontManager.Courgette, 40);

            // Set up menu
            editToolStripMenuItem.DropDownItems.Add(new UndoItem(PlayFieldEditor.History));
            editToolStripMenuItem.DropDownItems.Add(new RedoItem(PlayFieldEditor.History));

            // Set up left panel
            populateElementPanel();
            populateToolPanel();

            // Set up playfield and element inspector
            PlayFieldEditor.History.Change += () => { elementInspector.Refresh(); machineInspector.Refresh(); };
            elementInspector.PropertyValueChanged += onElementPropertyChanged;
            machineInspector.PropertyValueChanged += onMachinePropertyChanged;
            machineInspector.SelectedObject = PlayFieldEditor.PinballMachine;

            // Set up zoom bar
            zoomBar.Trackbar.Minimum = 5;
            zoomBar.Trackbar.Maximum = 20;
            zoomBar.Trackbar.Value = 10;
            zoomBar.Trackbar.ValueChanged += (sender, e) => { PlayFieldEditor.ScaleFactor = zoomBar.Trackbar.Value / 10f; };

            PlayFieldEditor.MouseWheel += onMouseWheel;

            FileName = null;

            // PlayFieldEditor
            //EditorContainer.AllowDrop = true;
            PlayFieldEditor.AllowDrop = true;
            EditorContainer.Location = new System.Drawing.Point(3, 3);
            EditorContainer.TabIndex = 2;

            PlayFieldEditor.SelectionChanged += new Sketchball.Controls.PinballEditControl.SelectionChangedHandler(this.onSelectionChanged);

            PlayFieldEditor.Drop += this.onDragDrop;
            PlayFieldEditor.DragEnter += this.onDragEnter;
            PlayFieldEditor.DragOver += this.onDragOver;
            PlayFieldEditor.DragLeave += this.onDragLeave;
            PlayFieldEditor.QueryContinueDrag += this.onQueryContinueDrag;

            //PlayFieldEditor.Background = System.Windows.Media.Brushes.White;
        }
Beispiel #2
0
        public PlayForm(PinballMachine pbm, SelectionForm selectionForm)
        {
            InitializeComponent();

            // Initialize game
            originalMachine = pbm;
            game = new Game(pbm, Environment.UserName);
            gameView = new GameView(game);
            gameContainer = new WPFContainer(gameView);
            game.GameOver += onGameOver;
            //this.MinimumSize = gameView.MinimumSize;
            gameView.MouseUp += onMouseUp;
            gameView.MouseMove += onMouseMove;
            // Fill entire space
            gameContainer.Dock = DockStyle.Fill;

            mainContainer.ContentPanel.Controls.Add(gameContainer);

            this.selectionForm = selectionForm;

            debugModeButton.Checked =  Properties.Settings.Default.Debug;
        }