예제 #1
0
        // retrieves the players from the db and assigns them colors so we can tell them apart
        private void AssignPlayerColors()
        {
            ourPlayers = client.RetrieveAllPlayersByGameId(CurrentGame);


            if (ourPlayers[0] != null)
            {
                PlayerLabel1.Text      = playerOrder[0].Player.Name;
                PlayerLabel1.ForeColor = Color.Red;
                PlayerLabel1.Visible   = true;
            }

            if (ourPlayers[1] != null)
            {
                PlayerLabel2.Text      = playerOrder[1].Player.Name;
                PlayerLabel2.ForeColor = Color.Yellow;
                PlayerLabel2.Visible   = true;
            }

            try
            {
                if (ourPlayers[2] != null)
                {
                    PlayerLabel3.Text      = playerOrder[2].Player.Name;
                    PlayerLabel3.ForeColor = Color.Green;
                    PlayerLabel3.Visible   = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("error", e);
            }

            try
            {
                if (ourPlayers[3] != null)
                {
                    PlayerLabel4.Text      = playerOrder[3].Player.Name;
                    PlayerLabel4.ForeColor = Color.Blue;
                    PlayerLabel4.Visible   = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("error", e);
            }
        }