diff --git a/Output/Themes/Changelog/Changelog_ScreenScore.txt b/Output/Themes/Changelog/Changelog_ScreenScore.txt index 611a2621..d34205f0 100644 --- a/Output/Themes/Changelog/Changelog_ScreenScore.txt +++ b/Output/Themes/Changelog/Changelog_ScreenScore.txt @@ -1,5 +1,9 @@ ScreenScore ++++++++++ +Version 4: +Removed , , +Added +++++++++++++++++++++ Version 3: Add , , to change text-string with player-num >= Add , set to "vertical" to draw animation in vertical direction. diff --git a/Output/Themes/Changelog/Changelog_ScreenSing.txt b/Output/Themes/Changelog/Changelog_ScreenSing.txt index 3d735b97..0a87c825 100644 --- a/Output/Themes/Changelog/Changelog_ScreenSing.txt +++ b/Output/Themes/Changelog/Changelog_ScreenSing.txt @@ -1,5 +1,11 @@ ScreenSing ++++++++++ +Version 9 + +Add: + + +++++++++ Version 8 diff --git a/Output/Themes/Genius/01_Standard.xml b/Output/Themes/Genius/01_Standard.xml index d0daa747..bc2c91a0 100644 --- a/Output/Themes/Genius/01_Standard.xml +++ b/Output/Themes/Genius/01_Standard.xml @@ -260,6 +260,42 @@ 1.000 0.700 + + 0.878 + 0.274 + 0.254 + 1.000 + + + 0.988 + 0.494 + 0.207 + 1.000 + + + 0.988 + 0.843 + 0.207 + 1.000 + + + 0.921 + 0.988 + 0.207 + 1.000 + + + 0.807 + 0.968 + 0.278 + 1.000 + + + 0.482 + 0.937 + 0.027 + 1.000 + BG_Default.png @@ -316,6 +352,12 @@ VolUp.png VolDown.png RandomIcon.png + RatingBar.png + RatingBar.png + RatingBar.png + NotesFillLeft.png + NotesFillMid.png + NotesFillRight.png PopupBG.png ScrollUp.png ScrollDown.png @@ -331,4 +373,4 @@ IntroMid.mp4 IntroOut.mp4 - \ No newline at end of file + diff --git a/Output/Themes/Genius/02_Ice_Blue.xml b/Output/Themes/Genius/02_Ice_Blue.xml index c2d71ec4..0f61be86 100644 --- a/Output/Themes/Genius/02_Ice_Blue.xml +++ b/Output/Themes/Genius/02_Ice_Blue.xml @@ -260,6 +260,42 @@ 0.945 0.700 + + 0.878 + 0.274 + 0.254 + 1.000 + + + 0.988 + 0.494 + 0.207 + 1.000 + + + 0.988 + 0.843 + 0.207 + 1.000 + + + 0.921 + 0.988 + 0.207 + 1.000 + + + 0.807 + 0.968 + 0.278 + 1.000 + + + 0.482 + 0.937 + 0.027 + 1.000 + BG_Default.png @@ -316,6 +352,12 @@ VolUp.png VolDown.png RandomIcon.png + RatingBar.png + RatingBar.png + RatingBar.png + NotesFillLeft.png + NotesFillMid.png + NotesFillRight.png PopupBG.png ScrollUp.png ScrollDown.png @@ -331,4 +373,4 @@ IntroMid.mp4 IntroOut.mp4 - \ No newline at end of file + diff --git a/Output/Themes/Genius/03_Crimson_Red.xml b/Output/Themes/Genius/03_Crimson_Red.xml index 87f0b965..d9b61b8a 100644 --- a/Output/Themes/Genius/03_Crimson_Red.xml +++ b/Output/Themes/Genius/03_Crimson_Red.xml @@ -260,6 +260,42 @@ 0.733 0.700 + + 0.878 + 0.274 + 0.254 + 1.000 + + + 0.988 + 0.494 + 0.207 + 1.000 + + + 0.988 + 0.843 + 0.207 + 1.000 + + + 0.921 + 0.988 + 0.207 + 1.000 + + + 0.807 + 0.968 + 0.278 + 1.000 + + + 0.482 + 0.937 + 0.027 + 1.000 + BG_Default.png @@ -316,6 +352,12 @@ VolUp.png VolDown.png RandomIcon.png + RatingBar.png + RatingBar.png + RatingBar.png + NotesFillLeft.png + NotesFillMid.png + NotesFillRight.png PopupBG.png ScrollUp.png ScrollDown.png @@ -331,4 +373,4 @@ IntroMid.mp4 IntroOut.mp4 - \ No newline at end of file + diff --git a/Output/Themes/Genius/RatingBar.png b/Output/Themes/Genius/RatingBar.png new file mode 100644 index 00000000..6ff1bde8 Binary files /dev/null and b/Output/Themes/Genius/RatingBar.png differ diff --git a/Output/Themes/Genius/Screens/ScreenScore.xml b/Output/Themes/Genius/Screens/ScreenScore.xml index d2727b00..6ebbf94a 100644 --- a/Output/Themes/Genius/Screens/ScreenScore.xml +++ b/Output/Themes/Genius/Screens/ScreenScore.xml @@ -2,7 +2,7 @@ ScreenScore - 3 + 4 @@ -25,28 +25,6 @@ 0 - - PointsBarBG - - - 520 - 360 - 390 - 10 - 0 - - - - PointsBar - - - 520 - 360 - 390 - 10 - 0 - - @@ -58,28 +36,6 @@ 0 - - PointsBarBG - - - 520 - 290 - 390 - 10 - 0 - - - - PointsBar - - - 520 - 290 - 390 - 10 - 0 - - @@ -91,28 +47,6 @@ 0 - - PointsBarBG - - - 520 - 535 - 390 - 10 - 0 - - - - PointsBar - - - 520 - 535 - 390 - 10 - 0 - - @@ -124,28 +58,6 @@ 0 - - PointsBarBG - - - 520 - 221 - 390 - 10 - 0 - - - - PointsBar - - - 520 - 221 - 390 - 10 - 0 - - @@ -157,28 +69,6 @@ 0 - - PointsBarBG - - - 520 - 412 - 390 - 10 - 0 - - - - PointsBar - - - 520 - 412 - 390 - 10 - 0 - - @@ -190,28 +80,6 @@ 0 - - PointsBarBG - - - 520 - 603 - 390 - 10 - 0 - - - - PointsBar - - - 520 - 603 - 390 - 10 - 0 - - @@ -223,28 +91,6 @@ 0 - - PointsBarBG - - - 210 - 290 - 390 - 10 - 0 - - - - PointsBar - - - 210 - 290 - 390 - 10 - 0 - - @@ -256,28 +102,6 @@ 0 - - PointsBarBG - - - 210 - 535 - 390 - 10 - 0 - - - - PointsBar - - - 210 - 535 - 390 - 10 - 0 - - @@ -289,28 +113,6 @@ 0 - - PointsBarBG - - - 820 - 290 - 390 - 10 - 0 - - - - PointsBar - - - 820 - 290 - 390 - 10 - 0 - - @@ -322,28 +124,6 @@ 0 - - PointsBarBG - - - 820 - 535 - 390 - 10 - 0 - - - - PointsBar - - - 820 - 535 - 390 - 10 - 0 - - @@ -355,28 +135,6 @@ 0 - - PointsBarBG - - - 210 - 221 - 390 - 10 - 0 - - - - PointsBar - - - 210 - 221 - 390 - 10 - 0 - - @@ -388,28 +146,6 @@ 0 - - PointsBarBG - - - 210 - 412 - 390 - 10 - 0 - - - - PointsBar - - - 210 - 412 - 390 - 10 - 0 - - @@ -421,28 +157,6 @@ 0 - - PointsBarBG - - - 210 - 603 - 390 - 10 - 0 - - - - PointsBar - - - 210 - 603 - 390 - 10 - 0 - - @@ -454,28 +168,6 @@ 0 - - PointsBarBG - - - 820 - 221 - 390 - 10 - 0 - - - - PointsBar - - - 820 - 221 - 390 - 10 - 0 - - @@ -487,28 +179,6 @@ 0 - - PointsBarBG - - - 820 - 412 - 390 - 10 - 0 - - - - PointsBar - - - 820 - 412 - 390 - 10 - 0 - - @@ -520,28 +190,6 @@ 0 - - PointsBarBG - - - 210 - 221 - 390 - 10 - 0 - - - - PointsBar - - - 210 - 221 - 390 - 10 - 0 - - @@ -553,28 +201,6 @@ 0 - - PointsBarBG - - - 210 - 412 - 390 - 10 - 0 - - - - PointsBar - - - 210 - 412 - 390 - 10 - 0 - - @@ -586,28 +212,6 @@ 0 - - PointsBarBG - - - 210 - 603 - 390 - 10 - 0 - - - - PointsBar - - - 210 - 603 - 390 - 10 - 0 - - @@ -619,28 +223,6 @@ 0 - - PointsBarBG - - - 820 - 221 - 390 - 10 - 0 - - - - PointsBar - - - 820 - 221 - 390 - 10 - 0 - - @@ -652,28 +234,6 @@ 0 - - PointsBarBG - - - 820 - 412 - 390 - 10 - 0 - - - - PointsBar - - - 820 - 412 - 390 - 10 - 0 - - @@ -685,28 +245,6 @@ 0 - - PointsBarBG - - - 820 - 603 - 390 - 10 - 0 - - - - PointsBar - - - 820 - 603 - 390 - 10 - 0 - - @@ -1952,4 +1490,531 @@ String - \ No newline at end of file + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 520 + 360 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 520 + 290 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 520 + 535 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 520 + 221 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 520 + 412 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 520 + 603 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 210 + 290 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 210 + 535 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 820 + 290 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 820 + 535 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 210 + 221 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 210 + 412 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 210 + 603 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 820 + 221 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 820 + 412 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 210 + 221 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 210 + 412 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 210 + 603 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 820 + 221 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 820 + 412 + 390 + 10 + 0 + + + + PointsBarBG + + + + + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + + 0 + + + + + 820 + 603 + 390 + 10 + 0 + + + + diff --git a/Output/Themes/Genius/Screens/ScreenSing.xml b/Output/Themes/Genius/Screens/ScreenSing.xml index 6213c368..57c09eec 100644 --- a/Output/Themes/Genius/Screens/ScreenSing.xml +++ b/Output/Themes/Genius/Screens/ScreenSing.xml @@ -2,7 +2,7 @@ ScreenSing - 8 + 9 @@ -174,7 +174,7 @@ 50 -0.75 - + @@ -196,7 +196,7 @@ 50 -0.75 - + @@ -218,7 +218,8 @@ 50 -0.75 - + + @@ -344,7 +345,7 @@ - 1150 + 1085 150 100 50 @@ -1684,5 +1685,952 @@ + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1085 + 410 + 160 + 13 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1085 + 170 + 160 + 13 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1085 + 430 + 160 + 13 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1155 + 135 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1155 + 305 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1155 + 475 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 471 + 170 + 160 + 13 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 471 + 430 + 160 + 13 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1105 + 170 + 160 + 13 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1105 + 430 + 160 + 13 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 540 + 135 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 540 + 305 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 540 + 475 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1175 + 135 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1175 + 305 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 540 + 135 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 540 + 305 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 540 + 475 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1175 + 135 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1175 + 305 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + + RatingBarBackground + RatingBarForeground + RatingBarProgressLeft + RatingBarProgressMid + RatingBarProgressRight + + + Right + TR_CONFIG_ON + TR_CONFIG_ON + + 1175 + 475 + 85 + 7 + -0.75 + + + + 0 + + + + 0.16 + + + + 0.33 + + + + 0.5 + + + + 0.62 + + + + 0.8 + + + + + - \ No newline at end of file + diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 4cb98e49..3cc7d685 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -134,7 +134,6 @@ namespace Vocaluxe.Base // ReSharper restore MemberHidesStaticFromOuterClass [DefaultValue(ESongSorting.TR_CONFIG_ARTIST)] public ESongSorting SongSorting; [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn IgnoreArticles; - [DefaultValue(10)] public float ScoreAnimationTime; [DefaultValue(ETimerMode.TR_CONFIG_TIMERMODE_REMAINING)] public ETimerMode TimerMode; [XmlAltName("NumPlayer"), DefaultValue(2)] public int NumPlayers; [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn Tabs; @@ -344,8 +343,6 @@ namespace Vocaluxe.Base { Config.Game.SongFolder = SongFolders.ToArray(); } - if ((Config.Game.ScoreAnimationTime > 0 && Config.Game.ScoreAnimationTime < 1) || Config.Game.ScoreAnimationTime < 0) - Config.Game.ScoreAnimationTime = 1; if (Config.Game.MinLineBreakTime < 0) Config.Game.MinLineBreakTime = 0.1f; @@ -469,8 +466,6 @@ namespace Vocaluxe.Base return "SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting))); case "IgnoreArticles": return "Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); - case "ScoreAnimationTime": - return "ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds."; case "TimerMode": return "TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode))); case "NumPlayers": diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index 187ac2bf..baddbf11 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -199,6 +199,7 @@ namespace Vocaluxe.Base Players[i].Points = 0f; Players[i].PointsLineBonus = 0f; Players[i].PointsGoldenNotes = 0f; + Players[i].Rating = 0.5f; Players[i].VoiceNr = 0; Players[i].NoteDiff = 0; Players[i].SungLines = new List(); @@ -343,10 +344,11 @@ namespace Vocaluxe.Base } } - // Line Bonus + // Check if line ended int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Players[p].VoiceNr); if (beat == lines[line].LastNoteBeat && lines[line].Points > 0 && numLinesWithPoints > 0) { + // Line Bonus double factor = Players[p].SungLines[line].Points / (double)lines[line].Points; if (factor <= 0.4) factor = 0.0; @@ -363,6 +365,11 @@ namespace Vocaluxe.Base Players[p].Points += points; Players[p].PointsLineBonus += points; Players[p].SungLines[line].BonusPoints += points; + + //Calculate rating + //Shift fraction of correct sung notes to [-0.1, 0.1], player needs to sing five lines fully correctly to get highest ranking + double current = Players[p].SungLines[line].Points / (double)lines[line].Points; + Players[p].Rating = (Players[p].Rating + (current * 0.2 - 0.1)).Clamp(0, 1); } } } diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 2f4f564a..33bc3983 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -33,7 +33,7 @@ namespace Vocaluxe.Screens // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion { - get { return 3; } + get { return 4; } } private const string _TextSong = "TextSong"; @@ -41,7 +41,6 @@ namespace Vocaluxe.Screens private const string _ScreenSettingShortScore = "ScreenSettingShortScore"; private const string _ScreenSettingShortRating = "ScreenSettingShortRating"; private const string _ScreenSettingShortDifficulty = "ScreenSettingShortDifficulty"; - private const string _ScreenSettingAnimationDirection = "ScreenSettingAnimationDirection"; private CBackground _SlideShowBG; @@ -49,13 +48,10 @@ namespace Vocaluxe.Screens private string[,] _TextScores; private string[,] _TextRatings; private string[,] _TextDifficulty; - private string[,] _StaticPointsBarBG; - private string[,] _StaticPointsBar; + private string[,] _ProgressBarPoints; private string[,] _StaticAvatar; - private double[] _StaticPointsBarDrawnPoints; private int _Round; private CPoints _Points; - private Stopwatch _Timer; public override EMusicType CurrentMusicType { @@ -77,9 +73,12 @@ namespace Vocaluxe.Screens _ThemeStatics = statics.ToArray(); - _ThemeScreenSettings = new string[] {_ScreenSettingShortScore, _ScreenSettingShortRating, _ScreenSettingShortDifficulty, _ScreenSettingAnimationDirection}; + var progressBars = new List(); + _BuildProgressBarString(ref progressBars); - _StaticPointsBarDrawnPoints = new double[CSettings.MaxNumPlayer]; + _ThemeProgressBars = progressBars.ToArray(); + + _ThemeScreenSettings = new string[] {_ScreenSettingShortScore, _ScreenSettingShortRating, _ScreenSettingShortDifficulty}; _SlideShowBG = GetNewBackground(); _AddBackground(_SlideShowBG); @@ -157,34 +156,6 @@ namespace Vocaluxe.Screens for (int p = 0; p < players.Length; p++) players[p].Points = (int)(players[p].Points / CGame.NumRounds); } - for (int p = 0; p < players.Length; p++) - { - if (_StaticPointsBarDrawnPoints[p] < players[p].Points) - { - if (CConfig.Config.Game.ScoreAnimationTime >= 1) - { - _StaticPointsBarDrawnPoints[p] = (_Timer.ElapsedMilliseconds / 1000f) / CConfig.Config.Game.ScoreAnimationTime * 10000; - - - if (_StaticPointsBarDrawnPoints[p] > players[p].Points) - _StaticPointsBarDrawnPoints[p] = players[p].Points; - var direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); - if (direction.ToLower() == "vertical") - { - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = ((float)_StaticPointsBarDrawnPoints[p]) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].W / CSettings.MaxScore); - } - else - { - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = ((float)_StaticPointsBarDrawnPoints[p]) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H / CSettings.MaxScore); - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H; - } - } - } - } return true; } @@ -242,8 +213,6 @@ namespace Vocaluxe.Screens private void _BuildStaticStrings(ref List statics) { - _StaticPointsBar = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; - _StaticPointsBarBG = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; _StaticAvatar = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) @@ -253,17 +222,31 @@ namespace Vocaluxe.Screens if (player > numplayer) continue; string target = "P" + (player + 1) + "N" + (numplayer + 1); - _StaticPointsBarBG[player, numplayer] = "StaticPointsBarBG" + target; - _StaticPointsBar[player, numplayer] = "StaticPointsBar" + target; _StaticAvatar[player, numplayer] = "StaticAvatar" + target; - statics.Add(_StaticPointsBarBG[player, numplayer]); - statics.Add(_StaticPointsBar[player, numplayer]); statics.Add(_StaticAvatar[player, numplayer]); } } } + private void _BuildProgressBarString(ref List progressBars) + { + _ProgressBarPoints = new string[CSettings.MaxNumPlayer, CSettings.MaxNumPlayer]; + + for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) + { + for (int player = 0; player < CSettings.MaxNumPlayer; player++) + { + if (player > numplayer) + continue; + string target = "P" + (player + 1) + "N" + (numplayer + 1); + _ProgressBarPoints[player, numplayer] = "ProgressBarPoints" + target; + + progressBars.Add(_ProgressBarPoints[player, numplayer]); + } + } + } + private void _UpdateRatings() { CSong song = null; @@ -296,7 +279,6 @@ namespace Vocaluxe.Screens players[p].Points = (int)Math.Round(players[p].Points / CGame.NumRounds); } - var pointAnimDirection = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); for (int p = 0; p < players.Length; p++) { string name = CProfiles.GetPlayerName(players[p].ProfileID, p); @@ -326,43 +308,11 @@ namespace Vocaluxe.Screens else _Texts[_TextRatings[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points))); - _StaticPointsBarDrawnPoints[p] = 0.0; - if (pointAnimDirection.ToLower() == "vertical") - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = 0; - else - { - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = 0; - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H; - } + _ProgressBars[_ProgressBarPoints[p, CGame.NumPlayers - 1]].Progress = (float)players[p].Points / CSettings.MaxScore; + if (CProfiles.IsProfileIDValid(players[p].ProfileID)) _Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID); } - - if (CConfig.Config.Game.ScoreAnimationTime < 1) - { - for (int p = 0; p < CGame.NumPlayers; p++) - { - if (pointAnimDirection.ToLower() == "vertical") - { - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = ((float)players[p].Points) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].W / CSettings.MaxScore); - } - else - { - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = ((float)players[p].Points) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H / CSettings.MaxScore); - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H; - } - _StaticPointsBarDrawnPoints[p] = players[p].Points; - } - } - - _Timer = new Stopwatch(); - _Timer.Start(); } private void _SetVisibility() @@ -377,8 +327,8 @@ namespace Vocaluxe.Screens _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; _Texts[_TextRatings[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; _Texts[_TextDifficulty[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; - _Statics[_StaticPointsBar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; - _Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; + _ProgressBars[_ProgressBarPoints[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; + _ProgressBars[_ProgressBarPoints[player, numplayer]].Reset(true); _Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; _Statics[_StaticAvatar[player, numplayer]].Texture = null; diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 0ec56ba1..2996aa4e 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -38,7 +38,7 @@ namespace Vocaluxe.Screens // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion { - get { return 8; } + get { return 9; } } private struct STimeRect @@ -74,6 +74,8 @@ namespace Vocaluxe.Screens private string[,] _StaticScores; private string[,] _StaticAvatars; + private string[,] _ProgressBarsRating; + private const string _ButtonCancel = "ButtonCancel"; private const string _ButtonContinue = "ButtonContinue"; private const string _ButtonSkip = "ButtonSkip"; @@ -150,7 +152,10 @@ namespace Vocaluxe.Screens _StaticPauseBG }; _BuildStaticStrings(ref statics); - _ThemeStatics = statics.ToArray(); + + var progressbars = new List(); + _BuildProgressBarStrings(ref progressbars); + _ThemeProgressBars = progressbars.ToArray(); _ThemeButtons = new string[] {_ButtonCancel, _ButtonContinue, _ButtonSkip}; _ThemeLyrics = new string[] {_LyricMain, _LyricSub, _LyricMainDuet, _LyricSubDuet, _LyricMainTop, _LyricSubTop}; @@ -303,12 +308,14 @@ namespace Vocaluxe.Screens _UpdateSongText(); _UpdateDuetNames(); + if (_FadeOut) return true; _UpdateTimeLine(); CGame.UpdatePoints(_CurrentTime); + _UpdateRatingBars(); _UpdateLyrics(); if (CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY) _UpdateMedleyCountdown(); @@ -343,6 +350,7 @@ namespace Vocaluxe.Screens _Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Texts[_TextNames[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Texts[_TextScores[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; + _ProgressBars[_ProgressBarsRating[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; } } @@ -596,6 +604,9 @@ namespace Vocaluxe.Screens _DynamicLyricsTop = true; } + for (int p = 0; p < CGame.NumPlayers; p++) + _ProgressBars[_ProgressBarsRating[p, CGame.NumPlayers - 1]].Reset(); + _SetDuetLyricsVisibility(song.IsDuet); _SetNormalLyricsVisibility(); @@ -783,6 +794,7 @@ namespace Vocaluxe.Screens } } + private void _TogglePause() { _SetPause(!_Pause); @@ -826,8 +838,8 @@ namespace Vocaluxe.Screens private void _BuildStaticStrings(ref List statics) { - _StaticScores = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; - _StaticAvatars = new string[CSettings.MaxNumPlayer,CSettings.MaxNumPlayer]; + _StaticScores = new string[CSettings.MaxNumPlayer, CSettings.MaxNumPlayer]; + _StaticAvatars = new string[CSettings.MaxNumPlayer, CSettings.MaxNumPlayer]; for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) { @@ -846,6 +858,24 @@ namespace Vocaluxe.Screens } } + private void _BuildProgressBarStrings(ref List progressbars) + { + _ProgressBarsRating = new string[CSettings.MaxNumPlayer, CSettings.MaxNumPlayer]; + + for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) + { + for (int player = 0; player < CSettings.MaxNumPlayer; player++) + { + if (player <= numplayer) + { + string target = "P" + (player + 1) + "N" + (numplayer + 1); + _ProgressBarsRating[player, numplayer] = "ProgressBarRating" + target; + progressbars.Add(_ProgressBarsRating[player, numplayer]); + } + } + } + } + private void _SetVisibility() { _Statics[_StaticLyricsDuet].Visible = false; @@ -890,15 +920,16 @@ namespace Vocaluxe.Screens { for (int player = 0; player < CSettings.MaxNumPlayer && player <= numplayer; player++) { - bool isIvisible = numplayer + 1 == CGame.NumPlayers && player <= CGame.NumPlayers; - _Texts[_TextScores[player, numplayer]].Visible = isIvisible; - _Texts[_TextNames[player, numplayer]].Visible = isIvisible && + bool isVisible = numplayer + 1 == CGame.NumPlayers && player <= CGame.NumPlayers; + _Texts[_TextScores[player, numplayer]].Visible = isVisible; + _Texts[_TextNames[player, numplayer]].Visible = isVisible && (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); - _Statics[_StaticScores[player, numplayer]].Visible = isIvisible; - _Statics[_StaticAvatars[player, numplayer]].Visible = isIvisible && + _Statics[_StaticScores[player, numplayer]].Visible = isVisible; + _Statics[_StaticAvatars[player, numplayer]].Visible = isVisible && (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); + _ProgressBars[_ProgressBarsRating[player, numplayer]].Visible = isVisible; } } @@ -1371,5 +1402,13 @@ namespace Vocaluxe.Screens _Texts[_TextNames[i, CGame.NumPlayers - 1]].Visible = false; } } + + private void _UpdateRatingBars() + { + for (int i = 0; i < CGame.NumPlayers; i++) + { + _ProgressBars[_ProgressBarsRating[i, CGame.NumPlayers - 1]].Progress = (float)CGame.Players[i].Rating; + } + } } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/CInteraction.cs b/VocaluxeLib/Menu/CInteraction.cs index b2214075..354b299f 100644 --- a/VocaluxeLib/Menu/CInteraction.cs +++ b/VocaluxeLib/Menu/CInteraction.cs @@ -30,7 +30,8 @@ namespace VocaluxeLib.Menu NameSelection, Equalizer, Playlist, - ParticleEffect + ParticleEffect, + ProgressBar } public class CInteraction diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 27b6d316..1dd7d049 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -51,6 +51,7 @@ namespace VocaluxeLib.Menu [XmlArray("Playlists")] public List Playlists; [XmlArray("ParticleEffects")] public List ParticleEffects; [XmlArray("ScreenSettings")] public List ScreenSettings; + [XmlArray("ProgressBars")] public List ProgressBars; } struct SZSort @@ -82,6 +83,7 @@ namespace VocaluxeLib.Menu protected string[] _ThemePlaylists; protected string[] _ThemeParticleEffects; protected string[] _ThemeScreenSettings; + protected string[] _ThemeProgressBars; protected readonly Dictionary _ScreenSettings = new Dictionary(); // ReSharper restore MemberCanBePrivate.Global @@ -117,6 +119,7 @@ namespace VocaluxeLib.Menu _ThemePlaylists = null; _ThemeParticleEffects = null; _ThemeScreenSettings = null; + _ThemeProgressBars = null; } protected virtual void _OnSongMenuChanged() @@ -158,7 +161,7 @@ namespace VocaluxeLib.Menu private static readonly string[] _AllowedMissing = new string[] { "Backgrounds", "Statics", "Texts", "Buttons", "SongMenus", "Lyrics", "SelectSlides", "SingNotes", - "NameSelections", "Equalizers", "Playlists", "ParticleEffects", "ScreenSettings" + "NameSelections", "Equalizers", "Playlists", "ParticleEffects", "ScreenSettings", "ProgressBars" }; public override void HandleError(CXmlException e) @@ -211,6 +214,9 @@ namespace VocaluxeLib.Menu foreach (SThemePlaylist pl in Theme.Playlists) _AddPlaylist(new CPlaylist(pl, PartyModeID), pl.Name); + foreach (SThemeProgressBar pb in Theme.ProgressBars) + _AddProgressBar(new CProgressBar(pb, PartyModeID), pb.Name); + foreach (SThemeScreenSetting ss in Theme.ScreenSettings) _AddScreenSetting(new CScreenSetting(ss, PartyModeID), ss.Name); @@ -351,6 +357,7 @@ namespace VocaluxeLib.Menu _AddThemeablesToList(Theme.NameSelections, _NameSelections); _AddThemeablesToList(Theme.ParticleEffects, _ParticleEffects); _AddThemeablesToList(Theme.Playlists, _Playlists); + _AddThemeablesToList(Theme.ProgressBars, _ProgressBars); _AddThemeablesToList(Theme.ScreenSettings, _ScreenSettings.Values); _AddThemeablesToList(Theme.SelectSlides, _SelectSlides); _AddThemeablesToList(Theme.Statics, _Statics); @@ -471,6 +478,16 @@ namespace VocaluxeLib.Menu return new CParticleEffect(PartyModeID, maxNumber, color, area, texture, size, type); } + public CProgressBar GetNewProgressBar() + { + return new CProgressBar(PartyModeID); + } + + public CProgressBar GetNewProgressBar(CProgressBar pb) + { + return new CProgressBar(pb); + } + // ReSharper restore MemberCanBeProtected.Global // ReSharper restore UnusedMember.Global #endregion Create Elements diff --git a/VocaluxeLib/Menu/CObjectInteractions.cs b/VocaluxeLib/Menu/CObjectInteractions.cs index 2d73dd4a..bf83b4e5 100644 --- a/VocaluxeLib/Menu/CObjectInteractions.cs +++ b/VocaluxeLib/Menu/CObjectInteractions.cs @@ -46,6 +46,7 @@ namespace VocaluxeLib.Menu protected readonly COrderedDictionaryLite _Equalizers; protected readonly COrderedDictionaryLite _Playlists; protected readonly COrderedDictionaryLite _ParticleEffects; + protected readonly COrderedDictionaryLite _ProgressBars; private readonly SColorF _HighlightColor = new SColorF(1, 0, 0, 0); protected CObjectInteractions() @@ -62,6 +63,7 @@ namespace VocaluxeLib.Menu _Equalizers = new COrderedDictionaryLite(this); _Playlists = new COrderedDictionaryLite(this); _ParticleEffects = new COrderedDictionaryLite(this); + _ProgressBars = new COrderedDictionaryLite(this); } public virtual void Init() @@ -86,6 +88,7 @@ namespace VocaluxeLib.Menu _Equalizers.Clear(); _Playlists.Clear(); _ParticleEffects.Clear(); + _ProgressBars.Clear(); } private void _SetSelected(int newSelection) @@ -297,6 +300,8 @@ namespace VocaluxeLib.Menu return _Playlists[element.Num]; case EType.ParticleEffect: return _ParticleEffects[element.Num]; + case EType.ProgressBar: + return _ProgressBars[element.Num]; } throw new ArgumentException("Invalid element type: " + element.Type); } @@ -401,6 +406,11 @@ namespace VocaluxeLib.Menu { _AddElement(_ParticleEffects.Add(pe, key), EType.ParticleEffect); } + + protected void _AddProgressBar(CProgressBar pb, String key = null) + { + _AddElement(_ProgressBars.Add(pb, key), EType.ProgressBar); + } #endregion Element-Adding #region InteractionHandling diff --git a/VocaluxeLib/Menu/CProgressBar.cs b/VocaluxeLib/Menu/CProgressBar.cs new file mode 100644 index 00000000..f7cbf6fd --- /dev/null +++ b/VocaluxeLib/Menu/CProgressBar.cs @@ -0,0 +1,497 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Xml.Serialization; +using VocaluxeLib.Draw; +using VocaluxeLib.Xml; + +namespace VocaluxeLib.Menu +{ + [XmlType("ProgressColor")] + public struct SThemeProgressBarColor + { + public float From; + public SThemeColor Color; + } + + [XmlType("ProgressBar")] + public struct SThemeProgressBar + { + [XmlAttribute(AttributeName = "Name")] public string Name; + public string SkinBackground; + public string SkinForeground; + public string SkinProgressLeft; + public string SkinProgressMid; + public string SkinProgressRight; + public SThemeColor ColorBackground; + public SThemeColor ColorForeground; + public EDirection Direction; + public EOffOn AnimateMovement; + public EOffOn AnimateColoring; + public SRectF Rect; + [XmlArrayItem("ProgressColor"), XmlArray] public List ProgressColors; + public SReflection? Reflection; + } + + public sealed class CProgressBar : CMenuElementBase, IMenuElement, IThemeable + { + private readonly int _PartyModeID; + + private SThemeProgressBar _Theme; + + public string GetThemeName() + { + return _Theme.Name; + } + + public bool ThemeLoaded { get; private set; } + + public bool Selectable + { + get { return false; } + } + + private CTextureRef _TextureBackground; + public CTextureRef TextureBackground + { + get { return _TextureBackground ?? CBase.Themes.GetSkinTexture(_Theme.SkinBackground, _PartyModeID); } + + set { _TextureBackground = value; } + } + + private CTextureRef _TextureForeground; + public CTextureRef TextureForeground + { + get { return _TextureForeground ?? CBase.Themes.GetSkinTexture(_Theme.SkinForeground, _PartyModeID); } + + set { _TextureForeground = value; } + } + + private CTextureRef _TextureProgressLeft; + public CTextureRef TextureProgressLeft + { + get { return _TextureProgressLeft ?? CBase.Themes.GetSkinTexture(_Theme.SkinProgressLeft, _PartyModeID); } + + set { _TextureProgressLeft = value; } + } + + private CTextureRef _TextureProgressMid; + public CTextureRef TextureProgressMid + { + get { return _TextureProgressMid ?? CBase.Themes.GetSkinTexture(_Theme.SkinProgressMid, _PartyModeID); } + + set { _TextureProgressMid = value; } + } + + private CTextureRef _TextureProgressRight; + public CTextureRef TextureProgressRight + { + get { return _TextureProgressRight ?? CBase.Themes.GetSkinTexture(_Theme.SkinProgressRight, _PartyModeID); } + + set { _TextureProgressRight = value; } + } + + public SColorF ColorBackground; + public SColorF ColorForeground; + + public bool Reflection; + public float ReflectionSpace; + public float ReflectionHeight; + + public float Alpha = 1; + + private float _ProgressTarget; + public float Progress + { + get { return _ProgressTarget; } + set + { + //Animation is still running, so use current state for calculations + if(_ProgressCurrent != _ProgressTarget) + { + _ProgressLast = _ProgressCurrent; + _ColorProgressLast = _ColorProgressCurrent; + } + _ProgressTarget = value; + } + } + private float _ProgressCurrent; + private float _ProgressLast; + + private SColorF _ColorProgressCurrent; + private SColorF _ColorProgressTarget; + private SColorF _ColorProgressLast; + + private SRectF _RectProgressBegin; + private SRectF _RectProgressMid; + private SRectF _RectProgressEnd; + + private CTextureRef _TextureProgressBegin; + private CTextureRef _TextureProgressEnd; + + private Stopwatch _AnimTimer; + private float _AnimDuration; + private bool _Animate; + + public CProgressBar(int partyModeID) + { + _PartyModeID = partyModeID; + _AnimTimer = new Stopwatch(); + } + + public CProgressBar(CProgressBar pb) + { + _PartyModeID = pb._PartyModeID; + + _TextureBackground = pb.TextureBackground; + _TextureForeground = pb.TextureForeground; + _TextureProgressLeft = pb.TextureProgressLeft; + _TextureProgressMid = pb._TextureProgressMid; + _TextureProgressRight = pb._TextureProgressRight; + + ColorBackground = pb.ColorBackground; + ColorForeground = pb.ColorForeground; + + MaxRect = pb.MaxRect; + Reflection = pb.Reflection; + ReflectionSpace = pb.ReflectionHeight; + ReflectionHeight = pb.ReflectionSpace; + + Alpha = pb.Alpha; + Visible = pb.Visible; + + _AnimTimer = new Stopwatch(); + } + + public CProgressBar(SThemeProgressBar theme, int partyModeID) + { + _PartyModeID = partyModeID; + _Theme = theme; + _Theme.ProgressColors.Sort((x, y) => x.From.CompareTo(y.From)); + _UpdateProgress(); + ThemeLoaded = true; + + _AnimTimer = new Stopwatch(); + } + + public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader) + { + //Will be removed + return false; + } + + public void Reset(bool animateInit = false) + { + _Animate = animateInit; + + _Theme.ProgressColors[0].Color.Get(_PartyModeID, out _ColorProgressLast); + } + + public void Draw() + { + Draw(1f); + } + + public void Draw(float scale = 1f, float zModify = 0f, bool forceDraw = false) + { + if (scale <= 0) + return; + + if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme)) + { + _UpdateProgress(); + + //Draw background + SColorF color = new SColorF(ColorBackground.R, ColorBackground.G, ColorBackground.B, ColorBackground.A * Alpha); + if (_TextureBackground != null) + { + CBase.Drawing.DrawTexture(_TextureBackground, Rect, color); + if (Reflection) + CBase.Drawing.DrawTextureReflection(_TextureBackground, Rect, color, Rect, ReflectionSpace, ReflectionHeight); + } + + //Draw progress + color = new SColorF(_ColorProgressCurrent.R, _ColorProgressCurrent.G, _ColorProgressCurrent.B, _ColorProgressCurrent.A * Alpha); + if (_TextureProgressBegin != null) + { + CBase.Drawing.DrawTexture(_TextureProgressBegin, _RectProgressBegin, color); + if (Reflection) + CBase.Drawing.DrawTextureReflection(_TextureProgressBegin, _RectProgressBegin, color, _RectProgressBegin, ReflectionSpace, ReflectionHeight); + } + + if (_TextureProgressMid != null) + { + CBase.Drawing.DrawTexture(_TextureProgressMid, _RectProgressMid, color); + if (Reflection) + CBase.Drawing.DrawTextureReflection(_TextureProgressMid, _RectProgressMid, color, _RectProgressMid, ReflectionSpace, ReflectionHeight); + } + else + CBase.Drawing.DrawRect(_ColorProgressCurrent, _RectProgressMid); + + if (_TextureProgressEnd != null) + { + CBase.Drawing.DrawTexture(_TextureProgressEnd, _RectProgressEnd, color); + if (Reflection) + CBase.Drawing.DrawTextureReflection(_TextureProgressEnd, _RectProgressEnd, color, _RectProgressEnd, ReflectionSpace, ReflectionHeight); + } + + //Draw foreground + color = new SColorF(ColorForeground.R, ColorForeground.G, ColorForeground.B, ColorForeground.A * Alpha); + if (_TextureForeground != null) + { + CBase.Drawing.DrawTexture(_TextureForeground, Rect, color); + if (Reflection) + CBase.Drawing.DrawTextureReflection(_TextureForeground, Rect, color, Rect, ReflectionSpace, ReflectionHeight); + } + } + + if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme)) + CBase.Drawing.DrawRect(new SColorF(1f, 1f, 1f, 0.5f), Rect); + } + + public void UnloadSkin() {} + + public void LoadSkin() + { + if (!ThemeLoaded) + return; + _Theme.ColorBackground.Get(_PartyModeID, out ColorBackground); + _Theme.ColorForeground.Get(_PartyModeID, out ColorForeground); + + TextureBackground = CBase.Themes.GetSkinTexture(_Theme.SkinBackground, _PartyModeID); + TextureForeground = CBase.Themes.GetSkinTexture(_Theme.SkinForeground, _PartyModeID); + TextureProgressLeft = CBase.Themes.GetSkinTexture(_Theme.SkinProgressLeft, _PartyModeID); + TextureProgressMid = CBase.Themes.GetSkinTexture(_Theme.SkinProgressMid, _PartyModeID); + TextureProgressRight = CBase.Themes.GetSkinTexture(_Theme.SkinProgressRight, _PartyModeID); + + MaxRect = _Theme.Rect; + Reflection = _Theme.Reflection.HasValue; + if (Reflection) + { + Debug.Assert(_Theme.Reflection != null); + ReflectionSpace = _Theme.Reflection.Value.Space; + ReflectionHeight = _Theme.Reflection.Value.Height; + } + } + + public void ReloadSkin() + { + UnloadSkin(); + LoadSkin(); + } + + public object GetTheme() + { + return _Theme; + } + + private void _UpdateProgress() + { + if (_ProgressCurrent == _ProgressTarget) + return; + + if (_Animate) + _CheckAnimation(); + else + _ProgressCurrent = _ProgressLast = _ProgressTarget; + + _UpdateProgressColor(); + + _UpdateProgressLeft(); + _UpdateProgressMid(); + _UpdateProgressRight(); + } + + private void _CheckAnimation() + { + //Check if animation needs to be started + if (_Theme.AnimateColoring == EOffOn.TR_CONFIG_ON || _Theme.AnimateMovement == EOffOn.TR_CONFIG_ON) + { + if (!_AnimTimer.IsRunning) + { + _AnimTimer.Restart(); + //Calc animation duration in ms based on rect size and progress change + if (_Theme.Direction == EDirection.Left || _Theme.Direction == EDirection.Right) + _AnimDuration = Math.Max(100f, (_Theme.Rect.W * 0.015f * 1000) * Math.Abs(_ProgressTarget - _ProgressCurrent)); + else + _AnimDuration = Math.Max(100f, (_Theme.Rect.H * 0.015f * 1000) * Math.Abs(_ProgressTarget - _ProgressCurrent)); + } + } + //Movement animation + if (_Theme.AnimateMovement == EOffOn.TR_CONFIG_ON) + _ProgressCurrent = _ProgressLast + (_AnimTimer.ElapsedMilliseconds / _AnimDuration).Clamp(0, 1) * (_ProgressTarget - _ProgressLast); + + //Check if animation needs to be stopped + if (_ProgressCurrent == _ProgressTarget) + { + _AnimTimer.Stop(); + + _ProgressLast = _ProgressCurrent = _ProgressTarget; + _ColorProgressLast = _ColorProgressCurrent = _ColorProgressTarget; + } + + _Animate = true; + } + + private void _UpdateProgressColor() + { + foreach (SThemeProgressBarColor col in _Theme.ProgressColors) + if (col.From < _ProgressTarget) + col.Color.Get(_PartyModeID, out _ColorProgressTarget); + + if(_Animate && _Theme.AnimateColoring == EOffOn.TR_CONFIG_ON) + { + float animFactor = (_AnimTimer.ElapsedMilliseconds / _AnimDuration).Clamp(0, 1); + + _ColorProgressCurrent.R = _ColorProgressLast.R + animFactor * (_ColorProgressTarget.R - _ColorProgressLast.R); + _ColorProgressCurrent.G = _ColorProgressLast.G + animFactor * (_ColorProgressTarget.G - _ColorProgressLast.G); + _ColorProgressCurrent.B = _ColorProgressLast.B + animFactor * (_ColorProgressTarget.B - _ColorProgressLast.B); + _ColorProgressCurrent.A = _ColorProgressLast.A + animFactor * (_ColorProgressTarget.A - _ColorProgressLast.A); + } + else + _ColorProgressCurrent = _ColorProgressLast = _ColorProgressTarget; + } + + private void _UpdateProgressLeft() + { + switch (_Theme.Direction) + { + case EDirection.Right: + _TextureProgressBegin = TextureProgressLeft; + if (_TextureProgressBegin == null) + _RectProgressBegin = new SRectF(Rect.X, Rect.Y, 0, 0, Rect.Z); + else + _RectProgressBegin = new SRectF(Rect.X, Rect.Y, Rect.H * _TextureProgressBegin.OrigAspect, Rect.H, Rect.Z); + break; + + case EDirection.Up: + _TextureProgressBegin = TextureProgressRight; + if (_TextureProgressBegin == null) + _RectProgressBegin = new SRectF(Rect.X, Rect.Y + Rect.H, 0, 0, Rect.Z); + else + _RectProgressBegin = new SRectF(Rect.X, Rect.Y + Rect.H - Rect.W * _TextureProgressBegin.OrigAspect, Rect.W, Rect.W * _TextureProgressBegin.OrigAspect, Rect.Z); + break; + + case EDirection.Left: + _TextureProgressBegin = TextureProgressRight; + if (_TextureProgressBegin == null) + _RectProgressBegin = new SRectF(Rect.X + Rect.W, Rect.Y, 0, 0, Rect.Z); + else + _RectProgressBegin = new SRectF(Rect.X + Rect.W - Rect.H * _TextureProgressBegin.OrigAspect, Rect.Y, Rect.H *_TextureProgressBegin.OrigAspect, Rect.H, Rect.Z); + break; + + case EDirection.Down: + _TextureProgressBegin = TextureProgressLeft; + if (_TextureProgressBegin == null) + _RectProgressBegin = new SRectF(Rect.X, Rect.Y, 0, 0, Rect.Z); + else + _RectProgressBegin = new SRectF(Rect.X, Rect.Y, Rect.W, Rect.W * _TextureProgressBegin.OrigAspect, Rect.Z); + break; + } + } + + private void _UpdateProgressMid() + { + switch (_Theme.Direction) + { + case EDirection.Right: + _RectProgressMid = new SRectF(_RectProgressBegin.X + _RectProgressBegin.W, Rect.Y, (Rect.W - 2 * _RectProgressBegin.W) * _ProgressCurrent, Rect.H, Rect.Z); + break; + + case EDirection.Up: + float newHeight = (Rect.H - 2 * _RectProgressBegin.H) * _ProgressCurrent; + _RectProgressMid = new SRectF(Rect.X, _RectProgressBegin.Y - newHeight, Rect.W, newHeight, Rect.Z); + break; + + case EDirection.Left: + float newWidth = (Rect.W - 2 * _RectProgressBegin.H) * _ProgressCurrent; + _RectProgressMid = new SRectF(_RectProgressBegin.X - newWidth, Rect.Y, newWidth, Rect.H, Rect.Z); + break; + + case EDirection.Down: + _RectProgressMid = new SRectF(Rect.X, _RectProgressBegin.Y + _RectProgressBegin.H, (Rect.H - 2 * _RectProgressBegin.W) * _ProgressCurrent, Rect.W, Rect.Z); + break; + } + } + + private void _UpdateProgressRight() + { + switch (_Theme.Direction) + { + case EDirection.Right: + _TextureProgressEnd = _TextureProgressRight; + if (_TextureProgressEnd == null) + _RectProgressEnd = new SRectF(_RectProgressMid.X + _RectProgressMid.W, Rect.Y, 0, 0, Rect.Z); + else + _RectProgressEnd = new SRectF(_RectProgressMid.X + _RectProgressMid.W, Rect.Y, Rect.H * _TextureProgressBegin.OrigAspect, Rect.H, Rect.Z); + break; + + case EDirection.Up: + _TextureProgressEnd = _TextureProgressLeft; + if (_TextureProgressEnd == null) + _RectProgressEnd = new SRectF(Rect.X, _RectProgressMid.Y + Rect.W, 0, 0, Rect.Z); + else + _RectProgressEnd = new SRectF(Rect.X, _RectProgressMid.Y + Rect.W, Rect.W, Rect.W * _TextureProgressBegin.OrigAspect, Rect.Z); + break; + + case EDirection.Left: + _TextureProgressEnd = _TextureProgressLeft; + if (_TextureProgressEnd == null) + _RectProgressEnd = new SRectF(_RectProgressMid.X - Rect.H, Rect.Y, 0, 0, Rect.Z); + else + _RectProgressEnd = new SRectF(_RectProgressMid.X - Rect.H, Rect.Y, Rect.H * _TextureProgressBegin.OrigAspect, Rect.H, Rect.Z); + break; + + case EDirection.Down: + _TextureProgressEnd = _TextureProgressRight; + if (_TextureProgressEnd == null) + _RectProgressEnd = new SRectF(Rect.X, _RectProgressMid.Y + _RectProgressMid.H, 0, 0, Rect.Z); + else + _RectProgressEnd = new SRectF(Rect.X, _RectProgressMid.Y + _RectProgressMid.H, Rect.W, Rect.W * _TextureProgressBegin.OrigAspect, Rect.Z); + break; + } + } + + #region ThemeEdit + public void MoveElement(int stepX, int stepY) + { + X += stepX; + Y += stepY; + + _Theme.Rect.X += stepX; + _Theme.Rect.Y += stepY; + } + + public void ResizeElement(int stepW, int stepH) + { + W += stepW; + if (W <= 0) + W = 1; + + H += stepH; + if (H <= 0) + H = 1; + + _Theme.Rect.W = Rect.W; + _Theme.Rect.H = Rect.H; + } + #endregion ThemeEdit + } +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index c655ddab..9f7ca429 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -69,6 +69,15 @@ namespace VocaluxeLib.Menu public EAspect Aspect = EAspect.Stretch; + /// + /// Adjust this value if you want to draw only a part of your texture, width + /// + public float ModW = -1f; + /// + /// Adjust this value if you want to draw only a part of your texture, height + /// + public float ModH = -1f; + public CStatic(int partyModeID) { _PartyModeID = partyModeID; @@ -168,8 +177,21 @@ namespace VocaluxeLib.Menu { CTextureRef texture = Texture; SRectF bounds = Rect.Scale(scale); + + //Change bounds if rect size should be modified without adjusting texture + if (ModH != -1) + bounds.H = ModH * scale; + if (ModW != -1) + bounds.W = ModW * scale; + bounds.Z += zModify; + SRectF rect = texture == null ? bounds : CHelper.FitInBounds(bounds, texture.OrigAspect, aspect); + + //Use original rect + if (ModH != -1 || ModW != -1) + rect = Rect.Scale(scale); + var color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha); if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme)) { diff --git a/VocaluxeLib/Structs.cs b/VocaluxeLib/Structs.cs index 09a1b960..9c1d4a0b 100644 --- a/VocaluxeLib/Structs.cs +++ b/VocaluxeLib/Structs.cs @@ -362,6 +362,7 @@ namespace VocaluxeLib public double Points; public double PointsLineBonus; public double PointsGoldenNotes; + public double Rating; public int NoteDiff; public int VoiceNr; public List SungLines; diff --git a/VocaluxeLib/VocaluxeLib.csproj b/VocaluxeLib/VocaluxeLib.csproj index 5222c389..2950a6ed 100644 --- a/VocaluxeLib/VocaluxeLib.csproj +++ b/VocaluxeLib/VocaluxeLib.csproj @@ -105,6 +105,7 @@ +