} //Движение рыбы private void OzeroForm_MouseClick(object sender, MouseEventArgs e) { for (int x = 0; x < 51; x++) { for (int y = 0; y < 18; y++) { Point between = new Point(Game.CastPoint.X - LVL.Deeparr[x, y].Location.X, Game.CastPoint.Y - LVL.Deeparr[x, y].Location.Y); float distance = (float)Math.Sqrt(between.X * between.X + between.Y * between.Y); if (distance < 20) { if (Player.getPlayer().lure != null) { Game.gui.DeepLabel.Text = LVL.Deeparr[x, y].Tag.ToString(); Sounder.setY(x); Sounder.setX(y); } } Game.Deep = Convert.ToInt32(Game.gui.DeepLabel.Text); } } } //Вычисляем длину
public GUI() { InitializeComponent(); for (int x = 0; x < 51; x++) { for (int y = 0; y < 18; y++) { LVL.Deeparr[x, y] = new Label() { Left = 5 + x * 20, Top = 350 + y * 20, Height = 20, TextAlign = ContentAlignment.MiddleCenter, Width = 20, Visible = false, }; Controls.Add(LVL.Deeparr[x, y]); LVL.Deeparr[x, y].MouseClick += GUI_MouseClick; } } Sounder sounder = new Sounder(SounderPanel, SounderUpdater); }
private void OzeroForm_KeyDown(object sender, KeyEventArgs e) { for (int x = 0; x < 51; x++) { for (int y = 0; y < 18; y++) { Point between = new Point(Game.CastPoint.X - LVL.Deeparr[x, y].Location.X, Game.CastPoint.Y - LVL.Deeparr[x, y].Location.Y); float distance = (float)Math.Sqrt(between.X * between.X + between.Y * between.Y); if (distance < 20) { Game.gui.DeepLabel.Text = LVL.Deeparr[x, y].Tag.ToString(); Sounder.setY(x); Sounder.setX(y); } Game.Deep = Convert.ToInt32(Game.gui.DeepLabel.Text); } } switch (e.KeyCode) { case Keys.G: Game.isBaitMoving = true; if (Game.isFishAttack) { Game.windingSpeed = Player.getPlayer().reel.Power; } else { Game.windingSpeed = Game.gui.SpeedBar.Value; } if (Game.roadY < 477) { Game.roadY += 7; } if (Game.isFishAttack) { if (Game.gui.FLineBar.Value < 100) { Game.gui.FLineBar.Increment(Fish.CFish.weight * 20 / (Player.getPlayer().fline.LeskaPower)); } if (Game.gui.ReelBar.Value > 0) { Game.gui.ReelBar.Increment(-(Fish.CFish.weight * 20 / (Player.getPlayer().proad.Power))); } } break; case Keys.H: if (Game.isFishAttack) { if (Game.gui.ReelBar.Value < 100) { Game.gui.ReelBar.Increment(Fish.CFish.weight * 20 / (Player.getPlayer().proad.Power)); } if (Game.gui.FLineBar.Value > 0) { Game.gui.FLineBar.Increment(-(Fish.CFish.weight * 20 / (Player.getPlayer().fline.LeskaPower))); } } break; case Keys.Space: if (Game.CastPoint.Y > 620) { Game.nettingY = 550; } break; } } //Нажатия кнопок