Esempio n. 1
0
 static int DrawBackgroundForCarNumberAndDriverName(GraphicRect graphics, int left, int top)
 {
     left += positionColumnWidth;
     graphics.InRectangle(left, top, leaderboardWidth - positionColumnWidth, rowHeight)
     .DrawBlackBackground();
     return(left);
 }
Esempio n. 2
0
        static int DrawCarNumber(GraphicRect graphics, Driver d, int left, int top)
        {
            graphics.InRectangle(left, top, carNumberColumnWidth, rowHeight)
            .DrawWhiteText(d.CarNumber, StringAlignment.Center);

            return(left + carNumberColumnWidth);
        }
Esempio n. 3
0
 private static void DrawLeaderboardRow(GraphicRect graphics, int top, Driver d, int left)
 {
     DrawPositionNumber(graphics, d, left, top);
     left = DrawBackgroundForCarNumberAndDriverName(graphics, left, top);
     left = DrawCarNumber(graphics, d, left, top);
     DrawDriverName(graphics, d, left, top);
 }
Esempio n. 4
0
 public static GraphicRect DrawGrayBackground(this GraphicRect rr)
 {
     return(rr
            .WithBrush(Styles.TransparentLightGray)
            .WithPen(Styles.WhitePen)
            .DrawRectangleWithoutBorder());
 }
Esempio n. 5
0
        static int DrawDividerLine(GraphicRect graphics, int left, int top)
        {
            graphics.InRectangle(left, top, leaderboardWidth, 4)
            .WithPen(Styles.DividerLinePen)
            .DrawLine(leaderboardLeft, top, leaderboardLeft + leaderboardWidth, top);

            return(top + 1);
        }
Esempio n. 6
0
        public static GraphicRect DrawWhiteText(this GraphicRect rr, string text, StringAlignment alignment)
        {
            rr.WithBrush(Styles.WhiteBrush)
            .WithStringFormat(alignment)
            .DrawText(text);

            return(rr);
        }
Esempio n. 7
0
 public static GraphicRect DrawWhiteGradiantBox(this GraphicRect rr)
 {
     return(rr
            .WithLinearGradientBrush(Color.DarkGray, Color.White, LinearGradientMode.Vertical)
            .WithPen(Styles.BlackPen)
            .DrawRectangleWithBorder()
            .WithBrush(Styles.BlackBrush));
 }
Esempio n. 8
0
 public static GraphicRect DrawRedGradiantBox(this GraphicRect rr)
 {
     return(rr
            .WithHeight(rr.Rectangle.Height + 3)
            .MoveUp(3)
            .WithLinearGradientBrush(Styles.RedBannerDark, Styles.RedBannerLight, LinearGradientMode.Vertical)
            .DrawRoundRectangle(5)
            .WithBrush(Styles.WhiteBrush));
 }
Esempio n. 9
0
        private int DrawLapCounterRow(GraphicRect graphics)
        {
            var counter = GetLapCounterDescription();

            graphics.InRectangle(leaderboardLeft, leaderboardTop, leaderboardWidth, rowHeight)
            .DrawBlackBackground()
            .DrawWhiteText(counter, StringAlignment.Center);

            return(leaderboardTop + rowHeight + counterGap);
        }
Esempio n. 10
0
 public DebugOuput()
 {
     font         = EngineCore.content.Load <SpriteFont>("DebugFont");
     choose       = new GraphicRect();
     choose.size  = Vector2.Zero;
     vline        = new GraphicRect();
     vline.pos.Y  = -10;
     vline.size.X = EngineCore.LengthToHundred(1);
     hline        = new GraphicRect();
     hline.size.Y = EngineCore.LengthToHundred(1);
 }
