Fixed and changed category handling and visible songs
This commit is contained in:
1 parent
3956fa17d1
commit
5172f17da7
20 files changed
+189
-336
No files matched your search
@@ -19,6 +19,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
using VocaluxeLib.PartyModes;
|
||||
@@ -240,7 +241,7 @@ namespace VocaluxeLib.Menu
|
||||
public interface ISongs
|
||||
{
|
||||
int GetNumSongs();
|
||||
int GetNumVisibleSongs();
|
||||
int GetNumSongsVisible();
|
||||
int GetNumCategories();
|
||||
int NumSongsInCategory(int categoryIndex);
|
||||
|
||||
@@ -253,13 +254,11 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
CSong GetVisibleSong(int visibleIndex);
|
||||
CSong GetSongByID(int songID);
|
||||
CSong[] GetSongs();
|
||||
CSong[] GetSongsNotSung();
|
||||
ReadOnlyCollection<CSong> GetVisibleSongs();
|
||||
CCategory GetCategory(int index);
|
||||
|
||||
void AddPartySongSung(int songID);
|
||||
void ResetPartySongSung();
|
||||
void ResetPartySongSung(int catIndex);
|
||||
void ResetSongSung(int catIndex = -1);
|
||||
|
||||
void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions);
|
||||
|
||||
|
||||
@@ -26,6 +26,19 @@ using VocaluxeLib.Menu.SingNotes;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
public class CSongPointer
|
||||
{
|
||||
public readonly int SongID;
|
||||
public string SortString;
|
||||
public bool IsSung;
|
||||
|
||||
public CSongPointer(int id, string sortString)
|
||||
{
|
||||
SongID = id;
|
||||
SortString = sortString;
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum EHeaderFlags
|
||||
{
|
||||
@@ -40,58 +53,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public enum EMedleySource
|
||||
{
|
||||
None,
|
||||
None = 0,
|
||||
Calculated,
|
||||
Tag
|
||||
}
|
||||
|
||||
public class CCategory
|
||||
{
|
||||
public readonly string Name;
|
||||
private STexture _CoverTextureSmall = new STexture(-1);
|
||||
private STexture _CoverTextureBig = new STexture(-1);
|
||||
private bool _CoverBigLoaded;
|
||||
|
||||
public CCategory(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public STexture CoverTextureSmall
|
||||
{
|
||||
get { return _CoverTextureSmall; }
|
||||
|
||||
set { _CoverTextureSmall = value; }
|
||||
}
|
||||
|
||||
public STexture CoverTextureBig
|
||||
{
|
||||
get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; }
|
||||
set
|
||||
{
|
||||
if (value.Index != -1)
|
||||
{
|
||||
_CoverTextureBig = value;
|
||||
_CoverBigLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CCategory(string name, STexture coverSmall, STexture coverBig)
|
||||
{
|
||||
Name = name;
|
||||
CoverTextureSmall = coverSmall;
|
||||
CoverTextureBig = coverBig;
|
||||
}
|
||||
|
||||
public CCategory(CCategory cat)
|
||||
{
|
||||
Name = cat.Name;
|
||||
CoverTextureSmall = cat.CoverTextureSmall;
|
||||
CoverTextureBig = cat.CoverTextureBig;
|
||||
}
|
||||
}
|
||||
|
||||
public struct SMedley
|
||||
{
|
||||
public EMedleySource Source;
|
||||
@@ -99,17 +65,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public int EndBeat;
|
||||
public float FadeInTime;
|
||||
public float FadeOutTime;
|
||||
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
public SMedley(int dummy)
|
||||
// ReSharper restore UnusedParameter.Local
|
||||
{
|
||||
Source = EMedleySource.None;
|
||||
StartBeat = 0;
|
||||
EndBeat = 0;
|
||||
FadeInTime = 0f;
|
||||
FadeOutTime = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public class CSong
|
||||
@@ -119,7 +74,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private STexture _CoverTextureSmall = new STexture(-1);
|
||||
private STexture _CoverTextureBig = new STexture(-1);
|
||||
|
||||
public SMedley Medley = new SMedley(0);
|
||||
public SMedley Medley;
|
||||
|
||||
public bool CalculateMedley = true;
|
||||
public float PreviewStart;
|
||||
@@ -159,10 +114,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public STexture CoverTextureBig
|
||||
{
|
||||
get
|
||||
{
|
||||
return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall;
|
||||
}
|
||||
get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; }
|
||||
set
|
||||
{
|
||||
_CoverTextureBig = value;
|
||||
|
||||
@@ -35,12 +35,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_CreateSongMenu();
|
||||
}
|
||||
|
||||
public void UpdateSongMenuType()
|
||||
{
|
||||
if (_Type != CBase.Config.GetSongMenuType())
|
||||
_CreateSongMenu();
|
||||
}
|
||||
|
||||
public bool Selected
|
||||
{
|
||||
get { return _SongMenu.IsSelected(); }
|
||||
|
||||
@@ -252,8 +252,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
StaticMedleyTagIcon = new CStatic(_PartyModeID)
|
||||
}
|
||||
};
|
||||
|
||||
_ThemeLoaded = false;
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
@@ -598,7 +596,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
protected void _SelectSong(int nr)
|
||||
{
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && (CBase.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_Actsong != nr) || (_Streams.Count == 0)))
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && (CBase.Songs.GetNumSongsVisible() > 0) && (nr >= 0) && ((_Actsong != nr) || (_Streams.Count == 0)))
|
||||
{
|
||||
_Streams.ForEach(soundStream => CBase.Sound.FadeAndStop(soundStream, 0f, 1f));
|
||||
_Streams.Clear();
|
||||
@@ -609,7 +607,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
CBase.Drawing.RemoveTexture(ref _Vidtex);
|
||||
|
||||
_Actsong = nr;
|
||||
if (_Actsong >= CBase.Songs.GetNumVisibleSongs())
|
||||
if (_Actsong >= CBase.Songs.GetNumSongsVisible())
|
||||
_Actsong = 0;
|
||||
|
||||
|
||||
|
||||
@@ -138,7 +138,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
//AfterCategoryChange();
|
||||
SetSelectedSong(_ActSong);
|
||||
_AfterCategoryChange();
|
||||
CBase.Songs.UpdateRandomSongList();
|
||||
|
||||
int actcat = _PreviewSelected;
|
||||
if ((CBase.Songs.GetNumCategories() > 0) && (actcat < 0))
|
||||
@@ -155,7 +154,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
|
||||
if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter() != "")
|
||||
if (CBase.Songs.GetNumSongsVisible() == 0 && CBase.Songs.GetSearchFilter() != "")
|
||||
{
|
||||
_CoverBig.Texture = _CoverBigTexture;
|
||||
_Artist.Text = String.Empty;
|
||||
@@ -253,7 +252,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() != -1 && _Locked < CBase.Songs.GetNumVisibleSongs() - 1 && !songOptions.Selection.RandomOnly)
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() != -1 && _Locked < CBase.Songs.GetNumSongsVisible() - 1 && !songOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked++;
|
||||
_UpdateList();
|
||||
@@ -291,7 +290,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_UpdateList();
|
||||
}
|
||||
}
|
||||
else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !songOptions.Selection.RandomOnly)
|
||||
else if (_Locked < CBase.Songs.GetNumSongsVisible() - _NumW && !songOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked += _NumW;
|
||||
_UpdateList();
|
||||
@@ -403,7 +402,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() >= 0)
|
||||
{
|
||||
int actsong = _PreviewSelected;
|
||||
if ((CBase.Songs.GetNumVisibleSongs() > actsong) && (actsong >= 0))
|
||||
if ((CBase.Songs.GetNumSongsVisible() > actsong) && (actsong >= 0))
|
||||
{
|
||||
CSong song = CBase.Songs.GetVisibleSong(actsong);
|
||||
|
||||
@@ -529,7 +528,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
base.SetSelectedSong(visibleSongNr);
|
||||
|
||||
if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumVisibleSongs())
|
||||
if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumSongsVisible())
|
||||
_SetSelectedTile(visibleSongNr);
|
||||
}
|
||||
|
||||
@@ -592,11 +591,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (_ActualSelection >= 0 && _ActualSelection < _Tiles.Count)
|
||||
_Tiles[_ActualSelection].Selected = true;
|
||||
|
||||
if ((_LastKnownNumSongs == CBase.Songs.GetNumVisibleSongs()) && (_LastKnownCategory == CBase.Songs.GetCurrentCategoryIndex()))
|
||||
if ((_LastKnownNumSongs == CBase.Songs.GetNumSongsVisible()) && (_LastKnownCategory == CBase.Songs.GetCurrentCategoryIndex()))
|
||||
return;
|
||||
|
||||
_LastKnownCategory = CBase.Songs.GetCurrentCategoryIndex();
|
||||
_LastKnownNumSongs = CBase.Songs.GetNumVisibleSongs();
|
||||
_LastKnownNumSongs = CBase.Songs.GetNumSongsVisible();
|
||||
_UpdateList(0, true);
|
||||
CBase.Songs.UpdateRandomSongList();
|
||||
}
|
||||
@@ -609,7 +608,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private void _UpdateList(int offset, bool force = false)
|
||||
{
|
||||
bool isInCategory = CBase.Songs.GetCurrentCategoryIndex() >= 0;
|
||||
int itemCount = isInCategory ? CBase.Songs.GetNumVisibleSongs() : CBase.Songs.GetNumCategories();
|
||||
int itemCount = isInCategory ? CBase.Songs.GetNumSongsVisible() : CBase.Songs.GetNumCategories();
|
||||
|
||||
if (offset >= (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1)))
|
||||
offset = (itemCount / _NumW) * _NumW - (_NumW * (_NumH - 1));
|
||||
|
||||
Reference in new issue
Block a user