private void ShootButton(object sender, EventArgs e) { try { Button btn = (Button)sender; BattleShipLib.Point point = (BattleShipLib.Point)btn.Tag; this.game.NextTurn(point.X, point.Y); Field[,] map = this.game.GetMap(); this.LoadTexture(btn, this.game.GetMap(), point.X, point.Y); } catch (Exception ex) { ShowError(ex); } }
public void RenderMapOnUI() { this.panelBoard.Enabled = true; Field[,] map = this.game.GetMap(); foreach (Control ctrl in this.panelBoard.Controls) { Button btn = ctrl as Button; if (btn == null) { continue; } BattleShipLib.Point point = (BattleShipLib.Point)btn.Tag; this.LoadTexture(btn, map, point.X, point.Y); } }