playlist converted
This commit is contained in:
1 parent
b1f0106b9a
commit
f29c38b500
6 files changed
+313
-90
No files matched your search
+103
-1
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
|
||||
using Vocaluxe.GameModes;
|
||||
using Vocaluxe.Menu;
|
||||
using Vocaluxe.Menu.SongMenu;
|
||||
|
||||
@@ -29,10 +30,11 @@ namespace Vocaluxe.Base
|
||||
public static ICover Cover = new BCover();
|
||||
public static IDataBase DataBase = new BDataBase();
|
||||
public static IInputs Input = new BInputs();
|
||||
public static IPlaylist Playlist = new BPlaylist();
|
||||
|
||||
|
||||
public static Menu.Base Base = new Menu.Base(
|
||||
Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles, Record, Songs, Video, Sound, Cover, DataBase, Input);
|
||||
Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles, Record, Songs, Video, Sound, Cover, DataBase, Input, Playlist);
|
||||
}
|
||||
|
||||
class BConfig : IConfig
|
||||
@@ -447,6 +449,26 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
return CGame.GetTimeFromBeats(Beat, BPM);
|
||||
}
|
||||
|
||||
public void AddSong(int SongID, EGameMode GameMode)
|
||||
{
|
||||
CGame.AddSong(SongID, GameMode);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
CGame.Reset();
|
||||
}
|
||||
|
||||
public void ClearSongs()
|
||||
{
|
||||
CGame.ClearSongs();
|
||||
}
|
||||
|
||||
public int GetNumSongs()
|
||||
{
|
||||
return CGame.GetNumSongs();
|
||||
}
|
||||
}
|
||||
|
||||
class BProfiles : IProfiles
|
||||
@@ -519,6 +541,11 @@ namespace Vocaluxe.Base
|
||||
return new CSong(song);
|
||||
}
|
||||
|
||||
public CSong GetSongByID(int SongID)
|
||||
{
|
||||
return new CSong(CSongs.GetSong(SongID));
|
||||
}
|
||||
|
||||
public CCategory GetCategory(int Index)
|
||||
{
|
||||
if (Index >= CSongs.NumCategories)
|
||||
@@ -643,4 +670,79 @@ namespace Vocaluxe.Base
|
||||
CInput.SetRumble(Duration);
|
||||
}
|
||||
}
|
||||
|
||||
class BPlaylist : IPlaylist
|
||||
{
|
||||
public void SetPlaylistName(int PlaylistID, string Name)
|
||||
{
|
||||
CPlaylists.SetPlaylistName(PlaylistID, Name);
|
||||
}
|
||||
|
||||
public string GetPlaylistName(int PlaylistID)
|
||||
{
|
||||
return CPlaylists.GetPlaylistName(PlaylistID);
|
||||
}
|
||||
|
||||
public void DeletePlaylist(int PlaylistID)
|
||||
{
|
||||
CPlaylists.DeletePlaylist(PlaylistID);
|
||||
}
|
||||
|
||||
public void SavePlaylist(int PlaylistID)
|
||||
{
|
||||
CPlaylists.SavePlaylist(PlaylistID);
|
||||
}
|
||||
|
||||
public int GetNumPlaylists()
|
||||
{
|
||||
return CPlaylists.NumPlaylists;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void AddPlaylistSong(int PlaylistID, int SongID)
|
||||
{
|
||||
CPlaylists.AddPlaylistSong(PlaylistID, SongID);
|
||||
}
|
||||
|
||||
public void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode)
|
||||
{
|
||||
CPlaylists.AddPlaylistSong(PlaylistID, SongID, GameMode);
|
||||
}
|
||||
|
||||
public void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode)
|
||||
{
|
||||
CPlaylists.InsertPlaylistSong(PlaylistID, PositionIndex, SongID, GameMode);
|
||||
}
|
||||
|
||||
public void MovePlaylistSong(int PlaylistID, int SourceIndex, int DestIndex)
|
||||
{
|
||||
CPlaylists.MovePlaylistSong(PlaylistID, SourceIndex, DestIndex);
|
||||
}
|
||||
|
||||
public void MovePlaylistSongDown(int PlaylistID, int SongIndex)
|
||||
{
|
||||
CPlaylists.MovePlaylistSongDown(PlaylistID, SongIndex);
|
||||
}
|
||||
|
||||
public void MovePlaylistSongUp(int PlaylistID, int SongIndex)
|
||||
{
|
||||
CPlaylists.MovePlaylistSongUp(PlaylistID, SongIndex);
|
||||
}
|
||||
|
||||
public void DeletePlaylistSong(int PlaylistID, int SongIndex)
|
||||
{
|
||||
CPlaylists.DeletePlaylistSong(PlaylistID, SongIndex);
|
||||
}
|
||||
|
||||
public int GetPlaylistSongCount(int PlaylistID)
|
||||
{
|
||||
return CPlaylists.GetPlaylistSongCount(PlaylistID);
|
||||
}
|
||||
|
||||
public CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex)
|
||||
{
|
||||
return CPlaylists.GetPlaylistSong(PlaylistID, SongIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,9 @@ using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
using Vocaluxe.Lib.Playlist;
|
||||
using Vocaluxe.GameModes;
|
||||
using Vocaluxe.Menu;
|
||||
using Vocaluxe.Menu.SongMenu;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
{
|
||||
@@ -59,16 +61,20 @@ namespace Vocaluxe.Base
|
||||
SortPlaylistsByName();
|
||||
}
|
||||
|
||||
#region private methods
|
||||
|
||||
private static void SortPlaylistsByName()
|
||||
public static string GetPlaylistName(int PlaylistID)
|
||||
{
|
||||
_Playlists.Sort(CompareByPlaylistName);
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return "Error: Can't find Playlist";
|
||||
|
||||
return _Playlists[PlaylistID].PlaylistName;
|
||||
}
|
||||
|
||||
private static int CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b)
|
||||
public static void SetPlaylistName(int PlaylistID, string Name)
|
||||
{
|
||||
return String.Compare(a.PlaylistName, b.PlaylistName);
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return;
|
||||
|
||||
_Playlists[PlaylistID].PlaylistName = Name;
|
||||
}
|
||||
|
||||
public static void DeletePlaylist(int PlaylistID)
|
||||
@@ -104,6 +110,93 @@ namespace Vocaluxe.Base
|
||||
return (_Playlists.Count - 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void AddPlaylistSong(int PlaylistID, int SongID)
|
||||
{
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return;
|
||||
|
||||
_Playlists[PlaylistID].AddSong(SongID);
|
||||
}
|
||||
|
||||
public static void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode)
|
||||
{
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return;
|
||||
|
||||
_Playlists[PlaylistID].AddSong(SongID, GameMode);
|
||||
}
|
||||
|
||||
public static void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode)
|
||||
{
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return;
|
||||
|
||||
_Playlists[PlaylistID].SongInsert(PositionIndex, SongID, GameMode);
|
||||
}
|
||||
|
||||
public static void MovePlaylistSong(int PlaylistID, int SourceIndex, int DestIndex)
|
||||
{
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return;
|
||||
|
||||
_Playlists[PlaylistID].SongMove(SourceIndex, DestIndex);
|
||||
}
|
||||
|
||||
public static void MovePlaylistSongDown(int PlaylistID, int SongIndex)
|
||||
{
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return;
|
||||
|
||||
_Playlists[PlaylistID].SongDown(SongIndex);
|
||||
}
|
||||
|
||||
public static void MovePlaylistSongUp(int PlaylistID, int SongIndex)
|
||||
{
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return;
|
||||
|
||||
_Playlists[PlaylistID].SongUp(SongIndex);
|
||||
}
|
||||
|
||||
public static void DeletePlaylistSong(int PlaylistID, int SongIndex)
|
||||
{
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return;
|
||||
|
||||
_Playlists[PlaylistID].DeleteSong(SongIndex);
|
||||
}
|
||||
|
||||
public static int GetPlaylistSongCount(int PlaylistID)
|
||||
{
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return 0;
|
||||
|
||||
return _Playlists[PlaylistID].Songs.Count;
|
||||
}
|
||||
|
||||
public static CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex)
|
||||
{
|
||||
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
|
||||
return null;
|
||||
|
||||
if (SongIndex >= _Playlists[PlaylistID].Songs.Count)
|
||||
return null;
|
||||
|
||||
return _Playlists[PlaylistID].Songs[SongIndex];
|
||||
}
|
||||
|
||||
#region private methods
|
||||
private static void SortPlaylistsByName()
|
||||
{
|
||||
_Playlists.Sort(CompareByPlaylistName);
|
||||
}
|
||||
|
||||
private static int CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b)
|
||||
{
|
||||
return String.Compare(a.PlaylistName, b.PlaylistName);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -10,32 +10,8 @@ using Vocaluxe.GameModes;
|
||||
using Vocaluxe.Menu;
|
||||
using Vocaluxe.Menu.SongMenu;
|
||||
|
||||
|
||||
namespace Vocaluxe.Lib.Playlist
|
||||
{
|
||||
public class CPlaylistSong
|
||||
{
|
||||
public int SongID;
|
||||
public EGameMode GameMode;
|
||||
|
||||
public CPlaylistSong(int SongID, EGameMode gm)
|
||||
{
|
||||
this.SongID = SongID;
|
||||
this.GameMode = gm;
|
||||
}
|
||||
|
||||
public CPlaylistSong()
|
||||
{
|
||||
GameMode = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
}
|
||||
|
||||
public CPlaylistSong(CPlaylistSong ps)
|
||||
{
|
||||
SongID = ps.SongID;
|
||||
GameMode = ps.GameMode;
|
||||
}
|
||||
}
|
||||
|
||||
public class CPlaylistFile
|
||||
{
|
||||
private static XmlWriterSettings _settings = new XmlWriterSettings();
|
||||
|
||||
@@ -2341,10 +2341,11 @@ namespace Vocaluxe.Menu
|
||||
public ICover Cover;
|
||||
public IDataBase DataBase;
|
||||
public IInputs Input;
|
||||
public IPlaylist Playlist;
|
||||
|
||||
public Base(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic,
|
||||
IDrawing Draw, IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles, IRecording Record,
|
||||
ISongs Songs, IVideo Video, ISound Sound, ICover Cover, IDataBase DataBase, IInputs Input)
|
||||
ISongs Songs, IVideo Video, ISound Sound, ICover Cover, IDataBase DataBase, IInputs Input, IPlaylist Playlist)
|
||||
{
|
||||
this.Config = Config;
|
||||
this.Settings = Settings;
|
||||
@@ -2365,6 +2366,7 @@ namespace Vocaluxe.Menu
|
||||
this.Cover = Cover;
|
||||
this.DataBase = DataBase;
|
||||
this.Input = Input;
|
||||
this.Playlist = Playlist;
|
||||
}
|
||||
}
|
||||
}
|
||||
+80
-58
@@ -6,7 +6,6 @@ using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Menu.SongMenu;
|
||||
using Vocaluxe.GameModes;
|
||||
|
||||
@@ -19,6 +18,29 @@ namespace Vocaluxe.Menu
|
||||
ChangeOrder
|
||||
}
|
||||
|
||||
public class CPlaylistSong
|
||||
{
|
||||
public int SongID;
|
||||
public EGameMode GameMode;
|
||||
|
||||
public CPlaylistSong(int SongID, EGameMode gm)
|
||||
{
|
||||
this.SongID = SongID;
|
||||
this.GameMode = gm;
|
||||
}
|
||||
|
||||
public CPlaylistSong()
|
||||
{
|
||||
GameMode = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
}
|
||||
|
||||
public CPlaylistSong(CPlaylistSong ps)
|
||||
{
|
||||
SongID = ps.SongID;
|
||||
GameMode = ps.GameMode;
|
||||
}
|
||||
}
|
||||
|
||||
struct SThemePlaylist
|
||||
{
|
||||
public string Name;
|
||||
@@ -147,7 +169,7 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
if (_EditMode == EEditMode.ChangeOrder && ChangeOrderSource != -1 && PlaylistElements.Count > ChangeOrderSource)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].DeleteSong(PlaylistElements[ChangeOrderSource].Content);
|
||||
_Base.Playlist.DeletePlaylistSong(ActivePlaylistID, PlaylistElements[ChangeOrderSource].Content);
|
||||
UpdatePlaylist();
|
||||
}
|
||||
ChangeOrderSource = -1;
|
||||
@@ -229,7 +251,7 @@ namespace Vocaluxe.Menu
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H);
|
||||
if (CHelper.GetValueFromXML(item + "/ColorBackground", navigator, ref _Theme.ColorBackgroundName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= CTheme.GetColor(_Theme.ColorBackgroundName, SkinIndex, ref BackgroundColor);
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorBackgroundName, SkinIndex, ref BackgroundColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -240,7 +262,7 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
if (CHelper.GetValueFromXML(item + "/SColorBackground", navigator, ref _Theme.SColorBackgroundName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= CTheme.GetColor(_Theme.SColorBackgroundName, SkinIndex, ref BackgroundSColor);
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.SColorBackgroundName, SkinIndex, ref BackgroundSColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -406,19 +428,19 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
LoadPlaylist(0);
|
||||
}
|
||||
if (!Visible && CSettings.GameState != EGameState.EditTheme && !ForceDraw)
|
||||
if (!Visible && _Base.Settings.GetGameState() != EGameState.EditTheme && !ForceDraw)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < PlaylistElements.Count; i++ )
|
||||
{
|
||||
if (i == CurrentPlaylistElement && _Selected)
|
||||
{
|
||||
PlaylistElements[i].Background.Texture = CTheme.GetSkinTexture(_Theme.STextureBackgroundName);
|
||||
PlaylistElements[i].Background.Texture = _Base.Theme.GetSkinTexture(_Theme.STextureBackgroundName);
|
||||
PlaylistElements[i].Background.Color = BackgroundSColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaylistElements[i].Background.Texture = CTheme.GetSkinTexture(_Theme.TextureBackgroundName);
|
||||
PlaylistElements[i].Background.Texture = _Base.Theme.GetSkinTexture(_Theme.TextureBackgroundName);
|
||||
PlaylistElements[i].Background.Color = BackgroundColor;
|
||||
}
|
||||
}
|
||||
@@ -452,10 +474,10 @@ namespace Vocaluxe.Menu
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (_Theme.ColorBackgroundName != String.Empty)
|
||||
BackgroundColor = CTheme.GetColor(_Theme.ColorBackgroundName);
|
||||
BackgroundColor = _Base.Theme.GetColor(_Theme.ColorBackgroundName);
|
||||
|
||||
if (_Theme.SColorBackgroundName != String.Empty)
|
||||
BackgroundSColor = CTheme.GetColor(_Theme.SColorBackgroundName);
|
||||
BackgroundSColor = _Base.Theme.GetColor(_Theme.SColorBackgroundName);
|
||||
|
||||
_Theme.Text1.LoadTextures();
|
||||
_Theme.ButtonPlaylistClose.LoadTextures();
|
||||
@@ -492,14 +514,14 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
else if (KeyEvent.Key == Keys.Enter)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].PlaylistName = _Theme.ButtonPlaylistName.Text.Text;
|
||||
CPlaylists.Playlists[ActivePlaylistID].SavePlaylist();
|
||||
_Base.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
||||
_Base.Playlist.SavePlaylist(ActivePlaylistID);
|
||||
_EditMode = EEditMode.None;
|
||||
_Theme.ButtonPlaylistName.EditMode = false;
|
||||
}
|
||||
else if (KeyEvent.Key == Keys.Escape)
|
||||
{
|
||||
_Theme.ButtonPlaylistName.Text.Text = CPlaylists.Playlists[ActivePlaylistID].PlaylistName;
|
||||
_Theme.ButtonPlaylistName.Text.Text = _Base.Playlist.GetPlaylistName(ActivePlaylistID);
|
||||
_EditMode = EEditMode.None;
|
||||
_Theme.ButtonPlaylistName.EditMode = false;
|
||||
}
|
||||
@@ -587,7 +609,7 @@ namespace Vocaluxe.Menu
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
CPlaylists.Playlists[ActivePlaylistID].DeleteSong(PlaylistElements[CurrentPlaylistElement].Content);
|
||||
_Base.Playlist.DeletePlaylistSong(ActivePlaylistID, PlaylistElements[CurrentPlaylistElement].Content);
|
||||
UpdatePlaylist();
|
||||
|
||||
if (Offset > 0)
|
||||
@@ -615,7 +637,7 @@ namespace Vocaluxe.Menu
|
||||
case Keys.Add: //move the selected song up
|
||||
if (PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0))
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].SongUp(CurrentPlaylistElement + Offset);
|
||||
_Base.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||
UpdatePlaylist();
|
||||
|
||||
KeyEvent key = new KeyEvent();
|
||||
@@ -645,7 +667,7 @@ namespace Vocaluxe.Menu
|
||||
case Keys.Subtract: //move the selected song down
|
||||
if (PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < PlaylistElementContents.Count - 1)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].SongDown(CurrentPlaylistElement + Offset);
|
||||
_Base.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||
UpdatePlaylist();
|
||||
|
||||
KeyEvent key = new KeyEvent();
|
||||
@@ -715,7 +737,7 @@ namespace Vocaluxe.Menu
|
||||
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
_Base.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
}
|
||||
break;
|
||||
@@ -726,7 +748,7 @@ namespace Vocaluxe.Menu
|
||||
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
_Base.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
}
|
||||
break;
|
||||
@@ -758,11 +780,11 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
else if (_Theme.ButtonPlaylistSave.Selected)
|
||||
{
|
||||
CPlaylists.SavePlaylist(ActivePlaylistID);
|
||||
_Base.Playlist.SavePlaylist(ActivePlaylistID);
|
||||
}
|
||||
else if (_Theme.ButtonPlaylistDelete.Selected)
|
||||
{
|
||||
CPlaylists.DeletePlaylist(ActivePlaylistID);
|
||||
_Base.Playlist.DeletePlaylist(ActivePlaylistID);
|
||||
ClosePlaylist();
|
||||
}
|
||||
else if (_Theme.ButtonPlaylistName.Selected)
|
||||
@@ -884,7 +906,7 @@ namespace Vocaluxe.Menu
|
||||
//Delete Entry with RB
|
||||
if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent) && MouseEvent.RB && PlaylistElements[i].Content != -1)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].DeleteSong(PlaylistElements[i].Content);
|
||||
_Base.Playlist.DeletePlaylistSong(ActivePlaylistID, PlaylistElements[i].Content);
|
||||
UpdatePlaylist();
|
||||
return true;
|
||||
}
|
||||
@@ -904,7 +926,7 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
_Base.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
}
|
||||
if (_Theme.ButtonPlaylistClose.Selected)
|
||||
@@ -919,12 +941,12 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
else if (_Theme.ButtonPlaylistSave.Selected)
|
||||
{
|
||||
CPlaylists.SavePlaylist(ActivePlaylistID);
|
||||
_Base.Playlist.SavePlaylist(ActivePlaylistID);
|
||||
return true;
|
||||
}
|
||||
else if (_Theme.ButtonPlaylistDelete.Selected)
|
||||
{
|
||||
CPlaylists.DeletePlaylist(ActivePlaylistID);
|
||||
_Base.Playlist.DeletePlaylist(ActivePlaylistID);
|
||||
ClosePlaylist();
|
||||
return true;
|
||||
}
|
||||
@@ -947,14 +969,14 @@ namespace Vocaluxe.Menu
|
||||
return true;
|
||||
|
||||
ChangeOrderElement = new PlaylistElement(PlaylistElements[CurrentPlaylistElement]);
|
||||
ChangeOrderElement.Background.Rect.Z = CSettings.zNear;
|
||||
ChangeOrderElement.Cover.Rect.Z = CSettings.zNear;
|
||||
ChangeOrderElement.SelectSlide.Rect.Z = CSettings.zNear;
|
||||
ChangeOrderElement.SelectSlide.RectArrowLeft.Z = CSettings.zNear;
|
||||
ChangeOrderElement.SelectSlide.RectArrowRight.Z = CSettings.zNear;
|
||||
ChangeOrderElement.Text1.Z = CSettings.zNear;
|
||||
ChangeOrderElement.Background.Rect.Z = _Base.Settings.GetZNear();
|
||||
ChangeOrderElement.Cover.Rect.Z = _Base.Settings.GetZNear();
|
||||
ChangeOrderElement.SelectSlide.Rect.Z = _Base.Settings.GetZNear();
|
||||
ChangeOrderElement.SelectSlide.RectArrowLeft.Z = _Base.Settings.GetZNear();
|
||||
ChangeOrderElement.SelectSlide.RectArrowRight.Z = _Base.Settings.GetZNear();
|
||||
ChangeOrderElement.Text1.Z = _Base.Settings.GetZNear();
|
||||
|
||||
ChangeOrderElement.Background.Texture = CTheme.GetSkinTexture(_Theme.TextureBackgroundName);
|
||||
ChangeOrderElement.Background.Texture = _Base.Theme.GetSkinTexture(_Theme.TextureBackgroundName);
|
||||
ChangeOrderElement.Background.Color = BackgroundColor;
|
||||
|
||||
OldMousePosX = MouseEvent.X;
|
||||
@@ -966,7 +988,7 @@ namespace Vocaluxe.Menu
|
||||
if (!MouseEvent.LBH && DragAndDropSongID != -1)
|
||||
{
|
||||
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
CSong song = CSongs.GetSong(DragAndDropSongID);
|
||||
CSong song = _Base.Songs.GetSongByID(DragAndDropSongID);
|
||||
|
||||
if (song != null)
|
||||
{
|
||||
@@ -975,14 +997,14 @@ namespace Vocaluxe.Menu
|
||||
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].SongInsert(CurrentPlaylistElement + Offset, DragAndDropSongID, gm);
|
||||
_Base.Playlist.InsertPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset, DragAndDropSongID, gm);
|
||||
UpdatePlaylist();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MouseEvent.Y < PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].SongInsert(0, DragAndDropSongID, gm);
|
||||
_Base.Playlist.InsertPlaylistSong(ActivePlaylistID, 0, DragAndDropSongID, gm);
|
||||
UpdatePlaylist();
|
||||
}
|
||||
else
|
||||
@@ -1001,7 +1023,7 @@ namespace Vocaluxe.Menu
|
||||
|
||||
if (MouseEvent.Y > min)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].AddSong(DragAndDropSongID, gm);
|
||||
_Base.Playlist.AddPlaylistSong(ActivePlaylistID, DragAndDropSongID, gm);
|
||||
UpdatePlaylist();
|
||||
ScrollToBottom();
|
||||
}
|
||||
@@ -1022,8 +1044,8 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
if (_Theme.ButtonPlaylistName.Selected)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].PlaylistName = _Theme.ButtonPlaylistName.Text.Text;
|
||||
CPlaylists.Playlists[ActivePlaylistID].SavePlaylist();
|
||||
_Base.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
|
||||
_Base.Playlist.SavePlaylist(ActivePlaylistID);
|
||||
_EditMode = EEditMode.None;
|
||||
return true;
|
||||
}
|
||||
@@ -1032,7 +1054,7 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
if (_Theme.ButtonPlaylistName.Selected)
|
||||
{
|
||||
_Theme.ButtonPlaylistName.Text.Text = CPlaylists.Playlists[ActivePlaylistID].PlaylistName;
|
||||
_Theme.ButtonPlaylistName.Text.Text = _Base.Playlist.GetPlaylistName(ActivePlaylistID);
|
||||
_EditMode = EEditMode.None;
|
||||
_Theme.ButtonPlaylistName.EditMode = false;
|
||||
return true;
|
||||
@@ -1052,14 +1074,14 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
if (CurrentPlaylistElement != -1 && CurrentPlaylistElement + Offset != ChangeOrderSource)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].SongMove(ChangeOrderSource, CurrentPlaylistElement + Offset);
|
||||
_Base.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, CurrentPlaylistElement + Offset);
|
||||
UpdatePlaylist();
|
||||
}
|
||||
else if (CurrentPlaylistElement == -1)
|
||||
{
|
||||
if (MouseEvent.Y < PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].SongMove(ChangeOrderSource, 0);
|
||||
_Base.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1077,7 +1099,7 @@ namespace Vocaluxe.Menu
|
||||
|
||||
if (MouseEvent.Y > min)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].SongMove(ChangeOrderSource, PlaylistElementContents.Count - 1);
|
||||
_Base.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, PlaylistElementContents.Count - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1130,17 +1152,17 @@ namespace Vocaluxe.Menu
|
||||
|
||||
public bool LoadPlaylist(int PlaylistID)
|
||||
{
|
||||
if (PlaylistID > -1 && PlaylistID < CPlaylists.NumPlaylists)
|
||||
if (PlaylistID > -1 && PlaylistID < _Base.Playlist.GetNumPlaylists())
|
||||
{
|
||||
_Theme.ButtonPlaylistName.Text.Text = CPlaylists.Playlists[ActivePlaylistID].PlaylistName;
|
||||
_Theme.ButtonPlaylistName.Text.Text = _Base.Playlist.GetPlaylistName(ActivePlaylistID);
|
||||
ActivePlaylistID = PlaylistID;
|
||||
PlaylistElementContents.Clear();
|
||||
for (int i = 0; i < CPlaylists.Playlists[ActivePlaylistID].Songs.Count; i++)
|
||||
for (int i = 0; i < _Base.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
||||
{
|
||||
PlaylistElementContent pec = new PlaylistElementContent();
|
||||
pec.SongID = CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID;
|
||||
pec.Modes = CSongs.AllSongs[CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID].AvailableGameModes;
|
||||
pec.Mode = CPlaylists.Playlists[ActivePlaylistID].Songs[i].GameMode;
|
||||
pec.SongID = _Base.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID;
|
||||
pec.Modes = _Base.Songs.GetSongByID(_Base.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes;
|
||||
pec.Mode = _Base.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode;
|
||||
PlaylistElementContents.Add(pec);
|
||||
}
|
||||
Update();
|
||||
@@ -1153,12 +1175,12 @@ namespace Vocaluxe.Menu
|
||||
public void UpdatePlaylist()
|
||||
{
|
||||
PlaylistElementContents.Clear();
|
||||
for (int i = 0; i < CPlaylists.Playlists[ActivePlaylistID].Songs.Count; i++)
|
||||
for (int i = 0; i < _Base.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
||||
{
|
||||
PlaylistElementContent pec = new PlaylistElementContent();
|
||||
pec.SongID = CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID;
|
||||
pec.Modes = CSongs.AllSongs[pec.SongID].AvailableGameModes;
|
||||
pec.Mode = CPlaylists.Playlists[ActivePlaylistID].Songs[i].GameMode;
|
||||
pec.SongID = _Base.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID;
|
||||
pec.Modes = _Base.Songs.GetSongByID(pec.SongID).AvailableGameModes;
|
||||
pec.Mode = _Base.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode;
|
||||
PlaylistElementContents.Add(pec);
|
||||
}
|
||||
|
||||
@@ -1167,16 +1189,16 @@ namespace Vocaluxe.Menu
|
||||
|
||||
private void StartPlaylistSongs()
|
||||
{
|
||||
CGame.Reset();
|
||||
CGame.ClearSongs();
|
||||
_Base.Game.Reset();
|
||||
_Base.Game.ClearSongs();
|
||||
|
||||
if (ActivePlaylistID > -1 && ActivePlaylistID < CPlaylists.NumPlaylists)
|
||||
if (ActivePlaylistID > -1 && ActivePlaylistID < _Base.Playlist.GetNumPlaylists())
|
||||
{
|
||||
for (int i = 0; i < CPlaylists.Playlists[ActivePlaylistID].Songs.Count; i++)
|
||||
for (int i = 0; i < _Base.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
|
||||
{
|
||||
CGame.AddSong(CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID, CPlaylists.Playlists[ActivePlaylistID].Songs[i].GameMode);
|
||||
_Base.Game.AddSong(_Base.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID, _Base.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode);
|
||||
}
|
||||
if (CGame.GetNumSongs() > 0)
|
||||
if (_Base.Game.GetNumSongs() > 0)
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
}
|
||||
}
|
||||
@@ -1190,7 +1212,7 @@ namespace Vocaluxe.Menu
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (ActivePlaylistID > -1 && ActivePlaylistID < CPlaylists.NumPlaylists)
|
||||
if (ActivePlaylistID > -1 && ActivePlaylistID < _Base.Playlist.GetNumPlaylists())
|
||||
{
|
||||
for (int i = 0; i < PlaylistElements.Count; i++ )
|
||||
{
|
||||
@@ -1202,7 +1224,7 @@ namespace Vocaluxe.Menu
|
||||
PlaylistElements[i].SelectSlide.Visible = true;
|
||||
PlaylistElements[i].Text1.Visible = true;
|
||||
PlaylistElementContent pec = PlaylistElementContents[Offset + i];
|
||||
CSong song = CSongs.GetSong(pec.SongID);
|
||||
CSong song = _Base.Songs.GetSongByID(pec.SongID);
|
||||
PlaylistElements[i].Cover.Texture = song.CoverTextureSmall;
|
||||
string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title);
|
||||
PlaylistElements[i].Text1.Text = /*(Offset + i + 1).ToString() + ") " + */song.Artist + " - " + song.Title; //TODO: Add text field for the number
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Vocaluxe.GameModes;
|
||||
using Vocaluxe.Menu.SingNotes;
|
||||
using Vocaluxe.Menu.SongMenu;
|
||||
|
||||
@@ -183,6 +184,11 @@ namespace Vocaluxe.Menu
|
||||
double GetRandomDouble();
|
||||
|
||||
float GetTimeFromBeats(float Beat, float BPM);
|
||||
|
||||
void AddSong(int SongID, EGameMode GameMode);
|
||||
void Reset();
|
||||
void ClearSongs();
|
||||
int GetNumSongs();
|
||||
}
|
||||
|
||||
public interface IRecording
|
||||
@@ -209,6 +215,7 @@ namespace Vocaluxe.Menu
|
||||
void UpdateRandomSongList();
|
||||
|
||||
CSong GetVisibleSong(int VisibleIndex);
|
||||
CSong GetSongByID(int SongID);
|
||||
CCategory GetCategory(int Index);
|
||||
|
||||
void NextCategory();
|
||||
@@ -255,6 +262,27 @@ namespace Vocaluxe.Menu
|
||||
void SetRumble(float Duration);
|
||||
}
|
||||
|
||||
public interface IPlaylist
|
||||
{
|
||||
string GetPlaylistName(int PlaylistID);
|
||||
void SetPlaylistName(int PlaylistID, string Name);
|
||||
void DeletePlaylist(int PlaylistID);
|
||||
void SavePlaylist(int PlaylistID);
|
||||
int GetNumPlaylists();
|
||||
|
||||
void AddPlaylistSong(int PlaylistID, int SongID);
|
||||
void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode);
|
||||
void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode);
|
||||
|
||||
void MovePlaylistSong(int PlaylistID, int SourceIndex, int DestIndex);
|
||||
void MovePlaylistSongDown(int PlaylistID, int SongIndex);
|
||||
void MovePlaylistSongUp(int PlaylistID, int SongIndex);
|
||||
void DeletePlaylistSong(int PlaylistID, int SongIndex);
|
||||
|
||||
int GetPlaylistSongCount(int PlaylistID);
|
||||
CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum EModifier
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user