public FieldSetup(ModelGame game) { GameModel = game; AmountOfShipsStock[1] = 4; AmountOfShipsStock[2] = 3; AmountOfShipsStock[3] = 2; AmountOfShipsStock[4] = 1; AmountOfShips[1] = AmountOfShipsStock[1]; AmountOfShips[2] = AmountOfShipsStock[2]; AmountOfShips[3] = AmountOfShipsStock[3]; AmountOfShips[4] = AmountOfShipsStock[4]; for (int i = 1; i < 5; i++) { ActiveShip[i] = false; } }
public Form1(ModelGame game) { this.Game = game; this.Setup = new FieldSetup(Game); this.FormClosing += (sender, args) => Application.Exit(); PlayerField = MakeField(new Point(100, 100)); Ships = MakeShips(new Point(600, 100)); MakeFinishButton(new Point(800, 100)); UpdateForm(); Controls.Add(PlayerField); Controls.Add(Ships); Controls.Add(FinishButton); Controls.Add(RotateButton(new Point(800, 250))); Controls.Add(ResetButton(new Point(800, 400))); Controls.Add(MakeShipNameLabel(new Point(650, 105), "1-Cell")); Controls.Add(MakeShipNameLabel(new Point(650, 145), "2-Cell")); Controls.Add(MakeShipNameLabel(new Point(650, 185), "3-Cell")); Controls.Add(MakeShipNameLabel(new Point(650, 225), "4-Cell")); foreach (var stateLabel in AmountOfShipsLabels) { Controls.Add(stateLabel.Value); } for (int i = 0; i < ModelGame.Size; i++) { Controls.Add(MakeCoordinateLabel(new Point(60, 100 + i * 40), (i + 1).ToString())); } for (int i = 0; i < ModelGame.Size; i++) { Controls.Add(MakeCoordinateLabel(new Point(100 + i * 40, 60), Convert.ToString((char)(i + 65)))); } var backSound = new SoundPlayer(); backSound.SoundLocation = @"..\..\backMusic.wav"; backSound.Load(); backSound.PlayLooping(); InitializeComponent(); }