Esempio n. 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);
        }
Esempio n. 2
0
        private void UpdatePlayers()
        {
            PlayerAdapter pa = new PlayerAdapter();

            lstPlayers.Title   = LangResources.CurLang.Players;
            lstPlayers.Columns = new List <ListColumn>()
            {
                new ListColumn(LangResources.CurLang.Name, 200),
                new ListColumn(LangResources.CurLang.Position_Short, 50),
                new ListColumn(LangResources.CurLang.Rating, 120)
            };

            List <ListRow> rows    = new List <ListRow>();
            List <Player>  players = (from p in pa.GetPlayers(SetupData.TeamData.UniqueID)
                                      orderby p.Position, p.PreferredSide
                                      select p).ToList();

            foreach (Player p in players)
            {
                rows.Add(new ListRow(p.UniqueID, new List <object>()
                {
                    p.DisplayName(PersonNameReturnType.LastnameInitial),
                    pa.PositionAndSideText(p, true),
                    GraphicUtils.StarRating(p.Stars)
                }));
            }

            lstPlayers.Rows               = rows;
            lstPlayers.SelectionMode      = SelectMode.HighlightAndCallback;
            lstPlayers.Callback_ItemClick = ShowPlayer;
        }
        public void SetupTeam(bool WithLabels)
        {
            int FormationID = (MyTeam ? team.CurrentFormation : team.LastKnownFormation);
            Dictionary <int, TeamPlayer> picks = (MyTeam ? team.Players : team.LastKnownPick);

            FormationPaging.DisplayItem(FormationID);
            SetupFormationTemplate(FormationID);

            PlayerAdapter pa = new PlayerAdapter();

            foreach (KeyValuePair <int, TeamPlayer> p in picks)
            {
                TeamPlayer tp     = p.Value;
                Player     player = pa.GetPlayer(tp.PlayerID);

                if (WithLabels)
                {
                    StackPanel s = new StackPanel();
                    s.Orientation = Orientation.Horizontal;

                    TextBlock playerLabel = new TextBlock();
                    playerLabel.Width             = 150;
                    playerLabel.Height            = 30;
                    playerLabel.Text              = player.DisplayName(PersonNameReturnType.LastnameInitial);
                    playerLabel.MouseMove        += new MouseEventHandler(PlayerName_MouseMove);
                    playerLabel.Tag               = tp.PlayerID;
                    playerLabel.VerticalAlignment = VerticalAlignment.Center;
                    playerLabel.Cursor            = Cursors.Hand;
                    PlayerLabels.Add(playerLabel);

                    s.Children.Add(PlayerLabels[PlayerLabels.Count - 1]);

                    TextBlock playerPos = new TextBlock();
                    playerPos.Width             = 60;
                    playerPos.Height            = 30;
                    playerPos.Text              = pa.PositionAndSideText(player, true);
                    playerPos.VerticalAlignment = VerticalAlignment.Center;

                    s.Children.Add(playerPos);

                    s.Children.Add(GraphicUtils.StarRatingWithNumber(player.Stars));

                    //stkNames.Children.Add(PlayerLabels[PlayerLabels.Count - 1]);
                    stkNames.Children.Add(s);
                    playerLabel = null;
                }



                if (tp.Selected == PlayerSelectionStatus.Starting && tp.PlayerGridX > -1 && tp.PlayerGridY > -1)
                {
                    MarkerText[tp.PlayerGridX, tp.PlayerGridY].Text       = player.DisplayName(PersonNameReturnType.InitialOptionalLastname);
                    MarkerText[tp.PlayerGridX, tp.PlayerGridY].Visibility = Visibility.Visible;
                    PlayerGridPositions[tp.PlayerGridX, tp.PlayerGridY]   = tp.PlayerID;
                }
            }

            ChangesNotSaved = false;
        }