moved menu and party mode files to the new lib
This commit is contained in:
1 parent
69420d6977
commit
d6c97568c9
35 files changed
+74
-70
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,232 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
using Vocaluxe.Menu;
|
||||
using Vocaluxe.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
public class CSongMenu : ISongMenu
|
||||
{
|
||||
private Basic _Base;
|
||||
|
||||
private ISongMenu _SongMenu;
|
||||
private ESongMenu _Type;
|
||||
|
||||
public CSongMenu(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
CreateSongMenu();
|
||||
}
|
||||
|
||||
public void UpdateSongMenuType()
|
||||
{
|
||||
if (_Type != _Base.Config.GetSongMenuType())
|
||||
CreateSongMenu();
|
||||
}
|
||||
|
||||
public bool Selected
|
||||
{
|
||||
get { return _SongMenu.IsSelected(); }
|
||||
set { _SongMenu.SetSelected(value); }
|
||||
}
|
||||
|
||||
public bool Visible
|
||||
{
|
||||
get { return _SongMenu.IsVisible(); }
|
||||
set { _SongMenu.SetVisible(value); }
|
||||
}
|
||||
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return _SongMenu.GetRect(); }
|
||||
}
|
||||
|
||||
#region ISongMenu
|
||||
public void Update()
|
||||
{
|
||||
_SongMenu.Update();
|
||||
}
|
||||
|
||||
public void OnShow()
|
||||
{
|
||||
_SongMenu.OnShow();
|
||||
}
|
||||
|
||||
public void OnHide()
|
||||
{
|
||||
_SongMenu.OnHide();
|
||||
}
|
||||
|
||||
public void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
_SongMenu.HandleInput(ref KeyEvent, SongOptions);
|
||||
}
|
||||
|
||||
public void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
_SongMenu.HandleMouse(ref MouseEvent, SongOptions);
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
_SongMenu.Draw();
|
||||
}
|
||||
|
||||
public void ApplyVolume(float VolumeMax)
|
||||
{
|
||||
_SongMenu.ApplyVolume(VolumeMax);
|
||||
}
|
||||
|
||||
public bool IsActive()
|
||||
{
|
||||
return _SongMenu.IsActive();
|
||||
}
|
||||
|
||||
public void SetActive(bool Active)
|
||||
{
|
||||
_SongMenu.SetActive(Active);
|
||||
}
|
||||
|
||||
public int GetSelectedSong()
|
||||
{
|
||||
return _SongMenu.GetSelectedSong();
|
||||
}
|
||||
|
||||
public CStatic GetSelectedSongCover()
|
||||
{
|
||||
return _SongMenu.GetSelectedSongCover();
|
||||
}
|
||||
|
||||
public void SetSelectedSong(int VisibleSongNr)
|
||||
{
|
||||
_SongMenu.SetSelectedSong(VisibleSongNr);
|
||||
}
|
||||
|
||||
public int GetSelectedCategory()
|
||||
{
|
||||
return _SongMenu.GetSelectedCategory();
|
||||
}
|
||||
|
||||
public void SetSelectedCategory(int CategoryNr)
|
||||
{
|
||||
_SongMenu.SetSelectedCategory(CategoryNr);
|
||||
}
|
||||
|
||||
public int GetActualSelection()
|
||||
{
|
||||
return _SongMenu.GetActualSelection();
|
||||
}
|
||||
|
||||
public bool IsSelected()
|
||||
{
|
||||
return _SongMenu.IsSelected();
|
||||
}
|
||||
|
||||
public void SetSelected(bool Selected)
|
||||
{
|
||||
_SongMenu.SetSelected(Selected);
|
||||
}
|
||||
|
||||
public bool IsVisible()
|
||||
{
|
||||
return _SongMenu.IsVisible();
|
||||
}
|
||||
|
||||
public void SetVisible(bool Visible)
|
||||
{
|
||||
_SongMenu.SetVisible(Visible);
|
||||
}
|
||||
|
||||
public SRectF GetRect()
|
||||
{
|
||||
return _SongMenu.GetRect();
|
||||
}
|
||||
|
||||
public bool IsSmallView()
|
||||
{
|
||||
return _SongMenu.IsSmallView();
|
||||
}
|
||||
|
||||
public void SetSmallView(bool SmallView)
|
||||
{
|
||||
_SongMenu.SetSmallView(SmallView);
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
public bool SaveTheme(XmlWriter writer)
|
||||
{
|
||||
return _SongMenu.SaveTheme(writer);
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
_SongMenu.UnloadTextures();
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
_SongMenu.LoadTextures();
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
_SongMenu.ReloadTextures();
|
||||
}
|
||||
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
_SongMenu.MoveElement(stepX, stepY);
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
_SongMenu.ResizeElement(stepW, stepH);
|
||||
}
|
||||
#endregion IMenuElement
|
||||
|
||||
private void CreateSongMenu()
|
||||
{
|
||||
if (_SongMenu != null)
|
||||
{
|
||||
_SongMenu.OnHide();
|
||||
}
|
||||
|
||||
switch (_Base.Config.GetSongMenuType())
|
||||
{
|
||||
//case ESongMenu.TR_CONFIG_LIST:
|
||||
// _SongMenu = new CSongMenuList();
|
||||
// break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_DREIDEL:
|
||||
// _SongMenu = new CSongMenuDreidel();
|
||||
// break;
|
||||
|
||||
case ESongMenu.TR_CONFIG_TILE_BOARD:
|
||||
_SongMenu = new CSongMenuTileBoard(_Base);
|
||||
break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_BOOK:
|
||||
// _SongMenu = new CSongMenuBook();
|
||||
// break;
|
||||
}
|
||||
|
||||
_Type = _Base.Config.GetSongMenuType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuBook : CSongMenuFramework
|
||||
{
|
||||
new private Basic _Base;
|
||||
|
||||
public CSongMenuBook(Basic Base)
|
||||
: base(Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuDreidel : CSongMenuFramework
|
||||
{
|
||||
new private Basic _Base;
|
||||
/*
|
||||
private SRectF _ScrollRect;
|
||||
private CStatic _CoverBig;
|
||||
private CStatic _TextBG;
|
||||
|
||||
private CStatic _DuetIcon;
|
||||
private CStatic _VideoIcon;
|
||||
|
||||
private CText _Artist;
|
||||
private CText _Title;
|
||||
private CText _SongLength;
|
||||
|
||||
private int _actualSelection = -1;
|
||||
|
||||
public override int GetActualSelection()
|
||||
{
|
||||
return _actualSelection;
|
||||
}
|
||||
*/
|
||||
|
||||
public CSongMenuDreidel(Basic Base)
|
||||
: base(Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
/**
|
||||
_CoverBig = _Theme.songMenuDreidel.StaticCoverBig;
|
||||
_TextBG = _Theme.songMenuDreidel.StaticTextBG;
|
||||
_DuetIcon = _Theme.songMenuDreidel.StaticDuetIcon;
|
||||
_VideoIcon = _Theme.songMenuDreidel.StaticVideoIcon;
|
||||
|
||||
_Artist = _Theme.songMenuDreidel.TextArtist;
|
||||
_Title = _Theme.songMenuDreidel.TextTitle;
|
||||
_SongLength = _Theme.songMenuDreidel.TextSongLength;
|
||||
**/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,710 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
using Vocaluxe.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
struct SThemeSongMenu
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string CoverBackgroundName;
|
||||
public string CoverBigBackgroundName;
|
||||
public string DuetIconName;
|
||||
public string VideoIconName;
|
||||
|
||||
public string MedleyCalcIcon;
|
||||
public string MedleyTagIcon;
|
||||
|
||||
public string ColorName;
|
||||
|
||||
//public SThemeSongMenuBook songMenuBook;
|
||||
//public SThemeSongMenuDreidel songMenuDreidel;
|
||||
//public SThemeSongMenuList songMenuList;
|
||||
public SThemeSongMenuTileBoard songMenuTileBoard;
|
||||
}
|
||||
|
||||
struct SThemeSongMenuBook
|
||||
{
|
||||
}
|
||||
|
||||
struct SThemeSongMenuDreidel
|
||||
{
|
||||
}
|
||||
|
||||
struct SThemeSongMenuList
|
||||
{
|
||||
}
|
||||
|
||||
struct SThemeSongMenuTileBoard
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of tiles horizontal
|
||||
/// </summary>
|
||||
public int numW;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles vertical
|
||||
/// </summary>
|
||||
public int numH;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles horizontal in small-modus
|
||||
/// </summary>
|
||||
public int numWsmall;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles vertical in small-modus
|
||||
/// </summary>
|
||||
public int numHsmall;
|
||||
|
||||
/// <summary>
|
||||
/// Space between tiles horizontal
|
||||
/// </summary>
|
||||
public float spaceW;
|
||||
|
||||
/// <summary>
|
||||
/// Space between tiles vertical
|
||||
/// </summary>
|
||||
public float spaceH;
|
||||
|
||||
public SRectF TileRect;
|
||||
public SRectF TileRectSmall;
|
||||
|
||||
public CText TextArtist;
|
||||
public CText TextTitle;
|
||||
public CText TextSongLength;
|
||||
|
||||
public CStatic StaticCoverBig;
|
||||
public CStatic StaticTextBG;
|
||||
public CStatic StaticDuetIcon;
|
||||
public CStatic StaticVideoIcon;
|
||||
public CStatic StaticMedleyCalcIcon;
|
||||
public CStatic StaticMedleyTagIcon;
|
||||
}
|
||||
|
||||
abstract class CSongMenuFramework : ISongMenu
|
||||
{
|
||||
protected Basic _Base;
|
||||
protected SThemeSongMenu _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
private Stopwatch _timer = new Stopwatch();
|
||||
private Stopwatch _VideoFadeTimer = new Stopwatch();
|
||||
private List<int> _streams = new List<int>();
|
||||
private int _video = -1;
|
||||
private int _actsong = -1;
|
||||
private int _actsongstream = -1;
|
||||
protected STexture _vidtex = new STexture(-1);
|
||||
|
||||
protected bool _Initialized = false;
|
||||
protected int _LastKnownNumSongs = 0;
|
||||
protected int _LastKnownCategory = -1;
|
||||
|
||||
protected SRectF _Rect = new SRectF();
|
||||
protected SColorF _Color = new SColorF();
|
||||
|
||||
private int _SelectedInternal = -1;
|
||||
private int _SelectedPending = -1;
|
||||
protected long _PendingTime = 500L;
|
||||
|
||||
private int _LockedInternal = -1;
|
||||
protected bool _Active = false;
|
||||
|
||||
protected float _MaxVolume = 100f;
|
||||
|
||||
protected int _PreviewSelected //for preview only
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((_SelectedInternal != _SelectedPending) && (_timer.ElapsedMilliseconds >= _PendingTime))
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
return _SelectedInternal;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == -1)
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
|
||||
_SelectedInternal = -1;
|
||||
_SelectedPending = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((value != _SelectedInternal) && (value != _SelectedPending))
|
||||
{
|
||||
_timer.Reset();
|
||||
_timer.Start();
|
||||
|
||||
_SelectedPending = value;
|
||||
}
|
||||
|
||||
if ((value == _SelectedPending) && ((_timer.ElapsedMilliseconds >= _PendingTime) || (_SelectedInternal == -1)))
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected virtual void SetSelectedNow()
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
|
||||
protected int _Locked //the real selected song for singing
|
||||
{
|
||||
get { return _LockedInternal; }
|
||||
set { _LockedInternal = value; }
|
||||
}
|
||||
|
||||
protected int _SongStream
|
||||
{
|
||||
get { return _actsongstream; }
|
||||
}
|
||||
|
||||
protected int _Video
|
||||
{
|
||||
get { return _video; }
|
||||
}
|
||||
|
||||
protected int _ActSong
|
||||
{
|
||||
get { return _actsong; }
|
||||
}
|
||||
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return _Rect; }
|
||||
}
|
||||
|
||||
public SRectF GetRect()
|
||||
{
|
||||
return _Rect;
|
||||
}
|
||||
|
||||
public SColorF Color
|
||||
{
|
||||
get { return _Color; }
|
||||
}
|
||||
|
||||
public virtual int GetActualSelection()
|
||||
{
|
||||
return _actsong;
|
||||
}
|
||||
|
||||
private bool _Selected = false;
|
||||
private bool _Visible = true;
|
||||
|
||||
public bool IsSelected()
|
||||
{
|
||||
return _Selected;
|
||||
}
|
||||
|
||||
public void SetSelected(bool Selected)
|
||||
{
|
||||
_Selected = Selected;
|
||||
SetActive(Selected);
|
||||
}
|
||||
|
||||
public bool IsVisible()
|
||||
{
|
||||
return _Visible;
|
||||
}
|
||||
|
||||
public void SetVisible(bool Visible)
|
||||
{
|
||||
_Visible = Visible;
|
||||
}
|
||||
|
||||
public CSongMenuFramework(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeSongMenu();
|
||||
|
||||
_Theme.songMenuTileBoard.TextArtist = new CText(_Base);
|
||||
_Theme.songMenuTileBoard.TextTitle = new CText(_Base);
|
||||
_Theme.songMenuTileBoard.TextSongLength = new CText(_Base);
|
||||
|
||||
_Theme.songMenuTileBoard.StaticCoverBig = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticTextBG = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticDuetIcon = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticVideoIcon = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticMedleyCalcIcon = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticMedleyTagIcon = new CStatic(_Base);
|
||||
|
||||
_ThemeLoaded = false;
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/CoverBackground", navigator, ref _Theme.CoverBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/CoverBigBackground", navigator, ref _Theme.CoverBigBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/DuetIcon", navigator, ref _Theme.DuetIconName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/VideoIcon", navigator, ref _Theme.VideoIconName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/MedleyCalcIcon", navigator, ref _Theme.MedleyCalcIcon, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/MedleyTagIcon", navigator, ref _Theme.MedleyTagIcon, String.Empty);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref _Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref _Color.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref _Color.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref _Color.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref _Color.A);
|
||||
}
|
||||
|
||||
#region SongMenuTileBoard
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumW", navigator, ref _Theme.songMenuTileBoard.numW);
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumH", navigator, ref _Theme.songMenuTileBoard.numH);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/SpaceW", navigator, ref _Theme.songMenuTileBoard.spaceW);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/SpaceH", navigator, ref _Theme.songMenuTileBoard.spaceH);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumWsmall", navigator, ref _Theme.songMenuTileBoard.numWsmall);
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumHsmall", navigator, ref _Theme.songMenuTileBoard.numHsmall);
|
||||
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.TextArtist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.TextTitle.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.TextSongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", navigator, SkinIndex);
|
||||
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticCoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticTextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticDuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticVideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticMedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticMedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", navigator, SkinIndex);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectX", navigator, ref _Theme.songMenuTileBoard.TileRect.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectY", navigator, ref _Theme.songMenuTileBoard.TileRect.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectZ", navigator, ref _Theme.songMenuTileBoard.TileRect.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectW", navigator, ref _Theme.songMenuTileBoard.TileRect.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectH", navigator, ref _Theme.songMenuTileBoard.TileRect.H);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallX", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallY", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallZ", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallW", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallH", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.H);
|
||||
|
||||
#endregion SongMenuTileBoard
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
LoadTextures();
|
||||
Init();
|
||||
}
|
||||
|
||||
return _ThemeLoaded;
|
||||
}
|
||||
|
||||
public bool SaveTheme(XmlWriter writer)
|
||||
{
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
writer.WriteStartElement(_Theme.Name);
|
||||
|
||||
writer.WriteComment("<CoverBackground>: Texture name of cover background/tiles");
|
||||
writer.WriteElementString("CoverBackground", _Theme.CoverBackgroundName);
|
||||
|
||||
writer.WriteComment("<CoverBigBackground>: Texture name of big cover background and info texts");
|
||||
writer.WriteElementString("CoverBigBackground", _Theme.CoverBigBackgroundName);
|
||||
|
||||
writer.WriteComment("<DuetIcon>: Texture name of duet icon");
|
||||
writer.WriteElementString("DuetIcon", _Theme.DuetIconName);
|
||||
|
||||
writer.WriteComment("<VideoIcon>: Texture name of video icon");
|
||||
writer.WriteElementString("VideoIcon", _Theme.VideoIconName);
|
||||
|
||||
writer.WriteComment("<MedleyCalcIcon>: Texture name of medley calc (calculated) icon");
|
||||
writer.WriteElementString("MedleyCalcIcon", _Theme.MedleyCalcIcon);
|
||||
|
||||
writer.WriteComment("<MedleyTagIcon>: Texture name of medley tag (manuelly set) icon");
|
||||
writer.WriteElementString("MedleyTagIcon", _Theme.MedleyTagIcon);
|
||||
|
||||
writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", _Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", _Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", _Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", _Color.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
#region SongMenuTileBoard
|
||||
writer.WriteComment("<SongMenuTileBoard>: Config for TileBoard view");
|
||||
writer.WriteStartElement("SongMenuTileBoard");
|
||||
|
||||
writer.WriteComment("<NumW>: Number of tiles horizontal");
|
||||
writer.WriteElementString("NumW", _Theme.songMenuTileBoard.numW.ToString());
|
||||
|
||||
writer.WriteComment("<NumH>: Number of tiles vertical");
|
||||
writer.WriteElementString("NumH", _Theme.songMenuTileBoard.numH.ToString());
|
||||
|
||||
writer.WriteComment("<SpaceW>: Space between tiles horizontal");
|
||||
writer.WriteElementString("SpaceW", _Theme.songMenuTileBoard.spaceW.ToString("#0.00"));
|
||||
|
||||
writer.WriteComment("<SpaceH>: Space between tiles vertical");
|
||||
writer.WriteElementString("SpaceH", _Theme.songMenuTileBoard.spaceH.ToString("#0.00"));
|
||||
|
||||
writer.WriteComment("<NumWsmall>: Number of tiles horizontal in small-mode");
|
||||
writer.WriteElementString("NumWsmall", _Theme.songMenuTileBoard.numWsmall.ToString());
|
||||
|
||||
writer.WriteComment("<NumHsmall>: Number of tiles vertical in small-mode");
|
||||
writer.WriteElementString("NumHsmall", _Theme.songMenuTileBoard.numHsmall.ToString());
|
||||
|
||||
writer.WriteComment("<TileRectX>, <TileRectY>, <TileRectZ>, <TileRectW>, <TileRectH>: SongMenu position, width and height");
|
||||
writer.WriteElementString("TileRectX", _Theme.songMenuTileBoard.TileRect.X.ToString("#0"));
|
||||
writer.WriteElementString("TileRectY", _Theme.songMenuTileBoard.TileRect.Y.ToString("#0"));
|
||||
writer.WriteElementString("TileRectZ", _Theme.songMenuTileBoard.TileRect.Z.ToString("#0.00"));
|
||||
writer.WriteElementString("TileRectW", _Theme.songMenuTileBoard.TileRect.W.ToString("#0"));
|
||||
writer.WriteElementString("TileRectH", _Theme.songMenuTileBoard.TileRect.H.ToString("#0"));
|
||||
|
||||
writer.WriteComment("<TileRectSmallX>, <TileRectSmallY>, <TileRectSmallZ>, <TileRectSmallW>, <TileRectSmallH>: SongMenu position, width and height in small-mode");
|
||||
writer.WriteElementString("TileRectSmallX", _Theme.songMenuTileBoard.TileRectSmall.X.ToString("#0"));
|
||||
writer.WriteElementString("TileRectSmallY", _Theme.songMenuTileBoard.TileRectSmall.Y.ToString("#0"));
|
||||
writer.WriteElementString("TileRectSmallZ", _Theme.songMenuTileBoard.TileRectSmall.Z.ToString("#0.00"));
|
||||
writer.WriteElementString("TileRectSmallW", _Theme.songMenuTileBoard.TileRectSmall.W.ToString("#0"));
|
||||
writer.WriteElementString("TileRectSmallH", _Theme.songMenuTileBoard.TileRectSmall.H.ToString("#0"));
|
||||
|
||||
_Theme.songMenuTileBoard.TextArtist.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.TextTitle.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.TextSongLength.SaveTheme(writer);
|
||||
|
||||
_Theme.songMenuTileBoard.StaticCoverBig.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticTextBG.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticDuetIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticVideoIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer);
|
||||
|
||||
writer.WriteEndElement();
|
||||
#endregion SongMenuTileBoard
|
||||
|
||||
writer.WriteEndElement();
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
{
|
||||
Reset();
|
||||
_Initialized = true;
|
||||
}
|
||||
|
||||
public virtual void UpdateRect(SRectF rect)
|
||||
{
|
||||
_Rect = rect;
|
||||
Init();
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
if (_actsong != _PreviewSelected)
|
||||
SelectSong(_PreviewSelected);
|
||||
|
||||
if (_streams.Count > 0 && _video != -1)
|
||||
{
|
||||
if (_Base.Video.IsFinished(_video) || _Base.Sound.IsFinished(_actsongstream))
|
||||
{
|
||||
_Base.Video.Close(_video);
|
||||
_video = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
float time = _Base.Sound.GetPosition(_actsongstream);
|
||||
|
||||
float vtime = 0f;
|
||||
_Base.Video.GetFrame(_video, ref _vidtex, time, ref vtime);
|
||||
if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L)
|
||||
{
|
||||
_vidtex.color.A = (_VideoFadeTimer.ElapsedMilliseconds / 3000f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_vidtex.color.A = 1f;
|
||||
_VideoFadeTimer.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnShow()
|
||||
{
|
||||
_actsongstream = -1;
|
||||
_vidtex = new STexture(-1);
|
||||
}
|
||||
|
||||
public virtual void OnHide()
|
||||
{
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
_Base.Sound.FadeAndStop(stream, 0f, 0.75f);
|
||||
}
|
||||
_streams.Clear();
|
||||
|
||||
_Base.Video.Close(_video);
|
||||
_video = -1;
|
||||
|
||||
_Base.Drawing.RemoveTexture(ref _vidtex);
|
||||
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
|
||||
public virtual void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void Draw()
|
||||
{
|
||||
if (!_Initialized || !_Visible)
|
||||
return;
|
||||
|
||||
if (_video != -1)
|
||||
{
|
||||
_Base.Drawing.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual void ApplyVolume(float VolumeMax)
|
||||
{
|
||||
_MaxVolume = VolumeMax;
|
||||
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
_Base.Sound.SetStreamVolumeMax(stream, _MaxVolume);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsActive()
|
||||
{
|
||||
return _Active;
|
||||
}
|
||||
|
||||
public virtual void SetActive(bool Active)
|
||||
{
|
||||
_Active = Active;
|
||||
}
|
||||
|
||||
public virtual int GetSelectedSong()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public virtual CStatic GetSelectedSongCover()
|
||||
{
|
||||
return new CStatic(_Base);
|
||||
}
|
||||
|
||||
public virtual int GetSelectedCategory()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public virtual void SetSelectedSong(int VisibleSongNr)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void SetSelectedCategory(int CategoryNr)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void SetSmallView(bool SmallView)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual bool IsSmallView()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void LoadTextures()
|
||||
{
|
||||
Init();
|
||||
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
_Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
protected virtual void EnterCategory(int Category)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
if (Category >= _Base.Songs.GetNumCategories())
|
||||
return;
|
||||
|
||||
_Base.Songs.SetCategory(Category);
|
||||
}
|
||||
|
||||
protected virtual void ShowCategories()
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() != -1)
|
||||
Reset();
|
||||
|
||||
_Base.Songs.SetCategory(-1);
|
||||
}
|
||||
|
||||
public void ApplyVolume()
|
||||
{
|
||||
_Base.Sound.SetStreamVolume(_actsongstream, _Base.Config.GetPreviewMusicVolume());
|
||||
}
|
||||
|
||||
protected void SelectSong(int nr)
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() >= 0 && (_Base.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0)))
|
||||
{
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
_Base.Sound.FadeAndStop(stream, 0f, 1f);
|
||||
}
|
||||
_streams.Clear();
|
||||
|
||||
_Base.Video.Close(_video);
|
||||
_video = -1;
|
||||
|
||||
_Base.Drawing.RemoveTexture(ref _vidtex);
|
||||
|
||||
_actsong = nr;
|
||||
if (_actsong >= _Base.Songs.GetNumVisibleSongs())
|
||||
_actsong = 0;
|
||||
|
||||
|
||||
int _stream = _Base.Sound.Load(Path.Combine(_Base.Songs.GetVisibleSong(_actsong).Folder, _Base.Songs.GetVisibleSong(_actsong).MP3FileName), true);
|
||||
_Base.Sound.SetStreamVolumeMax(_stream, _MaxVolume);
|
||||
_Base.Sound.SetStreamVolume(_stream, 0f);
|
||||
|
||||
float startposition = _Base.Songs.GetVisibleSong(_actsong).PreviewStart;
|
||||
|
||||
if (startposition == 0f)
|
||||
startposition = _Base.Sound.GetLength(_stream) / 4f;
|
||||
|
||||
_Base.Sound.SetPosition(_stream, startposition);
|
||||
_Base.Sound.Play(_stream);
|
||||
_Base.Sound.Fade(_stream, 100f, 3f);
|
||||
_streams.Add(_stream);
|
||||
_actsongstream = _stream;
|
||||
|
||||
if (_Base.Songs.GetVisibleSong(_actsong).VideoFileName != String.Empty && _Base.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
_video = _Base.Video.Load(Path.Combine(_Base.Songs.GetVisibleSong(_actsong).Folder, _Base.Songs.GetVisibleSong(_actsong).VideoFileName));
|
||||
if (_video == -1)
|
||||
return;
|
||||
_Base.Video.Skip(_video, startposition, _Base.Songs.GetVisibleSong(_actsong).VideoGap);
|
||||
_VideoFadeTimer.Stop();
|
||||
_VideoFadeTimer.Reset();
|
||||
_VideoFadeTimer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void Reset()
|
||||
{
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
_Base.Sound.FadeAndStop(stream, 0f, 0.75f);
|
||||
}
|
||||
_streams.Clear();
|
||||
|
||||
_Base.Video.Close(_video);
|
||||
_video = -1;
|
||||
|
||||
_Base.Drawing.RemoveTexture(ref _vidtex);
|
||||
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
SRectF rect = Rect;
|
||||
rect.X += stepX;
|
||||
rect.Y += stepY;
|
||||
UpdateRect(rect);
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
SRectF rect = Rect;
|
||||
|
||||
rect.W += stepW;
|
||||
if (rect.W < 100)
|
||||
rect.W = 100;
|
||||
|
||||
rect.H += stepH;
|
||||
if (rect.H < 100)
|
||||
rect.H = 100;
|
||||
|
||||
UpdateRect(rect);
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuList : CSongMenuFramework
|
||||
{
|
||||
new private Basic _Base;
|
||||
|
||||
public CSongMenuList(Basic Base)
|
||||
: base(Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,839 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Vocaluxe.Menu.SongMenu;
|
||||
using Vocaluxe.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuTileBoard : CSongMenuFramework
|
||||
{
|
||||
new private Basic _Base;
|
||||
private SRectF _ScrollRect;
|
||||
private List<CStatic> _Tiles;
|
||||
private CStatic _CoverBig;
|
||||
private CStatic _TextBG;
|
||||
private CStatic _DuetIcon;
|
||||
private CStatic _VideoIcon;
|
||||
private CStatic _MedleyCalcIcon;
|
||||
private CStatic _MedleyTagIcon;
|
||||
|
||||
private STexture _CoverBigTexture;
|
||||
private STexture _CoverTexture;
|
||||
|
||||
private CText _Artist;
|
||||
private CText _Title;
|
||||
private CText _SongLength;
|
||||
|
||||
private int _NumW;
|
||||
private int _NumH;
|
||||
|
||||
private float _SpaceW;
|
||||
private float _SpaceH;
|
||||
|
||||
private int _TileW;
|
||||
private int _TileH;
|
||||
|
||||
private int _Offset = 0;
|
||||
private int _actualSelection = -1;
|
||||
|
||||
private bool _SmallView = false;
|
||||
|
||||
public CSongMenuTileBoard(Basic Base)
|
||||
: base(Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
|
||||
public override int GetActualSelection()
|
||||
{
|
||||
return _actualSelection;
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_Rect = _Theme.songMenuTileBoard.TileRect;
|
||||
|
||||
_NumW = _Theme.songMenuTileBoard.numW;
|
||||
_NumH = _Theme.songMenuTileBoard.numH;
|
||||
_SpaceW = _Theme.songMenuTileBoard.spaceW;
|
||||
_SpaceH = _Theme.songMenuTileBoard.spaceH;
|
||||
|
||||
_PendingTime = 100L;
|
||||
|
||||
_TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||
_TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||
|
||||
_CoverTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBackgroundName);
|
||||
_CoverBigTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName);
|
||||
|
||||
_Tiles = new List<CStatic>();
|
||||
for (int i = 0; i < _NumH; i++)
|
||||
{
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
|
||||
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
CStatic tile = new CStatic(_Base, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
_ScrollRect = new SRectF(0, 0, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRect.Z);
|
||||
|
||||
_PreviewSelected = -1;
|
||||
_Offset = 0;
|
||||
|
||||
_CoverBig = _Theme.songMenuTileBoard.StaticCoverBig;
|
||||
_TextBG = _Theme.songMenuTileBoard.StaticTextBG;
|
||||
_DuetIcon = _Theme.songMenuTileBoard.StaticDuetIcon;
|
||||
_VideoIcon = _Theme.songMenuTileBoard.StaticVideoIcon;
|
||||
_MedleyCalcIcon = _Theme.songMenuTileBoard.StaticMedleyCalcIcon;
|
||||
_MedleyTagIcon = _Theme.songMenuTileBoard.StaticMedleyTagIcon;
|
||||
|
||||
_Artist = _Theme.songMenuTileBoard.TextArtist;
|
||||
_Title = _Theme.songMenuTileBoard.TextTitle;
|
||||
_SongLength = _Theme.songMenuTileBoard.TextSongLength;
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && _Base.Songs.GetNumCategories() > 0 && _Base.Songs.GetCurrentCategoryIndex() == -1)
|
||||
{
|
||||
EnterCategory(0);
|
||||
}
|
||||
_actualSelection = -1;
|
||||
_Locked = -1;
|
||||
_PreviewSelected = -1;
|
||||
UpdateList(0);
|
||||
//AfterCategoryChange();
|
||||
SetSelectedSong(_ActSong);
|
||||
AfterCategoryChange();
|
||||
_Base.Songs.UpdateRandomSongList();
|
||||
|
||||
int actcat = _PreviewSelected;
|
||||
if ((_Base.Songs.GetNumCategories() > 0) && (actcat < 0))
|
||||
{
|
||||
_CoverBig.Texture = _Base.Songs.GetCategory(0).CoverTextureSmall;
|
||||
_Artist.Text = _Base.Songs.GetCategory(0).Name;
|
||||
_Title.Text = String.Empty;
|
||||
_SongLength.Text = String.Empty;
|
||||
_PreviewSelected = 0;
|
||||
_Locked = 0;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
|
||||
if (_Base.Songs.GetNumVisibleSongs() == 0 && _Base.Songs.GetSearchFilter() != String.Empty)
|
||||
{
|
||||
_CoverBig.Texture = _CoverBigTexture;
|
||||
_Artist.Text = String.Empty;
|
||||
_Title.Text = String.Empty;
|
||||
_SongLength.Text = String.Empty;
|
||||
_PreviewSelected = -1;
|
||||
_Locked = -1;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
base.HandleInput(ref KeyEvent, SongOptions);
|
||||
|
||||
if (KeyEvent.KeyPressed)
|
||||
{
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down ||
|
||||
KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter ||
|
||||
KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp))
|
||||
return;
|
||||
|
||||
bool sel = false;
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
{
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((_Locked == -1 || !sel) &&
|
||||
KeyEvent.Key != Keys.Escape && KeyEvent.Key != Keys.Back && KeyEvent.Key != Keys.PageUp && KeyEvent.Key != Keys.PageDown)
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
_actualSelection = 0;
|
||||
_PreviewSelected = 0;
|
||||
SetSelectedNow();
|
||||
UpdateList(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
case Keys.Enter:
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() < 0)
|
||||
{
|
||||
EnterCategory(_PreviewSelected);
|
||||
KeyEvent.Handled = true;
|
||||
}
|
||||
else if (_actualSelection > -1 && _PreviewSelected >= 0)
|
||||
{
|
||||
_Locked = _actualSelection;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() > -1 && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
ShowCategories();
|
||||
KeyEvent.Handled = true;
|
||||
}
|
||||
//else if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF)
|
||||
//{
|
||||
// CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
//}
|
||||
break;
|
||||
|
||||
case Keys.PageUp:
|
||||
if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
PrevCategory();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.PageDown:
|
||||
if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
NextCategory();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
if (_Locked > 0 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && _Base.Songs.GetCurrentCategoryIndex() < 0))
|
||||
{
|
||||
_Locked--;
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() < 0 && _Locked < _Base.Songs.GetNumCategories() - _NumW ||
|
||||
_Base.Songs.GetCurrentCategoryIndex() >= 0 && _Locked < _Base.Songs.GetNumVisibleSongs() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Right:
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
if (_Locked < _Base.Songs.GetNumCategories() - 1)
|
||||
{
|
||||
_Locked++;
|
||||
if (_Locked < _Base.Songs.GetNumCategories() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() != -1 && _Locked < _Base.Songs.GetNumVisibleSongs() - 1 && !SongOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked++;
|
||||
if (_Locked < _Base.Songs.GetNumVisibleSongs() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Up:
|
||||
if (KeyEvent.ModSHIFT && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
PrevCategory();
|
||||
break;
|
||||
}
|
||||
|
||||
if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && _Base.Songs.GetCurrentCategoryIndex() < 0))
|
||||
{
|
||||
_Locked -= _NumW;
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Down:
|
||||
if (KeyEvent.ModSHIFT && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
NextCategory();
|
||||
break;
|
||||
}
|
||||
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
if (_Locked < _Base.Songs.GetNumCategories() - _NumW)
|
||||
{
|
||||
_Locked += _NumW;
|
||||
if (_Locked < _Base.Songs.GetNumCategories() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_Locked < _Base.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked += _NumW;
|
||||
if (_Locked < _Base.Songs.GetNumVisibleSongs() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!KeyEvent.Handled)
|
||||
{
|
||||
_PreviewSelected = _Locked;
|
||||
_actualSelection = _Locked;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
base.HandleMouse(ref MouseEvent, SongOptions);
|
||||
|
||||
int i = 0;
|
||||
bool sel = false;
|
||||
int lastselection = _actualSelection;
|
||||
|
||||
if (!SongOptions.Selection.RandomOnly || _Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent) && !sel)
|
||||
{
|
||||
if (MouseEvent.LB || _Base.Songs.GetCurrentCategoryIndex() == -1)
|
||||
{
|
||||
if (_PreviewSelected == i + _Offset)
|
||||
_Locked = _PreviewSelected;
|
||||
else
|
||||
{
|
||||
_PreviewSelected = i + _Offset;
|
||||
_Locked = -1;
|
||||
}
|
||||
}
|
||||
tile.Selected = true;
|
||||
_actualSelection = i + _Offset;
|
||||
sel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
sel = true;
|
||||
|
||||
if (MouseEvent.Sender == ESender.WiiMote && _actualSelection != lastselection && _actualSelection != -1)
|
||||
_Base.Input.SetRumble(0.050f);
|
||||
|
||||
if (!sel)
|
||||
_actualSelection = -1;
|
||||
|
||||
if ((MouseEvent.RB) && (_Base.Songs.GetNumCategories() > 0) && _Base.Songs.GetCurrentCategoryIndex() >= 0 && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
ShowCategories();
|
||||
return;
|
||||
}
|
||||
else if (MouseEvent.RB && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode)
|
||||
{
|
||||
_Base.Graphics.FadeTo(EScreens.ScreenMain);
|
||||
}
|
||||
else if (_PreviewSelected != -1 && MouseEvent.LB && _Base.Songs.GetCurrentCategoryIndex() != -1 && !SongOptions.Selection.PartyMode)
|
||||
{
|
||||
if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent))
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
}
|
||||
else if ((MouseEvent.LB) && (_Base.Songs.GetCurrentCategoryIndex() == -1))
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent))
|
||||
{
|
||||
EnterCategory(_PreviewSelected);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MouseEvent.Wheel > 0)
|
||||
{
|
||||
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || _Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() >= 0 && _Base.Songs.GetNumVisibleSongs() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1) ||
|
||||
_Base.Songs.GetCurrentCategoryIndex() < 0 && _Base.Songs.GetNumCategories() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1))
|
||||
{
|
||||
_Offset += _NumW * MouseEvent.Wheel;
|
||||
UpdateList(_Offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MouseEvent.Wheel < 0)
|
||||
{
|
||||
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || _Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
{
|
||||
_Offset += _NumW * MouseEvent.Wheel;
|
||||
if (_Offset < 0)
|
||||
{
|
||||
_Offset = 0;
|
||||
}
|
||||
UpdateList(_Offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected && _Active)
|
||||
tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop, false);
|
||||
else
|
||||
{
|
||||
if (tile.Texture.index != _CoverTexture.index)
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Crop, false);
|
||||
else
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Stretch, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() >= 0)
|
||||
{
|
||||
int actsong = _PreviewSelected;
|
||||
if ((_Base.Songs.GetNumVisibleSongs() > actsong) && (actsong >= 0))
|
||||
{
|
||||
CSong song = _Base.Songs.GetVisibleSong(actsong);
|
||||
|
||||
_CoverBig.Texture = song.CoverTextureSmall;
|
||||
_Artist.Text = song.Artist;
|
||||
_Title.Text = song.Title;
|
||||
_DuetIcon.Visible = song.IsDuet;
|
||||
_VideoIcon.Visible = song.VideoFileName.Length > 0;
|
||||
_MedleyCalcIcon.Visible = song.Medley.Source == EMedleySource.Calculated;
|
||||
_MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag;
|
||||
|
||||
float Time = _Base.Sound.GetLength(_SongStream);
|
||||
if (song.Finish != 0)
|
||||
Time = song.Finish;
|
||||
|
||||
Time -= song.Start;
|
||||
int min = (int)Math.Floor(Time / 60f);
|
||||
int sec = (int)(Time - min * 60f);
|
||||
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int actcat = _PreviewSelected;
|
||||
if ((_Base.Songs.GetNumCategories() > actcat) && (actcat >= 0))
|
||||
{
|
||||
_CoverBig.Texture = _Base.Songs.GetCategory(actcat).CoverTextureSmall;
|
||||
_Artist.Text = _Base.Songs.GetCategory(actcat).Name;
|
||||
|
||||
int num = _Base.Songs.NumSongsInCategory(actcat);
|
||||
if (num != 1)
|
||||
_Title.Text = _Base.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString());
|
||||
else
|
||||
_Title.Text = _Base.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString());
|
||||
|
||||
_SongLength.Text = String.Empty;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
_TextBG.Draw();
|
||||
|
||||
_CoverBig.Draw(1f, EAspect.Crop);
|
||||
if (_vidtex.color.A < 1)
|
||||
_CoverBig.Draw(1f, EAspect.Crop);
|
||||
|
||||
if (_vidtex.index != -1 && _Video != -1)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
|
||||
RectangleF rect = new RectangleF(0f, 0f, _vidtex.width, _vidtex.height);
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
|
||||
_Base.Drawing.DrawTexture(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z),
|
||||
_vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
|
||||
_Base.Drawing.DrawTextureReflection(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z),
|
||||
_vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Artist.Draw();
|
||||
_Title.Draw();
|
||||
_SongLength.Draw();
|
||||
_DuetIcon.Draw();
|
||||
_VideoIcon.Draw();
|
||||
_MedleyCalcIcon.Draw();
|
||||
_MedleyTagIcon.Draw();
|
||||
|
||||
}
|
||||
|
||||
public override int GetSelectedSong()
|
||||
{
|
||||
return _Locked;
|
||||
}
|
||||
|
||||
public override CStatic GetSelectedSongCover()
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
return new CStatic(tile);
|
||||
}
|
||||
return new CStatic(_Base);
|
||||
}
|
||||
|
||||
public override void SetSelectedSong(int VisibleSongNr)
|
||||
{
|
||||
base.SetSelectedSong(VisibleSongNr);
|
||||
|
||||
if (VisibleSongNr < 0)
|
||||
return;
|
||||
|
||||
if (_Base.Songs.GetNumVisibleSongs() > VisibleSongNr)
|
||||
{
|
||||
bool sel = false;
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
{
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_Locked == -1 || !sel)
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
_actualSelection = 0;
|
||||
_PreviewSelected = 0;
|
||||
SetSelectedNow();
|
||||
UpdateList(0);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
|
||||
_PreviewSelected = VisibleSongNr;
|
||||
SetSelectedNow();
|
||||
_Locked = VisibleSongNr;
|
||||
|
||||
UpdateList((VisibleSongNr / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
|
||||
_PreviewSelected = _Locked;
|
||||
_actualSelection = _Locked;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void SetSelectedCategory(int CategoryNr)
|
||||
{
|
||||
base.SetSelectedCategory(CategoryNr);
|
||||
|
||||
if (CategoryNr < 0)
|
||||
return;
|
||||
|
||||
if (_Base.Songs.GetNumCategories() > CategoryNr)
|
||||
{
|
||||
bool sel = false;
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
{
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_Locked == -1 || !sel)
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
_actualSelection = 0;
|
||||
_PreviewSelected = 0;
|
||||
SetSelectedNow();
|
||||
UpdateList(0);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
|
||||
_PreviewSelected = CategoryNr;
|
||||
SetSelectedNow();
|
||||
_Locked = CategoryNr;
|
||||
|
||||
UpdateList((CategoryNr / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
|
||||
_PreviewSelected = _Locked;
|
||||
_actualSelection = _Locked;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void EnterCategory(int cat)
|
||||
{
|
||||
base.EnterCategory(cat);
|
||||
|
||||
_PreviewSelected = 0;
|
||||
_Locked = -1;
|
||||
_actualSelection = 0;
|
||||
AfterCategoryChange();
|
||||
}
|
||||
|
||||
protected override void ShowCategories()
|
||||
{
|
||||
base.ShowCategories();
|
||||
|
||||
_PreviewSelected = 0;
|
||||
_Locked = -1;
|
||||
_actualSelection = 0;
|
||||
AfterCategoryChange();
|
||||
}
|
||||
|
||||
private void NextCategory()
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() > -1)
|
||||
{
|
||||
Reset();
|
||||
_Base.Songs.NextCategory();
|
||||
EnterCategory(_Base.Songs.GetCurrentCategoryIndex());
|
||||
_Locked = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void PrevCategory()
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() > -1)
|
||||
{
|
||||
Reset();
|
||||
_Base.Songs.PrevCategory();
|
||||
EnterCategory(_Base.Songs.GetCurrentCategoryIndex());
|
||||
_Locked = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void AfterCategoryChange()
|
||||
{
|
||||
SetSelectedNow();
|
||||
SelectSong(_PreviewSelected);
|
||||
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
|
||||
if (_actualSelection >= 0 && _actualSelection < _Tiles.Count)
|
||||
_Tiles[_actualSelection].Selected = true;
|
||||
|
||||
if ((_LastKnownNumSongs == _Base.Songs.GetNumVisibleSongs()) && (_LastKnownCategory == _Base.Songs.GetCurrentCategoryIndex()))
|
||||
return;
|
||||
|
||||
_LastKnownCategory = _Base.Songs.GetCurrentCategoryIndex();
|
||||
_LastKnownNumSongs = _Base.Songs.GetNumVisibleSongs();
|
||||
UpdateList(0);
|
||||
_Base.Songs.UpdateRandomSongList();
|
||||
}
|
||||
|
||||
private void UpdateList(int offset)
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() > -1)
|
||||
{
|
||||
if (offset >= (_Base.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1)))
|
||||
offset = (_Base.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (offset >= (_Base.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1)))
|
||||
offset = (_Base.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1));
|
||||
}
|
||||
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() >= 0)
|
||||
{
|
||||
if (_Base.Songs.GetNumVisibleSongs() > i + offset)
|
||||
{
|
||||
_Tiles[i].Texture = _Base.Songs.GetVisibleSong(i + offset).CoverTextureSmall;
|
||||
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_Tiles[i].Texture = _CoverTexture;
|
||||
_Tiles[i].Color = _Color;
|
||||
}
|
||||
}
|
||||
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() == -1)
|
||||
{
|
||||
if (_Base.Songs.GetNumCategories() > i + offset)
|
||||
{
|
||||
_Tiles[i].Texture = _Base.Songs.GetCategory(i + offset).CoverTextureSmall;
|
||||
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_Tiles[i].Texture = _CoverTexture;
|
||||
_Tiles[i].Color = _Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
_Offset = offset;
|
||||
}
|
||||
|
||||
public override void SetSmallView(bool SmallView)
|
||||
{
|
||||
base.SetSmallView(SmallView);
|
||||
|
||||
_SmallView = SmallView;
|
||||
|
||||
if (_SmallView)
|
||||
{
|
||||
_NumH = _Theme.songMenuTileBoard.numHsmall;
|
||||
_NumW = _Theme.songMenuTileBoard.numWsmall;
|
||||
|
||||
_TileW = (int)((_Theme.songMenuTileBoard.TileRectSmall.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||
_TileH = (int)((_Theme.songMenuTileBoard.TileRectSmall.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||
|
||||
_CoverTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBackgroundName);
|
||||
_CoverBigTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName);
|
||||
|
||||
_Tiles = new List<CStatic>();
|
||||
for (int i = 0; i < _NumH; i++)
|
||||
{
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRectSmall.X + j * (_TileW + _SpaceW),
|
||||
_Theme.songMenuTileBoard.TileRectSmall.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
CStatic tile = new CStatic(_Base, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
_Rect = _Theme.songMenuTileBoard.TileRectSmall;
|
||||
_ScrollRect = new SRectF(0, 0, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRectSmall.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
_NumH = _Theme.songMenuTileBoard.numH;
|
||||
_NumW = _Theme.songMenuTileBoard.numW;
|
||||
|
||||
_TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||
_TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||
|
||||
_CoverTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBackgroundName);
|
||||
_CoverBigTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName);
|
||||
|
||||
_Tiles = new List<CStatic>();
|
||||
for (int i = 0; i < _NumH; i++)
|
||||
{
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
|
||||
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
CStatic tile = new CStatic(_Base, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
_Rect = _Theme.songMenuTileBoard.TileRect;
|
||||
_ScrollRect = new SRectF(0, 0, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRect.Z);
|
||||
}
|
||||
|
||||
UpdateList(_Offset);
|
||||
|
||||
}
|
||||
|
||||
public override bool IsSmallView()
|
||||
{
|
||||
return _SmallView;
|
||||
}
|
||||
|
||||
public override void LoadTextures()
|
||||
{
|
||||
base.LoadTextures();
|
||||
|
||||
_Theme.songMenuTileBoard.StaticCoverBig.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticTextBG.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticDuetIcon.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticVideoIcon.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticMedleyCalcIcon.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticMedleyTagIcon.ReloadTextures();
|
||||
|
||||
_Theme.songMenuTileBoard.TextArtist.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.TextTitle.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.TextSongLength.ReloadTextures();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Vocaluxe.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
interface ISongMenu : IMenuElement
|
||||
{
|
||||
void Update();
|
||||
void OnShow();
|
||||
void OnHide();
|
||||
|
||||
void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions);
|
||||
void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions);
|
||||
void Draw();
|
||||
|
||||
void ApplyVolume(float VolumeMax);
|
||||
|
||||
int GetSelectedSong();
|
||||
CStatic GetSelectedSongCover();
|
||||
void SetSelectedSong(int VisibleSongNr);
|
||||
|
||||
bool IsActive();
|
||||
void SetActive(bool Active);
|
||||
|
||||
int GetSelectedCategory();
|
||||
void SetSelectedCategory(int CategoryNr);
|
||||
int GetActualSelection();
|
||||
|
||||
bool IsSelected();
|
||||
void SetSelected(bool Selected);
|
||||
|
||||
bool IsVisible();
|
||||
void SetVisible(bool Visible);
|
||||
|
||||
bool IsSmallView();
|
||||
void SetSmallView(bool SmallView);
|
||||
|
||||
SRectF GetRect();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user