Feature/rating pop up (#760)

* WIP

* WIP

* Add text

* Cleanup

* More Cleanup

* Update Changelog

* Fix layout

---------

Co-authored-by: Florian Schulze <flori.schulze@yahoo.de>
Co-authored-by: Florian Ostertag <flokuep@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-03-25 06:26:37 +01:00
1 parent 478f937771
commit 360c6ae2fa
12 files changed
+828 -3

No files matched your search

+8
View File
@@ -174,6 +174,14 @@
<string name="TR_SCREENSING_NOMORESONGS">No more songs in playlist!</string>
<string name="TR_SCREENSING_NOWEBCAM">No webcam available!</string>
<string name="TR_SCREENSING_ASPECTRATIO">Aspect Ratio: %a</string>
<string name="TR_SCREENSING_RATING_1">perfect!</string>
<string name="TR_SCREENSING_RATING_2">awesome!</string>
<string name="TR_SCREENSING_RATING_3">great!</string>
<string name="TR_SCREENSING_RATING_4">good!</string>
<string name="TR_SCREENSING_RATING_5">not bad!</string>
<string name="TR_SCREENSING_RATING_6">bad!</string>
<string name="TR_SCREENSING_RATING_7">poor!</string>
<string name="TR_SCREENSING_RATING_8">awful!</string>
<string name="TR_SCREENSING_SKIPPEDSECONDS">Skipped %s seconds</string>
<string name="TR_SCREENSCORE_SCORES">Scores</string>
<string name="TR_SCREENSCORE_RATING">Rating</string>
@@ -1,4 +1,9 @@
ScreenSing
+++++++++
Version 12
Add:
<RatingPopup>
+++++++++
Version 11
@@ -384,6 +384,7 @@
<RatingBarProgressLeft>NotesFillLeft.png</RatingBarProgressLeft>
<RatingBarProgressMid>NotesFillMid.png</RatingBarProgressMid>
<RatingBarProgressRight>NotesFillRight.png</RatingBarProgressRight>
<RatingPopup>RatingPopUp.png</RatingPopup>
<PopupBG>PopupBG.png</PopupBG>
<ScrollUp>ScrollUp.png</ScrollUp>
<ScrollDown>ScrollDown.png</ScrollDown>
@@ -2751,4 +2751,511 @@
</ProgressBar>
</ProgressBars>
<ScreenSettings />
<RatingPopups>
<RatingPopup Name="RatingPopupP1N1">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1425</X>
<Y>530.5</Y>
<W>210</W>
<H>75</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>100</X>
<Y>13</Y>
<Z>-2</Z>
<H>49</H>
<MaxW>150</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP1N2">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1425</X>
<Y>170.5</Y>
<W>210</W>
<H>75</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>100</X>
<Y>13</Y>
<Z>-2</Z>
<H>49</H>
<MaxW>150</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP2N2">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1425</X>
<Y>560.5</Y>
<W>210</W>
<H>75</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>100</X>
<Y>13</Y>
<Z>-2</Z>
<H>49</H>
<MaxW>150</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP1N3">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1575</X>
<Y>152</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP2N3">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1575</X>
<Y>408</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP3N3">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1575</X>
<Y>663</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP1N4">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>470</X>
<Y>171</Y>
<W>210</W>
<H>75</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>100</X>
<Y>13</Y>
<Z>-2</Z>
<H>49</H>
<MaxW>150</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP2N4">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>470</X>
<Y>561</Y>
<W>210</W>
<H>75</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>100</X>
<Y>13</Y>
<Z>-2</Z>
<H>49</H>
<MaxW>150</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP3N4">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1421</X>
<Y>171</Y>
<W>210</W>
<H>75</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>100</X>
<Y>13</Y>
<Z>-2</Z>
<H>49</H>
<MaxW>150</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP4N4">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1421</X>
<Y>561</Y>
<W>210</W>
<H>75</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>100</X>
<Y>13</Y>
<Z>-2</Z>
<H>49</H>
<MaxW>150</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP1N5">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>655.5</X>
<Y>153</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP2N5">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>655.5</X>
<Y>408</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP3N5">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>655.5</X>
<Y>663</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP4N5">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1608</X>
<Y>153</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP5N5">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1608</X>
<Y>408</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP1N6">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>655.5</X>
<Y>153</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP2N6">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>655.5</X>
<Y>408</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP3N6">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>655.5</X>
<Y>663</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP4N6">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1608</X>
<Y>153</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP5N6">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1608</X>
<Y>408</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
<RatingPopup Name="RatingPopupP6N6">
<SkinRatingPopup>RatingPopup</SkinRatingPopup>
<Rect>
<X>1608</X>
<Y>663</Y>
<W>140</W>
<H>47</H>
<Z>-1</Z>
</Rect>
<Text Name="Text">
<X>62</X>
<Y>8</Y>
<Z>-2</Z>
<H>30</H>
<MaxW>100</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text></Text>
</Text>
</RatingPopup>
</RatingPopups>
</Screen>
+8
View File
@@ -211,6 +211,8 @@ namespace Vocaluxe.Base
Players[i].GameMode = EGameMode.TR_GAMEMODE_NORMAL;
Players[i].DateTicks = DateTime.Now.Ticks;
Players[i].SongFinished = false;
Players[i].RatingLastLine = 0f;
Players[i].TimeLastLineChange = float.MaxValue;
}
_LastEvalBeat = -100;
CurrentBeatF = -100;
@@ -251,6 +253,11 @@ namespace Vocaluxe.Base
if (line < 0 || lines[line].EndBeat < beat)
continue;
if (Players[p].CurrentLine != line && line > 0)
{
Players[p].TimeLastLineChange = time;
}
//Check for already sung
if (line < Players[p].SungLines.Count - 1)
continue; // Already sung whole line
@@ -379,6 +386,7 @@ namespace Vocaluxe.Base
//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);
Players[p].RatingLastLine = current;
}
}
}
+133 -1
View File
@@ -41,7 +41,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 11; }
get { return 12; }
}
private struct STimeRect
@@ -81,6 +81,7 @@ namespace Vocaluxe.Screens
private string[,,] _StaticAvatars;
private string[,,] _ProgressBarsRating;
private string[,,] _RatingPopupsStrings;
private const string _ButtonCancel = "ButtonCancel";
private const string _ButtonContinue = "ButtonContinue";
@@ -100,6 +101,7 @@ namespace Vocaluxe.Screens
private string[] _PlayerTextScore;
private string[] _PlayerTextName;
private string[] _PlayerProgressBarRating;
private string[] _PlayerRatingPopup;
private string[] _PlayerStaticScore;
private string[] _PlayerStaticAvatar;
private List<string>[] _StaticsExtra;
@@ -178,9 +180,14 @@ namespace Vocaluxe.Screens
_BuildProgressBarStrings(ref progressbars);
_ThemeProgressBars = progressbars.ToArray();
var ratingPopups = new List<string>();
_BuildRatingPopupStrings(ref ratingPopups);
_ThemeRatingPopups = ratingPopups.ToArray();
_CreatePlayerStatics();
_CreatePlayerStrings();
_CreateProgressBars();
_CreateRatingPopups();
_AssignPlayerElements();
_ThemeButtons = new string[] { _ButtonCancel, _ButtonContinue, _ButtonRestartGame, _ButtonRestartRound, _ButtonSkip };
@@ -413,6 +420,7 @@ namespace Vocaluxe.Screens
_InitiatePlayerStatics();
_InitiatePlayerStrings();
_InitiateProgressBars();
_InitiateRatingPopups();
if (_StaticsExtra == null)
_CreateExtraStatics();
if (_TextsExtra == null)
@@ -507,6 +515,7 @@ namespace Vocaluxe.Screens
CGame.UpdatePoints(_CurrentTime);
_UpdateRatingBars();
_UpdateRatingPopups();
_UpdateLyrics();
if (CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY)
_UpdateMedleyCountdown();
@@ -542,6 +551,7 @@ namespace Vocaluxe.Screens
_Texts[_PlayerTextName[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_PlayerTextScore[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_ProgressBars[_PlayerProgressBarRating[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_RatingPopups[_PlayerRatingPopup[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
}
}
@@ -860,6 +870,62 @@ namespace Vocaluxe.Screens
}
}
private void _UpdateRatingPopups()
{
for (int i = 0; i < CGame.NumPlayers; i++)
{
float fadeOutTime = 1f;
float showTime = 0.5f;
var timeSinceLastLine = Math.Abs(_CurrentTime - CGame.Players[i].TimeLastLineChange);
if (timeSinceLastLine < showTime)
{
_RatingPopups[_PlayerRatingPopup[i]].Alpha = 1;
}
else if (timeSinceLastLine < showTime + fadeOutTime)
{
_RatingPopups[_PlayerRatingPopup[i]].Alpha = 1 - (timeSinceLastLine - showTime) / fadeOutTime;
}
else
{
_RatingPopups[_PlayerRatingPopup[i]].Alpha = 0;
}
switch(CGame.Players[i].RatingLastLine)
{
case 1:
_RatingPopups[_PlayerRatingPopup[i]].Text.Text = "TR_SCREENSING_RATING_1";
break;
case double rating when rating > 0.90:
_RatingPopups[_PlayerRatingPopup[i]].Text.Text = "TR_SCREENSING_RATING_2";
break;
case double rating when rating > 0.75:
_RatingPopups[_PlayerRatingPopup[i]].Text.Text = "TR_SCREENSING_RATING_3";
break;
case double rating when rating > 0.60:
_RatingPopups[_PlayerRatingPopup[i]].Text.Text = "TR_SCREENSING_RATING_4";
break;
case double rating when rating > 0.45:
_RatingPopups[_PlayerRatingPopup[i]].Text.Text = "TR_SCREENSING_RATING_5";
break;
case double rating when rating > 0.30:
_RatingPopups[_PlayerRatingPopup[i]].Text.Text = "TR_SCREENSING_RATING_6";
break;
case double rating when rating >= 0.15:
_RatingPopups[_PlayerRatingPopup[i]].Text.Text = "TR_SCREENSING_RATING_7";
break;
case double rating when rating < 0.15:
_RatingPopups[_PlayerRatingPopup[i]].Text.Text = "TR_SCREENSING_RATING_8";
break;
}
_RatingPopups[_PlayerRatingPopup[i]].Color = new SColorF(CBase.Themes.GetPlayerColor(i + 1), 1);
}
}
#endregion
#region drawing
@@ -1401,6 +1467,7 @@ namespace Vocaluxe.Screens
_Statics[_StaticAvatars[screen, player, numplayer]].Visible = false;
_ProgressBars[_ProgressBarsRating[screen, player, numplayer]].AllMonitors = false;
_ProgressBars[_ProgressBarsRating[screen, player, numplayer]].Visible = false;
_RatingPopups[_RatingPopupsStrings[screen, player, numplayer]].Visible = false;
}
}
}
@@ -1412,6 +1479,7 @@ namespace Vocaluxe.Screens
_Texts[_PlayerTextScore[player]].Visible = false;
_Statics[_PlayerStaticScore[player]].Visible = false;
_ProgressBars[_PlayerProgressBarRating[player]].Visible = false;
_RatingPopups[_PlayerRatingPopup[player]].Visible = false;
_SingNotes[_SingBars].Visible = false;
}
@@ -1420,6 +1488,7 @@ namespace Vocaluxe.Screens
_Texts[_PlayerTextScore[player]].Visible = true;
_Statics[_PlayerStaticScore[player]].Visible = true;
_ProgressBars[_PlayerProgressBarRating[player]].Visible = true;
_RatingPopups[_PlayerRatingPopup[player]].Visible = true;
_SingNotes[_SingBars].Visible = true;
}
@@ -1709,6 +1778,26 @@ namespace Vocaluxe.Screens
}
}
private void _BuildRatingPopupStrings(ref List<string> ratingPopups)
{
_RatingPopupsStrings = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
{
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);
_RatingPopupsStrings[screen, player, numplayer] = "RatingPopupS" + (screen + 1) + target;
ratingPopups.Add("RatingPopup" + target);
}
}
}
}
}
private void _CreateProgressBars()
{
for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
@@ -1727,6 +1816,24 @@ namespace Vocaluxe.Screens
}
}
private void _CreateRatingPopups()
{
for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
{
for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
{
for (int player = 0; player < CSettings.MaxNumPlayer; player++)
{
if (player <= numplayer)
{
string target = "S" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1);
_AddRatingPopup(GetNewRatingPopup(), "RatingPopup" + target);
}
}
}
}
}
private void _InitiateProgressBars()
{
for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
@@ -1747,6 +1854,26 @@ namespace Vocaluxe.Screens
}
}
private void _InitiateRatingPopups()
{
for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
{
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);
_RatingPopups["RatingPopup" + target].Visible = false;
_RatingPopups["RatingPopupS" + (screen + 1) + target] = GetNewRatingPopup(_RatingPopups["RatingPopup" + target]);
_RatingPopups["RatingPopupS" + (screen + 1) + target].X += screen * CSettings.RenderW;
}
}
}
}
}
private void _CreateExtraStatics()
{
_StaticsExtra = new List<string>[CSettings.MaxNumScreens];
@@ -1913,6 +2040,7 @@ namespace Vocaluxe.Screens
_PlayerStaticAvatar = new String[CGame.NumPlayers];
_PlayerStaticScore = new String[CGame.NumPlayers];
_PlayerProgressBarRating = new String[CGame.NumPlayers];
_PlayerRatingPopup = new String[CGame.NumPlayers];
int screenPlayers = CGame.NumPlayers / CConfig.GetNumScreens();
int remainingPlayers = CGame.NumPlayers - (screenPlayers * CConfig.GetNumScreens());
@@ -1927,6 +2055,7 @@ namespace Vocaluxe.Screens
_PlayerTextScore[player] = _TextScores[s, p, screenPlayers];
_PlayerTextName[player] = _TextNames[s, p, screenPlayers];
_PlayerProgressBarRating[player] = _ProgressBarsRating[s, p, screenPlayers];
_PlayerRatingPopup[player] = _RatingPopupsStrings[s, p, screenPlayers];
_PlayerStaticAvatar[player] = _StaticAvatars[s, p, screenPlayers];
_PlayerStaticScore[player++] = _StaticScores[s, p, screenPlayers];
if (p == screenPlayers - 1)
@@ -1934,6 +2063,7 @@ namespace Vocaluxe.Screens
_PlayerTextScore[player] = _TextScores[s, p + 1, screenPlayers];
_PlayerTextName[player] = _TextNames[s, p + 1, screenPlayers];
_PlayerProgressBarRating[player] = _ProgressBarsRating[s, p + 1, screenPlayers];
_PlayerRatingPopup[player] = _RatingPopupsStrings[s, p + 1, screenPlayers];
_PlayerStaticAvatar[player] = _StaticAvatars[s, p + 1, screenPlayers];
_PlayerStaticScore[player++] = _StaticScores[s, p + 1, screenPlayers];
remainingPlayers--;
@@ -1944,6 +2074,7 @@ namespace Vocaluxe.Screens
_PlayerTextScore[player] = _TextScores[s, p, screenPlayers - 1];
_PlayerTextName[player] = _TextNames[s, p, screenPlayers - 1];
_PlayerProgressBarRating[player] = _ProgressBarsRating[s, p, screenPlayers - 1];
_PlayerRatingPopup[player] = _RatingPopupsStrings[s, p, screenPlayers - 1];
_PlayerStaticAvatar[player] = _StaticAvatars[s, p, screenPlayers - 1];
_PlayerStaticScore[player++] = _StaticScores[s, p, screenPlayers - 1];
}
@@ -1955,6 +2086,7 @@ namespace Vocaluxe.Screens
_PlayerTextScore[player] = _TextScores[s, 0, 0];
_PlayerTextName[player] = _TextNames[s, 0, 0];
_PlayerProgressBarRating[player] = _ProgressBarsRating[s, 0, 0];
_PlayerRatingPopup[player] = _RatingPopupsStrings[s, 0, 0];
_PlayerStaticAvatar[player] = _StaticAvatars[s, 0, 0];
_PlayerStaticScore[player++] = _StaticScores[s, 0, 0];
remainingPlayers--;
+2 -1
View File
@@ -31,7 +31,8 @@ namespace VocaluxeLib.Menu
Equalizer,
Playlist,
ParticleEffect,
ProgressBar
ProgressBar,
RatingPopup,
}
public class CInteraction
+19 -1
View File
@@ -53,6 +53,7 @@ namespace VocaluxeLib.Menu
[XmlArray("ParticleEffects")] public List<SThemeParticleEffect> ParticleEffects;
[XmlArray("ScreenSettings")] public List<SThemeScreenSetting> ScreenSettings;
[XmlArray("ProgressBars")] public List<SThemeProgressBar> ProgressBars;
[XmlArray("RatingPopups")] public List<SThemeRatingPopup> RatingPopups;
}
struct SZSort
@@ -85,6 +86,7 @@ namespace VocaluxeLib.Menu
protected string[] _ThemeParticleEffects;
protected string[] _ThemeScreenSettings;
protected string[] _ThemeProgressBars;
protected string[] _ThemeRatingPopups;
protected readonly Dictionary<string, CScreenSetting> _ScreenSettings = new Dictionary<string, CScreenSetting>();
// ReSharper restore MemberCanBePrivate.Global
@@ -121,6 +123,7 @@ namespace VocaluxeLib.Menu
_ThemeParticleEffects = null;
_ThemeScreenSettings = null;
_ThemeProgressBars = null;
_ThemeRatingPopups = null;
}
protected virtual void _OnSongMenuChanged()
@@ -148,7 +151,8 @@ namespace VocaluxeLib.Menu
private static readonly string[] _AllowedMissing = new string[]
{
"Backgrounds", "Statics", "Texts", "Buttons", "SongMenus", "Lyrics", "SelectSlides", "SingNotes",
"NameSelections", "Equalizers", "Playlists", "ParticleEffects", "ScreenSettings", "ProgressBars"
"NameSelections", "Equalizers", "Playlists", "ParticleEffects", "ScreenSettings", "ProgressBars",
"RatingPopups"
};
public override void HandleError(CXmlException e)
@@ -198,6 +202,9 @@ namespace VocaluxeLib.Menu
foreach (SThemeProgressBar pb in Theme.ProgressBars)
_AddProgressBar(new CProgressBar(pb, PartyModeID), pb.Name);
foreach (SThemeRatingPopup rp in Theme.RatingPopups)
_AddRatingPopup(new CRatingPopup(rp, PartyModeID), rp.Name);
foreach (SThemeScreenSetting ss in Theme.ScreenSettings)
_AddScreenSetting(new CScreenSetting(ss, PartyModeID), ss.Name);
@@ -276,6 +283,7 @@ namespace VocaluxeLib.Menu
_AddThemeablesToList(Theme.ParticleEffects, _ParticleEffects);
_AddThemeablesToList(Theme.Playlists, _Playlists);
_AddThemeablesToList(Theme.ProgressBars, _ProgressBars);
_AddThemeablesToList(Theme.RatingPopups, _RatingPopups);
_AddThemeablesToList(Theme.ScreenSettings, _ScreenSettings.Values);
_AddThemeablesToList(Theme.SelectSlides, _SelectSlides);
_AddThemeablesToList(Theme.Statics, _Statics);
@@ -406,6 +414,16 @@ namespace VocaluxeLib.Menu
return new CProgressBar(pb);
}
public CRatingPopup GetNewRatingPopup()
{
return new CRatingPopup(PartyModeID);
}
public static CRatingPopup GetNewRatingPopup(CRatingPopup rp)
{
return new CRatingPopup(rp);
}
// ReSharper restore MemberCanBeProtected.Global
// ReSharper restore UnusedMember.Global
#endregion Create Elements
+10
View File
@@ -47,6 +47,7 @@ namespace VocaluxeLib.Menu
protected readonly COrderedDictionaryLite<CPlaylist> _Playlists;
protected readonly COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
protected readonly COrderedDictionaryLite<CProgressBar> _ProgressBars;
protected readonly COrderedDictionaryLite<CRatingPopup> _RatingPopups;
private readonly SColorF _HighlightColor = new SColorF(1, 0, 0, 0);
protected CObjectInteractions()
@@ -64,6 +65,7 @@ namespace VocaluxeLib.Menu
_Playlists = new COrderedDictionaryLite<CPlaylist>(this);
_ParticleEffects = new COrderedDictionaryLite<CParticleEffect>(this);
_ProgressBars = new COrderedDictionaryLite<CProgressBar>(this);
_RatingPopups = new COrderedDictionaryLite<CRatingPopup>(this);
}
public virtual void Init()
@@ -89,6 +91,7 @@ namespace VocaluxeLib.Menu
_Playlists.Clear();
_ParticleEffects.Clear();
_ProgressBars.Clear();
_RatingPopups.Clear();
}
private void _SetSelected(int newSelection)
@@ -302,6 +305,8 @@ namespace VocaluxeLib.Menu
return _ParticleEffects[element.Num];
case EType.ProgressBar:
return _ProgressBars[element.Num];
case EType.RatingPopup:
return _RatingPopups[element.Num];
}
throw new ArgumentException("Invalid element type: " + element.Type);
}
@@ -411,6 +416,11 @@ namespace VocaluxeLib.Menu
{
_AddElement(_ProgressBars.Add(pb, key), EType.ProgressBar);
}
protected void _AddRatingPopup(CRatingPopup rp, String key = null)
{
_AddElement(_RatingPopups.Add(rp, key), EType.RatingPopup);
}
#endregion Element-Adding
#region InteractionHandling
+131
View File
@@ -0,0 +1,131 @@
using System.Xml.Serialization;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
[XmlType("RatingPopup")]
public struct SThemeRatingPopup
{
[XmlAttribute(AttributeName = "Name")] public string Name;
public string SkinRatingPopup;
public SRectF Rect;
public SThemeText Text;
}
public sealed class CRatingPopup : CMenuElementBase, IMenuElement, IThemeable
{
private readonly int _PartyModeID;
private SThemeRatingPopup _Theme;
private CTextureRef _TextureRatingPopup;
public CTextureRef TextureRatingPopup
{
get { return _TextureRatingPopup ?? CBase.Themes.GetSkinTexture(_Theme.SkinRatingPopup, _PartyModeID); }
set { _TextureRatingPopup = value; }
}
public bool Selectable => false;
public bool ThemeLoaded { get; private set; }
public CText Text;
public float Alpha = 1;
public SColorF Color;
public CRatingPopup(int partyModeID)
{
_PartyModeID = partyModeID;
Text = new CText(partyModeID);
Text.AllMonitors = false;
Visible = false;
}
public CRatingPopup(CRatingPopup rp)
{
_PartyModeID = rp._PartyModeID;
_TextureRatingPopup = rp._TextureRatingPopup;
Text = new CText(rp.Text);
Text.AllMonitors = false;
Visible = false;
MaxRect = rp.MaxRect;
}
public CRatingPopup(SThemeRatingPopup theme, int partyModeID)
{
_Theme = theme;
_PartyModeID = partyModeID;
Text = new CText(theme.Text, partyModeID);
Text.AllMonitors = false;
Visible = false;
ThemeLoaded = true;
}
public void Draw()
{
SColorF color = Color;
color.A = Alpha;
Text.Color.A = Alpha;
if (_TextureRatingPopup != null)
{
CBase.Drawing.DrawTexture(_TextureRatingPopup , Rect, color, false);
}
Text.DrawRelative(Rect.X, Rect.Y);
}
public object GetTheme()
{
_Theme.Text = (SThemeText)Text.GetTheme();
return _Theme;
}
public string GetThemeName()
{
return _Theme.Name;
}
public void LoadSkin()
{
if (!ThemeLoaded)
return;
TextureRatingPopup = CBase.Themes.GetSkinTexture(_Theme.SkinRatingPopup, _PartyModeID);
Text = new CText(_Theme.Text, _PartyModeID);
Text.LoadSkin();
MaxRect = _Theme.Rect;
}
public void UnloadSkin()
{
}
public void ReloadSkin()
{
UnloadSkin();
LoadSkin();
}
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;
}
}
}
+3
View File
@@ -346,12 +346,15 @@ namespace VocaluxeLib
public double PointsLineBonus;
public double PointsGoldenNotes;
public double Rating;
public double RatingLastLine;
public int NoteDiff;
public int VoiceNr;
public List<CSungLine> SungLines;
public int CurrentLine;
public int CurrentNote;
public float TimeLastLineChange;
public int SongID;
public EGameMode GameMode;
public long DateTicks;
+1
View File
@@ -147,6 +147,7 @@
<Compile Include="Menu\CParticleEffect.cs" />
<Compile Include="Menu\CPlaylist.cs" />
<Compile Include="Game\CPoints.cs" />
<Compile Include="Menu\CRatingPopup.cs" />
<Compile Include="Menu\CScreenSetting.cs" />
<Compile Include="Menu\CSelectSlide.cs" />
<Compile Include="Menu\CProgressBar.cs" />