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:
12 files changed
+828
-3
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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--;
|
||||
|
||||
Reference in new issue
Block a user