Esempio n. 11
0
        void DrawFlashCardOutro(GraphicRect r, int page)
        {
            var rsession = EventData.Race;
            var results  = EventData.Results;

            var offset = 5;

            Graphics.InRectangle(FlashCardLeft, r.Rectangle.Top, FlashCardWidth, 10)
            .WithPen(Styles.ThickBlackPen)
            .DrawLine(FlashCardLeft + 8, r.Rectangle.Top - offset, FlashCardLeft + FlashCardWidth - 16, r.Rectangle.Top - offset);

            var LeaderTime = TimeSpan.FromSeconds(results[0].Time);

            foreach (var racerResult in results.Skip(DriversPerPage * page).Take(DriversPerPage))
            {
                var driver = EventData.GetCompetingDriverByIndex(racerResult.CarIdx);

                var Gap = TimeSpan.FromSeconds(racerResult.Time) - LeaderTime; // Gap calculation
                if (Gap == TimeSpan.Zero)                                      //For the leader we want to display the race duration
                {
                    Gap = LeaderTime;
                }

                r.WithBrush(PreferredDriverNames.Any(d => d.UserName == driver.UserName) ? Styles.RedBrush : Styles.BlackBrush);

                r.Center(cg => cg
                         .DrawText(racerResult.Position.ToString())
                         .AfterText(racerResult.Position.ToString())
                         .MoveRight(1)
                         .WithFont(Settings.FontName, 16, FontStyle.Bold)
                         .DrawText(racerResult.Position.Ordinal()))
                .ToRight(width: 190, left: 30)
                .DrawText(Gap.ToString("hh\\:mm\\:ss\\.fff"))
                .ToRight(width: 80, left: 20)
                .DrawText(driver.CarNumber)
                .ToRight(width: 350)
                .DrawText(driver.UserName);

                r = r.ToBelow();

                Graphics.InRectangle(FlashCardLeft, r.Rectangle.Top, FlashCardWidth, 10)
                .WithPen(Styles.ThickBlackPen)
                .DrawLine(FlashCardLeft + 8, r.Rectangle.Top - offset, FlashCardLeft + FlashCardWidth - 16, r.Rectangle.Top - offset);
            }
        }
        void DrawFlashCardOutro(GraphicRect r, int page)
        {
            var rsession = EventData.Race;
            var results = EventData.Results;

            var offset = 5;
            Graphics.InRectangle(FlashCardLeft, r.Rectangle.Top, FlashCardWidth, 10)
                .WithPen(Styles.ThickBlackPen)
                .DrawLine(FlashCardLeft + 8, r.Rectangle.Top - offset, FlashCardLeft + FlashCardWidth - 16, r.Rectangle.Top - offset);

            var LeaderTime = TimeSpan.FromSeconds(results[0].Time);

            foreach (var racerResult in results.Skip(DriversPerPage * page).Take(DriversPerPage))
            {
                var driver = EventData.GetCompetingDriverByIndex(racerResult.CarIdx);

                var Gap = TimeSpan.FromSeconds(racerResult.Time) - LeaderTime; // Gap calculation
                if (Gap == TimeSpan.Zero) //For the leader we want to display the race duration
                    Gap = LeaderTime;

                r.WithBrush(PreferredDriverNames.Any(d => d.UserName == driver.UserName) ? Styles.RedBrush : Styles.BlackBrush);

                r.Center(cg => cg
                            .DrawText(racerResult.Position.ToString())
                            .AfterText(racerResult.Position.ToString())
                            .MoveRight(1)
                            .WithFont(Settings.FontName, 16, FontStyle.Bold)
                            .DrawText(racerResult.Position.Ordinal()))
                    .ToRight(width: 190, left: 30)
                    .DrawText(Gap.ToString("hh\\:mm\\:ss\\.fff"))
                    .ToRight(width: 80, left: 20)
                    .DrawText(driver.CarNumber)
                    .ToRight(width: 350)
                    .DrawText(driver.UserName);

                r = r.ToBelow();

                Graphics.InRectangle(FlashCardLeft, r.Rectangle.Top, FlashCardWidth, 10)
                    .WithPen(Styles.ThickBlackPen)
                    .DrawLine(FlashCardLeft + 8, r.Rectangle.Top - offset, FlashCardLeft + FlashCardWidth - 16, r.Rectangle.Top - offset);
            }
        }
