Fix switching through songs on highscore-screen. Use Left/Right or MiddleButton.

This commit is contained in:
Florian Kuepper committed 2012-09-08 15:06:34 +02:00
1 parent fa26226701
commit 11f58a1ca4
5 files changed
+86 -58

No files matched your search

+5
View File
@@ -180,6 +180,11 @@ namespace Vocaluxe.Base
return _GameMode.GetSong(Num); return _GameMode.GetSong(Num);
} }
public static EGameMode GetGameMode(int Num)
{
return _GameMode.GetGameMode(Num);
}
public static int GetNumSongs() public static int GetNumSongs()
{ {
return _GameMode.GetNumSongs(); return _GameMode.GetNumSongs();
+8
View File
@@ -290,6 +290,14 @@ namespace Vocaluxe.GameModes
return null; return null;
} }
public virtual EGameMode GetGameMode(int Num)
{
if(Num - 1 < _SongQueque.Count && Num > -1)
return _SongQueque[Num].GameMode;
return EGameMode.TR_GAMEMODE_NORMAL;
}
public virtual CPoints GetPoints() public virtual CPoints GetPoints()
{ {
return _Points; return _Points;
+1
View File
@@ -38,5 +38,6 @@ namespace Vocaluxe.GameModes
int GetNumSongs(); int GetNumSongs();
CSong GetSong(); CSong GetSong();
CSong GetSong(int Num); CSong GetSong(int Num);
EGameMode GetGameMode(int Num);
} }
} }
+69 -57
View File
@@ -23,7 +23,7 @@ namespace Vocaluxe.Screens
private string[] TextScore; private string[] TextScore;
private string[] TextDate; private string[] TextDate;
private List<SScores> _Scores; private List<SScores>[] _Scores;
private List<int> _NewEntryIDs; private List<int> _NewEntryIDs;
private int _Round; private int _Round;
private int _Pos; private int _Pos;
@@ -135,6 +135,17 @@ namespace Vocaluxe.Screens
CGraphics.FadeTo(EScreens.ScreenSong); CGraphics.FadeTo(EScreens.ScreenSong);
} }
if (MouseEvent.MB)
{
int LastRound = _Round;
ChangeRound(1);
if (LastRound == _Round)
{
_Round = 0;
UpdateRound();
}
}
ChangePos(MouseEvent.Wheel); ChangePos(MouseEvent.Wheel);
return true; return true;
} }
@@ -143,7 +154,7 @@ namespace Vocaluxe.Screens
{ {
for (int p = 0; p < NumEntrys; p++) for (int p = 0; p < NumEntrys; p++)
{ {
if (_Pos + p < _Scores.Count) if (_Pos + p < _Scores[_Round].Count)
{ {
Texts[htTexts(TextNumber[p])].Visible = true; Texts[htTexts(TextNumber[p])].Visible = true;
Texts[htTexts(TextName[p])].Visible = true; Texts[htTexts(TextName[p])].Visible = true;
@@ -152,16 +163,16 @@ namespace Vocaluxe.Screens
Texts[htTexts(TextNumber[p])].Text = (_Pos + p + 1).ToString(); Texts[htTexts(TextNumber[p])].Text = (_Pos + p + 1).ToString();
string name = _Scores[_Pos + p].Name; string name = _Scores[_Round][_Pos + p].Name;
name += " [" + CLanguage.Translate(Enum.GetName(typeof(EGameDifficulty), _Scores[_Pos + p].Difficulty)) + "]"; name += " [" + CLanguage.Translate(Enum.GetName(typeof(EGameDifficulty), _Scores[_Round][_Pos + p].Difficulty)) + "]";
if (_IsDuet) if (_IsDuet)
name += " (P" + (_Scores[_Pos + p].LineNr + 1).ToString() + ")"; name += " (P" + (_Scores[_Round][_Pos + p].LineNr + 1).ToString() + ")";
Texts[htTexts(TextName[p])].Text = name; Texts[htTexts(TextName[p])].Text = name;
Texts[htTexts(TextScore[p])].Text = _Scores[_Pos + p].Score.ToString("00000"); Texts[htTexts(TextScore[p])].Text = _Scores[_Round][_Pos + p].Score.ToString("00000");
Texts[htTexts(TextDate[p])].Text = _Scores[_Pos + p].Date; Texts[htTexts(TextDate[p])].Text = _Scores[_Round][_Pos + p].Date;
if (isNewEntry(_Scores[_Pos + p].ID) == true) if (isNewEntry(_Scores[_Round][_Pos + p].ID) == true)
{ {
Texts[htTexts(TextNumber[p])].Style = EStyle.BoldItalic; Texts[htTexts(TextNumber[p])].Style = EStyle.BoldItalic;
Texts[htTexts(TextName[p])].Style = EStyle.BoldItalic; Texts[htTexts(TextName[p])].Style = EStyle.BoldItalic;
@@ -185,10 +196,16 @@ namespace Vocaluxe.Screens
base.OnShow(); base.OnShow();
_Round = 0; _Round = 0;
_Pos = 0; _Pos = 0;
_Scores = new List<SScores>(); CPoints _Points = CGame.GetPoints();
_Scores = new List<SScores>[_Points.NumRounds];
for (int i = 0; i < _Scores.Length; i++)
{
_Scores[i] = new List<SScores>();
}
_NewEntryIDs.Clear(); _NewEntryIDs.Clear();
AddScoresToDB(); AddScoresToDB();
LoadScores(); LoadScores();
UpdateRound();
UpdateGame(); UpdateGame();
} }
@@ -239,39 +256,47 @@ namespace Vocaluxe.Screens
for (int round = 0; round < points.NumRounds; round++) for (int round = 0; round < points.NumRounds; round++)
{ {
SPlayer player = points.GetPlayer(round, CGame.NumPlayer)[0]; SPlayer player = points.GetPlayer(round, CGame.NumPlayer)[0];
CDataBase.LoadScore(ref _Scores, player); CDataBase.LoadScore(ref _Scores[round], player);
}
}
if (round == _Round) private void UpdateRound()
{ {
_IsDuet = false; _IsDuet = false;
CPoints points = CGame.GetPoints();
SPlayer player = points.GetPlayer(_Round, CGame.NumPlayer)[0];
CSong song = CGame.GetSong(_Round+1);
if (song == null)
return;
CSong song = CSongs.GetSong(player.SongID); Texts[htTexts(TextSongName)].Text = song.Artist + " - " + song.Title;
Texts[htTexts(TextSongName)].Text = song.Artist + " - " + song.Title; if (points.NumRounds > 1)
{
Texts[htTexts(TextSongName)].Text += " (" + (_Round+1) + "/" + points.NumRounds + ")";
}
switch (CGame.GameMode) switch (CGame.GetGameMode(_Round))
{ {
case EGameMode.TR_GAMEMODE_NORMAL: case EGameMode.TR_GAMEMODE_NORMAL:
Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL"; Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL";
break; break;
case EGameMode.TR_GAMEMODE_MEDLEY: case EGameMode.TR_GAMEMODE_MEDLEY:
Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_MEDLEY"; Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_MEDLEY";
break; break;
case EGameMode.TR_GAMEMODE_DUET: case EGameMode.TR_GAMEMODE_DUET:
Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_DUET"; Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_DUET";
_IsDuet = true; _IsDuet = true;
break; break;
case EGameMode.TR_GAMEMODE_SHORTSONG: case EGameMode.TR_GAMEMODE_SHORTSONG:
Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_SHORTSONG"; Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_SHORTSONG";
break; break;
default: default:
Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL"; Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL";
break; break;
}
}
} }
} }
@@ -279,7 +304,7 @@ namespace Vocaluxe.Screens
{ {
if (Num > 0) if (Num > 0)
{ {
if (_Pos + Num + NumEntrys < _Scores.Count) if (_Pos + Num + NumEntrys < _Scores[_Round].Count)
_Pos += Num; _Pos += Num;
} }
if (Num < 0) if (Num < 0)
@@ -292,27 +317,14 @@ namespace Vocaluxe.Screens
private void ChangeRound(int Num) private void ChangeRound(int Num)
{ {
CPoints points = CGame.GetPoints(); CPoints _Points = CGame.GetPoints();
if (points.NumRounds < 2) if (_Round + Num < _Points.NumRounds && _Round + Num > -1)
return; _Round += Num;
else if (_Round + Num >= _Points.NumRounds)
_Round += Num; _Round = _Points.NumRounds - 1;
else if (_Round + Num < 0)
if (Num > 0) _Round = 0;
{ UpdateRound();
if (_Round >= points.NumRounds)
_Round = 0;
LoadScores();
}
if (Num < 0)
{
if (_Round < 0)
_Round = points.NumRounds - 1;
LoadScores();
}
} }
} }
} }
+3 -1
View File
@@ -658,7 +658,9 @@ namespace Vocaluxe.Screens
private void Stop() private void Stop()
{ {
CGame.NextRound(); //Need this to set other songs to points-var
while(!CGame.IsFinished())
CGame.NextRound();
CGraphics.FadeTo(EScreens.ScreenScore); CGraphics.FadeTo(EScreens.ScreenScore);
_FadeOut = true; _FadeOut = true;