Merge remote-tracking branch 'remotes/upstream/develop' into develop

This commit is contained in:
Florian Kuepper committed 2012-12-02 22:15:54 +01:00
commit c9a2c9404c
6 files changed
+148 -22

No files matched your search

+89 -19
View File
@@ -149,14 +149,18 @@ namespace Vocaluxe.Menu
}
public EEditMode _EditMode;
public int ActivePlaylistID;
public int Offset;
public int CurrentPlaylistElement;
public int ActivePlaylistID = -1;
public int Offset = 0;
public int CurrentPlaylistElement = -1;
private PlaylistElement ChangeOrderElement;
private int ChangeOrderSource;
private int OldMousePosX;
private int OldMousePosY;
private PlaylistElement ChangeOrderElement = new PlaylistElement();
private int ChangeOrderSource = -1;
private int OldMousePosX = 0;
private int OldMousePosY = 0;
public int DragAndDropSongID = -1;
//private static
public CPlaylist()
{
@@ -198,15 +202,6 @@ namespace Vocaluxe.Menu
_Interactions.AddButton(_Theme.ButtonPlaylistDelete);
_Interactions.AddButton(_Theme.ButtonPlaylistSave);
_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)
@@ -430,17 +425,42 @@ namespace Vocaluxe.Menu
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()
{
_Theme.Text1.LoadTextures();
if (_Theme.ColorBackgroundName != String.Empty)
BackgroundColor = CTheme.GetColor(_Theme.ColorBackgroundName);
if (_Theme.SColorBackgroundName != String.Empty)
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()
@@ -906,7 +926,7 @@ namespace Vocaluxe.Menu
}
//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;
@@ -932,6 +952,56 @@ namespace Vocaluxe.Menu
_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;
case EEditMode.PlaylistName:
+5
View File
@@ -88,6 +88,11 @@ namespace Vocaluxe.Menu.SongMenu
return _SongMenu.GetSelectedSong();
}
public CStatic GetSelectedSongCover()
{
return _SongMenu.GetSelectedSongCover();
}
public void SetSelectedSong(int VisibleSongNr)
{
_SongMenu.SetSelectedSong(VisibleSongNr);
@@ -525,6 +525,11 @@ namespace Vocaluxe.Menu.SongMenu
return -1;
}
public virtual CStatic GetSelectedSongCover()
{
return new CStatic();
}
public virtual int GetSelectedCategory()
{
return -1;
@@ -499,6 +499,16 @@ namespace Vocaluxe.Menu.SongMenu
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)
{
base.SetSelectedSong(VisibleSongNr);
+1
View File
@@ -18,6 +18,7 @@ namespace Vocaluxe.Menu.SongMenu
void Draw();
int GetSelectedSong();
CStatic GetSelectedSongCover();
void SetSelectedSong(int VisibleSongNr);
bool IsActive();
+38 -3
View File
@@ -59,6 +59,11 @@ namespace Vocaluxe.Screens
private bool _PlaylistActive = false;
private List<GameModes.EGameMode> _AvailableGameModes;
private CStatic DragAndDropCover;
private bool DragAndDropActive;
private int OldMousePosX;
private int OldMousePosY;
public CScreenSong()
{
Init();
@@ -98,6 +103,8 @@ namespace Vocaluxe.Screens
Statics[htStatics(StaticOptionsBG)].Visible = false;
Playlists[htPlaylists(Playlist)].Visible = false;
DragAndDropCover = new CStatic();
Playlists[htPlaylists(Playlist)].Init();
}
@@ -310,6 +317,14 @@ namespace Vocaluxe.Screens
{
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))
{
_PlaylistActive = true;
@@ -349,7 +364,14 @@ namespace Vocaluxe.Screens
else
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)
{
@@ -364,7 +386,6 @@ namespace Vocaluxe.Screens
}
}
}
else
{
if (MouseEvent.LB && IsMouseOver(MouseEvent))
@@ -417,6 +438,12 @@ namespace Vocaluxe.Screens
}
}
if (!MouseEvent.LBH && DragAndDropActive)
{
DragAndDropActive = false;
Playlists[htPlaylists(Playlist)].DragAndDropSongID = -1;
}
return true;
}
@@ -426,10 +453,14 @@ namespace Vocaluxe.Screens
CGame.EnterNormalGame();
SongMenus[htSongMenus(SongMenu)].OnShow();
SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive);
SongMenus[htSongMenus(SongMenu)].SetSmallView(Playlists[htPlaylists(Playlist)].Visible);
if (Playlists[htPlaylists(Playlist)].ActivePlaylistID != -1)
Playlists[htPlaylists(Playlist)].LoadPlaylist(Playlists[htPlaylists(Playlist)].ActivePlaylistID);
UpdatePlaylistNames();
DragAndDropActive = false;
Playlists[htPlaylists(Playlist)].DragAndDropSongID = -1;
}
public override bool UpdateGame()
@@ -480,6 +511,10 @@ namespace Vocaluxe.Screens
public override bool Draw()
{
base.Draw();
if (DragAndDropActive)
DragAndDropCover.Draw();
return true;
}