added drag and drop playlist building, fixed color textures reload for playlists
This commit is contained in:
1 parent
ec39b72f80
commit
e762d290cc
6 files changed
+148
-22
No files matched your search
+89
-19
@@ -149,14 +149,18 @@ namespace Vocaluxe.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EEditMode _EditMode;
|
public EEditMode _EditMode;
|
||||||
public int ActivePlaylistID;
|
public int ActivePlaylistID = -1;
|
||||||
public int Offset;
|
public int Offset = 0;
|
||||||
public int CurrentPlaylistElement;
|
public int CurrentPlaylistElement = -1;
|
||||||
|
|
||||||
private PlaylistElement ChangeOrderElement;
|
private PlaylistElement ChangeOrderElement = new PlaylistElement();
|
||||||
private int ChangeOrderSource;
|
private int ChangeOrderSource = -1;
|
||||||
private int OldMousePosX;
|
private int OldMousePosX = 0;
|
||||||
private int OldMousePosY;
|
private int OldMousePosY = 0;
|
||||||
|
|
||||||
|
public int DragAndDropSongID = -1;
|
||||||
|
|
||||||
|
//private static
|
||||||
|
|
||||||
public CPlaylist()
|
public CPlaylist()
|
||||||
{
|
{
|
||||||
@@ -198,15 +202,6 @@ namespace Vocaluxe.Menu
|
|||||||
_Interactions.AddButton(_Theme.ButtonPlaylistDelete);
|
_Interactions.AddButton(_Theme.ButtonPlaylistDelete);
|
||||||
_Interactions.AddButton(_Theme.ButtonPlaylistSave);
|
_Interactions.AddButton(_Theme.ButtonPlaylistSave);
|
||||||
_Interactions.AddButton(_Theme.ButtonPlaylistSing);
|
_Interactions.AddButton(_Theme.ButtonPlaylistSing);
|
||||||
|
|
||||||
ActivePlaylistID = -1;
|
|
||||||
Offset = 0;
|
|
||||||
CurrentPlaylistElement = -1;
|
|
||||||
|
|
||||||
ChangeOrderElement = new PlaylistElement();
|
|
||||||
OldMousePosX = 0;
|
|
||||||
OldMousePosY = 0;
|
|
||||||
ChangeOrderSource = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||||
@@ -430,17 +425,42 @@ namespace Vocaluxe.Menu
|
|||||||
|
|
||||||
public void UnloadTextures()
|
public void UnloadTextures()
|
||||||
{
|
{
|
||||||
|
_Theme.Text1.UnloadTextures();
|
||||||
|
_Theme.ButtonPlaylistClose.UnloadTextures();
|
||||||
|
_Theme.ButtonPlaylistDelete.UnloadTextures();
|
||||||
|
_Theme.ButtonPlaylistName.UnloadTextures();
|
||||||
|
_Theme.ButtonPlaylistSave.UnloadTextures();
|
||||||
|
_Theme.ButtonPlaylistSing.UnloadTextures();
|
||||||
|
|
||||||
|
_Theme.StaticCover.UnloadTextures();
|
||||||
|
_Theme.StaticPlaylistFooter.UnloadTextures();
|
||||||
|
_Theme.StaticPlaylistHeader.UnloadTextures();
|
||||||
|
|
||||||
|
_Theme.SelectSlideGameMode.UnloadTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadTextures()
|
public void LoadTextures()
|
||||||
{
|
{
|
||||||
_Theme.Text1.LoadTextures();
|
|
||||||
|
|
||||||
if (_Theme.ColorBackgroundName != String.Empty)
|
if (_Theme.ColorBackgroundName != String.Empty)
|
||||||
BackgroundColor = CTheme.GetColor(_Theme.ColorBackgroundName);
|
BackgroundColor = CTheme.GetColor(_Theme.ColorBackgroundName);
|
||||||
|
|
||||||
if (_Theme.SColorBackgroundName != String.Empty)
|
if (_Theme.SColorBackgroundName != String.Empty)
|
||||||
BackgroundSColor = CTheme.GetColor(_Theme.SColorBackgroundName);
|
BackgroundSColor = CTheme.GetColor(_Theme.SColorBackgroundName);
|
||||||
|
|
||||||
|
_Theme.Text1.LoadTextures();
|
||||||
|
_Theme.ButtonPlaylistClose.LoadTextures();
|
||||||
|
_Theme.ButtonPlaylistDelete.LoadTextures();
|
||||||
|
_Theme.ButtonPlaylistName.LoadTextures();
|
||||||
|
_Theme.ButtonPlaylistSave.LoadTextures();
|
||||||
|
_Theme.ButtonPlaylistSing.LoadTextures();
|
||||||
|
|
||||||
|
_Theme.StaticCover.LoadTextures();
|
||||||
|
_Theme.StaticPlaylistFooter.LoadTextures();
|
||||||
|
_Theme.StaticPlaylistHeader.LoadTextures();
|
||||||
|
|
||||||
|
_Theme.SelectSlideGameMode.LoadTextures();
|
||||||
|
|
||||||
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadTextures()
|
public void ReloadTextures()
|
||||||
@@ -906,7 +926,7 @@ namespace Vocaluxe.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Change order with holding LB
|
//Change order with holding LB
|
||||||
if (MouseEvent.LBH && CurrentPlaylistElement != -1 && PlaylistElementContents.Count > 1)
|
if (MouseEvent.LBH && CurrentPlaylistElement != -1 && PlaylistElementContents.Count > 1 && DragAndDropSongID == -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
ChangeOrderSource = CurrentPlaylistElement + Offset;
|
ChangeOrderSource = CurrentPlaylistElement + Offset;
|
||||||
@@ -932,6 +952,56 @@ namespace Vocaluxe.Menu
|
|||||||
_EditMode = EEditMode.ChangeOrder;
|
_EditMode = EEditMode.ChangeOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!MouseEvent.LBH && DragAndDropSongID != -1)
|
||||||
|
{
|
||||||
|
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||||
|
CSong song = CSongs.GetSong(DragAndDropSongID);
|
||||||
|
|
||||||
|
if (song != null)
|
||||||
|
{
|
||||||
|
if (song.IsDuet)
|
||||||
|
gm = EGameMode.TR_GAMEMODE_DUET;
|
||||||
|
|
||||||
|
if (CurrentPlaylistElement != -1)
|
||||||
|
{
|
||||||
|
CPlaylists.Playlists[ActivePlaylistID].SongInsert(CurrentPlaylistElement, DragAndDropSongID, gm);
|
||||||
|
UpdatePlaylist();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (MouseEvent.Y < PlaylistElements[0].Background.Rect.Y && Offset == 0)
|
||||||
|
{
|
||||||
|
CPlaylists.Playlists[ActivePlaylistID].SongInsert(0, DragAndDropSongID, gm);
|
||||||
|
UpdatePlaylist();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (PlaylistElements.Count + Offset >= PlaylistElementContents.Count)
|
||||||
|
{
|
||||||
|
float min = 0f;
|
||||||
|
for (int i = PlaylistElements.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (PlaylistElements[i].SelectSlide.Visible)
|
||||||
|
{
|
||||||
|
min = PlaylistElements[i].SelectSlide.Rect.Y + PlaylistElements[i].SelectSlide.Rect.H;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MouseEvent.Y > min)
|
||||||
|
{
|
||||||
|
CPlaylists.Playlists[ActivePlaylistID].AddSong(DragAndDropSongID, gm);
|
||||||
|
UpdatePlaylist();
|
||||||
|
ScrollToBottom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DragAndDropSongID = -1;
|
||||||
|
UpdatePlaylist();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EEditMode.PlaylistName:
|
case EEditMode.PlaylistName:
|
||||||
|
|||||||
@@ -88,6 +88,11 @@ namespace Vocaluxe.Menu.SongMenu
|
|||||||
return _SongMenu.GetSelectedSong();
|
return _SongMenu.GetSelectedSong();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CStatic GetSelectedSongCover()
|
||||||
|
{
|
||||||
|
return _SongMenu.GetSelectedSongCover();
|
||||||
|
}
|
||||||
|
|
||||||
public void SetSelectedSong(int VisibleSongNr)
|
public void SetSelectedSong(int VisibleSongNr)
|
||||||
{
|
{
|
||||||
_SongMenu.SetSelectedSong(VisibleSongNr);
|
_SongMenu.SetSelectedSong(VisibleSongNr);
|
||||||
|
|||||||
@@ -525,6 +525,11 @@ namespace Vocaluxe.Menu.SongMenu
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual CStatic GetSelectedSongCover()
|
||||||
|
{
|
||||||
|
return new CStatic();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual int GetSelectedCategory()
|
public virtual int GetSelectedCategory()
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -499,6 +499,16 @@ namespace Vocaluxe.Menu.SongMenu
|
|||||||
return _Locked;
|
return _Locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override CStatic GetSelectedSongCover()
|
||||||
|
{
|
||||||
|
foreach (CStatic tile in _Tiles)
|
||||||
|
{
|
||||||
|
if (tile.Selected)
|
||||||
|
return new CStatic(tile);
|
||||||
|
}
|
||||||
|
return new CStatic();
|
||||||
|
}
|
||||||
|
|
||||||
public override void SetSelectedSong(int VisibleSongNr)
|
public override void SetSelectedSong(int VisibleSongNr)
|
||||||
{
|
{
|
||||||
base.SetSelectedSong(VisibleSongNr);
|
base.SetSelectedSong(VisibleSongNr);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace Vocaluxe.Menu.SongMenu
|
|||||||
void Draw();
|
void Draw();
|
||||||
|
|
||||||
int GetSelectedSong();
|
int GetSelectedSong();
|
||||||
|
CStatic GetSelectedSongCover();
|
||||||
void SetSelectedSong(int VisibleSongNr);
|
void SetSelectedSong(int VisibleSongNr);
|
||||||
|
|
||||||
bool IsActive();
|
bool IsActive();
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ namespace Vocaluxe.Screens
|
|||||||
private bool _PlaylistActive = false;
|
private bool _PlaylistActive = false;
|
||||||
private List<GameModes.EGameMode> _AvailableGameModes;
|
private List<GameModes.EGameMode> _AvailableGameModes;
|
||||||
|
|
||||||
|
private CStatic DragAndDropCover;
|
||||||
|
private bool DragAndDropActive;
|
||||||
|
private int OldMousePosX;
|
||||||
|
private int OldMousePosY;
|
||||||
|
|
||||||
public CScreenSong()
|
public CScreenSong()
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
@@ -96,6 +101,8 @@ namespace Vocaluxe.Screens
|
|||||||
Statics[htStatics(StaticOptionsBG)].Visible = false;
|
Statics[htStatics(StaticOptionsBG)].Visible = false;
|
||||||
Playlists[htPlaylists(Playlist)].Visible = false;
|
Playlists[htPlaylists(Playlist)].Visible = false;
|
||||||
|
|
||||||
|
DragAndDropCover = new CStatic();
|
||||||
|
|
||||||
Playlists[htPlaylists(Playlist)].Init();
|
Playlists[htPlaylists(Playlist)].Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,6 +301,14 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
base.HandleMouse(MouseEvent);
|
base.HandleMouse(MouseEvent);
|
||||||
|
|
||||||
|
if (DragAndDropActive)
|
||||||
|
{
|
||||||
|
DragAndDropCover.Rect.X += MouseEvent.X - OldMousePosX;
|
||||||
|
DragAndDropCover.Rect.Y += MouseEvent.Y - OldMousePosY;
|
||||||
|
}
|
||||||
|
OldMousePosX = MouseEvent.X;
|
||||||
|
OldMousePosY = MouseEvent.Y;
|
||||||
|
|
||||||
if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].IsMouseOver(MouseEvent))
|
if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].IsMouseOver(MouseEvent))
|
||||||
{
|
{
|
||||||
_PlaylistActive = true;
|
_PlaylistActive = true;
|
||||||
@@ -327,7 +342,14 @@ namespace Vocaluxe.Screens
|
|||||||
else
|
else
|
||||||
SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent);
|
SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent);
|
||||||
|
|
||||||
if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
|
if (MouseEvent.LBH && !DragAndDropActive && Playlists[htPlaylists(Playlist)].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
|
||||||
|
{
|
||||||
|
DragAndDropCover = SongMenus[htSongMenus(SongMenu)].GetSelectedSongCover();
|
||||||
|
DragAndDropCover.Rect.Z = CSettings.zNear;
|
||||||
|
Playlists[htPlaylists(Playlist)].DragAndDropSongID = CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetActualSelection()].ID;
|
||||||
|
DragAndDropActive = true;
|
||||||
|
}
|
||||||
|
else if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
|
||||||
{
|
{
|
||||||
if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive)
|
if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive)
|
||||||
{
|
{
|
||||||
@@ -342,7 +364,6 @@ namespace Vocaluxe.Screens
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (MouseEvent.LB && IsMouseOver(MouseEvent))
|
if (MouseEvent.LB && IsMouseOver(MouseEvent))
|
||||||
@@ -388,6 +409,12 @@ namespace Vocaluxe.Screens
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!MouseEvent.LBH && DragAndDropActive)
|
||||||
|
{
|
||||||
|
DragAndDropActive = false;
|
||||||
|
Playlists[htPlaylists(Playlist)].DragAndDropSongID = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,10 +424,14 @@ namespace Vocaluxe.Screens
|
|||||||
CGame.EnterNormalGame();
|
CGame.EnterNormalGame();
|
||||||
SongMenus[htSongMenus(SongMenu)].OnShow();
|
SongMenus[htSongMenus(SongMenu)].OnShow();
|
||||||
SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive);
|
SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive);
|
||||||
|
SongMenus[htSongMenus(SongMenu)].SetSmallView(Playlists[htPlaylists(Playlist)].Visible);
|
||||||
|
|
||||||
if (Playlists[htPlaylists(Playlist)].ActivePlaylistID != -1)
|
if (Playlists[htPlaylists(Playlist)].ActivePlaylistID != -1)
|
||||||
Playlists[htPlaylists(Playlist)].LoadPlaylist(Playlists[htPlaylists(Playlist)].ActivePlaylistID);
|
Playlists[htPlaylists(Playlist)].LoadPlaylist(Playlists[htPlaylists(Playlist)].ActivePlaylistID);
|
||||||
UpdatePlaylistNames();
|
UpdatePlaylistNames();
|
||||||
|
|
||||||
|
DragAndDropActive = false;
|
||||||
|
Playlists[htPlaylists(Playlist)].DragAndDropSongID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool UpdateGame()
|
public override bool UpdateGame()
|
||||||
@@ -451,6 +482,10 @@ namespace Vocaluxe.Screens
|
|||||||
public override bool Draw()
|
public override bool Draw()
|
||||||
{
|
{
|
||||||
base.Draw();
|
base.Draw();
|
||||||
|
|
||||||
|
if (DragAndDropActive)
|
||||||
|
DragAndDropCover.Draw();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user