Merge branch 'develop' into ChangeSortOptions
This commit is contained in:
5 files changed
+143
-57
No files matched your search
@@ -813,6 +813,33 @@
|
||||
<Text>TR_SCREENSONG_BUTTON_STARTMEDLEY</Text>
|
||||
</Text>
|
||||
</Button>
|
||||
<Button Name="ButtonOptionsHighscore">
|
||||
<Skin>SongSelectButton</Skin>
|
||||
<SkinSelected>SongSelectButton</SkinSelected>
|
||||
<Rect>
|
||||
<X>40</X>
|
||||
<Y>290</Y>
|
||||
<W>360</W>
|
||||
<H>40</H>
|
||||
<Z>-2.11</Z>
|
||||
</Rect>
|
||||
<Color Name="ButtonColor" />
|
||||
<SelColor Name="ButtonSelColor" />
|
||||
<Text Name="Text">
|
||||
<X>180</X>
|
||||
<Y>7</Y>
|
||||
<Z>0</Z>
|
||||
<H>25</H>
|
||||
<MaxW>350</MaxW>
|
||||
<Color Name="ButtonTextColor" />
|
||||
<SelColor Name="ButtonTextSelColor" />
|
||||
<Align>Center</Align>
|
||||
<ResizeAlign>Center</ResizeAlign>
|
||||
<Style>Bold</Style>
|
||||
<Font>Outline</Font>
|
||||
<Text>TR_SCREENHIGHSCORE_HIGHSCORE</Text>
|
||||
</Text>
|
||||
</Button>
|
||||
</Buttons>
|
||||
<SongMenus>
|
||||
<SongMenu Name="SongMenu">
|
||||
|
||||
@@ -316,56 +316,33 @@ namespace Vocaluxe.Base
|
||||
CSound.SetGlobalVolume(CConfig.PreviewMusicVolume);
|
||||
}
|
||||
|
||||
//Change song position only if song is changed or near to end
|
||||
bool songChanged = _CurPlayer.SongID != song.ID;
|
||||
if (!songChanged && _CurPlayer.Position + 30 < _CurPlayer.Length)
|
||||
return;
|
||||
|
||||
_PreviewPlayer.Load(song);
|
||||
|
||||
|
||||
//Change song position only if song is changed or near to end
|
||||
if (songChanged || _CurPlayer.Position + 30 < _CurPlayer.Length || _PreviewStartHelperTask == null)
|
||||
lock (_PreviewStartHelperTaskLock)
|
||||
{
|
||||
lock (_PreviewStartHelperTaskLock)
|
||||
_PreviewStartHelperTask = new Task(() =>
|
||||
{
|
||||
_PreviewStartHelperTask = new Task(() =>
|
||||
{
|
||||
float length = _PreviewPlayer.Length;
|
||||
if (length < 1)
|
||||
length = 30; // If length is unknow or invalid assume a length of 30s
|
||||
float length = _PreviewPlayer.Length;
|
||||
if (length < 1)
|
||||
length = 30; // If length is unknow or invalid assume a length of 30s
|
||||
|
||||
if (start < 0)
|
||||
start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime;
|
||||
if (start > length - 5f)
|
||||
start = Math.Max(0f, Math.Min(length / 4f, length - 5f));
|
||||
if (start >= 0.5f)
|
||||
start -= 0.5f;
|
||||
if (start < 0)
|
||||
start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime;
|
||||
if (start > length - 5f)
|
||||
start = Math.Max(0f, Math.Min(length / 4f, length - 5f));
|
||||
if (start >= 0.5f)
|
||||
start -= 0.5f;
|
||||
|
||||
_PreviewPlayer.Position = start;
|
||||
Play();
|
||||
});
|
||||
}
|
||||
_CurPlayer = _PreviewPlayer;
|
||||
_PreviewPlayer.Position = start;
|
||||
Play();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_PreviewStartHelperTask != null)
|
||||
{
|
||||
lock (_PreviewStartHelperTaskLock)
|
||||
{
|
||||
// Recheck the condition as it cloud have change before we got the lock
|
||||
if (_PreviewStartHelperTask != null)
|
||||
{
|
||||
_PreviewStartHelperTask = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
_PreviewPlayer.Position = _CurPlayer.Position;
|
||||
_CurPlayer = _PreviewPlayer;
|
||||
Play();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_CurPlayer = _PreviewPlayer;
|
||||
}
|
||||
|
||||
public static void StopPreview()
|
||||
@@ -460,4 +437,4 @@ namespace Vocaluxe.Base
|
||||
return _BGMusicFiles.Contains(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,37 @@ 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 = CScreenSong.getSelectedSongID();
|
||||
EHighscoreStyle style = CBase.Config.GetHighscoreStyle();
|
||||
_Scores[round] = CDataBase.LoadScore(songID, gameMode, style);
|
||||
bool foundHighscoreEntries = false;
|
||||
|
||||
for (int gameModeNum = 0; gameModeNum < 4; gameModeNum++)
|
||||
{
|
||||
_Scores[gameModeNum] = CDataBase.LoadScore(songID, (EGameMode)gameModeNum, style);
|
||||
if (!foundHighscoreEntries && _Scores[gameModeNum].Count > 0)
|
||||
{
|
||||
_Round = gameModeNum;
|
||||
foundHighscoreEntries = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 +275,21 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
_IsDuet = false;
|
||||
CPoints points = CGame.GetPoints();
|
||||
CSong song = CGame.GetSong(_Round);
|
||||
|
||||
CSong song;
|
||||
if (_FromScreenSong)
|
||||
song = CSongs.GetSong(CScreenSong.getSelectedSongID());
|
||||
else
|
||||
song = CGame.GetSong(_Round);
|
||||
|
||||
if (song == null)
|
||||
return;
|
||||
|
||||
_Texts[_TextSongName].Text = song.Artist + " - " + song.Title;
|
||||
if (points.NumRounds > 1)
|
||||
if (points != null && !_FromScreenSong && 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 +329,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 +351,4 @@ namespace Vocaluxe.Screens
|
||||
CParty.LeavingHighscore();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ namespace Vocaluxe.Screens
|
||||
private const string _ButtonOptionsRandomMedley = "ButtonOptionsRandomMedley";
|
||||
private const string _ButtonOptionsStartMedley = "ButtonOptionsStartMedley";
|
||||
private const string _ButtonStart = "ButtonStart";
|
||||
private const string _ButtonOptionsHighscore = "ButtonOptionsHighscore";
|
||||
|
||||
private const string _SelectSlideOptionsMode = "SelectSlideOptionsMode";
|
||||
private const string _SelectSlideOptionsPlaylistAdd = "SelectSlideOptionsPlaylistAdd";
|
||||
@@ -104,6 +105,18 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private System.Timers.Timer _TimerShortInfoText;
|
||||
|
||||
private static int _StaticSelectedSongID;
|
||||
|
||||
private static void setStaticSelectedSongID(int songID)
|
||||
{
|
||||
_StaticSelectedSongID = songID;
|
||||
}
|
||||
|
||||
public static int getSelectedSongID()
|
||||
{
|
||||
return _StaticSelectedSongID;
|
||||
}
|
||||
|
||||
public override EMusicType CurrentMusicType
|
||||
{
|
||||
get { return CSongs.IsInCategory ? EMusicType.Preview : EMusicType.Background; }
|
||||
@@ -135,6 +148,7 @@ namespace Vocaluxe.Screens
|
||||
blist.Add(_ButtonStart);
|
||||
blist.Add(_ButtonOptionsRandomMedley);
|
||||
blist.Add(_ButtonOptionsStartMedley);
|
||||
blist.Add(_ButtonOptionsHighscore);
|
||||
|
||||
_TextsPlayer.Clear();
|
||||
for (int i = 0; i < CSettings.MaxNumPlayer; i++)
|
||||
@@ -342,6 +356,13 @@ namespace Vocaluxe.Screens
|
||||
_ToggleSort(tempSortNr);
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.H:
|
||||
if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumSongsVisible > 0 && !_Sso.Selection.PartyMode)
|
||||
{
|
||||
_ShowHighscore();
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!_SearchActive)
|
||||
{
|
||||
@@ -439,6 +460,10 @@ namespace Vocaluxe.Screens
|
||||
_ToggleSongOptions(ESongOptionsView.None);
|
||||
_StartRandomMedley(_SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory);
|
||||
}
|
||||
else if (_Buttons[_ButtonOptionsHighscore].Selected)
|
||||
{
|
||||
_ShowHighscore();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Escape:
|
||||
@@ -614,6 +639,10 @@ namespace Vocaluxe.Screens
|
||||
_StartRandomMedley(_SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory);
|
||||
return true;
|
||||
}
|
||||
else if (_Buttons[_ButtonOptionsHighscore].Selected)
|
||||
{
|
||||
_ShowHighscore();
|
||||
}
|
||||
else if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null)
|
||||
{
|
||||
if (_Buttons[_ButtonStart].Selected)
|
||||
@@ -942,6 +971,13 @@ namespace Vocaluxe.Screens
|
||||
_SongMenu.OnShow();
|
||||
}
|
||||
|
||||
private void _ShowHighscore()
|
||||
{
|
||||
CGame.ClearSongs();
|
||||
CScreenSong.setStaticSelectedSongID(CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].ID);
|
||||
CBase.Graphics.FadeTo(EScreen.Highscore);
|
||||
}
|
||||
|
||||
private void _StartSong(int songNr)
|
||||
{
|
||||
if (CSongs.IsInCategory && (songNr >= 0))
|
||||
@@ -1263,6 +1299,7 @@ namespace Vocaluxe.Screens
|
||||
_Buttons[_ButtonOptionsOpenSelectedItem].Visible = false;
|
||||
_Buttons[_ButtonOptionsRandomMedley].Visible = false;
|
||||
_Buttons[_ButtonOptionsStartMedley].Visible = false;
|
||||
_Buttons[_ButtonOptionsHighscore].Visible = false;
|
||||
_Texts[_TextOptionsTitle].Visible = false;
|
||||
_Statics[_StaticOptionsBG].Visible = false;
|
||||
_Buttons[_ButtonOpenOptions].Visible = true;
|
||||
@@ -1319,6 +1356,7 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true;
|
||||
_Buttons[_ButtonOptionsSing].Visible = true;
|
||||
_Buttons[_ButtonOptionsPlaylist].Visible = true;
|
||||
_Buttons[_ButtonOptionsHighscore].Visible = true;
|
||||
_SelectElement(_Buttons[_ButtonOptionsSing]);
|
||||
_SetSelectSlidePlaylistToCurrentPlaylist();
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
EScreen check = CBase.Graphics.GetNextScreenType();
|
||||
if (CBase.Graphics.GetNextScreenType() == EScreen.Sing)
|
||||
_ResetPreview(false);
|
||||
else if (CBase.Graphics.GetNextScreenType() != EScreen.Names || CBase.Config.GetBackgroundMusicStatus() == EBackgroundMusicOffOn.TR_CONFIG_OFF)
|
||||
else if ((CBase.Graphics.GetNextScreenType() != EScreen.Names && CBase.Graphics.GetNextScreenType() != EScreen.Highscore) || CBase.Config.GetBackgroundMusicStatus() == EBackgroundMusicOffOn.TR_CONFIG_OFF)
|
||||
_ResetPreview();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user