Audio mode for each playlist entry (#909)
- Playlist entries get a second select slide for the audio mode (normal, instrumental, vocals, karaoke) - The slide is only shown if the song has an instrumental file, otherwise normal is used - The audio mode is saved in the playlist file and used for each round - Sing, score and highscore screens use the audio mode of the current round - Song options select the audio mode by mode instead of position - ScreenSong theme version 15 Co-authored-by: Florian Ostertag <flokuep@users.noreply.github.com>
This commit is contained in:
1 parent
61b2677f16
commit
d03224f29b
14 files changed
+295
-53
No files matched your search
@@ -1,5 +1,15 @@
|
||||
ScreenSong
|
||||
|
||||
++++++++++
|
||||
Version 15:
|
||||
(2026 Oct 16)
|
||||
|
||||
Add:
|
||||
<SelectSlideAudioMode> in <Playlist> (audio mode for each playlist entry, only shown if the song has an instrumental file)
|
||||
|
||||
Change:
|
||||
<EntryHeight> of <Playlist> to make room for the second select slide
|
||||
|
||||
++++++++++
|
||||
Version 14:
|
||||
Add InstrumentalIcon
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Screen xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Informations>
|
||||
<ScreenName>ScreenSong</ScreenName>
|
||||
<ScreenVersion>14</ScreenVersion>
|
||||
<ScreenVersion>15</ScreenVersion>
|
||||
</Informations>
|
||||
<Backgrounds>
|
||||
<Background Name="Background1">
|
||||
@@ -1530,7 +1530,7 @@
|
||||
<H>675</H>
|
||||
<Z>-0.9</Z>
|
||||
</Rect>
|
||||
<EntryHeight>75</EntryHeight>
|
||||
<EntryHeight>112.5</EntryHeight>
|
||||
<SkinBackground>CoverTile</SkinBackground>
|
||||
<SkinBackgroundSelected>CoverTile</SkinBackgroundSelected>
|
||||
<ColorBackground Name="StaticColorAlpha">
|
||||
@@ -1787,6 +1787,47 @@
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>1</NumVisible>
|
||||
</SelectSlideGameMode>
|
||||
<SelectSlideAudioMode Name="SelectSlideAudioMode">
|
||||
<Skin />
|
||||
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
|
||||
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
|
||||
<SkinSelected />
|
||||
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
|
||||
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
|
||||
<Rect>
|
||||
<X>78</X>
|
||||
<Y>75</Y>
|
||||
<W>537</W>
|
||||
<H>36</H>
|
||||
<Z>-11</Z>
|
||||
</Rect>
|
||||
<RectArrowLeft>
|
||||
<X>84</X>
|
||||
<Y>79.5</Y>
|
||||
<W>30</W>
|
||||
<H>30</H>
|
||||
<Z>-12</Z>
|
||||
</RectArrowLeft>
|
||||
<RectArrowRight>
|
||||
<X>577.5</X>
|
||||
<Y>79.5</Y>
|
||||
<W>30</W>
|
||||
<H>30</H>
|
||||
<Z>-12</Z>
|
||||
</RectArrowRight>
|
||||
<Color Name="ButtonColor" />
|
||||
<SelColor Name="ButtonSelColor" />
|
||||
<ArrowColor Name="ArrowColor" />
|
||||
<ArrowSelColor Name="ArrowSelColor" />
|
||||
<TextColor Name="TextColor" />
|
||||
<TextSelColor Name="TextSelColor" />
|
||||
<TextH>33</TextH>
|
||||
<TextRelativeX>37.5</TextRelativeX>
|
||||
<TextMaxW>555</TextMaxW>
|
||||
<TextFont>Outline</TextFont>
|
||||
<TextStyle>Bold</TextStyle>
|
||||
<NumVisible>1</NumVisible>
|
||||
</SelectSlideAudioMode>
|
||||
</Playlist>
|
||||
</Playlists>
|
||||
<ParticleEffects />
|
||||
|
||||
+18
-2
@@ -22,6 +22,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Vocaluxe.Screens;
|
||||
using Vocaluxe.SongQueue;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Game;
|
||||
@@ -97,14 +98,24 @@ namespace Vocaluxe.Base
|
||||
get { return _SongQueue.GetCurrentGameMode(); }
|
||||
}
|
||||
|
||||
public static EAudioMode AudioMode
|
||||
{
|
||||
get { return _SongQueue.GetCurrentAudioMode(); }
|
||||
}
|
||||
|
||||
public static bool AddVisibleSong(int visibleIndex, EGameMode gameMode)
|
||||
{
|
||||
return _SongQueue.AddVisibleSong(visibleIndex, gameMode);
|
||||
return _SongQueue.AddVisibleSong(visibleIndex, gameMode, CScreenSong.GetAudioMode());
|
||||
}
|
||||
|
||||
public static bool AddSong(int absoluteIndex, EGameMode gameMode)
|
||||
{
|
||||
return _SongQueue.AddSong(absoluteIndex, gameMode);
|
||||
return _SongQueue.AddSong(absoluteIndex, gameMode, CScreenSong.GetAudioMode());
|
||||
}
|
||||
|
||||
public static bool AddSong(int absoluteIndex, EGameMode gameMode, EAudioMode audioMode)
|
||||
{
|
||||
return _SongQueue.AddSong(absoluteIndex, gameMode, audioMode);
|
||||
}
|
||||
|
||||
public static bool RemoveVisibleSong(int visibleIndex)
|
||||
@@ -162,6 +173,11 @@ namespace Vocaluxe.Base
|
||||
return _SongQueue.GetGameMode(round);
|
||||
}
|
||||
|
||||
public static EAudioMode GetAudioMode(int round)
|
||||
{
|
||||
return _SongQueue.GetAudioMode(round);
|
||||
}
|
||||
|
||||
public static int GetNumSongs()
|
||||
{
|
||||
return _SongQueue.GetNumSongs();
|
||||
|
||||
@@ -610,6 +610,11 @@ namespace Vocaluxe.Base
|
||||
CGame.AddSong(songId, gameMode);
|
||||
}
|
||||
|
||||
public void AddSong(int songId, EGameMode gameMode, EAudioMode audioMode)
|
||||
{
|
||||
CGame.AddSong(songId, gameMode, audioMode);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
CGame.Reset();
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Vocaluxe.Lib.Playlist
|
||||
}
|
||||
else
|
||||
{
|
||||
var playlistSong = new CPlaylistSong(plSong.Id, songEntry.GameMode);
|
||||
var playlistSong = new CPlaylistSong(plSong.Id, songEntry.GameMode) { AudioMode = songEntry.AudioMode };
|
||||
Songs.Add(playlistSong);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,14 +359,14 @@ namespace Vocaluxe.Screens
|
||||
return;
|
||||
}
|
||||
|
||||
// No points in Karaoke Mode
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (var round = 0; round < points.NumRounds; round++)
|
||||
{
|
||||
// No points in Karaoke Mode
|
||||
if (CGame.GetAudioMode(round) == EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var players = points.GetPlayer(round, CGame.NumPlayers);
|
||||
|
||||
for (var p = 0; p < players.Length; p++)
|
||||
|
||||
@@ -182,11 +182,29 @@ namespace Vocaluxe.Screens
|
||||
return true;
|
||||
}
|
||||
|
||||
private static string _GetRating(double points)
|
||||
private bool _IsKaraokeMode(int round)
|
||||
{
|
||||
if (round >= 0)
|
||||
{
|
||||
return CGame.GetAudioMode(round) == EAudioMode.TR_AUDIOMODE_KARAOKE;
|
||||
}
|
||||
|
||||
for (var r = 0; r < CGame.NumRounds; r++)
|
||||
{
|
||||
if (CGame.GetAudioMode(r) != EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private string _GetRating(double points)
|
||||
{
|
||||
string rating;
|
||||
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
if (_IsKaraokeMode(_Round))
|
||||
{
|
||||
rating = "TR_RATING_KARAOKE";
|
||||
}
|
||||
@@ -307,7 +325,7 @@ namespace Vocaluxe.Screens
|
||||
_StopScoreSounds();
|
||||
|
||||
// Do not play in Karaoke Mode
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE || maxPoints <= 0)
|
||||
if (_IsKaraokeMode(_Round) || maxPoints <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -371,7 +389,7 @@ namespace Vocaluxe.Screens
|
||||
private void _PlayApplauseSound(int maxPoints)
|
||||
{
|
||||
// Play no applause sound based on Karaoke Mode
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
if (_IsKaraokeMode(_Round))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -501,7 +519,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private void _SetVisibility()
|
||||
{
|
||||
var isKaraokeMode = CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE;
|
||||
var isKaraokeMode = _IsKaraokeMode(_Round);
|
||||
|
||||
for (var numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
|
||||
{
|
||||
@@ -569,7 +587,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
_StopScoreSounds();
|
||||
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
if (_IsKaraokeMode(-1))
|
||||
{
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
CSound.SetPosition(_CurrentStream, newTime);
|
||||
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_VOCALS)
|
||||
if (CGame.AudioMode == EAudioMode.TR_AUDIOMODE_VOCALS)
|
||||
{
|
||||
CSound.SetPosition(_CurrentStreamVocals, newTime);
|
||||
}
|
||||
@@ -1320,7 +1320,7 @@ namespace Vocaluxe.Screens
|
||||
_PrepareTimeLine();
|
||||
CSound.Play(_CurrentStream);
|
||||
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_VOCALS)
|
||||
if (CGame.AudioMode == EAudioMode.TR_AUDIOMODE_VOCALS)
|
||||
{
|
||||
CSound.Play(_CurrentStreamVocals);
|
||||
}
|
||||
@@ -1386,6 +1386,7 @@ namespace Vocaluxe.Screens
|
||||
CGame.Reset();
|
||||
CGame.ResetPlayer();
|
||||
CGame.NextRound();
|
||||
_SetVisibility();
|
||||
|
||||
_LoadCurrentSong();
|
||||
|
||||
@@ -1400,6 +1401,7 @@ namespace Vocaluxe.Screens
|
||||
_CloseSong();
|
||||
|
||||
CGame.NextRound();
|
||||
_SetVisibility();
|
||||
var voiceAssignments = new int[CGame.NumPlayers];
|
||||
if (CGame.GetSong() != null && CGame.GetSong().IsDuet)
|
||||
{
|
||||
@@ -1456,8 +1458,8 @@ namespace Vocaluxe.Screens
|
||||
_Buttons[_ButtonRestartGame].Visible = _Pause;
|
||||
_Buttons[_ButtonRestartRound].Visible = _Pause && CGame.NumRounds > 1;
|
||||
|
||||
_SelectSlides[_SelectSlidePauseVocalsVolume].Visible = _Pause && CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_VOCALS;
|
||||
_Texts[_TextPauseVocalsVolume].Visible = _Pause && CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_VOCALS;
|
||||
_SelectSlides[_SelectSlidePauseVocalsVolume].Visible = _Pause && CGame.AudioMode == EAudioMode.TR_AUDIOMODE_VOCALS;
|
||||
_Texts[_TextPauseVocalsVolume].Visible = _Pause && CGame.AudioMode == EAudioMode.TR_AUDIOMODE_VOCALS;
|
||||
|
||||
if (_StartDelayed)
|
||||
{
|
||||
@@ -1491,7 +1493,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
_Texts[_TextSongName].Visible = !_Pause;
|
||||
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_VOCALS)
|
||||
if (CGame.AudioMode == EAudioMode.TR_AUDIOMODE_VOCALS)
|
||||
{
|
||||
if (_Pause)
|
||||
{
|
||||
@@ -1557,11 +1559,11 @@ namespace Vocaluxe.Screens
|
||||
_Texts[_TextSongName].Text = songname;
|
||||
_Texts[_TextPauseSongName].Text = songname;
|
||||
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_INSTRUMENTAL || CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
if (CGame.AudioMode == EAudioMode.TR_AUDIOMODE_INSTRUMENTAL || CGame.AudioMode == EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
{
|
||||
_CurrentStream = CSound.Load(song.GetInstrumental(), false, true, EAudioEffect.None);
|
||||
}
|
||||
else if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_VOCALS)
|
||||
else if (CGame.AudioMode == EAudioMode.TR_AUDIOMODE_VOCALS)
|
||||
{
|
||||
_CurrentStream = CSound.Load(song.GetInstrumental(), false, true, EAudioEffect.None);
|
||||
_CurrentStreamVocals = CSound.Load(song.GetVocals(), false, true, EAudioEffect.None);
|
||||
@@ -1849,7 +1851,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
for (var player = 0; player < CGame.NumPlayers; player++)
|
||||
{
|
||||
if (CScreenSong.GetAudioMode() == EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
if (CGame.AudioMode == EAudioMode.TR_AUDIOMODE_KARAOKE)
|
||||
{
|
||||
_Texts[_PlayerTextScore[player]].Visible = false;
|
||||
_Statics[_PlayerStaticScore[player]].Visible = false;
|
||||
|
||||
@@ -42,7 +42,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 14; }
|
||||
get { return 15; }
|
||||
}
|
||||
|
||||
private const string _TextCategory = "TextCategory";
|
||||
@@ -1302,7 +1302,7 @@ namespace Vocaluxe.Screens
|
||||
gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
|
||||
}
|
||||
|
||||
_AudioMode = (EAudioMode)_SelectSlides[_SelectSlideOptionsAudioMode].SelectedTag;
|
||||
_AudioMode = _SelectSlides[_SelectSlideOptionsAudioMode].SelectedTag >= 0 ? (EAudioMode)_SelectSlides[_SelectSlideOptionsAudioMode].SelectedTag : EAudioMode.TR_AUDIOMODE_NORMAL;
|
||||
_PlayerSelect = (EPlayerSelect)_SelectSlides[_SelectSlideOptionsPlayerSelect].Selection;
|
||||
|
||||
CGame.Reset();
|
||||
@@ -1849,7 +1849,11 @@ namespace Vocaluxe.Screens
|
||||
_Texts[_TextOptionsAudioMode].Visible = false;
|
||||
}
|
||||
|
||||
_SelectSlides[_SelectSlideOptionsAudioMode].Selection = (int)_AudioMode;
|
||||
_SelectSlides[_SelectSlideOptionsAudioMode].SelectedTag = (int)_AudioMode;
|
||||
if (_SelectSlides[_SelectSlideOptionsAudioMode].SelectedTag != (int)_AudioMode)
|
||||
{
|
||||
_SelectSlides[_SelectSlideOptionsAudioMode].SelectedTag = (int)EAudioMode.TR_AUDIOMODE_NORMAL;
|
||||
}
|
||||
|
||||
_SelectSlides[_SelectSlideOptionsPlayerSelect].Clear();
|
||||
_SelectSlides[_SelectSlideOptionsPlayerSelect].AddValue("TR_SCREENSONG_PLAYERSELECT_ON");
|
||||
|
||||
@@ -28,11 +28,13 @@ namespace Vocaluxe.SongQueue
|
||||
{
|
||||
public readonly int SongId;
|
||||
public readonly EGameMode GameMode;
|
||||
public readonly EAudioMode AudioMode;
|
||||
|
||||
public SSongQueueEntry(int songId, EGameMode gameMode)
|
||||
public SSongQueueEntry(int songId, EGameMode gameMode, EAudioMode audioMode)
|
||||
{
|
||||
SongId = songId;
|
||||
GameMode = gameMode;
|
||||
AudioMode = audioMode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,24 +58,35 @@ namespace Vocaluxe.SongQueue
|
||||
return GetGameMode(_CurrentRound);
|
||||
}
|
||||
|
||||
public bool AddVisibleSong(int visibleIndex, EGameMode gameMode)
|
||||
public EAudioMode GetCurrentAudioMode()
|
||||
{
|
||||
return CSongs.VisibleSongs.Count > visibleIndex && _AddSong(CSongs.VisibleSongs[visibleIndex].Id, gameMode);
|
||||
return GetAudioMode(_CurrentRound);
|
||||
}
|
||||
|
||||
public bool AddSong(int absoluteIndex, EGameMode gameMode)
|
||||
public bool AddVisibleSong(int visibleIndex, EGameMode gameMode, EAudioMode audioMode)
|
||||
{
|
||||
return CSongs.AllSongs.Count > absoluteIndex && _AddSong(CSongs.AllSongs[absoluteIndex].Id, gameMode);
|
||||
return CSongs.VisibleSongs.Count > visibleIndex && _AddSong(CSongs.VisibleSongs[visibleIndex].Id, gameMode, audioMode);
|
||||
}
|
||||
|
||||
private bool _AddSong(int songId, EGameMode gameMode)
|
||||
public bool AddSong(int absoluteIndex, EGameMode gameMode, EAudioMode audioMode)
|
||||
{
|
||||
if (!CSongs.GetSong(songId).IsGameModeAvailable(gameMode))
|
||||
return CSongs.AllSongs.Count > absoluteIndex && _AddSong(CSongs.AllSongs[absoluteIndex].Id, gameMode, audioMode);
|
||||
}
|
||||
|
||||
private bool _AddSong(int songId, EGameMode gameMode, EAudioMode audioMode)
|
||||
{
|
||||
var song = CSongs.GetSong(songId);
|
||||
if (!song.IsGameModeAvailable(gameMode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_SongQueue.Add(new SSongQueueEntry(songId, gameMode));
|
||||
if (!song.HasInstrumental() || audioMode == EAudioMode.TR_AUDIOMODE_VOCALS && !song.HasVocals())
|
||||
{
|
||||
audioMode = EAudioMode.TR_AUDIOMODE_NORMAL;
|
||||
}
|
||||
|
||||
_SongQueue.Add(new SSongQueueEntry(songId, gameMode, audioMode));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -210,6 +223,16 @@ namespace Vocaluxe.SongQueue
|
||||
return EGameMode.TR_GAMEMODE_NORMAL;
|
||||
}
|
||||
|
||||
public EAudioMode GetAudioMode(int round)
|
||||
{
|
||||
if (round < _SongQueue.Count && round >= 0)
|
||||
{
|
||||
return _SongQueue[round].AudioMode;
|
||||
}
|
||||
|
||||
return EAudioMode.TR_AUDIOMODE_NORMAL;
|
||||
}
|
||||
|
||||
public CPoints GetPoints()
|
||||
{
|
||||
return _Points;
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Vocaluxe.SongQueue
|
||||
{
|
||||
void Init();
|
||||
|
||||
bool AddVisibleSong(int visibleIndex, EGameMode gameMode);
|
||||
bool AddSong(int absoluteIndex, EGameMode gameMode);
|
||||
bool AddVisibleSong(int visibleIndex, EGameMode gameMode, EAudioMode audioMode);
|
||||
bool AddSong(int absoluteIndex, EGameMode gameMode, EAudioMode audioMode);
|
||||
bool RemoveVisibleSong(int visibleIndex);
|
||||
bool RemoveSong(int absoluteIndex);
|
||||
void ClearSongs();
|
||||
@@ -45,5 +45,7 @@ namespace Vocaluxe.SongQueue
|
||||
CSong GetSong(int round);
|
||||
EGameMode GetCurrentGameMode();
|
||||
EGameMode GetGameMode(int round);
|
||||
EAudioMode GetCurrentAudioMode();
|
||||
EAudioMode GetAudioMode(int round);
|
||||
}
|
||||
}
|
||||
@@ -198,6 +198,7 @@ namespace VocaluxeLib
|
||||
float GetBeatFromTime(float time, float bpm, float gap);
|
||||
|
||||
void AddSong(int songId, EGameMode gameMode);
|
||||
void AddSong(int songId, EGameMode gameMode, EAudioMode audioMode);
|
||||
void Reset();
|
||||
void ClearSongs();
|
||||
int GetNumSongs();
|
||||
|
||||
+133
-15
@@ -19,6 +19,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Songs;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -33,16 +34,19 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
public int SongId;
|
||||
public EGameMode GameMode;
|
||||
public EAudioMode AudioMode;
|
||||
|
||||
public CPlaylistSong(int songId, EGameMode gm)
|
||||
{
|
||||
SongId = songId;
|
||||
GameMode = gm;
|
||||
AudioMode = EAudioMode.TR_AUDIOMODE_NORMAL;
|
||||
}
|
||||
|
||||
public CPlaylistSong()
|
||||
{
|
||||
GameMode = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
AudioMode = EAudioMode.TR_AUDIOMODE_NORMAL;
|
||||
}
|
||||
|
||||
public SPlaylistSong ToStruct()
|
||||
@@ -53,7 +57,7 @@ namespace VocaluxeLib.Menu
|
||||
throw new Exception("Can't find Song. This should never happen!");
|
||||
}
|
||||
|
||||
return new SPlaylistSong { Artist = song.Artist, Title = song.Title, GameMode = GameMode };
|
||||
return new SPlaylistSong { Artist = song.Artist, Title = song.Title, GameMode = GameMode, AudioMode = AudioMode };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +91,7 @@ namespace VocaluxeLib.Menu
|
||||
public SThemeButton ButtonPlaylistList;
|
||||
|
||||
public SThemeSelectSlide SelectSlideGameMode;
|
||||
public SThemeSelectSlide? SelectSlideAudioMode;
|
||||
}
|
||||
|
||||
//TODO: Refactor this class, it is almost unreadable and may not work in some occasions
|
||||
@@ -97,6 +102,7 @@ namespace VocaluxeLib.Menu
|
||||
public IList<EGameMode> Modes;
|
||||
public int SongId;
|
||||
public EGameMode Mode;
|
||||
public EAudioMode AudioMode;
|
||||
}
|
||||
|
||||
private class CPlaylistElement
|
||||
@@ -105,6 +111,7 @@ namespace VocaluxeLib.Menu
|
||||
public CStatic Background;
|
||||
public CText Text1;
|
||||
public CSelectSlide SelectSlide;
|
||||
public CSelectSlide SelectSlideAudio;
|
||||
public int Content;
|
||||
|
||||
public CPlaylistElement() { }
|
||||
@@ -115,6 +122,7 @@ namespace VocaluxeLib.Menu
|
||||
Background = new CStatic(pe.Background);
|
||||
Text1 = new CText(pe.Text1);
|
||||
SelectSlide = new CSelectSlide(pe.SelectSlide);
|
||||
SelectSlideAudio = pe.SelectSlideAudio == null ? null : new CSelectSlide(pe.SelectSlideAudio);
|
||||
Content = pe.Content;
|
||||
}
|
||||
|
||||
@@ -122,6 +130,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
Background.Draw();
|
||||
SelectSlide.Draw();
|
||||
SelectSlideAudio?.Draw();
|
||||
Cover.Draw();
|
||||
Text1.Draw();
|
||||
}
|
||||
@@ -140,6 +149,12 @@ namespace VocaluxeLib.Menu
|
||||
SelectSlide.X += diffX;
|
||||
SelectSlide.Y += diffY;
|
||||
|
||||
if (SelectSlideAudio != null)
|
||||
{
|
||||
SelectSlideAudio.X += diffX;
|
||||
SelectSlideAudio.Y += diffY;
|
||||
}
|
||||
|
||||
Text1.X += diffX;
|
||||
Text1.Y += diffY;
|
||||
}
|
||||
@@ -170,6 +185,7 @@ namespace VocaluxeLib.Menu
|
||||
private readonly CButton _ButtonPlaylistList;
|
||||
private readonly CText _Text1;
|
||||
private readonly CSelectSlide _SelectSlideGameMode;
|
||||
private readonly CSelectSlide _SelectSlideAudioMode;
|
||||
private readonly CStatic _StaticPlaylistHeader;
|
||||
private readonly CStatic _StaticPlaylistFooter;
|
||||
|
||||
@@ -265,6 +281,10 @@ namespace VocaluxeLib.Menu
|
||||
_ButtonPlaylistSing = new CButton(_Theme.ButtonPlaylistSing, _PartyModeId);
|
||||
_ButtonPlaylistList = new CButton(_Theme.ButtonPlaylistList, _PartyModeId);
|
||||
_SelectSlideGameMode = new CSelectSlide(_Theme.SelectSlideGameMode, _PartyModeId);
|
||||
if (_Theme.SelectSlideAudioMode.HasValue)
|
||||
{
|
||||
_SelectSlideAudioMode = new CSelectSlide(_Theme.SelectSlideAudioMode.Value, _PartyModeId);
|
||||
}
|
||||
|
||||
_AddStatic(_StaticPlaylistFooter);
|
||||
_AddStatic(_StaticPlaylistHeader);
|
||||
@@ -344,6 +364,7 @@ namespace VocaluxeLib.Menu
|
||||
_StaticPlaylistHeader.UnloadSkin();
|
||||
|
||||
_SelectSlideGameMode.UnloadSkin();
|
||||
_SelectSlideAudioMode?.UnloadSkin();
|
||||
_ClearElements();
|
||||
}
|
||||
|
||||
@@ -366,6 +387,7 @@ namespace VocaluxeLib.Menu
|
||||
_StaticPlaylistHeader.LoadSkin();
|
||||
|
||||
_SelectSlideGameMode.LoadSkin();
|
||||
_SelectSlideAudioMode?.LoadSkin();
|
||||
|
||||
_UpdateRect();
|
||||
|
||||
@@ -449,6 +471,10 @@ namespace VocaluxeLib.Menu
|
||||
base.HandleInput(keyEvent);
|
||||
_CurrentPlaylistElement = _GetSelectedElementNr();
|
||||
}
|
||||
else if (_IsAudioSlideSelected(_CurrentPlaylistElement))
|
||||
{
|
||||
_SelectElement(_PlaylistElements[_CurrentPlaylistElement].SelectSlide);
|
||||
}
|
||||
else if (_CurrentPlaylistElement > scrollLimit || _PlaylistElementContents.Count == 0)
|
||||
{
|
||||
base.HandleInput(keyEvent);
|
||||
@@ -460,6 +486,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_Offset--;
|
||||
_Update();
|
||||
_SelectLastSlide(_CurrentPlaylistElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -483,12 +510,17 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_IsAudioSlideVisible(_CurrentPlaylistElement) && !_IsAudioSlideSelected(_CurrentPlaylistElement))
|
||||
{
|
||||
_SelectElement(_PlaylistElements[_CurrentPlaylistElement].SelectSlideAudio);
|
||||
}
|
||||
else if (_CurrentPlaylistElement >= scrollLimit)
|
||||
{
|
||||
if (_Offset < _PlaylistElementContents.Count - _PlaylistElements.Count)
|
||||
{
|
||||
_Offset++;
|
||||
_Update();
|
||||
_SelectElement(_PlaylistElements[_CurrentPlaylistElement].SelectSlide);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -646,9 +678,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (_CurrentPlaylistElement != -1)
|
||||
{
|
||||
CBase.Playlist.GetSong(ActivePlaylistId, _CurrentPlaylistElement + _Offset).GameMode =
|
||||
_PlaylistElementContents[_CurrentPlaylistElement + _Offset].Modes[_PlaylistElements[_CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
_ApplySelection(_CurrentPlaylistElement);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -659,9 +689,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (_CurrentPlaylistElement != -1)
|
||||
{
|
||||
CBase.Playlist.GetSong(ActivePlaylistId, _CurrentPlaylistElement + _Offset).GameMode =
|
||||
_PlaylistElementContents[_CurrentPlaylistElement + _Offset].Modes[_PlaylistElements[_CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
_ApplySelection(_CurrentPlaylistElement);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -784,7 +812,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
for (var i = 0; i < _PlaylistElements.Count; i++)
|
||||
{
|
||||
if (_PlaylistElements[i].SelectSlide.Selected)
|
||||
if (_PlaylistElements[i].SelectSlide.Selected || _IsAudioSlideSelected(i))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@@ -793,6 +821,33 @@ namespace VocaluxeLib.Menu
|
||||
return -1;
|
||||
}
|
||||
|
||||
private bool _IsAudioSlideVisible(int element)
|
||||
{
|
||||
return element >= 0 && element < _PlaylistElements.Count && _PlaylistElements[element].SelectSlideAudio != null && _PlaylistElements[element].SelectSlideAudio.Visible;
|
||||
}
|
||||
|
||||
private bool _IsAudioSlideSelected(int element)
|
||||
{
|
||||
return element >= 0 && element < _PlaylistElements.Count && _PlaylistElements[element].SelectSlideAudio != null && _PlaylistElements[element].SelectSlideAudio.Selected;
|
||||
}
|
||||
|
||||
private void _SelectLastSlide(int element)
|
||||
{
|
||||
_SelectElement(_IsAudioSlideVisible(element) ? _PlaylistElements[element].SelectSlideAudio : _PlaylistElements[element].SelectSlide);
|
||||
}
|
||||
|
||||
private void _ApplySelection(int element)
|
||||
{
|
||||
var playlistSong = CBase.Playlist.GetSong(ActivePlaylistId, element + _Offset);
|
||||
playlistSong.GameMode = _PlaylistElementContents[element + _Offset].Modes[_PlaylistElements[element].SelectSlide.Selection];
|
||||
if (_IsAudioSlideVisible(element))
|
||||
{
|
||||
playlistSong.AudioMode = (EAudioMode)_PlaylistElements[element].SelectSlideAudio.SelectedTag;
|
||||
}
|
||||
|
||||
UpdatePlaylist();
|
||||
}
|
||||
|
||||
public void ScrollToBottom()
|
||||
{
|
||||
if (_PlaylistElementContents.Count == 0)
|
||||
@@ -843,7 +898,9 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
hoverSet = true;
|
||||
_CurrentPlaylistElement = i;
|
||||
_SelectElement(_PlaylistElements[_CurrentPlaylistElement].SelectSlide);
|
||||
_SelectElement(_IsAudioSlideVisible(i) && CHelper.IsInBounds(_PlaylistElements[i].SelectSlideAudio.Rect, mouseEvent)
|
||||
? _PlaylistElements[i].SelectSlideAudio
|
||||
: _PlaylistElements[i].SelectSlide);
|
||||
ProcessMouseMove(mouseEvent.X, mouseEvent.Y);
|
||||
}
|
||||
|
||||
@@ -876,9 +933,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (_CurrentPlaylistElement != -1)
|
||||
{
|
||||
CBase.Playlist.GetSong(ActivePlaylistId, _CurrentPlaylistElement + _Offset).GameMode =
|
||||
_PlaylistElementContents[_CurrentPlaylistElement + _Offset].Modes[_PlaylistElements[_CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
_ApplySelection(_CurrentPlaylistElement);
|
||||
}
|
||||
|
||||
if (_ButtonPlaylistClose.Selected)
|
||||
@@ -939,6 +994,11 @@ namespace VocaluxeLib.Menu
|
||||
Text1 = { Z = CBase.Settings.GetZNear() }
|
||||
};
|
||||
|
||||
if (_ChangeOrderElement.SelectSlideAudio != null)
|
||||
{
|
||||
_ChangeOrderElement.SelectSlideAudio.Z = CBase.Settings.GetZNear();
|
||||
}
|
||||
|
||||
_ChangeOrderElement.Background.Texture = CBase.Themes.GetSkinTexture(_Theme.SkinBackground, _PartyModeId);
|
||||
_ChangeOrderElement.Background.Color = _BackgroundColor;
|
||||
|
||||
@@ -1116,10 +1176,23 @@ namespace VocaluxeLib.Menu
|
||||
en.SelectSlide.X += _Theme.Rect.X;
|
||||
en.SelectSlide.Y += _Theme.Rect.Y + i * _Theme.EntryHeight;
|
||||
|
||||
if (_SelectSlideAudioMode != null)
|
||||
{
|
||||
en.SelectSlideAudio = new CSelectSlide(_SelectSlideAudioMode);
|
||||
en.SelectSlideAudio.LoadSkin();
|
||||
en.SelectSlideAudio.X += _Theme.Rect.X;
|
||||
en.SelectSlideAudio.Y += _Theme.Rect.Y + i * _Theme.EntryHeight;
|
||||
}
|
||||
|
||||
en.Content = -1;
|
||||
|
||||
_PlaylistElements.Add(en);
|
||||
_AddSelectSlide(en.SelectSlide);
|
||||
if (en.SelectSlideAudio != null)
|
||||
{
|
||||
_AddSelectSlide(en.SelectSlideAudio);
|
||||
}
|
||||
|
||||
_AddText(en.Text1);
|
||||
_AddStatic(en.Background);
|
||||
_AddStatic(en.Cover);
|
||||
@@ -1142,7 +1215,8 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
SongId = CBase.Playlist.GetSong(ActivePlaylistId, i).SongId,
|
||||
Modes = CBase.Songs.GetSongById(CBase.Playlist.GetSong(ActivePlaylistId, i).SongId).AvailableGameModes,
|
||||
Mode = CBase.Playlist.GetSong(ActivePlaylistId, i).GameMode
|
||||
Mode = CBase.Playlist.GetSong(ActivePlaylistId, i).GameMode,
|
||||
AudioMode = CBase.Playlist.GetSong(ActivePlaylistId, i).AudioMode
|
||||
};
|
||||
_PlaylistElementContents.Add(pec);
|
||||
}
|
||||
@@ -1160,6 +1234,7 @@ namespace VocaluxeLib.Menu
|
||||
var pec = new CPlaylistElementContent { SongId = CBase.Playlist.GetSong(ActivePlaylistId, i).SongId };
|
||||
pec.Modes = CBase.Songs.GetSongById(pec.SongId).AvailableGameModes;
|
||||
pec.Mode = CBase.Playlist.GetSong(ActivePlaylistId, i).GameMode;
|
||||
pec.AudioMode = CBase.Playlist.GetSong(ActivePlaylistId, i).AudioMode;
|
||||
_PlaylistElementContents.Add(pec);
|
||||
}
|
||||
|
||||
@@ -1183,7 +1258,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
for (var i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistId); i++)
|
||||
{
|
||||
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistId, i).SongId, CBase.Playlist.GetSong(ActivePlaylistId, i).GameMode);
|
||||
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistId, i).SongId, CBase.Playlist.GetSong(ActivePlaylistId, i).GameMode, CBase.Playlist.GetSong(ActivePlaylistId, i).AudioMode);
|
||||
}
|
||||
|
||||
if (CBase.Game.GetNumSongs() > 0)
|
||||
@@ -1198,7 +1273,7 @@ namespace VocaluxeLib.Menu
|
||||
CBase.Game.Reset();
|
||||
CBase.Game.ClearSongs();
|
||||
|
||||
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistId, selected).SongId, CBase.Playlist.GetSong(ActivePlaylistId, selected).GameMode);
|
||||
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistId, selected).SongId, CBase.Playlist.GetSong(ActivePlaylistId, selected).GameMode, CBase.Playlist.GetSong(ActivePlaylistId, selected).AudioMode);
|
||||
|
||||
if (CBase.Game.GetNumSongs() > 0)
|
||||
{
|
||||
@@ -1234,18 +1309,61 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
_PlaylistElements[i].SelectSlide.SelectedTag = (int)pec.Mode;
|
||||
_UpdateAudioSlide(i, song, pec.AudioMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
_PlaylistElements[i].Background.Visible = false;
|
||||
_PlaylistElements[i].Cover.Visible = false;
|
||||
_PlaylistElements[i].SelectSlide.Visible = false;
|
||||
if (_PlaylistElements[i].SelectSlideAudio != null)
|
||||
{
|
||||
_PlaylistElements[i].SelectSlideAudio.Visible = false;
|
||||
}
|
||||
|
||||
_PlaylistElements[i].Text1.Visible = false;
|
||||
_PlaylistElements[i].Content = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _UpdateAudioSlide(int element, CSong song, EAudioMode audioMode)
|
||||
{
|
||||
var audioSlide = _PlaylistElements[element].SelectSlideAudio;
|
||||
if (audioSlide == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
audioSlide.Clear();
|
||||
if (!song.HasInstrumental())
|
||||
{
|
||||
if (audioSlide.Selected)
|
||||
{
|
||||
_SelectElement(_PlaylistElements[element].SelectSlide);
|
||||
}
|
||||
|
||||
audioSlide.Visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
audioSlide.AddValue("TR_AUDIOMODE_NORMAL", null, (int)EAudioMode.TR_AUDIOMODE_NORMAL);
|
||||
audioSlide.AddValue("TR_AUDIOMODE_INSTRUMENTAL", null, (int)EAudioMode.TR_AUDIOMODE_INSTRUMENTAL);
|
||||
if (song.HasVocals())
|
||||
{
|
||||
audioSlide.AddValue("TR_AUDIOMODE_VOCALS", null, (int)EAudioMode.TR_AUDIOMODE_VOCALS);
|
||||
}
|
||||
|
||||
audioSlide.AddValue("TR_AUDIOMODE_KARAOKE", null, (int)EAudioMode.TR_AUDIOMODE_KARAOKE);
|
||||
audioSlide.SelectedTag = (int)audioMode;
|
||||
if (audioSlide.SelectedTag != (int)audioMode)
|
||||
{
|
||||
audioSlide.SelectedTag = (int)EAudioMode.TR_AUDIOMODE_NORMAL;
|
||||
}
|
||||
|
||||
audioSlide.Visible = true;
|
||||
}
|
||||
|
||||
public object GetTheme()
|
||||
{
|
||||
_ReadSubThemeElements();
|
||||
|
||||
@@ -26,5 +26,7 @@ namespace VocaluxeLib
|
||||
public string Artist, Title;
|
||||
[DefaultValue(EGameMode.TR_GAMEMODE_NORMAL)]
|
||||
public EGameMode GameMode;
|
||||
[DefaultValue(EAudioMode.TR_AUDIOMODE_NORMAL)]
|
||||
public EAudioMode AudioMode;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user