Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qubqub committed Sep 9, 2023
1 parent 4a6b866 commit ed95908
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 36 deletions.
4 changes: 2 additions & 2 deletions Controls/TransparentLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void Draw(Graphics g) {

if (!string.IsNullOrEmpty(this.Text)) {
if (this.Name.Equals("lblPlayers")) {
if (this.SecondProgress > 0) this.FillRoundedRectangleF(g, new Pen(this.GetComplementaryColor(brFore.Color, 127)), new SolidBrush(this.GetComplementaryColor(brFore.Color, 127)), this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width * this.SecondProgress / 60f, this.ClientRectangle.Height, 4f);
if (this.SecondProgress > 0) this.FillRoundedRectangleF(g, new Pen(this.GetComplementaryColor(brFore.Color, 127)), new SolidBrush(this.GetComplementaryColor(brFore.Color, 127)), this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width * this.SecondProgress / 60f, this.ClientRectangle.Height * 2 - 1, 4f);
}
this.DrawOutlineText(g, this.ClientRectangle, null, brFore, this.Font.FontFamily, this.Font.Style, this.Font.Size * this.GetFontSizeFactor(), this.Text, stringFormat);
}
Expand Down Expand Up @@ -147,7 +147,7 @@ private float GetFontSizeFactor() {
(Stats.CurrentLanguage == 4 || Stats.CurrentLanguage == 5) ? (this.TextRight.Length > 17 ? (1f - (((this.TextRight.Length * 3.3f) - 68 + (this.Text.Length * 3.3f)) / 100f)) : 1f) : 1f;
case "lblPlayers":
return (Stats.CurrentLanguage == 0 || Stats.CurrentLanguage == 1) ? (this.TextRight.Length > 7 ? (1f - (((this.TextRight.Length * 3.3f) - 63 + (this.Text.Length * 3.3f)) / 100f)) : 1f) :
(Stats.CurrentLanguage == 2 || Stats.CurrentLanguage == 3) ? (this.TextRight.Length > 7 ? (1f - (((this.TextRight.Length * 3.3f) - 49 + (this.Text.Length * 3.3f)) / 100f)) : 1f) :
(Stats.CurrentLanguage == 2 || Stats.CurrentLanguage == 3) ? (this.TextRight.Length > 7 ? (1f - (((this.TextRight.Length * 3.3f) - 47 + (this.Text.Length * 3.3f)) / 100f)) : 1f) :
(Stats.CurrentLanguage == 4 || Stats.CurrentLanguage == 5) ? (this.TextRight.Length > 7 ? (1f - (((this.TextRight.Length * 3.3f) - 46 + (this.Text.Length * 3.3f)) / 100f)) : 1f) : 1f;
case "lblDuration":
return (Stats.CurrentLanguage == 0 || Stats.CurrentLanguage == 1) ? (this.Text.Length > 14 ? (1f - ((this.TextRight.Length - 42 + (this.Text.Length * 2.5f)) / 100f)) : 1f) :
Expand Down
77 changes: 43 additions & 34 deletions Views/Overlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ private void SetPlayersLabel() {
this.lblPingIcon.DrawVisible = false;
this.lblPlayers.SecondProgress = DateTime.Now.Second;
this.lblPlayers.Text = $"{Multilingual.GetWord("overlay_current_time")} :";
//this.lblPlayers.Text = $@"{DateTime.Now.ToString(Multilingual.GetWord("level_date_format"))}";
this.lblPlayers.TextRight = $"{DateTime.Now:HH\\:mm\\:ss}";
} else {
this.lblPlayers.SecondProgress = 0;
Expand Down Expand Up @@ -880,53 +881,61 @@ private void UpdateInfo() {
this.lastRound.CreativeTimeLimitSeconds = this.StatsForm.GetTimeLimitSecondsFromShareCode(this.lastRound.ShowNameId, levelType);
}

if (this.lastRound.UseShareCode) {
this.lblDuration.Text = this.lastRound.CreativeTimeLimitSeconds > 0 ? $"{Multilingual.GetWord("overlay_duration")} ({TimeSpan.FromSeconds(this.lastRound.CreativeTimeLimitSeconds):m\\:ss}) :"
: $"{Multilingual.GetWord("overlay_duration")} :";
if (!Stats.IsPrePlaying) {
this.lblDuration.SecondProgress = DateTime.Now.Second;
this.lblDuration.Text = "";
this.lblDuration.TextRight = $@"{DateTime.Now.ToString(Multilingual.GetWord("level_date_format"))}";
} else {
if ((("main_show".Equals(this.lastRound.ShowNameId) || level.IsCreative) || (!level.IsCreative && level.IsFinal)) && level.TimeLimitSeconds > 0) {
this.lblDuration.Text = $"{Multilingual.GetWord("overlay_duration")} ({TimeSpan.FromSeconds(level.TimeLimitSeconds):m\\:ss}) :";
} else if (("squads_2player_template".Equals(this.lastRound.ShowNameId) || "squads_4player".Equals(this.lastRound.ShowNameId)) && level.TimeLimitSecondsForSquad > 0) {
this.lblDuration.Text = $"{Multilingual.GetWord("overlay_duration")} ({TimeSpan.FromSeconds(level.TimeLimitSecondsForSquad):m\\:ss}) :";
} else {
this.lblDuration.Text = $"{Multilingual.GetWord("overlay_duration")} :";
}
}

if (end != DateTime.MinValue) {
this.lblPlayers.SecondProgress = 0;

if (this.lastRound.UseShareCode) {
if (this.lastRound.CreativeTimeLimitSeconds > 0) {
this.lblDuration.TextRight = $"{TimeSpan.FromSeconds(this.lastRound.CreativeTimeLimitSeconds) - (end - start):m\\:ss\\.ff}";
} else {
this.lblDuration.TextRight = $"{end - start:m\\:ss\\.ff}";
}
this.lblDuration.Text = this.lastRound.CreativeTimeLimitSeconds > 0 ? $"{Multilingual.GetWord("overlay_duration")} ({TimeSpan.FromSeconds(this.lastRound.CreativeTimeLimitSeconds):m\\:ss}) :"
: $"{Multilingual.GetWord("overlay_duration")} :";
} else {
if ((("main_show".Equals(this.lastRound.ShowNameId) || level.IsCreative) || (!level.IsCreative && level.IsFinal)) && level.TimeLimitSeconds > 0) {
this.lblDuration.TextRight = $"{TimeSpan.FromSeconds(level.TimeLimitSeconds) - (end - start):m\\:ss\\.ff}";
this.lblDuration.Text = $"{Multilingual.GetWord("overlay_duration")} ({TimeSpan.FromSeconds(level.TimeLimitSeconds):m\\:ss}) :";
} else if (("squads_2player_template".Equals(this.lastRound.ShowNameId) || "squads_4player".Equals(this.lastRound.ShowNameId)) && level.TimeLimitSecondsForSquad > 0) {
this.lblDuration.TextRight = $"{TimeSpan.FromSeconds(level.TimeLimitSecondsForSquad) - (end - start):m\\:ss\\.ff}";
this.lblDuration.Text = $"{Multilingual.GetWord("overlay_duration")} ({TimeSpan.FromSeconds(level.TimeLimitSecondsForSquad):m\\:ss}) :";
} else {
this.lblDuration.TextRight = $"{end - start:m\\:ss\\.ff}";
this.lblDuration.Text = $"{Multilingual.GetWord("overlay_duration")} :";
}
}
} else if (this.lastRound.Playing && Stats.IsPlaying) {
if (this.lastRound.UseShareCode) {
if (this.lastRound.CreativeTimeLimitSeconds > 0) {
this.lblDuration.TextRight = $"{TimeSpan.FromSeconds(this.lastRound.CreativeTimeLimitSeconds) - (DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start)):m\\:ss}";

if (end != DateTime.MinValue) {
if (this.lastRound.UseShareCode) {
if (this.lastRound.CreativeTimeLimitSeconds > 0) {
this.lblDuration.TextRight = $"{TimeSpan.FromSeconds(this.lastRound.CreativeTimeLimitSeconds) - (end - start):m\\:ss\\.ff}";
} else {
this.lblDuration.TextRight = $"{end - start:m\\:ss\\.ff}";
}
} else {
this.lblDuration.TextRight = $"{DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start):m\\:ss}";
if ((("main_show".Equals(this.lastRound.ShowNameId) || level.IsCreative) || (!level.IsCreative && level.IsFinal)) && level.TimeLimitSeconds > 0) {
this.lblDuration.TextRight = $"{TimeSpan.FromSeconds(level.TimeLimitSeconds) - (end - start):m\\:ss\\.ff}";
} else if (("squads_2player_template".Equals(this.lastRound.ShowNameId) || "squads_4player".Equals(this.lastRound.ShowNameId)) && level.TimeLimitSecondsForSquad > 0) {
this.lblDuration.TextRight = $"{TimeSpan.FromSeconds(level.TimeLimitSecondsForSquad) - (end - start):m\\:ss\\.ff}";
} else {
this.lblDuration.TextRight = $"{end - start:m\\:ss\\.ff}";
}
}
} else {
if ((("main_show".Equals(this.lastRound.ShowNameId) || level.IsCreative) || (!level.IsCreative && level.IsFinal)) && level.TimeLimitSeconds > 0) {
this.lblDuration.TextRight = $"{(TimeSpan.FromSeconds(level.TimeLimitSeconds)) - (DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start)):m\\:ss}";
} else if (("squads_2player_template".Equals(this.lastRound.ShowNameId) || "squads_4player".Equals(this.lastRound.ShowNameId)) && level.TimeLimitSecondsForSquad > 0) {
this.lblDuration.TextRight = $"{(TimeSpan.FromSeconds(level.TimeLimitSecondsForSquad)) - (DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start)):m\\:ss}";
} else if (this.lastRound.Playing && Stats.IsPlaying) {
if (this.lastRound.UseShareCode) {
if (this.lastRound.CreativeTimeLimitSeconds > 0) {
this.lblDuration.TextRight = $"{TimeSpan.FromSeconds(this.lastRound.CreativeTimeLimitSeconds) - (DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start)):m\\:ss}";
} else {
this.lblDuration.TextRight = $"{DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start):m\\:ss}";
}
} else {
this.lblDuration.TextRight = $"{DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start):m\\:ss}";
if ((("main_show".Equals(this.lastRound.ShowNameId) || level.IsCreative) || (!level.IsCreative && level.IsFinal)) && level.TimeLimitSeconds > 0) {
this.lblDuration.TextRight = $"{(TimeSpan.FromSeconds(level.TimeLimitSeconds)) - (DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start)):m\\:ss}";
} else if (("squads_2player_template".Equals(this.lastRound.ShowNameId) || "squads_4player".Equals(this.lastRound.ShowNameId)) && level.TimeLimitSecondsForSquad > 0) {
this.lblDuration.TextRight = $"{(TimeSpan.FromSeconds(level.TimeLimitSecondsForSquad)) - (DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start)):m\\:ss}";
} else {
this.lblDuration.TextRight = $"{DateTime.UtcNow - (start > DateTime.UtcNow ? startTime : start):m\\:ss}";
}
}
} else {
this.lblDuration.TextRight = "-";
}
} else {
this.lblDuration.TextRight = "-";
}
}
this.Invalidate();
Expand Down

0 comments on commit ed95908

Please sign in to comment.