private static Label GainLabelForScoreDisplay(EndOfRoundInformationsPivot.PlayerInformationsPivot p) { var gainLbl = new Label { VerticalAlignment = VerticalAlignment.Center, Content = p.HandPointsGain, Foreground = System.Windows.Media.Brushes.Red }; gainLbl.SetValue(Grid.RowProperty, 0); gainLbl.SetValue(Grid.ColumnProperty, 2); return(gainLbl); }
private static Label FanlabelForScoreDisplay(EndOfRoundInformationsPivot.PlayerInformationsPivot p) { if (p.Yakus == null || p.Yakus.Count == 0) { return(null); } Label fanLbl = new Label { VerticalAlignment = VerticalAlignment.Center, Content = p.FanCount }; fanLbl.SetValue(Grid.RowProperty, 0); fanLbl.SetValue(Grid.ColumnProperty, 0); return(fanLbl); }
private static Line SeparatorForScoreDisplay(EndOfRoundInformationsPivot.PlayerInformationsPivot p) { if (p.Yakus == null || p.Yakus.Count == 0) { return(null); } Line separator = new Line { Fill = System.Windows.Media.Brushes.Black, Height = 2, Width = 200, VerticalAlignment = VerticalAlignment.Center }; separator.SetValue(DockPanel.DockProperty, Dock.Bottom); return(separator); }
private static StackPanel HandPanelForScoreDisplay(EndOfRoundInformationsPivot.PlayerInformationsPivot p) { var handPanel = new StackPanel { Orientation = Orientation.Horizontal, Height = TILE_HEIGHT + (0.5 * DEFAULT_TILE_MARGIN), HorizontalAlignment = HorizontalAlignment.Center }; foreach (Tuple <TilePivot, bool, bool> tile in p.GetFullHandForDisplay()) { Button b = GenerateTileButton(tile.Item1, null, (tile.Item2 ? AnglePivot.A90 : AnglePivot.A0), false); if (tile.Item3) { b.Margin = new Thickness(5, 0, 0, 0); } handPanel.Children.Add(b); } handPanel.SetValue(DockPanel.DockProperty, Dock.Top); return(handPanel); }
private static Grid YakusGridForScoreDisplay(EndOfRoundInformationsPivot.PlayerInformationsPivot p) { if (p.Yakus == null || p.Yakus.Count == 0) { return(null); } Grid gridYakus = new Grid(); gridYakus.ColumnDefinitions.Add(new ColumnDefinition()); gridYakus.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50) }); int i = 0; foreach (var yaku in p.Yakus.GroupBy(y => y)) { gridYakus.AddGridRowYaku(i, yaku.Key.Name, (p.Concealed ? yaku.Key.ConcealedFanCount : yaku.Key.FanCount) * yaku.Count()); i++; } if (p.DoraCount > 0) { gridYakus.AddGridRowYaku(i, YakuPivot.Dora, p.DoraCount); i++; } if (p.UraDoraCount > 0) { gridYakus.AddGridRowYaku(i, YakuPivot.UraDora, p.UraDoraCount); i++; } if (p.RedDoraCount > 0) { gridYakus.AddGridRowYaku(i, YakuPivot.RedDora, p.RedDoraCount); i++; } gridYakus.SetValue(DockPanel.DockProperty, Dock.Top); return(gridYakus); }
private static Grid PointsGridForScoreDisplay(EndOfRoundInformationsPivot.PlayerInformationsPivot p) { var gridPoints = new Grid { HorizontalAlignment = HorizontalAlignment.Right }; gridPoints.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50) }); gridPoints.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50) }); gridPoints.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(100) }); gridPoints.RowDefinitions.Add(new RowDefinition { Height = new GridLength(30) }); Label fanLbl = FanlabelForScoreDisplay(p); if (fanLbl != null) { gridPoints.Children.Add(fanLbl); } Label fuLbl = FuLabelForScopreDisplay(p); if (fuLbl != null) { gridPoints.Children.Add(fuLbl); } gridPoints.Children.Add(GainLabelForScoreDisplay(p)); gridPoints.SetValue(DockPanel.DockProperty, Dock.Bottom); return(gridPoints); }
/// <summary> /// Generates a panel which contains every information about the value of the hand of the specified player. /// </summary> /// <param name="p">The player informations for this round.</param> /// <returns>A panel with informations about hand value.</returns> internal static DockPanel GenerateYakusInfosPanel(this EndOfRoundInformationsPivot.PlayerInformationsPivot p) { var boxPanel = new DockPanel(); Line separator = SeparatorForScoreDisplay(p); if (separator != null) { boxPanel.Children.Add(separator); } boxPanel.Children.Add(PointsGridForScoreDisplay(p)); boxPanel.Children.Add(HandPanelForScoreDisplay(p)); Grid gridYakus = YakusGridForScoreDisplay(p); if (gridYakus != null) { boxPanel.Children.Add(gridYakus); } return(boxPanel); }