public void AddPlate(Button btnButton, int x, int y) { ShipPlate plate = new ShipPlate(row: y, column: x, button: btnButton); #if DEBUG Trace.WriteLine(message: "Adding plate btn " + plate.BtnButton.ToString()); #endif ShipPlates.Add(item: plate); }
public bool RevealButton(Button btn) { ShipPlate plate = ShipPlates. FirstOrDefault(predicate: x => Equals(objA: x.BtnButton as Button, objB: btn)); if (plate == null) { throw new NullReferenceException(message: "Plate not found from " + ShipPlates.Count); } if (!plate.IsRevealed) { SetButtonVisuals(stat: plate.IsMined?ShipStat.Ship: ShipStat.Water, btn: btn, plate: plate); } return(CheckGameEndingConditions()); }