new interaction handling for playlist (there are still some minor bugs)
This commit is contained in:
1 parent
8cbc0a1ae6
commit
6f2fe5f1a7
20 files changed
+360
-104
No files matched your search
@@ -741,7 +741,7 @@
|
||||
<Y>80</Y>
|
||||
<W>295</W>
|
||||
<H>460</H>
|
||||
<Z>-1,00</Z>
|
||||
<Z>-0,90</Z>
|
||||
<EntryHeight>50,00</EntryHeight>
|
||||
<SkinBackground>CoverTile</SkinBackground>
|
||||
<SkinBackgroundSelected>CoverTile</SkinBackgroundSelected>
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace Vocaluxe.Base
|
||||
|
||||
static class CPlaylists
|
||||
{
|
||||
private static List<CPlaylist> _Playlists;
|
||||
private static List<CPlaylistFile> _Playlists;
|
||||
private static CHelper Helper = new CHelper();
|
||||
|
||||
public static CPlaylist[] Playlists
|
||||
public static CPlaylistFile[] Playlists
|
||||
{
|
||||
get { return _Playlists.ToArray(); }
|
||||
}
|
||||
@@ -46,13 +46,13 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void LoadPlaylists()
|
||||
{
|
||||
_Playlists = new List<CPlaylist>();
|
||||
_Playlists = new List<CPlaylistFile>();
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(Helper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true));
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
CPlaylist playlist = new CPlaylist(file);
|
||||
CPlaylistFile playlist = new CPlaylistFile(file);
|
||||
_Playlists.Add(playlist);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Vocaluxe.Base
|
||||
_Playlists.Sort(CompareByPlaylistName);
|
||||
}
|
||||
|
||||
private static int CompareByPlaylistName(CPlaylist a, CPlaylist b)
|
||||
private static int CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b)
|
||||
{
|
||||
return String.Compare(a.PlaylistName, b.PlaylistName);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static int NewPlaylist()
|
||||
{
|
||||
CPlaylist pl = new CPlaylist();
|
||||
CPlaylistFile pl = new CPlaylistFile();
|
||||
pl.PlaylistName = "New Playlist";
|
||||
_Playlists.Add(pl);
|
||||
return (_Playlists.Count - 1);
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Vocaluxe.Lib.Playlist
|
||||
}
|
||||
}
|
||||
|
||||
public class CPlaylist
|
||||
public class CPlaylistFile
|
||||
{
|
||||
private static XmlWriterSettings _settings = new XmlWriterSettings();
|
||||
private static CHelper Helper = new CHelper();
|
||||
@@ -38,14 +38,14 @@ namespace Vocaluxe.Lib.Playlist
|
||||
public string PlaylistFile;
|
||||
public List<CPlaylistSong> Songs = new List<CPlaylistSong>();
|
||||
|
||||
public CPlaylist()
|
||||
public CPlaylistFile()
|
||||
{
|
||||
Init();
|
||||
PlaylistName = string.Empty;
|
||||
PlaylistFile = string.Empty;
|
||||
}
|
||||
|
||||
public CPlaylist(string file)
|
||||
public CPlaylistFile(string file)
|
||||
{
|
||||
Init();
|
||||
PlaylistFile = file;
|
||||
@@ -38,6 +38,11 @@ namespace Vocaluxe.Menu
|
||||
|
||||
public SColorF Color;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
#region Constructors
|
||||
public CBackground()
|
||||
{
|
||||
|
||||
@@ -55,6 +55,11 @@ namespace Vocaluxe.Menu
|
||||
}
|
||||
public bool Visible;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public CButton()
|
||||
{
|
||||
_Theme = new SThemeButton();
|
||||
|
||||
@@ -47,6 +47,11 @@ namespace Vocaluxe.Menu
|
||||
public bool Visible;
|
||||
public bool ScreenHandles;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
private float[] _Bars;
|
||||
|
||||
public CEqualizer()
|
||||
|
||||
@@ -47,6 +47,11 @@ namespace Vocaluxe.Menu
|
||||
|
||||
private float _Alpha = 1f;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return new SRectF(_X, _Y, _MaxW, _H, _Z); }
|
||||
|
||||
@@ -879,8 +879,7 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.TSelectSlide && KeyEvent.Mod != Modifier.Shift)
|
||||
KeyEvent.Handled = PrevElement();
|
||||
|
||||
if (!KeyEvent.Handled)
|
||||
else
|
||||
KeyEvent.Handled = _NextInteraction(KeyEvent);
|
||||
}
|
||||
|
||||
@@ -888,8 +887,7 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.TSelectSlide && KeyEvent.Mod != Modifier.Shift)
|
||||
KeyEvent.Handled = NextElement();
|
||||
|
||||
if (!KeyEvent.Handled)
|
||||
else
|
||||
KeyEvent.Handled = _NextInteraction(KeyEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ namespace Vocaluxe.Menu
|
||||
private SThemeNameSelection _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool Selected = false;
|
||||
public bool Visible = true;
|
||||
|
||||
|
||||
+234
-88
@@ -8,6 +8,7 @@ using System.Windows.Forms;
|
||||
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Lib.Draw;
|
||||
using Vocaluxe.Lib.Song;
|
||||
using Vocaluxe.GameModes;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
@@ -69,6 +70,13 @@ namespace Vocaluxe.Menu
|
||||
private SThemePlaylist _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
private CObjectInteractions _Interactions;
|
||||
|
||||
private List<PlaylistElement> PlaylistElements;
|
||||
private List<PlaylistElementContent> PlaylistElementContents;
|
||||
|
||||
@@ -85,6 +93,7 @@ namespace Vocaluxe.Menu
|
||||
set
|
||||
{
|
||||
_Selected = value;
|
||||
_Interactions.Active = value;
|
||||
if (CurrentPlaylistElement == -1 && _Selected && PlaylistElementContents.Count > 0)
|
||||
{
|
||||
CurrentPlaylistElement = 0;
|
||||
@@ -122,13 +131,26 @@ namespace Vocaluxe.Menu
|
||||
PlaylistElements = new List<PlaylistElement>();
|
||||
PlaylistElementContents = new List<PlaylistElementContent>();
|
||||
|
||||
_Interactions = new CObjectInteractions();
|
||||
|
||||
Visible = false;
|
||||
Selected = false;
|
||||
Selected = false;
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
PrepareList();
|
||||
_Interactions.AddText(_Theme.Text1);
|
||||
_Interactions.AddText(_Theme.Text2);
|
||||
_Interactions.AddText(_Theme.Text3);
|
||||
_Interactions.AddText(_Theme.TextPlaylistHeader);
|
||||
_Interactions.AddStatic(_Theme.StaticCover);
|
||||
_Interactions.AddStatic(_Theme.StaticPlaylistFooter);
|
||||
_Interactions.AddStatic(_Theme.StaticPlaylistHeader);
|
||||
_Interactions.AddButton(_Theme.ButtonPlaylistClose);
|
||||
_Interactions.AddButton(_Theme.ButtonPlaylistDelete);
|
||||
_Interactions.AddButton(_Theme.ButtonPlaylistSave);
|
||||
_Interactions.AddButton(_Theme.ButtonPlaylistSing);
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
@@ -290,20 +312,14 @@ namespace Vocaluxe.Menu
|
||||
PlaylistElements[i].Background.Texture = CTheme.GetSkinTexture(_Theme.TextureBackgroundName);
|
||||
PlaylistElements[i].Background.Color = BackgroundColor;
|
||||
}
|
||||
PlaylistElements[i].Background.Draw();
|
||||
PlaylistElements[i].Cover.Draw();
|
||||
PlaylistElements[i].Text1.Draw();
|
||||
PlaylistElements[i].Text2.Draw();
|
||||
PlaylistElements[i].Text3.Draw();
|
||||
PlaylistElements[i].SelectSlide.Draw();
|
||||
}
|
||||
_Theme.ButtonPlaylistSing.Draw();
|
||||
_Theme.ButtonPlaylistSave.Draw();
|
||||
_Theme.ButtonPlaylistDelete.Draw();
|
||||
_Theme.ButtonPlaylistClose.Draw();
|
||||
_Theme.StaticPlaylistHeader.Draw();
|
||||
_Theme.StaticPlaylistFooter.Draw();
|
||||
_Theme.TextPlaylistHeader.Draw();
|
||||
|
||||
_Interactions.Draw();
|
||||
}
|
||||
|
||||
public bool IsMouseOver(MouseEvent MouseEvent)
|
||||
{
|
||||
return CHelper.IsInBounds(Rect, MouseEvent.X, MouseEvent.Y) || _Interactions.IsMouseOver(MouseEvent);
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
@@ -329,34 +345,77 @@ namespace Vocaluxe.Menu
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
public bool HandleInput(KeyEvent kevent)
|
||||
public bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
if (Selected)
|
||||
{
|
||||
switch (kevent.Key)
|
||||
int PrevPlaylistElement = CurrentPlaylistElement;
|
||||
int CurrPlaylistElement = -1;
|
||||
//_Interactions.HandleInput(KeyEvent);
|
||||
|
||||
for (int i = 0; i < PlaylistElements.Count; i++)
|
||||
{
|
||||
//Hover for playlist-element
|
||||
if (PlaylistElementContents.Count - 1 >= i && PlaylistElements[i].SelectSlide.Selected)
|
||||
CurrPlaylistElement = i;
|
||||
}
|
||||
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
case Keys.Up:
|
||||
if (CurrentPlaylistElement == -1 && PlaylistElementContents.Count > 0)
|
||||
{
|
||||
CurrentPlaylistElement = 0;
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
SetSelectionToLastEntry();
|
||||
return true;
|
||||
}
|
||||
else if (CurrentPlaylistElement == 0 || PlaylistElementContents.Count == 0 || KeyEvent.ModSHIFT)
|
||||
{
|
||||
CurrentPlaylistElement = -1;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
_Interactions.SetInteractionToSelectSlide(PlaylistElements[0].SelectSlide);
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
|
||||
int selection = GetSelectedSelectionNr();
|
||||
if (selection != -1 && PlaylistElementContents.Count > selection)
|
||||
{
|
||||
CurrentPlaylistElement = selection;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (CurrentPlaylistElement - 1 > 0)
|
||||
{
|
||||
CurrentPlaylistElement--;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
_Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide);
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
|
||||
int selection = GetSelectedSelectionNr();
|
||||
|
||||
if (selection != -1 && PlaylistElementContents.Count > selection)
|
||||
{
|
||||
CurrentPlaylistElement = selection;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (CurrentPlaylistElement - 1 == 0)
|
||||
{
|
||||
CurrentPlaylistElement--;
|
||||
if (Offset > 0)
|
||||
{
|
||||
Offset--;
|
||||
Update();
|
||||
}
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
|
||||
_Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide);
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
|
||||
int selection = GetSelectedSelectionNr();
|
||||
if (selection != -1 && PlaylistElementContents.Count > selection)
|
||||
{
|
||||
CurrentPlaylistElement = selection;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -364,28 +423,63 @@ namespace Vocaluxe.Menu
|
||||
case Keys.Down:
|
||||
if (CurrentPlaylistElement == -1 && PlaylistElementContents.Count > 0)
|
||||
{
|
||||
CurrentPlaylistElement = 0;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
SetSelectionToFirstEntry();
|
||||
return true;
|
||||
}
|
||||
else if (CurrentPlaylistElement + 1 < PlaylistElements.Count)
|
||||
else if (CurrentPlaylistElement == PlaylistElements.Count -1 || PlaylistElementContents.Count == 0 || KeyEvent.ModSHIFT)
|
||||
{
|
||||
if (PlaylistElements[CurrentPlaylistElement + 1].Content != -1)
|
||||
CurrentPlaylistElement = -1;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
|
||||
int sel = PlaylistElementContents.Count - 1;
|
||||
if (sel > PlaylistElements.Count - 1)
|
||||
sel = PlaylistElements.Count - 1;
|
||||
|
||||
_Interactions.SetInteractionToSelectSlide(PlaylistElements[sel].SelectSlide);
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
|
||||
int selection = GetSelectedSelectionNr();
|
||||
if (selection != -1 && PlaylistElementContents.Count > selection)
|
||||
{
|
||||
CurrentPlaylistElement++;
|
||||
CurrentPlaylistElement = selection;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (CurrentPlaylistElement + 1 >= PlaylistElements.Count && CurrentPlaylistElement + Offset + 1 < PlaylistElementContents.Count)
|
||||
else if (CurrentPlaylistElement + 1 < PlaylistElements.Count - 1)
|
||||
{
|
||||
_Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide);
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
|
||||
int selection = GetSelectedSelectionNr();
|
||||
|
||||
if (selection != -1 && PlaylistElementContents.Count > selection)
|
||||
{
|
||||
CurrentPlaylistElement = selection;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (CurrentPlaylistElement + 1 >= PlaylistElements.Count - 1 && CurrentPlaylistElement + Offset + 1 < PlaylistElementContents.Count)
|
||||
{
|
||||
if (PlaylistElementContents[CurrentPlaylistElement + Offset + 1].SongID != -1)
|
||||
{
|
||||
Offset++;
|
||||
Update();
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
return true;
|
||||
Update();
|
||||
}
|
||||
|
||||
_Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide);
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
|
||||
int selection = GetSelectedSelectionNr();
|
||||
if (selection != -1 && PlaylistElementContents.Count > selection)
|
||||
{
|
||||
CurrentPlaylistElement = selection;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -394,6 +488,8 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].DeleteSong(PlaylistElements[CurrentPlaylistElement].Content);
|
||||
UpdatePlaylist();
|
||||
if (CurrentPlaylistElement != -1)
|
||||
_Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -420,6 +516,7 @@ namespace Vocaluxe.Menu
|
||||
Offset--;
|
||||
}
|
||||
UpdatePlaylist();
|
||||
_Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@@ -438,28 +535,27 @@ namespace Vocaluxe.Menu
|
||||
Offset++;
|
||||
}
|
||||
UpdatePlaylist();
|
||||
_Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
int oldValue = PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection;
|
||||
PlaylistElements[CurrentPlaylistElement].SelectSlide.PrevValue();
|
||||
if (oldValue != PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection)
|
||||
CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case Keys.Right:
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
int oldValue = PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection;
|
||||
PlaylistElements[CurrentPlaylistElement].SelectSlide.NextValue();
|
||||
if (oldValue != PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection)
|
||||
CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -468,72 +564,117 @@ namespace Vocaluxe.Menu
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HandleMouse(MouseEvent mevent)
|
||||
private void SetSelectionToLastEntry()
|
||||
{
|
||||
if (CHelper.IsInBounds(Rect, mevent) && Visible)
|
||||
if (PlaylistElementContents.Count == 0)
|
||||
return;
|
||||
|
||||
int selection = GetSelectedSelectionNr();
|
||||
if (selection == -1)
|
||||
return;
|
||||
|
||||
int off = PlaylistElementContents.Count - PlaylistElements.Count;
|
||||
if (off >= 0)
|
||||
{
|
||||
if (mevent.Wheel > 0)
|
||||
Offset = off;
|
||||
Update();
|
||||
}
|
||||
|
||||
if (PlaylistElementContents.Count > selection)
|
||||
{
|
||||
CurrentPlaylistElement = selection;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSelectionToFirstEntry()
|
||||
{
|
||||
if (PlaylistElementContents.Count == 0)
|
||||
return;
|
||||
|
||||
int selection = GetSelectedSelectionNr();
|
||||
if (selection == -1)
|
||||
return;
|
||||
|
||||
Offset = 0;
|
||||
Update();
|
||||
|
||||
if (PlaylistElementContents.Count > selection)
|
||||
{
|
||||
CurrentPlaylistElement = selection;
|
||||
ActiveHover = CurrentPlaylistElement;
|
||||
}
|
||||
}
|
||||
|
||||
private int GetSelectedSelectionNr()
|
||||
{
|
||||
for (int i = 0; i < PlaylistElements.Count; i++)
|
||||
{
|
||||
if (PlaylistElements[i].SelectSlide.Selected)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public bool HandleMouse(MouseEvent MouseEvent)
|
||||
{
|
||||
_Interactions.HandleMouse(MouseEvent);
|
||||
|
||||
if (CHelper.IsInBounds(Rect, MouseEvent) && Visible)
|
||||
{
|
||||
if (MouseEvent.Wheel > 0)
|
||||
{
|
||||
if (PlaylistElements.Count + Offset + mevent.Wheel <= PlaylistElementContents.Count)
|
||||
if (PlaylistElements.Count + Offset + MouseEvent.Wheel <= PlaylistElementContents.Count)
|
||||
{
|
||||
Offset = Offset + mevent.Wheel;
|
||||
Offset += MouseEvent.Wheel;
|
||||
Update();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (mevent.Wheel < 0)
|
||||
else if (MouseEvent.Wheel < 0)
|
||||
{
|
||||
if (Offset + mevent.Wheel >= 0)
|
||||
if (Offset + MouseEvent.Wheel >= 0)
|
||||
{
|
||||
Offset = Offset + mevent.Wheel;
|
||||
Offset += MouseEvent.Wheel;
|
||||
Update();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (mevent.LB)
|
||||
|
||||
if (MouseEvent.LB)
|
||||
{
|
||||
if (CurrentPlaylistElement != -1)
|
||||
{
|
||||
int oldValue = PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection;
|
||||
PlaylistElements[CurrentPlaylistElement].SelectSlide.ProcessMouseLBClick(mevent.X, mevent.Y);
|
||||
if (oldValue != PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection)
|
||||
CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
|
||||
UpdatePlaylist();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < PlaylistElements.Count; i++)
|
||||
{
|
||||
{
|
||||
//Hover for playlist-element
|
||||
if (PlaylistElementContents.Count - 1 >= i && CHelper.IsInBounds(PlaylistElements[i].Background.Rect, mevent))
|
||||
if (PlaylistElementContents.Count - 1 >= i && CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent))
|
||||
{
|
||||
PlaylistElements[i].Background.Texture = CTheme.GetSkinTexture(_Theme.STextureBackgroundName);
|
||||
PlaylistElements[i].Background.Color = BackgroundSColor;
|
||||
ActiveHover = i;
|
||||
CurrentPlaylistElement = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaylistElements[i].Background.Texture = CTheme.GetSkinTexture(_Theme.TextureBackgroundName);
|
||||
PlaylistElements[i].Background.Color = BackgroundColor;
|
||||
}
|
||||
//Hover for SelectSlide-Arrow
|
||||
PlaylistElements[i].SelectSlide.ProcessMouseMove(mevent.X, mevent.Y);
|
||||
|
||||
//Delete Entry with RB
|
||||
if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, mevent) && mevent.RB && PlaylistElements[i].Content != -1)
|
||||
if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent) && MouseEvent.RB && PlaylistElements[i].Content != -1)
|
||||
{
|
||||
CPlaylists.Playlists[ActivePlaylistID].DeleteSong(PlaylistElements[i].Content);
|
||||
UpdatePlaylist();
|
||||
return true;
|
||||
}
|
||||
//Change order with holding LB
|
||||
else if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, mevent) && mevent.LBH && PlaylistElements[i].Content != -1 && !changeOrder)
|
||||
else if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent) && MouseEvent.LBH && PlaylistElements[i].Content != -1 && !changeOrder)
|
||||
{
|
||||
changeOrder = true;
|
||||
CurrentPlaylistElement = i;
|
||||
}
|
||||
else if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, mevent) && mevent.LBH && PlaylistElements[i].Content != -1 && changeOrder)
|
||||
else if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent) && MouseEvent.LBH && PlaylistElements[i].Content != -1 && changeOrder)
|
||||
{
|
||||
/*
|
||||
if (PlaylistElements.Count < CurrentPlaylistElement + 1)
|
||||
@@ -560,25 +701,21 @@ namespace Vocaluxe.Menu
|
||||
|
||||
if (ActivePlaylistID > -1)
|
||||
{
|
||||
_Theme.ButtonPlaylistClose.ProcessMouseMove(mevent.X, mevent.Y);
|
||||
_Theme.ButtonPlaylistSing.ProcessMouseMove(mevent.X, mevent.Y);
|
||||
_Theme.ButtonPlaylistSave.ProcessMouseMove(mevent.X, mevent.Y);
|
||||
_Theme.ButtonPlaylistDelete.ProcessMouseMove(mevent.X, mevent.Y);
|
||||
if (mevent.LB)
|
||||
if (MouseEvent.LB)
|
||||
{
|
||||
if (CHelper.IsInBounds(_Theme.ButtonPlaylistClose.Rect, mevent))
|
||||
if (_Theme.ButtonPlaylistClose.Selected)
|
||||
{
|
||||
ClosePlaylist();
|
||||
}
|
||||
else if (CHelper.IsInBounds(_Theme.ButtonPlaylistSing.Rect, mevent))
|
||||
else if (_Theme.ButtonPlaylistSing.Selected)
|
||||
{
|
||||
StartPlaylistSongs();
|
||||
}
|
||||
else if (CHelper.IsInBounds(_Theme.ButtonPlaylistSave.Rect, mevent))
|
||||
else if (_Theme.ButtonPlaylistSave.Selected)
|
||||
{
|
||||
CPlaylists.SavePlaylist(ActivePlaylistID);
|
||||
}
|
||||
else if (CHelper.IsInBounds(_Theme.ButtonPlaylistDelete.Rect, mevent))
|
||||
else if (_Theme.ButtonPlaylistDelete.Selected)
|
||||
{
|
||||
CPlaylists.DeletePlaylist(ActivePlaylistID);
|
||||
ClosePlaylist();
|
||||
@@ -599,12 +736,20 @@ namespace Vocaluxe.Menu
|
||||
en.Text1 = new CText(Rect.X + _Theme.Text1.X, Rect.Y + _Theme.Text1.Y + (i * _Theme.EntryHeight), _Theme.Text1.Z, _Theme.Text1.Height, _Theme.Text1.MaxWidth, _Theme.Text1.Align, _Theme.Text1.Style, _Theme.Text1.Fon, _Theme.Text1.Color, "", _Theme.Text1.ReflectionSpace, _Theme.Text1.ReflectionHeight);
|
||||
en.Text2 = new CText(Rect.X + _Theme.Text2.X, Rect.Y + _Theme.Text2.Y + (i * _Theme.EntryHeight), _Theme.Text2.Z, _Theme.Text2.Height, _Theme.Text2.MaxWidth, _Theme.Text2.Align, _Theme.Text2.Style, _Theme.Text2.Fon, _Theme.Text2.Color, "", _Theme.Text2.ReflectionSpace, _Theme.Text2.ReflectionHeight);
|
||||
en.Text3 = new CText(Rect.X + _Theme.Text3.X, Rect.Y + _Theme.Text3.Y + (i * _Theme.EntryHeight), _Theme.Text3.Z, _Theme.Text3.Height, _Theme.Text3.MaxWidth, _Theme.Text3.Align, _Theme.Text3.Style, _Theme.Text3.Fon, _Theme.Text3.Color, "", _Theme.Text3.ReflectionSpace, _Theme.Text3.ReflectionHeight);
|
||||
en.SelectSlide = (CSelectSlide)_Theme.SelectSlideGameMode.Clone();
|
||||
|
||||
|
||||
en.SelectSlide = new CSelectSlide(_Theme.SelectSlideGameMode);
|
||||
en.SelectSlide.Rect = new SRectF(Rect.X + _Theme.SelectSlideGameMode.Rect.X, Rect.Y + _Theme.SelectSlideGameMode.Rect.Y + (i * _Theme.EntryHeight), _Theme.SelectSlideGameMode.Rect.W, _Theme.SelectSlideGameMode.Rect.H, _Theme.SelectSlideGameMode.Rect.Z);
|
||||
en.SelectSlide.RectArrowLeft = new SRectF(Rect.X + _Theme.SelectSlideGameMode.RectArrowLeft.X, Rect.Y + _Theme.SelectSlideGameMode.RectArrowLeft.Y + (i * _Theme.EntryHeight), _Theme.SelectSlideGameMode.RectArrowLeft.W, _Theme.SelectSlideGameMode.RectArrowLeft.H, _Theme.SelectSlideGameMode.RectArrowLeft.Z);
|
||||
en.SelectSlide.RectArrowRight = new SRectF(Rect.X + _Theme.SelectSlideGameMode.RectArrowRight.X, Rect.Y + _Theme.SelectSlideGameMode.RectArrowRight.Y + (i * _Theme.EntryHeight), _Theme.SelectSlideGameMode.RectArrowRight.W, _Theme.SelectSlideGameMode.RectArrowRight.H, _Theme.SelectSlideGameMode.RectArrowRight.Z);
|
||||
en.Content = -1;
|
||||
PlaylistElements.Add(en);
|
||||
_Interactions.AddSelectSlide(en.SelectSlide);
|
||||
_Interactions.AddText(en.Text1);
|
||||
_Interactions.AddText(en.Text2);
|
||||
_Interactions.AddText(en.Text3);
|
||||
_Interactions.AddStatic(en.Background);
|
||||
_Interactions.AddStatic(en.Cover);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -637,7 +782,7 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
PlaylistElementContent pec = new PlaylistElementContent();
|
||||
pec.SongID = CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID;
|
||||
pec.Modes = CSongs.AllSongs[CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID].AvailableGameModes;
|
||||
pec.Modes = CSongs.AllSongs[pec.SongID].AvailableGameModes;
|
||||
pec.Mode = CPlaylists.Playlists[ActivePlaylistID].Songs[i].GameMode;
|
||||
PlaylistElementContents.Add(pec);
|
||||
}
|
||||
@@ -679,30 +824,31 @@ namespace Vocaluxe.Menu
|
||||
int e = 0 + Offset;
|
||||
for (int i = 0; i < PlaylistElements.Count; i++ )
|
||||
{
|
||||
if (e < PlaylistElementContents.Count)
|
||||
if (e + i < PlaylistElementContents.Count)
|
||||
{
|
||||
PlaylistElements[i].Content = e;
|
||||
PlaylistElements[i].Content = e+i;
|
||||
PlaylistElements[i].Background.Visible = true;
|
||||
PlaylistElements[i].Cover.Visible = true;
|
||||
PlaylistElements[i].SelectSlide.Visible = true;
|
||||
PlaylistElements[i].Text1.Visible = true;
|
||||
PlaylistElements[i].Text2.Visible = true;
|
||||
PlaylistElements[i].Text3.Visible = true;
|
||||
PlaylistElements[i].Cover.Texture = CSongs.GetSong(PlaylistElementContents[e].SongID).CoverTextureSmall;
|
||||
string t1 = _Theme.Text1.Text.Replace("%a", CSongs.GetSong(PlaylistElementContents[e].SongID).Artist).Replace("%t", CSongs.GetSong(PlaylistElementContents[e].SongID).Title);
|
||||
string t2 = _Theme.Text2.Text.Replace("%a", CSongs.GetSong(PlaylistElementContents[e].SongID).Artist).Replace("%t", CSongs.GetSong(PlaylistElementContents[e].SongID).Title);
|
||||
string t3 = _Theme.Text3.Text.Replace("%a", CSongs.GetSong(PlaylistElementContents[e].SongID).Artist).Replace("%t", CSongs.GetSong(PlaylistElementContents[e].SongID).Title);
|
||||
PlaylistElementContent pec = PlaylistElementContents[e + i];
|
||||
CSong song = CSongs.GetSong(pec.SongID);
|
||||
PlaylistElements[i].Cover.Texture = song.CoverTextureSmall;
|
||||
string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title);
|
||||
string t2 = _Theme.Text2.Text.Replace("%a", song.Artist).Replace("%t", song.Title);
|
||||
string t3 = _Theme.Text3.Text.Replace("%a", song.Artist).Replace("%t", song.Title);
|
||||
PlaylistElements[i].Text1.Text = t1;
|
||||
PlaylistElements[i].Text2.Text = t2;
|
||||
PlaylistElements[i].Text3.Text = t3;
|
||||
PlaylistElements[i].SelectSlide.Clear();
|
||||
for (int g = 0; g < PlaylistElementContents[e].Modes.Length; g++)
|
||||
for (int g = 0; g < pec.Modes.Length; g++)
|
||||
{
|
||||
PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(GameModes.EGameMode), PlaylistElementContents[e].Modes[g]));
|
||||
if (PlaylistElementContents[e].Modes[g] == PlaylistElementContents[e].Mode)
|
||||
PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(GameModes.EGameMode), pec.Modes[g]));
|
||||
if (pec.Modes[g] == pec.Mode)
|
||||
PlaylistElements[i].SelectSlide.SetSelectionByValueIndex(g);
|
||||
}
|
||||
e++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -43,6 +43,11 @@ namespace Vocaluxe.Menu
|
||||
private SThemeSelectSlide _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public SRectF Rect;
|
||||
public SRectF RectArrowLeft;
|
||||
public SRectF RectArrowRight;
|
||||
@@ -159,6 +164,56 @@ namespace Vocaluxe.Menu
|
||||
_ValueNames = new List<string>();
|
||||
}
|
||||
|
||||
public CSelectSlide(CSelectSlide slide)
|
||||
{
|
||||
_Theme = new SThemeSelectSlide();
|
||||
|
||||
_Theme.TextureArrowLeftName = slide._Theme.TextureArrowLeftName;
|
||||
_Theme.TextureArrowRightName = slide._Theme.TextureArrowRightName;
|
||||
|
||||
_Theme.STextureName = slide._Theme.STextureName;
|
||||
_Theme.STextureArrowLeftName = slide._Theme.STextureArrowLeftName;
|
||||
_Theme.STextureArrowRightName = slide._Theme.STextureArrowRightName;
|
||||
|
||||
_Theme.HTextureName = slide._Theme.HTextureName;
|
||||
|
||||
_Theme.ColorName = slide._Theme.ColorName;
|
||||
_Theme.SColorName = slide._Theme.SColorName;
|
||||
_Theme.HColorName = slide._Theme.HColorName;
|
||||
|
||||
_Theme.ArrowColorName = slide._Theme.ArrowColorName;
|
||||
_Theme.SArrowColorName = slide._Theme.SArrowColorName;
|
||||
|
||||
_Theme.TextColorName = slide._Theme.TextColorName;
|
||||
_Theme.STextColorName = slide._Theme.STextColorName;
|
||||
|
||||
_Theme.TextFont = slide._Theme.TextFont;
|
||||
_Theme.TextStyle = slide._Theme.TextStyle;
|
||||
|
||||
_ThemeLoaded = false;
|
||||
|
||||
Rect = new SRectF(slide.Rect);
|
||||
RectArrowLeft = new SRectF(slide.RectArrowLeft);
|
||||
RectArrowRight = new SRectF(slide.RectArrowRight);
|
||||
|
||||
Color = new SColorF(slide.Color);
|
||||
SColor = new SColorF(slide.SColor);
|
||||
|
||||
ColorArrow = new SColorF(slide.ColorArrow);
|
||||
SColorArrow = new SColorF(slide.SColorArrow);
|
||||
|
||||
TextColor = new SColorF(slide.TextColor);
|
||||
STextColor = new SColorF(slide.STextColor);
|
||||
TextH = slide.TextH;
|
||||
MaxW = slide.MaxW;
|
||||
|
||||
_Selected = false;
|
||||
_Textures = new List<STexture>();
|
||||
_ValueIndexes = new List<int>();
|
||||
_ValueNames = new List<string>();
|
||||
_NumVisible = slide._NumVisible;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
|
||||
@@ -22,6 +22,11 @@ namespace Vocaluxe.Menu
|
||||
private SThemeStatic _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
private STexture _Texture;
|
||||
public STexture Texture
|
||||
{
|
||||
|
||||
@@ -41,6 +41,12 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
private SThemeText _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
private bool _ButtonText;
|
||||
private bool _PositionNeedsUpdate = true;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Vocaluxe.Menu
|
||||
{
|
||||
interface IMenuElement
|
||||
{
|
||||
string GetThemeName();
|
||||
bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex);
|
||||
bool SaveTheme(XmlWriter writer);
|
||||
|
||||
|
||||
@@ -75,6 +75,11 @@ namespace Vocaluxe.Menu.SingNotes
|
||||
_ActID = 0;
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
|
||||
@@ -141,6 +141,11 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
#endregion ISongMenu
|
||||
|
||||
#region IMenuElement
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _SongMenu.GetThemeName();
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
return _SongMenu.LoadTheme(XmlPath, ElementName, navigator, SkinIndex);
|
||||
|
||||
@@ -249,6 +249,11 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
_ThemeLoaded = false;
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
|
||||
@@ -692,6 +692,7 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
}
|
||||
}
|
||||
|
||||
_Rect = _Theme.songMenuTileBoard.TileRectSmall;
|
||||
_ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRectSmall.Z);
|
||||
}
|
||||
else
|
||||
@@ -717,6 +718,7 @@ namespace Vocaluxe.Menu.SongMenu
|
||||
}
|
||||
}
|
||||
|
||||
_Rect = _Theme.songMenuTileBoard.TileRect;
|
||||
_ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRect.Z);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
base.HandleMouse(MouseEvent);
|
||||
|
||||
if (CHelper.IsInBounds(Playlists[htPlaylists(Playlist)].Rect, MouseEvent.X, MouseEvent.Y))
|
||||
if (Playlists[htPlaylists(Playlist)].IsMouseOver(MouseEvent))
|
||||
{
|
||||
_PlaylistActive = true;
|
||||
Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive;
|
||||
@@ -377,8 +377,10 @@ namespace Vocaluxe.Screens
|
||||
public override bool UpdateGame()
|
||||
{
|
||||
SongMenus[htSongMenus(SongMenu)].Update();
|
||||
|
||||
if (SongMenus[htSongMenus(SongMenu)].IsSmallView())
|
||||
CheckPlaylist();
|
||||
|
||||
Texts[htTexts(TextCategory)].Text = CSongs.GetActualCategoryName();
|
||||
|
||||
if (CSongs.Category > -1 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF)
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
<Compile Include="Lib\Draw\COpenGL.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Lib\Playlist\CPlaylist.cs" />
|
||||
<Compile Include="Lib\Playlist\CPlaylistFile.cs" />
|
||||
<Compile Include="Lib\Song\CNotes.cs" />
|
||||
<Compile Include="Lib\Song\CSong.cs" />
|
||||
<Compile Include="Lib\Sound\CDirectSoundRecord.cs" />
|
||||
@@ -215,6 +215,7 @@
|
||||
<Compile Include="Menu\CLyric.cs" />
|
||||
<Compile Include="Menu\CMenu.cs" />
|
||||
<Compile Include="Menu\CInteraction.cs" />
|
||||
<Compile Include="Menu\CObjectInteractions.cs" />
|
||||
<Compile Include="Menu\CPlaylist.cs" />
|
||||
<Compile Include="Menu\CSelectSlide.cs" />
|
||||
<Compile Include="Menu\CStatic.cs" />
|
||||
|
||||
Reference in new issue
Block a user