// each node button is colored with their players color so know who owns each node private void ColorOccupiedNodes(List <Button> buttons) { ourPlayers = client.RetrieveAllPlayersByGameId(CurrentGame); Player aPlayer = new Player(); foreach (Button aButton in buttons) { int Index = Convert.ToInt32(aButton.Text); aPlayer = client.ReturnNodeOwner(CurrentGame, Index); if (aPlayer != null) { if (ourPlayers[0] != null) { if (aPlayer.Name.Equals(ourPlayers[0].Name)) { aButton.BackColor = Color.Red; } if (aPlayer.Name.Equals(ourPlayers[1].Name)) { aButton.BackColor = Color.Yellow; } try { if (aPlayer.Name.Equals(ourPlayers[2].Name)) { aButton.BackColor = Color.Green; } } catch (Exception e) { Console.WriteLine("error", e); } try { if (aPlayer.Name.Equals(ourPlayers[3].Name)) { aButton.BackColor = Color.Blue; } } catch (Exception e) { Console.WriteLine("error", e); } } } else if (aPlayer == null) { aButton.BackColor = Color.Transparent; } } }