Merge branch 'release-0.3' into develop
Conflicts: Vocaluxe/Base/CConfig.cs Vocaluxe/Lib/Playlist/CPlaylistFile.cs Vocaluxe/Screens/CScreenSong.cs VocaluxeLib/CHelper.cs VocaluxeLib/Menu/CMenu.cs VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs
This commit is contained in:
commit
73e4a9fa74
15 files changed
+240
-272
No files matched your search
@@ -675,7 +675,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
|
|
||||||
case ESongSource.TR_CATEGORY:
|
case ESongSource.TR_CATEGORY:
|
||||||
CBase.Songs.SetCategory(_GameData.CategoryID);
|
CBase.Songs.SetCategory(_GameData.CategoryID);
|
||||||
for (int i = 0; i < CBase.Songs.NumSongsInCategory(_GameData.CategoryID); i++)
|
for (int i = 0; i < CBase.Songs.GetNumSongsVisible(); i++)
|
||||||
{
|
{
|
||||||
// ReSharper disable LoopCanBeConvertedToQuery
|
// ReSharper disable LoopCanBeConvertedToQuery
|
||||||
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
|
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
|
using VocaluxeLib.Songs;
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.TicTacToe
|
namespace VocaluxeLib.PartyModes.TicTacToe
|
||||||
{
|
{
|
||||||
@@ -59,7 +60,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
|
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
|
||||||
|
|
||||||
_Data = new SDataFromScreen();
|
_Data = new SDataFromScreen();
|
||||||
SFromScreenConfig config = new SFromScreenConfig
|
var config = new SFromScreenConfig
|
||||||
{
|
{
|
||||||
PlaylistID = 0,
|
PlaylistID = 0,
|
||||||
NumFields = 9,
|
NumFields = 9,
|
||||||
@@ -76,7 +77,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SDataToScreenConfig config = (SDataToScreenConfig)receivedData;
|
var config = (SDataToScreenConfig)receivedData;
|
||||||
_Data.ScreenConfig.NumFields = config.NumFields;
|
_Data.ScreenConfig.NumFields = config.NumFields;
|
||||||
_Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1;
|
_Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1;
|
||||||
_Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2;
|
_Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2;
|
||||||
@@ -207,13 +208,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID;
|
_SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID;
|
||||||
_SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
|
_SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
|
||||||
|
|
||||||
string[] categories = new string[CBase.Songs.GetNumCategories()];
|
var categories = new string[CBase.Songs.GetNumCategories()];
|
||||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
||||||
categories[i] = CBase.Songs.GetCategory(i).Name;
|
categories[i] = CBase.Songs.GetCategory(i).Name;
|
||||||
_SelectSlides[_SelectSlideCategory].Clear();
|
_SelectSlides[_SelectSlideCategory].Clear();
|
||||||
for (int i = 0; i < categories.Length; i++)
|
for (int i = 0; i < categories.Length; i++)
|
||||||
{
|
{
|
||||||
string value = categories[i] + " (" + CBase.Songs.NumSongsInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
|
string value = categories[i] + " (" + CBase.Songs.GetNumSongsNotSungInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
|
||||||
_SelectSlides[_SelectSlideCategory].AddValue(value);
|
_SelectSlides[_SelectSlideCategory].AddValue(value);
|
||||||
}
|
}
|
||||||
_SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID;
|
_SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID;
|
||||||
@@ -240,7 +241,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_Data.ScreenConfig.CategoryID = _SelectSlides[_SelectSlideCategory].Selection;
|
_Data.ScreenConfig.CategoryID = _SelectSlides[_SelectSlideCategory].Selection;
|
||||||
_Data.ScreenConfig.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
|
_Data.ScreenConfig.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
|
||||||
|
|
||||||
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||||
|
|
||||||
switch (_Data.ScreenConfig.GameMode)
|
switch (_Data.ScreenConfig.GameMode)
|
||||||
{
|
{
|
||||||
@@ -280,25 +281,22 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
}
|
}
|
||||||
if (_Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY)
|
if (_Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY)
|
||||||
{
|
{
|
||||||
if (CBase.Songs.GetNumCategories() > 0)
|
if (CBase.Songs.GetNumCategories() == 0)
|
||||||
{
|
|
||||||
if (CBase.Songs.NumSongsInCategory(_Data.ScreenConfig.CategoryID) > 0)
|
|
||||||
{
|
|
||||||
CBase.Songs.SetCategory(_Data.ScreenConfig.CategoryID);
|
|
||||||
_ConfigOk = false;
|
|
||||||
for (int i = 0; i < CBase.Songs.NumSongsInCategory(_Data.ScreenConfig.CategoryID); i++)
|
|
||||||
{
|
|
||||||
_ConfigOk = CBase.Songs.GetVisibleSong(i).AvailableGameModes.Any(mode => mode == gm);
|
|
||||||
if (_ConfigOk)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
CBase.Songs.SetCategory(-1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_ConfigOk = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_ConfigOk = false;
|
_ConfigOk = false;
|
||||||
|
else if (CBase.Songs.GetNumSongsNotSungInCategory(_Data.ScreenConfig.CategoryID) <= 0)
|
||||||
|
_ConfigOk = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CBase.Songs.SetCategory(_Data.ScreenConfig.CategoryID);
|
||||||
|
_ConfigOk = false;
|
||||||
|
foreach (CSong song in CBase.Songs.GetVisibleSongs())
|
||||||
|
{
|
||||||
|
_ConfigOk = song.AvailableGameModes.Any(mode => mode == gm);
|
||||||
|
if (_ConfigOk)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CBase.Songs.SetCategory(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (_Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS)
|
if (_Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,15 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
static class CConfig
|
static class CConfig
|
||||||
{
|
{
|
||||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
/// <summary>
|
||||||
|
/// Uniform settings for writing XML files. ALWAYS use this!
|
||||||
|
/// </summary>
|
||||||
|
public static readonly XmlWriterSettings XMLSettings = new XmlWriterSettings
|
||||||
|
{
|
||||||
|
Indent = true,
|
||||||
|
Encoding = Encoding.UTF8,
|
||||||
|
ConformanceLevel = ConformanceLevel.Document
|
||||||
|
};
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF;
|
public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF;
|
||||||
@@ -141,10 +149,6 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
_Settings.Indent = true;
|
|
||||||
_Settings.Encoding = Encoding.UTF8;
|
|
||||||
_Settings.ConformanceLevel = ConformanceLevel.Document;
|
|
||||||
|
|
||||||
SongFolder.Add(Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderSongs));
|
SongFolder.Add(Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderSongs));
|
||||||
|
|
||||||
#if INSTALLER
|
#if INSTALLER
|
||||||
@@ -304,7 +308,7 @@ namespace Vocaluxe.Base
|
|||||||
XmlWriter writer = null;
|
XmlWriter writer = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer = XmlWriter.Create(Path.Combine(CSettings.DataPath, CSettings.FileConfig), _Settings);
|
writer = XmlWriter.Create(Path.Combine(CSettings.DataPath, CSettings.FileConfig), XMLSettings);
|
||||||
writer.WriteStartDocument();
|
writer.WriteStartDocument();
|
||||||
writer.WriteStartElement("root");
|
writer.WriteStartElement("root");
|
||||||
|
|
||||||
|
|||||||
+14
-6
@@ -19,6 +19,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Xml;
|
||||||
using Vocaluxe.Base.Fonts;
|
using Vocaluxe.Base.Fonts;
|
||||||
using VocaluxeLib;
|
using VocaluxeLib;
|
||||||
using VocaluxeLib.Game;
|
using VocaluxeLib.Game;
|
||||||
@@ -144,6 +145,11 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
return CConfig.GetMaxNumMics();
|
return CConfig.GetMaxNumMics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XmlWriterSettings GetXMLSettings()
|
||||||
|
{
|
||||||
|
return CConfig.XMLSettings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CBsettings : ISettings
|
class CBsettings : ISettings
|
||||||
@@ -606,9 +612,14 @@ namespace Vocaluxe.Base
|
|||||||
return CSongs.NumCategories;
|
return CSongs.NumCategories;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int NumSongsInCategory(int categoryIndex)
|
public int GetNumSongsInCategory(int categoryIndex)
|
||||||
{
|
{
|
||||||
return CSongs.NumSongsInCategory(categoryIndex);
|
return CSongs.GetNumSongsInCategory(categoryIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetNumSongsNotSungInCategory(int categoryIndex)
|
||||||
|
{
|
||||||
|
return CSongs.GetNumSongsNotSungInCategory(categoryIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInCategory()
|
public bool IsInCategory()
|
||||||
@@ -663,10 +674,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public CCategory GetCategory(int index)
|
public CCategory GetCategory(int index)
|
||||||
{
|
{
|
||||||
if (index >= CSongs.NumCategories)
|
return CSongs.GetCategoryByIndex(index);
|
||||||
return null;
|
|
||||||
|
|
||||||
return new CCategory(CSongs.Categories[index]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPartySongSung(int songID)
|
public void AddPartySongSung(int songID)
|
||||||
|
|||||||
+33
-6
@@ -64,7 +64,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static int NumSongsVisible
|
public static int NumSongsVisible
|
||||||
{
|
{
|
||||||
get { return _CatIndex < 0 ? 0 : Categories[_CatIndex].Songs.Count(sp => !sp.IsSung); }
|
get { return VisibleSongs.Count; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int NumCategories
|
public static int NumCategories
|
||||||
@@ -102,9 +102,19 @@ namespace Vocaluxe.Base
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="catIndex">Category index</param>
|
/// <param name="catIndex">Category index</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int NumSongsInCategory(int catIndex)
|
public static int GetNumSongsInCategory(int catIndex)
|
||||||
{
|
{
|
||||||
return _IsCatIndexValid(catIndex) ? Categories[catIndex].Songs.Count(sp => !sp.IsSung) : 0;
|
return _IsCatIndexValid(catIndex) ? Categories[catIndex].Songs.Count : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the number of song that are not sung in the category specified with CatIndex
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="catIndex">Category index</param>
|
||||||
|
/// <returns>Number of visible songs in that category</returns>
|
||||||
|
public static int GetNumSongsNotSungInCategory(int catIndex)
|
||||||
|
{
|
||||||
|
return _IsCatIndexValid(catIndex) ? Categories[catIndex].GetNumSongsNotSung() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void NextCategory()
|
public static void NextCategory()
|
||||||
@@ -157,9 +167,8 @@ namespace Vocaluxe.Base
|
|||||||
foreach (CSongPointer song in category.Songs.Where(song => song.SongID == songID))
|
foreach (CSongPointer song in category.Songs.Where(song => song.SongID == songID))
|
||||||
{
|
{
|
||||||
song.IsSung = true;
|
song.IsSung = true;
|
||||||
int catIndex = _GetCategoryNumber(category);
|
if (category.GetNumSongsNotSung() == 0)
|
||||||
if (NumSongsInCategory(catIndex) == 0)
|
ResetPartySongSung(_GetCategoryNumber(category));
|
||||||
ResetPartySongSung(catIndex);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -269,6 +278,24 @@ namespace Vocaluxe.Base
|
|||||||
get { return Categorizer.Categories.AsReadOnly(); }
|
get { return Categorizer.Categories.AsReadOnly(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets category with given index or null for invalid index
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index"></param>
|
||||||
|
/// <returns>category with given index or null for invalid index</returns>
|
||||||
|
public static CCategory GetCategoryByIndex(int index)
|
||||||
|
{
|
||||||
|
if (!_IsCatIndexValid(index))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return Categorizer.Categories[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets visible song with given index or null for invalid index or song not visible
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="index"></param>
|
||||||
|
/// <returns>visible song with given index or null for invalid index or song not visible</returns>
|
||||||
public static CSong GetVisibleSongByIndex(int index)
|
public static CSong GetVisibleSongByIndex(int index)
|
||||||
{
|
{
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ namespace Vocaluxe.Base
|
|||||||
private const int _SkinSystemVersion = 3;
|
private const int _SkinSystemVersion = 3;
|
||||||
|
|
||||||
#region Vars
|
#region Vars
|
||||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
|
||||||
private static readonly List<STheme> _Themes = new List<STheme>();
|
private static readonly List<STheme> _Themes = new List<STheme>();
|
||||||
public static string[] ThemeNames
|
public static string[] ThemeNames
|
||||||
{
|
{
|
||||||
@@ -146,10 +145,6 @@ namespace Vocaluxe.Base
|
|||||||
#region Theme and Skin loading and writing
|
#region Theme and Skin loading and writing
|
||||||
public static void InitTheme()
|
public static void InitTheme()
|
||||||
{
|
{
|
||||||
_Settings.Indent = true;
|
|
||||||
_Settings.Encoding = Encoding.UTF8;
|
|
||||||
_Settings.ConformanceLevel = ConformanceLevel.Document;
|
|
||||||
|
|
||||||
_ListThemes();
|
_ListThemes();
|
||||||
ListSkins();
|
ListSkins();
|
||||||
|
|
||||||
@@ -289,7 +284,7 @@ namespace Vocaluxe.Base
|
|||||||
private static void _SaveTheme(int themeIndex)
|
private static void _SaveTheme(int themeIndex)
|
||||||
{
|
{
|
||||||
#region ThemeMainFile
|
#region ThemeMainFile
|
||||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName), _Settings))
|
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName), CConfig.XMLSettings))
|
||||||
{
|
{
|
||||||
writer.WriteStartDocument();
|
writer.WriteStartDocument();
|
||||||
writer.WriteStartElement("root");
|
writer.WriteStartElement("root");
|
||||||
@@ -331,7 +326,7 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
for (int skinIndex = 0; skinIndex < _Skins.Count; skinIndex++)
|
for (int skinIndex = 0; skinIndex < _Skins.Count; skinIndex++)
|
||||||
{
|
{
|
||||||
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName), _Settings))
|
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName), CConfig.XMLSettings))
|
||||||
{
|
{
|
||||||
writer.WriteStartDocument();
|
writer.WriteStartDocument();
|
||||||
writer.WriteStartElement("root");
|
writer.WriteStartElement("root");
|
||||||
|
|||||||
@@ -29,33 +29,22 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
{
|
{
|
||||||
public class CPlaylistFile
|
public class CPlaylistFile
|
||||||
{
|
{
|
||||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
|
||||||
|
|
||||||
public string PlaylistName;
|
public string PlaylistName;
|
||||||
public string PlaylistFile;
|
public string PlaylistFile;
|
||||||
public List<CPlaylistSong> Songs = new List<CPlaylistSong>();
|
public List<CPlaylistSong> Songs = new List<CPlaylistSong>();
|
||||||
|
|
||||||
public CPlaylistFile()
|
public CPlaylistFile()
|
||||||
{
|
{
|
||||||
_Init();
|
|
||||||
PlaylistName = string.Empty;
|
PlaylistName = string.Empty;
|
||||||
PlaylistFile = string.Empty;
|
PlaylistFile = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPlaylistFile(string file)
|
public CPlaylistFile(string file)
|
||||||
{
|
{
|
||||||
_Init();
|
|
||||||
PlaylistFile = file;
|
PlaylistFile = file;
|
||||||
_LoadPlaylist();
|
_LoadPlaylist();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _Init()
|
|
||||||
{
|
|
||||||
_Settings.Indent = true;
|
|
||||||
_Settings.Encoding = Encoding.UTF8;
|
|
||||||
_Settings.ConformanceLevel = ConformanceLevel.Document;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SavePlaylist()
|
public void SavePlaylist()
|
||||||
{
|
{
|
||||||
if (PlaylistFile == "")
|
if (PlaylistFile == "")
|
||||||
@@ -86,7 +75,7 @@ namespace Vocaluxe.Lib.Playlist
|
|||||||
XmlWriter writer;
|
XmlWriter writer;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer = XmlWriter.Create(PlaylistFile, _Settings);
|
writer = XmlWriter.Create(PlaylistFile, CConfig.XMLSettings);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1011,7 +1011,10 @@ namespace Vocaluxe.Screens
|
|||||||
if (firstLevel && !secondSort)
|
if (firstLevel && !secondSort)
|
||||||
{
|
{
|
||||||
//TODO: What's to do with multiple tags?
|
//TODO: What's to do with multiple tags?
|
||||||
|
//Flamefire: What? We only sorted by one tag, sorting by multiple tags (e.g. Album) will be by e.g. the first entry. That can be used here too as otherwhise it will confuse users because it jumps randomly
|
||||||
|
|
||||||
//How can we get current letter? I think we have to save it - Or is there a better method?
|
//How can we get current letter? I think we have to save it - Or is there a better method?
|
||||||
|
//"Current letter"? The letter that was typed last? Doesn't matter as we are starting the search on current selected song
|
||||||
ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs;
|
ReadOnlyCollection<CSong> songs = CSongs.VisibleSongs;
|
||||||
int ct = songs.Count;
|
int ct = songs.Count;
|
||||||
int visibleID = -1;
|
int visibleID = -1;
|
||||||
@@ -1025,6 +1028,7 @@ namespace Vocaluxe.Screens
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
//TODO: Does this make sense? Maybe we should deactivate this for years? You could only jump between 1 and 2
|
//TODO: Does this make sense? Maybe we should deactivate this for years? You could only jump between 1 and 2
|
||||||
|
//Keep it for consistency. Decades are reasonable though.
|
||||||
case ESongSorting.TR_CONFIG_YEAR:
|
case ESongSorting.TR_CONFIG_YEAR:
|
||||||
case ESongSorting.TR_CONFIG_DECADE:
|
case ESongSorting.TR_CONFIG_DECADE:
|
||||||
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Year.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Year.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||||
@@ -1139,27 +1143,29 @@ namespace Vocaluxe.Screens
|
|||||||
_Statics[_StaticOptionsBG].Visible = false;
|
_Statics[_StaticOptionsBG].Visible = false;
|
||||||
_Buttons[_ButtonOpenOptions].Visible = true;
|
_Buttons[_ButtonOpenOptions].Visible = true;
|
||||||
|
|
||||||
if (CSongs.VisibleSongs.Count > 0)
|
if (view == ESongOptionsView.None)
|
||||||
{
|
_SongOptionsActive = false;
|
||||||
_SongOptionsActive = view != ESongOptionsView.None;
|
else if (CSongs.IsInCategory)
|
||||||
|
_SongOptionsActive = CSongs.VisibleSongs.Count > 0;
|
||||||
|
else
|
||||||
|
_SongOptionsActive = CSongs.Categories.Count > 0;
|
||||||
|
|
||||||
if (_SongOptionsActive)
|
if (!_SongOptionsActive)
|
||||||
{
|
return;
|
||||||
//Has to be done here otherwhise changed playlist names will not appear until OnShow is called!
|
|
||||||
_UpdatePlaylistNames();
|
|
||||||
|
|
||||||
_Texts[_TextOptionsTitle].Visible = true;
|
//Has to be done here otherwhise changed playlist names will not appear until OnShow is called!
|
||||||
_Buttons[_ButtonOptionsClose].Visible = true;
|
_UpdatePlaylistNames();
|
||||||
_Statics[_StaticOptionsBG].Visible = true;
|
|
||||||
_Buttons[_ButtonOpenOptions].Visible = false;
|
_Texts[_TextOptionsTitle].Visible = true;
|
||||||
if (view == ESongOptionsView.Song)
|
_Buttons[_ButtonOptionsClose].Visible = true;
|
||||||
_ShowSongOptionsSong();
|
_Statics[_StaticOptionsBG].Visible = true;
|
||||||
else if (view == ESongOptionsView.General)
|
_Buttons[_ButtonOpenOptions].Visible = false;
|
||||||
_ShowSongOptionsGeneral();
|
if (view == ESongOptionsView.Song)
|
||||||
else if (view == ESongOptionsView.Medley)
|
_ShowSongOptionsSong();
|
||||||
_ShowSongOptionsMedley();
|
else if (view == ESongOptionsView.General)
|
||||||
}
|
_ShowSongOptionsGeneral();
|
||||||
}
|
else if (view == ESongOptionsView.Medley)
|
||||||
|
_ShowSongOptionsMedley();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _CheckAndAddGameMode(EGameMode gameMode)
|
private void _CheckAndAddGameMode(EGameMode gameMode)
|
||||||
|
|||||||
@@ -140,6 +140,8 @@ namespace VocaluxeLib
|
|||||||
{
|
{
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
var dir = new DirectoryInfo(path);
|
var dir = new DirectoryInfo(path);
|
||||||
|
if (!dir.Exists)
|
||||||
|
return files;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Xml;
|
||||||
using VocaluxeLib.Draw;
|
using VocaluxeLib.Draw;
|
||||||
using VocaluxeLib.Game;
|
using VocaluxeLib.Game;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
@@ -54,6 +55,11 @@ namespace VocaluxeLib
|
|||||||
|
|
||||||
bool IsMicConfigured(int playerNr);
|
bool IsMicConfigured(int playerNr);
|
||||||
int GetMaxNumMics();
|
int GetMaxNumMics();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the uniform settings for writing XML files. ALWAYS use this!
|
||||||
|
/// </summary>
|
||||||
|
XmlWriterSettings GetXMLSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ISettings
|
public interface ISettings
|
||||||
@@ -207,7 +213,8 @@ namespace VocaluxeLib
|
|||||||
int GetNumSongs();
|
int GetNumSongs();
|
||||||
int GetNumSongsVisible();
|
int GetNumSongsVisible();
|
||||||
int GetNumCategories();
|
int GetNumCategories();
|
||||||
int NumSongsInCategory(int categoryIndex);
|
int GetNumSongsInCategory(int categoryIndex);
|
||||||
|
int GetNumSongsNotSungInCategory(int categoryIndex);
|
||||||
bool IsInCategory();
|
bool IsInCategory();
|
||||||
|
|
||||||
int GetCurrentCategoryIndex();
|
int GetCurrentCategoryIndex();
|
||||||
|
|||||||
@@ -196,10 +196,9 @@ namespace VocaluxeLib.Menu
|
|||||||
if (_ThemePath == "")
|
if (_ThemePath == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document};
|
|
||||||
|
|
||||||
string file = Path.Combine(_ThemePath, ThemeName + ".xml");
|
string file = Path.Combine(_ThemePath, ThemeName + ".xml");
|
||||||
using (XmlWriter writer = XmlWriter.Create(file, settings))
|
using (XmlWriter writer = XmlWriter.Create(file, CBase.Config.GetXMLSettings()))
|
||||||
{
|
{
|
||||||
writer.WriteStartDocument();
|
writer.WriteStartDocument();
|
||||||
writer.WriteStartElement("root");
|
writer.WriteStartElement("root");
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
protected SThemeSongMenu _Theme;
|
protected SThemeSongMenu _Theme;
|
||||||
private bool _ThemeLoaded;
|
private bool _ThemeLoaded;
|
||||||
|
|
||||||
private readonly Stopwatch _Timer = new Stopwatch();
|
|
||||||
private readonly Stopwatch _VideoFadeTimer = new Stopwatch();
|
private readonly Stopwatch _VideoFadeTimer = new Stopwatch();
|
||||||
private readonly List<int> _Streams = new List<int>();
|
private readonly List<int> _Streams = new List<int>();
|
||||||
private int _ActSongId = -1;
|
private int _ActSongId = -1;
|
||||||
@@ -113,64 +112,13 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
protected SRectF _Rect;
|
protected SRectF _Rect;
|
||||||
protected SColorF _Color;
|
protected SColorF _Color;
|
||||||
|
|
||||||
private int _SelectedInternal = -1;
|
|
||||||
private int _SelectedPending = -1;
|
|
||||||
protected long _PendingTime = 500L;
|
|
||||||
|
|
||||||
private int _LockedInternal = -1;
|
|
||||||
protected bool _Active;
|
protected bool _Active;
|
||||||
|
|
||||||
protected float _MaxVolume = 100f;
|
protected float _MaxVolume = 100f;
|
||||||
|
|
||||||
protected int _PreviewSelected
|
protected virtual int _PreviewId { get; set; }
|
||||||
{
|
|
||||||
//for preview only
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ((_SelectedInternal != _SelectedPending) && (_Timer.ElapsedMilliseconds >= _PendingTime))
|
|
||||||
{
|
|
||||||
_Timer.Stop();
|
|
||||||
_Timer.Reset();
|
|
||||||
_SelectedInternal = _SelectedPending;
|
|
||||||
}
|
|
||||||
return _SelectedInternal;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == -1)
|
|
||||||
{
|
|
||||||
_Timer.Stop();
|
|
||||||
_Timer.Reset();
|
|
||||||
|
|
||||||
_SelectedInternal = -1;
|
|
||||||
_SelectedPending = -1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((value != _SelectedInternal) && (value != _SelectedPending))
|
|
||||||
{
|
|
||||||
_Timer.Reset();
|
|
||||||
_Timer.Start();
|
|
||||||
|
|
||||||
_SelectedPending = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((value == _SelectedPending) && ((_Timer.ElapsedMilliseconds >= _PendingTime) || (_SelectedInternal == -1)))
|
|
||||||
{
|
|
||||||
_Timer.Stop();
|
|
||||||
_Timer.Reset();
|
|
||||||
_SelectedInternal = _SelectedPending;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void _SetSelectedNow()
|
|
||||||
{
|
|
||||||
_Timer.Stop();
|
|
||||||
_Timer.Reset();
|
|
||||||
_SelectedInternal = _SelectedPending;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private int _LockedInternal = -1;
|
||||||
protected int _Locked
|
protected int _Locked
|
||||||
{
|
{
|
||||||
//the real selected song for singing
|
//the real selected song for singing
|
||||||
@@ -435,8 +383,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
if (!_Initialized)
|
if (!_Initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_ActSongId != _PreviewSelected)
|
if (_ActSongId != _PreviewId)
|
||||||
_SelectSong(_PreviewSelected);
|
_SelectSong(_PreviewId);
|
||||||
|
|
||||||
if (_Streams.Count <= 0 || _Video == -1)
|
if (_Streams.Count <= 0 || _Video == -1)
|
||||||
return;
|
return;
|
||||||
@@ -475,18 +423,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
|
|
||||||
public virtual void OnHide()
|
public virtual void OnHide()
|
||||||
{
|
{
|
||||||
foreach (int stream in _Streams)
|
_Reset();
|
||||||
CBase.Sound.FadeAndStop(stream, 0f, 0.75f);
|
|
||||||
_Streams.Clear();
|
|
||||||
|
|
||||||
CBase.Video.Close(_Video);
|
|
||||||
_Video = -1;
|
|
||||||
|
|
||||||
CBase.Drawing.RemoveTexture(ref _Vidtex);
|
|
||||||
|
|
||||||
_Timer.Stop();
|
|
||||||
_Timer.Reset();
|
|
||||||
_SelectedInternal = _SelectedPending;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) {}
|
public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) {}
|
||||||
@@ -571,9 +508,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
{
|
{
|
||||||
if (!_Initialized)
|
if (!_Initialized)
|
||||||
return false;
|
return false;
|
||||||
if (CBase.Songs.IsInCategory() || _PreviewSelected < 0 || _PreviewSelected >= CBase.Songs.GetNumCategories())
|
if (CBase.Songs.IsInCategory() || _PreviewId < 0 || _PreviewId >= CBase.Songs.GetNumCategories())
|
||||||
return false;
|
return false;
|
||||||
_EnterCategory(_PreviewSelected);
|
_EnterCategory(_PreviewId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -665,10 +602,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
_Video = -1;
|
_Video = -1;
|
||||||
|
|
||||||
CBase.Drawing.RemoveTexture(ref _Vidtex);
|
CBase.Drawing.RemoveTexture(ref _Vidtex);
|
||||||
|
|
||||||
_Timer.Stop();
|
|
||||||
_Timer.Reset();
|
|
||||||
_SelectedInternal = _SelectedPending;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ThemeEdit
|
#region ThemeEdit
|
||||||
|
|||||||
@@ -61,6 +61,15 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
public CSongMenuTileBoard(int partyModeID)
|
public CSongMenuTileBoard(int partyModeID)
|
||||||
: base(partyModeID) {}
|
: base(partyModeID) {}
|
||||||
|
|
||||||
|
protected override int _PreviewId
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base._PreviewId = value;
|
||||||
|
_UpdatePreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override int GetActualSelection()
|
public override int GetActualSelection()
|
||||||
{
|
{
|
||||||
return _ActualSelection;
|
return _ActualSelection;
|
||||||
@@ -77,8 +86,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
_SpaceW = _Theme.SongMenuTileBoard.SpaceW;
|
_SpaceW = _Theme.SongMenuTileBoard.SpaceW;
|
||||||
_SpaceH = _Theme.SongMenuTileBoard.SpaceH;
|
_SpaceH = _Theme.SongMenuTileBoard.SpaceH;
|
||||||
|
|
||||||
_PendingTime = 100L;
|
|
||||||
|
|
||||||
_TileW = (int)((_Theme.SongMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
|
_TileW = (int)((_Theme.SongMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||||
_TileH = (int)((_Theme.SongMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
|
_TileH = (int)((_Theme.SongMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||||
|
|
||||||
@@ -99,9 +106,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
|
|
||||||
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.SongMenuTileBoard.TileRect.Z);
|
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), _Theme.SongMenuTileBoard.TileRect.Z);
|
||||||
|
|
||||||
_PreviewSelected = -1;
|
|
||||||
_Offset = 0;
|
|
||||||
|
|
||||||
_CoverBig = _Theme.SongMenuTileBoard.StaticCoverBig;
|
_CoverBig = _Theme.SongMenuTileBoard.StaticCoverBig;
|
||||||
_TextBG = _Theme.SongMenuTileBoard.StaticTextBG;
|
_TextBG = _Theme.SongMenuTileBoard.StaticTextBG;
|
||||||
_DuetIcon = _Theme.SongMenuTileBoard.StaticDuetIcon;
|
_DuetIcon = _Theme.SongMenuTileBoard.StaticDuetIcon;
|
||||||
@@ -112,6 +116,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
_Artist = _Theme.SongMenuTileBoard.TextArtist;
|
_Artist = _Theme.SongMenuTileBoard.TextArtist;
|
||||||
_Title = _Theme.SongMenuTileBoard.TextTitle;
|
_Title = _Theme.SongMenuTileBoard.TextTitle;
|
||||||
_SongLength = _Theme.SongMenuTileBoard.TextSongLength;
|
_SongLength = _Theme.SongMenuTileBoard.TextSongLength;
|
||||||
|
|
||||||
|
_PreviewId = -1;
|
||||||
|
_Offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(SScreenSongOptions songOptions)
|
public override void Update(SScreenSongOptions songOptions)
|
||||||
@@ -120,52 +127,102 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
|
|
||||||
if (songOptions.Selection.RandomOnly)
|
if (songOptions.Selection.RandomOnly)
|
||||||
{
|
{
|
||||||
_Locked = _PreviewSelected;
|
_Locked = _PreviewId;
|
||||||
_ActualSelection = _PreviewSelected;
|
_ActualSelection = _PreviewId;
|
||||||
for (int i = 0; i < _Tiles.Count; i++)
|
for (int i = 0; i < _Tiles.Count; i++)
|
||||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void _UpdatePreview()
|
||||||
|
{
|
||||||
|
//First hide everything so we just have to set what we actually want
|
||||||
|
_CoverBig.Texture = _CoverBigTexture;
|
||||||
|
_Artist.Text = String.Empty;
|
||||||
|
_Title.Text = String.Empty;
|
||||||
|
_SongLength.Text = String.Empty;
|
||||||
|
_DuetIcon.Visible = false;
|
||||||
|
_VideoIcon.Visible = false;
|
||||||
|
_MedleyCalcIcon.Visible = false;
|
||||||
|
_MedleyTagIcon.Visible = false;
|
||||||
|
|
||||||
|
//Check if nothing is selected (for preview)
|
||||||
|
if (_PreviewId < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CBase.Songs.IsInCategory())
|
||||||
|
{
|
||||||
|
CSong song = CBase.Songs.GetVisibleSong(_PreviewId);
|
||||||
|
//Check if we have a valid song (song still visible, index >=0 etc is checked by framework)
|
||||||
|
if (song == null)
|
||||||
|
{
|
||||||
|
//Display at least the category
|
||||||
|
CCategory category = CBase.Songs.GetCategory(CBase.Songs.GetCurrentCategoryIndex());
|
||||||
|
//Check if we have a valid category
|
||||||
|
if (category == null)
|
||||||
|
return;
|
||||||
|
_CoverBig.Texture = category.CoverTextureBig;
|
||||||
|
_Artist.Text = category.Name;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_CoverBig.Texture = song.CoverTextureBig;
|
||||||
|
_Artist.Text = song.Artist;
|
||||||
|
_Title.Text = song.Title;
|
||||||
|
_DuetIcon.Visible = song.IsDuet;
|
||||||
|
_VideoIcon.Visible = song.VideoFileName != "";
|
||||||
|
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
||||||
|
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
||||||
|
|
||||||
|
float time = CBase.Sound.GetLength(_SongStream);
|
||||||
|
if (Math.Abs(song.Finish) > 0.001)
|
||||||
|
time = song.Finish;
|
||||||
|
|
||||||
|
time -= song.Start;
|
||||||
|
var min = (int)Math.Floor(time / 60f);
|
||||||
|
var sec = (int)(time - min * 60f);
|
||||||
|
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCategory category = CBase.Songs.GetCategory(_PreviewId);
|
||||||
|
//Check if we have a valid category
|
||||||
|
if (category == null)
|
||||||
|
return;
|
||||||
|
_CoverBig.Texture = category.CoverTextureBig;
|
||||||
|
_Artist.Text = category.Name;
|
||||||
|
|
||||||
|
int num = category.GetNumSongsNotSung();
|
||||||
|
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||||
|
if (num != 1)
|
||||||
|
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||||
|
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString());
|
||||||
|
else
|
||||||
|
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnShow()
|
public override void OnShow()
|
||||||
{
|
{
|
||||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && !CBase.Songs.IsInCategory())
|
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && !CBase.Songs.IsInCategory())
|
||||||
_EnterCategory(0);
|
_EnterCategory(0);
|
||||||
_ActualSelection = -1;
|
_ActualSelection = -1;
|
||||||
_Locked = -1;
|
_Locked = -1;
|
||||||
_PreviewSelected = -1;
|
_PreviewId = -1;
|
||||||
_UpdateList(0, true);
|
_UpdateList(0, true);
|
||||||
//AfterCategoryChange();
|
//AfterCategoryChange();
|
||||||
SetSelectedSong(_ActSong);
|
SetSelectedSong(_ActSong);
|
||||||
_AfterCategoryChange();
|
_AfterCategoryChange();
|
||||||
|
|
||||||
int actcat = _PreviewSelected;
|
if (_PreviewId < 0)
|
||||||
if ((CBase.Songs.GetNumCategories() > 0) && (actcat < 0))
|
|
||||||
{
|
{
|
||||||
_CoverBig.Texture = CBase.Songs.GetCategory(0).CoverTextureBig;
|
_PreviewId = 0;
|
||||||
_Artist.Text = CBase.Songs.GetCategory(0).Name;
|
|
||||||
_Title.Text = String.Empty;
|
|
||||||
_SongLength.Text = String.Empty;
|
|
||||||
_PreviewSelected = 0;
|
|
||||||
_Locked = 0;
|
_Locked = 0;
|
||||||
_DuetIcon.Visible = false;
|
|
||||||
_VideoIcon.Visible = false;
|
|
||||||
_MedleyCalcIcon.Visible = false;
|
|
||||||
_MedleyTagIcon.Visible = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CBase.Songs.GetNumSongsVisible() == 0 && CBase.Songs.GetSearchFilter() != "")
|
if (CBase.Songs.GetNumSongsVisible() == 0 && CBase.Songs.GetSearchFilter() != "")
|
||||||
{
|
{
|
||||||
_CoverBig.Texture = _CoverBigTexture;
|
_PreviewId = -1;
|
||||||
_Artist.Text = String.Empty;
|
|
||||||
_Title.Text = String.Empty;
|
|
||||||
_SongLength.Text = String.Empty;
|
|
||||||
_PreviewSelected = -1;
|
|
||||||
_Locked = -1;
|
_Locked = -1;
|
||||||
_DuetIcon.Visible = false;
|
|
||||||
_VideoIcon.Visible = false;
|
|
||||||
_MedleyCalcIcon.Visible = false;
|
|
||||||
_MedleyTagIcon.Visible = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,14 +242,13 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
if ((_Locked == -1 || !sel) &&
|
if ((_Locked == -1 || !sel) &&
|
||||||
(keyEvent.Key != Keys.Escape && keyEvent.Key != Keys.Back && keyEvent.Key != Keys.PageUp && keyEvent.Key != Keys.PageDown))
|
(keyEvent.Key != Keys.Escape && keyEvent.Key != Keys.Back && keyEvent.Key != Keys.PageUp && keyEvent.Key != Keys.PageDown))
|
||||||
{
|
{
|
||||||
if (_PreviewSelected > -1)
|
if (_PreviewId > -1)
|
||||||
_Locked = _PreviewSelected;
|
_Locked = _PreviewId;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_Locked = 0;
|
_Locked = 0;
|
||||||
_ActualSelection = 0;
|
_ActualSelection = 0;
|
||||||
_PreviewSelected = 0;
|
_PreviewId = 0;
|
||||||
_SetSelectedNow();
|
|
||||||
_UpdateList(0, true);
|
_UpdateList(0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,10 +259,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
case Keys.Enter:
|
case Keys.Enter:
|
||||||
if (!CBase.Songs.IsInCategory())
|
if (!CBase.Songs.IsInCategory())
|
||||||
{
|
{
|
||||||
_EnterCategory(_PreviewSelected);
|
_EnterCategory(_PreviewId);
|
||||||
keyEvent.Handled = true;
|
keyEvent.Handled = true;
|
||||||
}
|
}
|
||||||
else if (_ActualSelection > -1 && _PreviewSelected >= 0)
|
else if (_ActualSelection > -1 && _PreviewId >= 0)
|
||||||
_Locked = _ActualSelection;
|
_Locked = _ActualSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -301,7 +357,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
|
|
||||||
if (!keyEvent.Handled)
|
if (!keyEvent.Handled)
|
||||||
{
|
{
|
||||||
_PreviewSelected = _Locked;
|
_PreviewId = _Locked;
|
||||||
_ActualSelection = _Locked;
|
_ActualSelection = _Locked;
|
||||||
|
|
||||||
for (int i = 0; i < _Tiles.Count; i++)
|
for (int i = 0; i < _Tiles.Count; i++)
|
||||||
@@ -326,11 +382,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
{
|
{
|
||||||
if (mouseEvent.LB || !CBase.Songs.IsInCategory())
|
if (mouseEvent.LB || !CBase.Songs.IsInCategory())
|
||||||
{
|
{
|
||||||
if (_PreviewSelected == i + _Offset)
|
if (_PreviewId == i + _Offset)
|
||||||
_Locked = _PreviewSelected;
|
_Locked = _PreviewId;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_PreviewSelected = i + _Offset;
|
_PreviewId = i + _Offset;
|
||||||
_Locked = -1;
|
_Locked = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,10 +417,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
}
|
}
|
||||||
if (mouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
|
if (mouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
|
||||||
CBase.Graphics.FadeTo(EScreens.ScreenMain);
|
CBase.Graphics.FadeTo(EScreens.ScreenMain);
|
||||||
else if (_PreviewSelected != -1 && mouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !songOptions.Selection.PartyMode)
|
else if (_PreviewId != -1 && mouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !songOptions.Selection.PartyMode)
|
||||||
{
|
{
|
||||||
if (CHelper.IsInBounds(_CoverBig.Rect, mouseEvent) || CHelper.IsInBounds(_TextBG.Rect, mouseEvent))
|
if (CHelper.IsInBounds(_CoverBig.Rect, mouseEvent) || CHelper.IsInBounds(_TextBG.Rect, mouseEvent))
|
||||||
_Locked = _PreviewSelected;
|
_Locked = _PreviewId;
|
||||||
}
|
}
|
||||||
else if (mouseEvent.LB && (!CBase.Songs.IsInCategory()))
|
else if (mouseEvent.LB && (!CBase.Songs.IsInCategory()))
|
||||||
{
|
{
|
||||||
@@ -372,7 +428,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
{
|
{
|
||||||
if (tile.Texture != _CoverTexture && CHelper.IsInBounds(tile.Rect, mouseEvent))
|
if (tile.Texture != _CoverTexture && CHelper.IsInBounds(tile.Rect, mouseEvent))
|
||||||
{
|
{
|
||||||
_EnterCategory(_PreviewSelected);
|
_EnterCategory(_PreviewId);
|
||||||
mouseEvent.Handled = true;
|
mouseEvent.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -392,61 +448,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop);
|
tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
EAspect aspect = (tile.Texture != _CoverTexture) ? EAspect.Crop : EAspect.Stretch;
|
||||||
if (tile.Texture != _CoverTexture)
|
tile.Draw(1f, tile.Rect.Z, aspect);
|
||||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
|
||||||
tile.Draw(1f, tile.Rect.Z, EAspect.Crop);
|
|
||||||
else
|
|
||||||
tile.Draw(1f, tile.Rect.Z, EAspect.Stretch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CBase.Songs.IsInCategory())
|
|
||||||
{
|
|
||||||
int actsong = _PreviewSelected;
|
|
||||||
if ((CBase.Songs.GetNumSongsVisible() > actsong) && (actsong >= 0))
|
|
||||||
{
|
|
||||||
CSong song = CBase.Songs.GetVisibleSong(actsong);
|
|
||||||
|
|
||||||
_CoverBig.Texture = song.CoverTextureBig;
|
|
||||||
_Artist.Text = song.Artist;
|
|
||||||
_Title.Text = song.Title;
|
|
||||||
_DuetIcon.Visible = song.IsDuet;
|
|
||||||
_VideoIcon.Visible = song.VideoFileName != "";
|
|
||||||
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
|
||||||
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
|
||||||
|
|
||||||
float time = CBase.Sound.GetLength(_SongStream);
|
|
||||||
if (Math.Abs(song.Finish) > 0.001)
|
|
||||||
time = song.Finish;
|
|
||||||
|
|
||||||
time -= song.Start;
|
|
||||||
var min = (int)Math.Floor(time / 60f);
|
|
||||||
var sec = (int)(time - min * 60f);
|
|
||||||
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int actcat = _PreviewSelected;
|
|
||||||
if ((CBase.Songs.GetNumCategories() > actcat) && (actcat >= 0))
|
|
||||||
{
|
|
||||||
_CoverBig.Texture = CBase.Songs.GetCategory(actcat).CoverTextureBig;
|
|
||||||
_Artist.Text = CBase.Songs.GetCategory(actcat).Name;
|
|
||||||
|
|
||||||
int num = CBase.Songs.NumSongsInCategory(actcat);
|
|
||||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
|
||||||
if (num != 1)
|
|
||||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
|
||||||
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString());
|
|
||||||
else
|
|
||||||
_Title.Text = CBase.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString());
|
|
||||||
|
|
||||||
_SongLength.Text = String.Empty;
|
|
||||||
_DuetIcon.Visible = false;
|
|
||||||
_VideoIcon.Visible = false;
|
|
||||||
_MedleyCalcIcon.Visible = false;
|
|
||||||
_MedleyTagIcon.Visible = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,14 +511,13 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
|
|
||||||
if (_Locked == -1 || !sel)
|
if (_Locked == -1 || !sel)
|
||||||
{
|
{
|
||||||
if (_PreviewSelected > -1)
|
if (_PreviewId > -1)
|
||||||
_Locked = _PreviewSelected;
|
_Locked = _PreviewId;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_Locked = 0;
|
_Locked = 0;
|
||||||
_ActualSelection = 0;
|
_ActualSelection = 0;
|
||||||
_PreviewSelected = 0;
|
_PreviewId = 0;
|
||||||
_SetSelectedNow();
|
|
||||||
_UpdateList(0, true);
|
_UpdateList(0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -523,13 +525,12 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
foreach (CStatic tile in _Tiles)
|
foreach (CStatic tile in _Tiles)
|
||||||
tile.Selected = false;
|
tile.Selected = false;
|
||||||
|
|
||||||
_PreviewSelected = itemNr;
|
_PreviewId = itemNr;
|
||||||
_SetSelectedNow();
|
|
||||||
_Locked = itemNr;
|
_Locked = itemNr;
|
||||||
|
|
||||||
_UpdateList(true);
|
_UpdateList(true);
|
||||||
|
|
||||||
_PreviewSelected = _Locked;
|
_PreviewId = _Locked;
|
||||||
_ActualSelection = _Locked;
|
_ActualSelection = _Locked;
|
||||||
|
|
||||||
if (_Locked - _Offset >= 0)
|
if (_Locked - _Offset >= 0)
|
||||||
@@ -556,7 +557,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
{
|
{
|
||||||
base._EnterCategory(cat);
|
base._EnterCategory(cat);
|
||||||
|
|
||||||
_PreviewSelected = 0;
|
_PreviewId = 0;
|
||||||
_Locked = -1;
|
_Locked = -1;
|
||||||
_ActualSelection = 0;
|
_ActualSelection = 0;
|
||||||
_AfterCategoryChange();
|
_AfterCategoryChange();
|
||||||
@@ -567,7 +568,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
{
|
{
|
||||||
base._ShowCategories();
|
base._ShowCategories();
|
||||||
|
|
||||||
_PreviewSelected = 0;
|
_PreviewId = 0;
|
||||||
_Locked = -1;
|
_Locked = -1;
|
||||||
_ActualSelection = 0;
|
_ActualSelection = 0;
|
||||||
_AfterCategoryChange();
|
_AfterCategoryChange();
|
||||||
@@ -594,8 +595,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
|
|
||||||
private void _AfterCategoryChange()
|
private void _AfterCategoryChange()
|
||||||
{
|
{
|
||||||
_SetSelectedNow();
|
_SelectSong(_PreviewId);
|
||||||
_SelectSong(_PreviewSelected);
|
_UpdatePreview();
|
||||||
|
|
||||||
foreach (CStatic tile in _Tiles)
|
foreach (CStatic tile in _Tiles)
|
||||||
tile.Selected = false;
|
tile.Selected = false;
|
||||||
|
|||||||
@@ -24,13 +24,6 @@ namespace VocaluxeLib.Profile
|
|||||||
{
|
{
|
||||||
public class CProfile
|
public class CProfile
|
||||||
{
|
{
|
||||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings
|
|
||||||
{
|
|
||||||
Indent = true,
|
|
||||||
Encoding = Encoding.UTF8,
|
|
||||||
ConformanceLevel = ConformanceLevel.Document
|
|
||||||
};
|
|
||||||
|
|
||||||
public int ID;
|
public int ID;
|
||||||
|
|
||||||
public string PlayerName;
|
public string PlayerName;
|
||||||
@@ -137,7 +130,7 @@ namespace VocaluxeLib.Profile
|
|||||||
XmlWriter writer;
|
XmlWriter writer;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writer = XmlWriter.Create(Path.Combine(FilePath, FileName), _Settings);
|
writer = XmlWriter.Create(Path.Combine(FilePath, FileName), CBase.Config.GetXMLSettings());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using VocaluxeLib.Draw;
|
using VocaluxeLib.Draw;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace VocaluxeLib.Songs
|
namespace VocaluxeLib.Songs
|
||||||
{
|
{
|
||||||
@@ -50,6 +51,11 @@ namespace VocaluxeLib.Songs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetNumSongsNotSung()
|
||||||
|
{
|
||||||
|
return Songs.Count(sp => !sp.IsSung);
|
||||||
|
}
|
||||||
|
|
||||||
public CCategory(string name, CTexture coverSmall, CTexture coverBig)
|
public CCategory(string name, CTexture coverSmall, CTexture coverBig)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
|
|||||||
Reference in new issue
Block a user