예제 #1
0
        private void SetStats(Podatkovni_sloj.Modals.Player player, ImageSource source, Matches match)
        {
            pImage.Source     = source;
            pName.Content     = player.Name;
            pNumber.Content   = $"{Properties.Resources.pNumber}{player.Shirt_Number}";
            pPosition.Content = player.Position;
            pRole.Content     = $"{Properties.Resources.pCaptain}{((player.Captain == true) ? Properties.Resources .pYes: Properties.Resources.pNo)}";


            int yellowCardsCount = 0;
            int goalsScoredCount = 0;

            foreach (var other in match.Home_Team_Statistics.Starting_Eleven)
            {
                if (other.Name == player.Name)
                {
                    foreach (var evt in match.Home_Team_Events)
                    {
                        if (evt.Type_Of_Event == "yellow-card" && evt.Player == player.Name)
                        {
                            yellowCardsCount++;
                        }
                        if (evt.Type_Of_Event == "goal-penalty" && evt.Player == player.Name ||
                            evt.Type_Of_Event == "goal-own" && evt.Player == player.Name ||
                            evt.Type_Of_Event == "goal" && evt.Player == player.Name)
                        {
                            goalsScoredCount++;
                        }
                    }
                }
            }
            foreach (var other in match.Away_Team_Statistics.Starting_Eleven)
            {
                if (other.Name == player.Name)
                {
                    foreach (var evt in match.Away_Team_Events)
                    {
                        if (evt.Type_Of_Event == "yellow-card" && evt.Player == player.Name)
                        {
                            yellowCardsCount++;
                        }
                        if (evt.Type_Of_Event == "goal-penalty" && evt.Player == player.Name ||
                            evt.Type_Of_Event == "goal-own" && evt.Player == player.Name ||
                            evt.Type_Of_Event == "goal" && evt.Player == player.Name)
                        {
                            goalsScoredCount++;
                        }
                    }
                }
            }

            pGoalsScored.Content = $"{Properties.Resources.pGoals}{goalsScoredCount}";
            pYellowCards.Content = $"{Properties.Resources.pCards}{yellowCardsCount}";
        }
예제 #2
0
        private void SetPlayer(Podatkovni_sloj.Modals.Player player, Matches match)
        {
            System.Drawing.Bitmap image;
            image = FileManager.LoadPlayerPictureFromCache(player.Name, FileManager.playerPicturesPath);

            if (image == null)
            {
                image = Properties.Resources.p5;
            }
            pImage.Source = MainWindow.BitmapToImageSource(image);
            pNumber.Text  = player.Shirt_Number.ToString();
            pName.Text    = player.Name;
        }
예제 #3
0
 public Player(Podatkovni_sloj.Modals.Player player, Matches match)
 {
     this.match  = match;
     this.player = player;
     InitializeComponent();
     SetPlayer(player, match);
     //Thickness padding = Padding;
     //padding.Left = MainWindow.rnd.Next(0, 50);
     ////margin.Bottom = MainWindow.rnd.Next(0, 50);
     ////margin.Top = MainWindow.rnd.Next(0, 50);
     //padding.Right= MainWindow.rnd.Next(0, 50);
     //Padding = padding;
 }
예제 #4
0
        private void AddPlayerCount(Podatkovni_sloj.Modals.Player player)
        {
            switch (player.Position)
            {
            case "Defender":
                defenderPlayerCount++;
                break;

            case "Midfield":
                midfilderPlayerCount++;
                break;

            case "Forward":
                forwardPlayerCount++;
                break;
            }
        }
예제 #5
0
        private void PlacePlayer(Podatkovni_sloj.Modals.Player player, int column, int index, int playerCount, Matches match)
        {
            UserControl temp = new Player(player, match);

            temp.HorizontalAlignment = HorizontalAlignment.Center;
            temp.VerticalAlignment   = VerticalAlignment.Center;

            Grid.SetColumn(temp, column);
            if (player.Position == "Goalie")
            {
                Grid.SetRow(temp, 1);
                Grid.SetRowSpan(temp, 3);
            }
            else
            {
                Grid.SetRow(temp, playerCount - 1);
            }
            gPlayers.Children.Add(temp);
        }
예제 #6
0
        private void DrawPlayers(Podatkovni_sloj.Modals.Player player, int from, int playerIndex, Matches match)
        {
            switch (player.Position)
            {
            case "Goalie":
                PlacePlayer(player, (from == 0) ? 0 : 7, playerIndex, 0, match);
                break;

            case "Defender":
                PlacePlayer(player, (from == 0) ? 1 : 6, playerIndex, defenderPlayerCount, match);
                defenderPlayerCount--;
                break;

            case "Midfield":
                PlacePlayer(player, (from == 0) ? 2 : 5, playerIndex, midfilderPlayerCount, match);
                midfilderPlayerCount--;
                break;

            case "Forward":
                PlacePlayer(player, (from == 0) ? 3 : 4, playerIndex, forwardPlayerCount, match);
                forwardPlayerCount--;
                break;
            }
        }
예제 #7
0
 public PlayerStats(Podatkovni_sloj.Modals.Player player, ImageSource source, Matches match)
 {
     Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(FileManager.ApplicationLanguage);
     InitializeComponent();
     SetStats(player, source, match);
 }