Allow ingame changing of songmenu
This commit is contained in:
1 parent
91fd13855f
commit
84694ccbe0
8 files changed
+267
-83
No files matched your search
@@ -126,7 +126,9 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
[DefaultValue(CSettings.FallbackLanguage)] public string Language;
|
||||
public string[] SongFolder;
|
||||
// ReSharper disable MemberHidesStaticFromOuterClass
|
||||
[DefaultValue(ESongMenu.TR_CONFIG_TILE_BOARD)] public ESongMenu SongMenu;
|
||||
// ReSharper restore MemberHidesStaticFromOuterClass
|
||||
[DefaultValue(ESongSorting.TR_CONFIG_ARTIST)] public ESongSorting SongSorting;
|
||||
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn IgnoreArticles;
|
||||
[DefaultValue(10)] public float ScoreAnimationTime;
|
||||
@@ -181,6 +183,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static SConfig Config;
|
||||
public static bool LoadOldThemeFiles;
|
||||
public static event OnSongMenuChanged SongMenuChanged;
|
||||
|
||||
//Folders
|
||||
public static readonly List<string> SongFolders = new List<string>
|
||||
@@ -273,6 +276,19 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
}
|
||||
|
||||
public static ESongMenu SongMenu
|
||||
{
|
||||
get { return Config.Game.SongMenu; }
|
||||
set
|
||||
{
|
||||
if (Config.Game.SongMenu == value)
|
||||
return;
|
||||
Config.Game.SongMenu = value;
|
||||
if (SongMenuChanged != null)
|
||||
SongMenuChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
if (_Initialized)
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public ESongMenu GetSongMenuType()
|
||||
{
|
||||
return CConfig.Config.Game.SongMenu;
|
||||
return CConfig.SongMenu;
|
||||
}
|
||||
|
||||
public EOffOn GetVideosToBackground()
|
||||
@@ -155,6 +155,11 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
return CConfig.LoadOldThemeFiles;
|
||||
}
|
||||
|
||||
public void AddSongMenuListener(OnSongMenuChanged onSongMenuChanged)
|
||||
{
|
||||
CConfig.SongMenuChanged += onSongMenuChanged;
|
||||
}
|
||||
}
|
||||
|
||||
class CBsettings : ISettings
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Vocaluxe.Screens
|
||||
_SelectSlides[_SelectSlideLanguage].Selection = CLanguage.LanguageId;
|
||||
|
||||
_SelectSlides[_SelectSlideDebugLevel].SetValues<EDebugLevel>((int)CConfig.Config.Debug.DebugLevel);
|
||||
_SelectSlides[_SelectSlideSongMenu].SetValues<ESongMenu>((int)CConfig.Config.Game.SongMenu);
|
||||
_SelectSlides[_SelectSlideSongMenu].SetValues<ESongMenu>((int)CConfig.SongMenu);
|
||||
_SelectSlides[_SelectSlideSongSorting].SetValues<ESongSorting>((int)CConfig.Config.Game.SongSorting);
|
||||
_SelectSlides[_SelectSlideTabs].SetValues<EOffOn>((int)CConfig.Config.Game.Tabs);
|
||||
_SelectSlides[_SelectSlideTimerMode].SetValues<ETimerMode>((int)CConfig.Config.Game.TimerMode);
|
||||
@@ -136,7 +136,7 @@ namespace Vocaluxe.Screens
|
||||
CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection;
|
||||
CConfig.Config.Game.Language = _SelectSlides[_SelectSlideLanguage].Value;
|
||||
CConfig.Config.Debug.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection;
|
||||
CConfig.Config.Game.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection;
|
||||
CConfig.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection;
|
||||
CConfig.Config.Game.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection;
|
||||
CConfig.Config.Game.Tabs = (EOffOn)_SelectSlides[_SelectSlideTabs].Selection;
|
||||
CConfig.Config.Game.TimerMode = (ETimerMode)_SelectSlides[_SelectSlideTimerMode].Selection;
|
||||
|
||||
@@ -27,6 +27,7 @@ using VocaluxeLib.Songs;
|
||||
|
||||
namespace VocaluxeLib
|
||||
{
|
||||
public delegate void OnSongMenuChanged();
|
||||
public interface IConfig
|
||||
{
|
||||
EOffOn GetSaveModifiedSongs();
|
||||
@@ -58,6 +59,7 @@ namespace VocaluxeLib
|
||||
int GetMaxNumMics();
|
||||
|
||||
bool GetLoadOldThemeFiles();
|
||||
void AddSongMenuListener(OnSongMenuChanged onSongMenuChanged);
|
||||
}
|
||||
|
||||
public interface ISettings
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace VocaluxeLib.Menu
|
||||
_AddSingNote(new CSingNotes(sb, PartyModeID), sb.Name);
|
||||
|
||||
foreach (SThemeSongMenu sm in Theme.SongMenus)
|
||||
_AddSongMenu(CSongMenuFactory.CreateSongMenu(sm, PartyModeID), sm.Name);
|
||||
_AddSongMenu(new CSongMenu(sm, PartyModeID), sm.Name);
|
||||
|
||||
foreach (SThemeStatic st in Theme.Statics)
|
||||
_AddStatic(new CStatic(st, PartyModeID), st.Name);
|
||||
@@ -258,14 +258,7 @@ namespace VocaluxeLib.Menu
|
||||
_LoadThemeElement<CText>(_ThemeTexts, _AddText, xmlReader);
|
||||
_LoadThemeElement<CButton>(_ThemeButtons, _AddButton, xmlReader);
|
||||
_LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, _AddSelectSlide, xmlReader);
|
||||
foreach (string elName in _ThemeSongMenus)
|
||||
{
|
||||
ISongMenu element = CSongMenuFactory.CreateSongMenu(PartyModeID);
|
||||
if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader))
|
||||
_AddSongMenu(element, elName);
|
||||
else
|
||||
CBase.Log.LogError("Can't load songmenu \"" + elName + "\" in screen " + ThemeName);
|
||||
}
|
||||
_LoadThemeElement<CSongMenu>(_ThemeSongMenus, _AddSongMenu, xmlReader);
|
||||
_LoadThemeElement<CSongMenuFramework>(_ThemeSongMenus, _AddSongMenu, xmlReader);
|
||||
_LoadThemeElement<CLyric>(_ThemeLyrics, _AddLyric, xmlReader);
|
||||
_LoadThemeElement<CSingNotes>(_ThemeSingNotes, _AddSingNote, xmlReader);
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using VocaluxeLib.PartyModes;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
public class CSongMenu : ISongMenu
|
||||
{
|
||||
private readonly int _PartyModeID;
|
||||
private ISongMenu _SongMenu;
|
||||
|
||||
/// <summary>
|
||||
/// Deprecated! Only used for old theme loading.
|
||||
/// </summary>
|
||||
/// <param name="partyModeID"></param>
|
||||
public CSongMenu(int partyModeID)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
_SongMenu = new CSongMenuTileBoard(partyModeID);
|
||||
}
|
||||
|
||||
public CSongMenu(SThemeSongMenu theme, int partyModeID)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
_CreateSongMenu(theme);
|
||||
CBase.Config.AddSongMenuListener(_OnSongMenuChanged);
|
||||
}
|
||||
|
||||
#region ISongMenu
|
||||
public bool SmallView
|
||||
{
|
||||
get { return _SongMenu.SmallView; }
|
||||
set { _SongMenu.SmallView = value; }
|
||||
}
|
||||
|
||||
public void Update(SScreenSongOptions songOptions)
|
||||
{
|
||||
_SongMenu.Update(songOptions);
|
||||
}
|
||||
|
||||
public void OnShow()
|
||||
{
|
||||
_SongMenu.OnShow();
|
||||
}
|
||||
|
||||
public void OnHide()
|
||||
{
|
||||
_SongMenu.OnHide();
|
||||
}
|
||||
|
||||
public bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options)
|
||||
{
|
||||
return _SongMenu.HandleInput(ref keyEvent, options);
|
||||
}
|
||||
|
||||
public bool HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions)
|
||||
{
|
||||
return _SongMenu.HandleMouse(ref mouseEvent, songOptions);
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
_SongMenu.Draw();
|
||||
}
|
||||
|
||||
public bool IsMouseOverSelectedSong(SMouseEvent mEvent)
|
||||
{
|
||||
return _SongMenu.IsMouseOverSelectedSong(mEvent);
|
||||
}
|
||||
|
||||
public int GetPreviewSongNr()
|
||||
{
|
||||
return _SongMenu.GetPreviewSongNr();
|
||||
}
|
||||
|
||||
public int GetSelectedSongNr()
|
||||
{
|
||||
return _SongMenu.GetSelectedSongNr();
|
||||
}
|
||||
|
||||
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 bool EnterSelectedCategory()
|
||||
{
|
||||
return _SongMenu.EnterSelectedCategory();
|
||||
}
|
||||
|
||||
public int GetPreviewSong()
|
||||
{
|
||||
return _SongMenu.GetPreviewSong();
|
||||
}
|
||||
#endregion ISongMenu
|
||||
|
||||
#region IMenuElement
|
||||
public bool Highlighted
|
||||
{
|
||||
get { return _SongMenu.Highlighted; }
|
||||
set { _SongMenu.Highlighted = value; }
|
||||
}
|
||||
public bool Selected
|
||||
{
|
||||
get { return _SongMenu.Selected; }
|
||||
set { _SongMenu.Selected = value; }
|
||||
}
|
||||
|
||||
public bool Selectable
|
||||
{
|
||||
get { return _SongMenu.Selectable; }
|
||||
}
|
||||
public bool Visible
|
||||
{
|
||||
get { return _SongMenu.Visible; }
|
||||
set { _SongMenu.Visible = value; }
|
||||
}
|
||||
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return _SongMenu.Rect; }
|
||||
}
|
||||
public SRectF MaxRect
|
||||
{
|
||||
get { return _SongMenu.MaxRect; }
|
||||
set { _SongMenu.MaxRect = value; }
|
||||
}
|
||||
#endregion IMenuElement
|
||||
|
||||
#region IThemeable
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _SongMenu.GetThemeName();
|
||||
}
|
||||
|
||||
public object GetTheme()
|
||||
{
|
||||
return _SongMenu.GetTheme();
|
||||
}
|
||||
|
||||
public bool ThemeLoaded
|
||||
{
|
||||
get { return _SongMenu.ThemeLoaded; }
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
return _SongMenu.LoadTheme(xmlPath, elementName, xmlReader);
|
||||
}
|
||||
|
||||
public void UnloadSkin()
|
||||
{
|
||||
_SongMenu.UnloadSkin();
|
||||
}
|
||||
|
||||
public void LoadSkin()
|
||||
{
|
||||
_SongMenu.LoadSkin();
|
||||
}
|
||||
|
||||
public void ReloadSkin()
|
||||
{
|
||||
_SongMenu.ReloadSkin();
|
||||
}
|
||||
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
_SongMenu.MoveElement(stepX, stepY);
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
_SongMenu.ResizeElement(stepW, stepH);
|
||||
}
|
||||
#endregion IThemeable
|
||||
|
||||
private void _OnSongMenuChanged()
|
||||
{
|
||||
_CreateSongMenu((SThemeSongMenu)_SongMenu.GetTheme());
|
||||
_SongMenu.LoadSkin();
|
||||
}
|
||||
|
||||
private void _CreateSongMenu(SThemeSongMenu theme)
|
||||
{
|
||||
switch (CBase.Config.GetSongMenuType())
|
||||
{
|
||||
case ESongMenu.TR_CONFIG_LIST:
|
||||
_SongMenu = new CSongMenuList(theme, _PartyModeID);
|
||||
break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_DREIDEL:
|
||||
// _SongMenu = new CSongMenuDreidel();
|
||||
// break;
|
||||
case ESongMenu.TR_CONFIG_TILE_BOARD:
|
||||
_SongMenu = new CSongMenuTileBoard(theme, _PartyModeID);
|
||||
break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_BOOK:
|
||||
// _SongMenu = new CSongMenuBook();
|
||||
// break;
|
||||
default:
|
||||
throw new ArgumentException("Invalid songmenu type: " + CBase.Config.GetSongMenuType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
public static class CSongMenuFactory
|
||||
{
|
||||
public static ISongMenu CreateSongMenu(SThemeSongMenu theme, int partyModeID)
|
||||
{
|
||||
switch (CBase.Config.GetSongMenuType())
|
||||
{
|
||||
case ESongMenu.TR_CONFIG_LIST:
|
||||
return new CSongMenuList(theme, partyModeID);
|
||||
|
||||
//case ESongMenu.TR_CONFIG_DREIDEL:
|
||||
// _SongMenu = new CSongMenuDreidel();
|
||||
// break;
|
||||
case ESongMenu.TR_CONFIG_TILE_BOARD:
|
||||
return new CSongMenuTileBoard(theme, partyModeID);
|
||||
|
||||
//case ESongMenu.TR_CONFIG_BOOK:
|
||||
// _SongMenu = new CSongMenuBook();
|
||||
// break;
|
||||
}
|
||||
throw new ArgumentException("Invalid songmenu type: " + CBase.Config.GetSongMenuType());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deprecated! Only used for old theme loading.
|
||||
/// </summary>
|
||||
/// <param name="partyModeID"></param>
|
||||
/// <returns></returns>
|
||||
public static ISongMenu CreateSongMenu(int partyModeID)
|
||||
{
|
||||
switch (CBase.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:
|
||||
return new CSongMenuTileBoard(partyModeID);
|
||||
|
||||
//case ESongMenu.TR_CONFIG_BOOK:
|
||||
// _SongMenu = new CSongMenuBook();
|
||||
// break;
|
||||
}
|
||||
throw new ArgumentException("Invalid songmenu type: " + CBase.Config.GetSongMenuType());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,6 +108,7 @@
|
||||
<Compile Include="Draw\CTextureRef.cs" />
|
||||
<Compile Include="Menu\IThemeable.cs" />
|
||||
<Compile Include="Menu\SingNotes\CNoteBars.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenu.cs" />
|
||||
<Compile Include="XmlStructs.cs" />
|
||||
<Compile Include="Xml\CTypeExtensions.cs" />
|
||||
<Compile Include="Xml\CXmlDeserializer.cs" />
|
||||
@@ -128,7 +129,6 @@
|
||||
<Compile Include="Menu\SingNotes\CSingNotes.cs" />
|
||||
<Compile Include="Songs\CCategory.cs" />
|
||||
<Compile Include="Songs\CSong.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenuFactory.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenuFramework.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenuTileBoard.cs" />
|
||||
<Compile Include="Menu\SongMenu\ISongMenu.cs" />
|
||||
|
||||
Reference in new issue
Block a user