Added possibility to open highscores from song screen

If opened from song screen, you can use the Arrow Left/Right keys to switch between the game modes Normal, Short, Medley and Duet.
This commit is contained in:
Stefan authored and GitHub committed 2020-01-21 07:16:30 +01:00
1 parent 4c1eaa407e
commit 72d279e525
1 file changed
+52 -14
+52 -14
View File
@@ -49,6 +49,7 @@ namespace Vocaluxe.Screens
private int _Round;
private int _Pos;
private bool _IsDuet;
private bool _FromScreenSong = false;
public override EMusicType CurrentMusicType
{
@@ -113,11 +114,13 @@ namespace Vocaluxe.Screens
break;
case Keys.Down:
_ChangePos(1);
if (!_FromScreenSong)
_ChangePos(1);
break;
case Keys.Up:
_ChangePos(-1);
if (!_FromScreenSong)
_ChangePos(-1);
break;
case Keys.Left:
@@ -234,13 +237,31 @@ namespace Vocaluxe.Screens
{
_Pos = 0;
int rounds = CGame.NumRounds;
_Scores = new List<SDBScoreEntry>[rounds];
for (int round = 0; round < rounds; round++)
if (rounds == 0)
{
int songID = CGame.GetSong(round).ID;
EGameMode gameMode = CGame.GetGameMode(round);
_FromScreenSong = true;
_Round = (int)EGameMode.TR_GAMEMODE_NORMAL;
_Scores = new List<SDBScoreEntry>[4];
int songID = CSongs.VisibleSongs[CScreenSong.getSelectedSongID()].ID;
EHighscoreStyle style = CBase.Config.GetHighscoreStyle();
_Scores[round] = CDataBase.LoadScore(songID, gameMode, style);
for (int gameModeNum = 0; gameModeNum < 4; gameModeNum++)
{
_Scores[gameModeNum] = CDataBase.LoadScore(songID, (EGameMode)gameModeNum, style);
}
}
else
{
_FromScreenSong = false;
_Scores = new List<SDBScoreEntry>[rounds];
for (int round = 0; round < rounds; round++)
{
int songID = CGame.GetSong(round).ID;
EGameMode gameMode = CGame.GetGameMode(round);
EHighscoreStyle style = CBase.Config.GetHighscoreStyle();
_Scores[round] = CDataBase.LoadScore(songID, gameMode, style);
}
}
}
@@ -248,15 +269,21 @@ namespace Vocaluxe.Screens
{
_IsDuet = false;
CPoints points = CGame.GetPoints();
CSong song = CGame.GetSong(_Round);
CSong song;
if (_FromScreenSong)
song = CSongs.GetSong(CSongs.VisibleSongs[CScreenSong.getSelectedSongID()].ID);
else
song = CGame.GetSong(_Round);
if (song == null)
return;
_Texts[_TextSongName].Text = song.Artist + " - " + song.Title;
if (points.NumRounds > 1)
if (points != null && points.NumRounds > 1)
_Texts[_TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")";
switch (CGame.GetGameMode(_Round))
switch ((_FromScreenSong ? (EGameMode)_Round : CGame.GetGameMode(_Round)))
{
case EGameMode.TR_GAMEMODE_NORMAL:
_Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL";
@@ -296,9 +323,20 @@ namespace Vocaluxe.Screens
private void _ChangeRound(int num)
{
CPoints points = CGame.GetPoints();
_Round += num;
_Round = _Round.Clamp(0, points.NumRounds - 1);
if (_FromScreenSong)
{
if (_Round == (int)EGameMode.TR_GAMEMODE_SHORTSONG)
_Round = (int)EGameMode.TR_GAMEMODE_NORMAL;
else
++_Round;
}
else
{
CPoints points = CGame.GetPoints();
_Round += num;
_Round = _Round.Clamp(0, points.NumRounds - 1);
}
_UpdateRound();
}
@@ -307,4 +345,4 @@ namespace Vocaluxe.Screens
CParty.LeavingHighscore();
}
}
}
}