Пример #1
0
        private Grid GeneratePlayerTitleBlock(Player p)
        {
            PlayerAdapter pa = new PlayerAdapter();
            Maths         u  = new Maths();

            Grid g;

            g = GenerateBlankBlockGrid(3, p.DisplayName(PersonNameReturnType.FirstnameLastname) +
                                       (Debugger.IsAttached ? string.Format(", ID: {0}", p.UniqueID.ToString()) : ""), 2);
            Grid.SetColumnSpan(g, 2);

            TextBlock t = new TextBlock();

            t.Text   = pa.PositionAndSideText(p, false);
            t.Style  = Application.Current.FindResource("ListHeader") as Style;
            t.Margin = new Thickness(8, 0, 0, 0);
            Grid.SetColumn(t, 0);
            Grid.SetColumnSpan(t, 2);
            Grid.SetRow(t, 1);
            g.Children.Add(t);

            UiUtils.AddGridData(g, 0, 2, LangResources.CurLang.DateOfBirth,
                                p.DateOfBirth.ToString(LangResources.CurLang.DateFormat) + string.Format(" (Age: {0})", u.CalculateAgeInGame(p.DateOfBirth)));

            StackPanel stars = GraphicUtils.StarRating(p.Stars);

            stars.HorizontalAlignment = HorizontalAlignment.Right;
            Grid.SetColumn(stars, 3);
            Grid.SetColumnSpan(stars, 3);
            Grid.SetRow(stars, 0);
            g.Children.Add(stars);
            return(g);
        }
Пример #2
0
        private Grid GeneratePlayerStatsBlock(Player p)
        {
            List <(string, int)> stats = new List <(string, int)>();

            stats.Add((LangResources.CurLang.Agility, p.Agility));
            stats.Add((LangResources.CurLang.Attitude, p.Attitude));
            stats.Add((LangResources.CurLang.Speed, p.Speed));
            stats.Add((LangResources.CurLang.Stamina, p.Stamina));

            stats.Add((LangResources.CurLang.Passing, p.Passing));
            stats.Add((LangResources.CurLang.Marking, p.Marking));
            stats.Add((LangResources.CurLang.Balance, p.Balance));
            stats.Add((LangResources.CurLang.Tackling, p.Tackling));
            stats.Add((LangResources.CurLang.Shooting, p.Shooting));
            stats.Add((LangResources.CurLang.Handling, p.Handling));
            stats.Add((LangResources.CurLang.Heading, p.Heading));
            stats.Add((LangResources.CurLang.Influence, p.Influence));

            stats.Add((LangResources.CurLang.Strength, p.Strength));
            stats.Add((LangResources.CurLang.Fitness, p.Fitness));

            int halfList = (int)Math.Ceiling((double)stats.Count() / 2) - 1;

            Grid g;

            g = GenerateBlankBlockGrid(halfList + 2, "Player Attributes", 1);

            List <(string, int)> statsOrdered = (from s in stats
                                                 orderby s.Item1
                                                 select s).ToList(); // Because localised, these may not be in alpha-order!


            for (int i = 0; i <= halfList; i++)
            {
                UiUtils.AddGridData(g, 0, i + 1, statsOrdered[i].Item1, statsOrdered[i].Item2);
                if ((i + halfList + 1) < stats.Count())
                {
                    UiUtils.AddGridData(g, 2, i + 1, statsOrdered[i + halfList + 1].Item1, statsOrdered[i + halfList + 1].Item2);
                }
            }


            return(g);
        }