Esempio n. 13
0
        void DrawFlashCardIntro(GraphicRect r, int page)
        {
            var totalWidth = FlashCardWidth;
            var left       = FlashCardLeft;

            var thisPageOfQualifyingResults = EventData.QualifyingResults.Skip(page * DriversPerPage).Take(DriversPerPage);

            var offset = 5;

            Graphics.InRectangle(left, r.Rectangle.Top, totalWidth, 10)
            .WithPen(Styles.ThickBlackPen)
            .DrawLine(left + 8, r.Rectangle.Top - offset, left + totalWidth - 16, r.Rectangle.Top - offset);

            foreach (var qualifier in thisPageOfQualifyingResults)
            {
                var driver = EventData.GetCompetingDriverByIndex(qualifier.CarIdx);

                r.Center(cg => cg
                         .DrawText(qualifier.Position.ToString())
                         .AfterText(qualifier.Position.ToString())
                         .MoveRight(1)
                         .WithFont(Settings.FontName, 16, FontStyle.Bold)
                         .DrawText(qualifier.Position.Ordinal()))
                .ToRight(width: 120, left: 30)
                .DrawText(TimeSpan.FromSeconds(qualifier.FastestTime).ToString("mm\\:ss\\.ff"))
                .ToRight(width: 60)
                .DrawText(driver.CarNumber)
                .ToRight(width: 300)
                .DrawText(driver.UserName);

                r = r.ToBelow();

                Graphics.InRectangle(left, r.Rectangle.Top, totalWidth, 10)
                .WithPen(Styles.ThickBlackPen)
                .DrawLine(left + 8, r.Rectangle.Top - offset, left + totalWidth - 16, r.Rectangle.Top - offset);
            }
        }
        void DrawFlashCardIntro(GraphicRect r, int page)
        {
            var totalWidth = FlashCardWidth;
            var left = FlashCardLeft;

            var thisPageOfQualifyingResults = EventData.QualifyingResults.Skip(page * DriversPerPage).Take(DriversPerPage);

            var offset = 5;
            Graphics.InRectangle(left, r.Rectangle.Top, totalWidth, 10)
                .WithPen(Styles.ThickBlackPen)
                .DrawLine(left + 8, r.Rectangle.Top - offset, left + totalWidth - 16, r.Rectangle.Top - offset);

            foreach (var qualifier in thisPageOfQualifyingResults)
            {
                var driver = EventData.GetCompetingDriverByIndex(qualifier.CarIdx);

                r.Center(cg => cg
                            .DrawText(qualifier.Position.ToString())
                            .AfterText(qualifier.Position.ToString())
                            .MoveRight(1)
                            .WithFont(Settings.FontName, 16, FontStyle.Bold)
                            .DrawText(qualifier.Position.Ordinal()))
                    .ToRight(width: 120, left: 30)
                    .DrawText(TimeSpan.FromSeconds(qualifier.FastestTime).ToString("mm\\:ss\\.ff"))
                    .ToRight(width: 60)
                    .DrawText(driver.CarNumber)
                    .ToRight(width: 300)
                    .DrawText(driver.UserName);

                r = r.ToBelow();

                Graphics.InRectangle(left, r.Rectangle.Top, totalWidth, 10)
                    .WithPen(Styles.ThickBlackPen)
                    .DrawLine(left + 8, r.Rectangle.Top - offset, left + totalWidth - 16, r.Rectangle.Top - offset);
            }
        }
Esempio n. 15
0
 static void DrawDriverName(GraphicRect graphics, Driver d, int left, int top)
 {
     graphics.InRectangle(left, top, nameColumnWidth, rowHeight)
     .DrawWhiteText(d.ShortName.FormattedForLeaderboard(), StringAlignment.Near);
 }
Esempio n. 16
0
 public static GraphicRect WithFontSizeOf(this GraphicRect rr, int fontSize)
 {
     return(rr
            .WithFont(Settings.FontName, fontSize, FontStyle.Regular));
 }
Esempio n. 17
0
 static void DrawPositionNumber(GraphicRect graphics, Driver d, int left, int top)
 {
     graphics.InRectangle(left, top, positionColumnWidth, rowHeight)
     .DrawGrayBackground()
     .DrawWhiteText(d.Position.ToString(), StringAlignment.Center);
 }