Skip to content

Commit

Permalink
Merge pull request #68 from bertrey/fix-DisplayIssuesStarRating
Browse files Browse the repository at this point in the history
Fix for display issues star rating
  • Loading branch information
Rick164 committed Apr 6, 2018
2 parents 6bb3085 + 111c2fb commit b8d2593
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
9 changes: 5 additions & 4 deletions Shoko.MyAnime3/Logos.cs
Expand Up @@ -59,26 +59,27 @@ public static string buildRating(double value, string offstar, string onstar, in
Image off = ImageAllocator.LoadImageFastFromFile(GUIGraphicsContext.Skin + @"\Media\" + offstar);
Image on = ImageAllocator.LoadImageFastFromFile(GUIGraphicsContext.Skin + @"\Media\" + onstar);
int val = (int)Math.Floor(value);
string tmpfile = ((int)val).ToString(CultureInfo.InvariantCulture) + "_";
string tmpfile = onstar + "_" + ((int)val).ToString(CultureInfo.InvariantCulture) + "_";

for (int x = 0; x < 10; x++)
{
if (x < val)
{
g.DrawImageUnscaled(on, x * width, 0);
g.DrawImage(on, new Rectangle(x * width, 0, width, height), new Rectangle(0, 0, on.Width, on.Height), GraphicsUnit.Pixel);
}
if (x >= val)
{
g.DrawImageUnscaled(off, x * width, 0);
g.DrawImage(off, new Rectangle(x * width, 0, width, height), new Rectangle(0, 0, off.Width, off.Height), GraphicsUnit.Pixel);
}
if (x == val)
{
int sub = (int)((value - val) * width);
tmpfile += sub;
if (sub > 0)
{
var subSrc = (int)((value - val) * on.Width);
g.DrawImage(on, new Rectangle(x * width, 0, sub, height),
new Rectangle(0, 0, sub, height), GraphicsUnit.Pixel);
new Rectangle(0, 0, subSrc, on.Height), GraphicsUnit.Pixel);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Shoko.MyAnime3/Translation.cs
Expand Up @@ -583,7 +583,7 @@ public static string ParseString(string input)
public static string uTorrent="uTorrent";
public static string Version = "Version";
public static string ViewSeriesInfo = "View Series Info";
public static string Votes = "Votes";
public static string Votes = "votes";


public static string Year = "Year";
Expand Down
12 changes: 11 additions & 1 deletion Shoko.MyAnime3/Windows/MainWindow.cs
Expand Up @@ -3198,7 +3198,17 @@ private void Group_OnItemSelectedDisplay()
string rating = Utils.FormatAniDBRating((double) AniDBRating) + " (" + totalVotes + " " + Translation.Votes + ")";
SetGUIProperty(GuiProperty.SeriesGroup_RawRating, Utils.FormatAniDBRating((double) AniDBRating));
SetGUIProperty(GuiProperty.SeriesGroup_RatingVoteCount, totalVotes.ToString(Globals.Culture));
SetGUIProperty(GuiProperty.SeriesGroup_Rating, rating);
SetGUIProperty(GuiProperty.SeriesGroup_Rating, rating);

// Image Rankings
if (dummyStarOnPlaceholder != null && dummyStarOffPlaceholder != null)
{
string im = Logos.buildRating((double)AniDBRating, dummyStarOffPlaceholder.FileName,
dummyStarOnPlaceholder.FileName,
dummyStarOnPlaceholder.Width, dummyStarOnPlaceholder.Height);
SetGUIProperty(GuiProperty.RatingImage, im);
}


// set watched/unavailable flag
if (dummyIsWatched != null) dummyIsWatched.Visible = grp.UnwatchedEpisodeCount == 0;
Expand Down

0 comments on commit b8d2593

Please sign in to comment.