forked from vipoo/iRacingReplayOverlay.net
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrated standard overlay submodule
- Loading branch information
Showing
19 changed files
with
730 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule iRacingDirector.Plugin.StandardOverlays
deleted from
2698fd
21 changes: 21 additions & 0 deletions
21
plugins/iRacingDirector.Plugin.StandardOverlays/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
*.suo | ||
*.userprefs | ||
**/bin/* | ||
**/obj/* | ||
**/SampleRaceStream.bin | ||
packages/ | ||
TestResult.xml | ||
iRacingReplayOverlay.net.Tests.VisualState.xml | ||
publish/ | ||
publish-beta/ | ||
**/*.csproj.user | ||
**/*.log | ||
deploy/* | ||
!deploy/.keep | ||
!deploy/test/.keep | ||
Application Files | ||
setup.exe | ||
iRacingReplayOverlay.test.application | ||
.vs/* | ||
tools/encrypt.cmd | ||
Aws/AwsKeyActual.cs |
47 changes: 47 additions & 0 deletions
47
plugins/iRacingDirector.Plugin.StandardOverlays/MyPlugin.DriverCamera.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System.Drawing; | ||
using System.Drawing.Drawing2D; | ||
|
||
namespace iRacingDirector.Plugin.StandardOverlays | ||
{ | ||
public partial class MyPlugin | ||
{ | ||
public Driver CamDriver; | ||
|
||
void DrawCurrentDriverRow() | ||
{ | ||
var position = CamDriver.Position != null ? CamDriver.Position.Value.ToString() : ""; | ||
var indicator = CamDriver.Position != null ? CamDriver.Position.Value.Ordinal() : ""; | ||
|
||
var offset = 5; | ||
|
||
Graphics.InRectangle(1920 / 2 - 440 / 2, 980, 70, 40) | ||
.WithBrush(Styles.YellowBrush) | ||
.WithPen(Styles.BlackPen) | ||
.DrawRectangleWithBorder() | ||
.WithFontSizeOf(24) | ||
.WithBrush(Styles.BlackBrush) | ||
.WithStringFormat(StringAlignment.Near) | ||
.Center(cg => cg | ||
.DrawText(position, topOffset: offset) | ||
.AfterText(position) | ||
.MoveRight(3) | ||
.WithFont(Settings.FontName, 18, FontStyle.Bold) | ||
.DrawText(indicator, topOffset: offset) | ||
) | ||
|
||
.ToRight(width: 70) | ||
.WithLinearGradientBrush(Styles.White, Styles.WhiteSmoke, LinearGradientMode.BackwardDiagonal) | ||
.DrawRectangleWithBorder() | ||
.WithStringFormat(StringAlignment.Center) | ||
.WithBrush(Styles.BlackBrush) | ||
.DrawText(CamDriver.CarNumber, topOffset: offset) | ||
|
||
.ToRight(width: 300) | ||
.WithLinearGradientBrush(Styles.White, Styles.WhiteSmoke, LinearGradientMode.BackwardDiagonal) | ||
.DrawRectangleWithBorder() | ||
.WithStringFormat(StringAlignment.Center) | ||
.WithBrush(Styles.BlackBrush) | ||
.DrawText(CamDriver.UserName, topOffset: offset); | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
plugins/iRacingDirector.Plugin.StandardOverlays/MyPlugin.Extensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.Drawing.Drawing2D; | ||
|
||
namespace iRacingDirector.Plugin.StandardOverlays | ||
{ | ||
public static class MyPluginExtensions | ||
{ | ||
public static string FormattedForLeaderboard(this string shortName) | ||
{ | ||
var length = Math.Min(4, shortName.Length); | ||
return shortName.Substring(0, length).ToUpper(); | ||
} | ||
|
||
public static GraphicRect DrawGrayBackground(this GraphicRect rr) | ||
{ | ||
return rr | ||
.WithBrush(Styles.TransparentLightGray) | ||
.WithPen(Styles.BlackPen) | ||
.DrawRectangleWithBorder(); | ||
} | ||
|
||
public static GraphicRect WithFontSizeOf(this GraphicRect rr, int fontSize) | ||
{ | ||
return rr | ||
.WithFont(Settings.FontName, fontSize, FontStyle.Bold); | ||
} | ||
|
||
public static GraphicRect DrawWhiteGradiantBox(this GraphicRect rr) | ||
{ | ||
return rr | ||
.WithLinearGradientBrush(Color.DarkGray, Color.White, LinearGradientMode.Vertical) | ||
.WithPen(Styles.BlackPen) | ||
.DrawRectangleWithBorder() | ||
.WithBrush(Styles.BlackBrush); | ||
} | ||
|
||
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); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
plugins/iRacingDirector.Plugin.StandardOverlays/MyPlugin.FastestLaps.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Drawing; | ||
|
||
namespace iRacingDirector.Plugin.StandardOverlays | ||
{ | ||
public partial class MyPlugin | ||
{ | ||
public FastLap FastLap; | ||
|
||
void DrawFastestLap() | ||
{ | ||
if (FastLap == null) | ||
return; | ||
|
||
const int left = 1920 - 80 - 450; | ||
const int top = 900; | ||
|
||
Graphics.InRectangle(left, top + 34, 400, 34) | ||
.DrawRedGradiantBox(); | ||
|
||
Graphics.InRectangle(left, top + 34, 250, 34) | ||
.WithBrush(Styles.WhiteBrush) | ||
.WithFontSizeOf(19) | ||
.WithStringFormat(StringAlignment.Center) | ||
.DrawText(FastLap.Driver.UserName, topOffset: 5) | ||
.ToRight(width: 150) | ||
.DrawText(TimeSpan.FromSeconds(FastLap.Time).ToString(@"mm\:ss\.fff"), topOffset: 5); | ||
|
||
Graphics.InRectangle(left, top, 400, 34) | ||
.DrawWhiteGradiantBox() | ||
.WithBrush(Styles.BlackBrush) | ||
.WithFontSizeOf(18) | ||
.WithStringFormat(StringAlignment.Center) | ||
.DrawText("New Fast Lap", topOffset: 5); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
plugins/iRacingDirector.Plugin.StandardOverlays/MyPlugin.FlashCardHeading.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Drawing; | ||
|
||
namespace iRacingDirector.Plugin.StandardOverlays | ||
{ | ||
public partial class MyPlugin | ||
{ | ||
GraphicRect DrawFlashCardHeading(string title) | ||
{ | ||
var displayName = EventData.WeekendInfo.TrackDisplayName.ToUpper(); | ||
|
||
Graphics.InRectangle(FlashCardLeft, 250, FlashCardWidth, 575) | ||
.DrawGrayBackground(); | ||
|
||
Graphics.InRectangle(FlashCardLeft - 10, 311 - 2, FlashCardWidth - 100, 48) | ||
.DrawRedGradiantBox() | ||
.MoveDown(7) | ||
.MoveRight(20) | ||
.WithFontSizeOf(23) | ||
.WithStringFormat(StringAlignment.Near) | ||
.DrawText(title, topOffset: 4); | ||
|
||
Graphics.InRectangle(FlashCardLeft - 10, 240, FlashCardWidth - 100, 72) | ||
.DrawWhiteGradiantBox() | ||
.MoveDown(7) | ||
.MoveRight(20) | ||
.WithFontSizeOf(23) | ||
.WithStringFormat(StringAlignment.Near) | ||
.DrawText(displayName) | ||
.MoveDown(32) | ||
.WithFontSizeOf(17) | ||
.WithStringFormat(StringAlignment.Near) | ||
.DrawText(EventData.WeekendInfo.TrackCity.ToUpper() + ", " + EventData.WeekendInfo.TrackCountry.ToUpper()); | ||
|
||
return Graphics.InRectangle(FlashCardLeft + 30, 400, 60, 40) | ||
.WithPen(Styles.BlackPen) | ||
.WithBrush(Styles.BlackBrush) | ||
.WithFontSizeOf(20) | ||
.WithStringFormat(StringAlignment.Near); | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
plugins/iRacingDirector.Plugin.StandardOverlays/MyPlugin.FlashCardIntro.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using iRacingSDK; | ||
using System; | ||
using System.Drawing; | ||
using System.Linq; | ||
|
||
namespace iRacingDirector.Plugin.StandardOverlays | ||
{ | ||
public partial class MyPlugin | ||
{ | ||
void DrawIntroFlashCard(int page) | ||
{ | ||
var r = DrawFlashCardHeading("Qualifying Results"); | ||
|
||
DrawFlashCardIntro(r, page); | ||
} | ||
|
||
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); | ||
} | ||
} | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
plugins/iRacingDirector.Plugin.StandardOverlays/MyPlugin.FlashCardOutro.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.Linq; | ||
|
||
namespace iRacingDirector.Plugin.StandardOverlays | ||
{ | ||
public partial class MyPlugin | ||
{ | ||
public Driver[] PreferredDriverNames; | ||
|
||
void DrawOutroFlashCard(int page) | ||
{ | ||
var r = DrawFlashCardHeading("Race Results"); | ||
|
||
DrawFlashCardOutro(r, page); | ||
} | ||
|
||
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); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.