Merge branch 'develop' into player-guid
This commit is contained in:
commit
86dc259c17
387 files changed
+18124
-16761
No files matched your search
@@ -20,7 +20,6 @@ using System.Xml.Serialization;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -88,51 +87,6 @@ namespace VocaluxeLib.Menu
|
||||
#endregion Constructors
|
||||
|
||||
#region public
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
|
||||
|
||||
bool vid = xmlReader.GetValue(item + "/Video", out _Theme.VideoName, String.Empty);
|
||||
bool tex = xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty);
|
||||
ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
bool success = true;
|
||||
success &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
success &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
|
||||
success &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
|
||||
success &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
|
||||
if (_Theme.Type != EBackgroundTypes.None)
|
||||
ThemeLoaded &= success;
|
||||
}
|
||||
|
||||
_Theme.Color.Color = Color;
|
||||
|
||||
int i = 1;
|
||||
|
||||
while (xmlReader.ItemExists(item + "/SlideShow" + i))
|
||||
{
|
||||
string slideShow;
|
||||
xmlReader.GetValue(item + "/SlideShow" + i, out slideShow, String.Empty);
|
||||
if (slideShow != "")
|
||||
_Theme.SlideShowTextures.Add(slideShow);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
LoadSkin();
|
||||
}
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -154,92 +152,6 @@ namespace VocaluxeLib.Menu
|
||||
_SelReflectionSpace = button._SelReflectionSpace;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", out _Theme.SkinSelected, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColor.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.SelColor.Get(_PartyModeID, out SelColor);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref SelColor.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref SelColor.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A);
|
||||
}
|
||||
|
||||
ThemeLoaded &= Text.LoadTheme(item, "Text", xmlReader, true);
|
||||
Text.Z = Rect.Z;
|
||||
if (xmlReader.ItemExists(item + "/SText"))
|
||||
{
|
||||
ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, true);
|
||||
_SelText.Z = Rect.Z;
|
||||
}
|
||||
else
|
||||
_SelText = null;
|
||||
|
||||
|
||||
//Reflections
|
||||
if (xmlReader.ItemExists(item + "/Reflection"))
|
||||
{
|
||||
_Reflection = true;
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref _ReflectionSpace);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref _ReflectionHeight);
|
||||
|
||||
_Theme.Reflection = new SReflection(_ReflectionHeight, _ReflectionSpace);
|
||||
}
|
||||
else
|
||||
{
|
||||
_Reflection = false;
|
||||
_Theme.Reflection = null;
|
||||
}
|
||||
|
||||
if (xmlReader.ItemExists(item + "/SReflection"))
|
||||
{
|
||||
_SelReflection = true;
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Space", ref _SelReflectionSpace);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Height", ref _SelReflectionHeight);
|
||||
|
||||
_Theme.SelReflection = new SReflection(_SelReflectionHeight, _SelReflectionSpace);
|
||||
}
|
||||
else
|
||||
{
|
||||
_SelReflection = false;
|
||||
_Theme.SelReflection = null;
|
||||
}
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
_Theme.Color.Color = Color;
|
||||
_Theme.SelColor.Color = SelColor;
|
||||
_ReadSubThemeElements();
|
||||
|
||||
LoadSkin();
|
||||
}
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
private void _ReadSubThemeElements()
|
||||
{
|
||||
_Theme.Text = (SThemeText)Text.GetTheme();
|
||||
|
||||
@@ -15,10 +15,8 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -97,72 +95,6 @@ namespace VocaluxeLib.Menu
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/NumBars", ref _Theme.NumBars);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Space", ref _Theme.Space);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Theme.Style);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/DrawNegative", ref _Theme.DrawNegative);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/MaxColor", out _Theme.MaxColor.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.MaxColor.Get(_PartyModeID, out MaxColor);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/MaxR", ref MaxColor.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/MaxG", ref MaxColor.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/MaxB", ref MaxColor.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/MaxA", ref MaxColor.A);
|
||||
}
|
||||
|
||||
//Reflection
|
||||
if (xmlReader.ItemExists(item + "/Reflection"))
|
||||
{
|
||||
Reflection = true;
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref ReflectionHeight);
|
||||
|
||||
_Theme.Reflection = new SReflection(ReflectionHeight, ReflectionSpace);
|
||||
}
|
||||
else
|
||||
{
|
||||
Reflection = false;
|
||||
_Theme.Reflection = null;
|
||||
}
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
_Theme.Color.Color = Color;
|
||||
_Theme.MaxColor.Color = MaxColor;
|
||||
LoadSkin();
|
||||
}
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
public void Update(float[] weights, float volume)
|
||||
{
|
||||
if (weights == null || weights.Length == 0 || _Bars == null)
|
||||
|
||||
@@ -30,7 +30,8 @@ namespace VocaluxeLib.Menu
|
||||
NameSelection,
|
||||
Equalizer,
|
||||
Playlist,
|
||||
ParticleEffect
|
||||
ParticleEffect,
|
||||
ProgressBar
|
||||
}
|
||||
|
||||
public class CInteraction
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Songs;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -88,7 +87,7 @@ namespace VocaluxeLib.Menu
|
||||
_Line = new CSongLine();
|
||||
_Text = new CText(_PartyModeID);
|
||||
|
||||
LyricStyle = ELyricStyle.Fill;
|
||||
LyricStyle = ELyricStyle.TR_CONFIG_LYRICSTYLE_FILL;
|
||||
}
|
||||
|
||||
public CLyric(SThemeLyrics theme, int partyModeID)
|
||||
@@ -100,52 +99,11 @@ namespace VocaluxeLib.Menu
|
||||
_Text = new CText(_PartyModeID);
|
||||
_Width = 1f;
|
||||
|
||||
LyricStyle = ELyricStyle.Fill;
|
||||
LyricStyle = ELyricStyle.TR_CONFIG_LYRICSTYLE_FILL;
|
||||
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out _Color);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref _Color.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _Color.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.ProcessedColor.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.ProcessedColor.Get(_PartyModeID, out _ColorProcessed);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref _ColorProcessed.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref _ColorProcessed.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref _ColorProcessed.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref _ColorProcessed.A);
|
||||
}
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
_Theme.Color.Color = _Color;
|
||||
_Theme.ProcessedColor.Color = _ColorProcessed;
|
||||
LoadSkin();
|
||||
}
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
public void SetLine(CSongLine line)
|
||||
{
|
||||
_Line = line;
|
||||
@@ -185,14 +143,14 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
switch (LyricStyle)
|
||||
{
|
||||
case ELyricStyle.Fill:
|
||||
case ELyricStyle.TR_CONFIG_LYRICSTYLE_FILL:
|
||||
_DrawFill();
|
||||
break;
|
||||
case ELyricStyle.Slide:
|
||||
case ELyricStyle.TR_CONFIG_LYRICSTYLE_SLIDE:
|
||||
_DrawSlide();
|
||||
break;
|
||||
case ELyricStyle.Zoom:
|
||||
case ELyricStyle.Jump:
|
||||
case ELyricStyle.TR_CONFIG_LYRICSTYLE_ZOOM:
|
||||
case ELyricStyle.TR_CONFIG_LYRICSTYLE_JUMP:
|
||||
_DrawZoomOrJump();
|
||||
break;
|
||||
default:
|
||||
@@ -368,7 +326,7 @@ namespace VocaluxeLib.Menu
|
||||
return;
|
||||
_SetText(highlightNote);
|
||||
_Text.X = hX;
|
||||
if (LyricStyle == ELyricStyle.Jump)
|
||||
if (LyricStyle == ELyricStyle.TR_CONFIG_LYRICSTYLE_JUMP)
|
||||
_DrawJumpingNode(highlightNote);
|
||||
else
|
||||
_DrawZoomedNote(highlightNote, hEndBeat);
|
||||
|
||||
+18
-137
@@ -51,6 +51,7 @@ namespace VocaluxeLib.Menu
|
||||
[XmlArray("Playlists")] public List<SThemePlaylist> Playlists;
|
||||
[XmlArray("ParticleEffects")] public List<SThemeParticleEffect> ParticleEffects;
|
||||
[XmlArray("ScreenSettings")] public List<SThemeScreenSetting> ScreenSettings;
|
||||
[XmlArray("ProgressBars")] public List<SThemeProgressBar> ProgressBars;
|
||||
}
|
||||
|
||||
struct SZSort
|
||||
@@ -82,6 +83,7 @@ namespace VocaluxeLib.Menu
|
||||
protected string[] _ThemePlaylists;
|
||||
protected string[] _ThemeParticleEffects;
|
||||
protected string[] _ThemeScreenSettings;
|
||||
protected string[] _ThemeProgressBars;
|
||||
protected readonly Dictionary<string, CScreenSetting> _ScreenSettings = new Dictionary<string, CScreenSetting>();
|
||||
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
@@ -117,6 +119,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemePlaylists = null;
|
||||
_ThemeParticleEffects = null;
|
||||
_ThemeScreenSettings = null;
|
||||
_ThemeProgressBars = null;
|
||||
}
|
||||
|
||||
protected virtual void _OnSongMenuChanged()
|
||||
@@ -138,27 +141,13 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
private delegate void AddElementHandler<in T>(T element, String key);
|
||||
|
||||
private void _LoadThemeElement<T>(IEnumerable<string> elements, AddElementHandler<T> addElementHandler, CXmlReader xmlReader) where T : IThemeable
|
||||
{
|
||||
if (elements != null)
|
||||
{
|
||||
foreach (string elName in elements)
|
||||
{
|
||||
var element = (T)Activator.CreateInstance(typeof(T), PartyModeID);
|
||||
if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader))
|
||||
addElementHandler(element, elName);
|
||||
else
|
||||
CBase.Log.LogError("Can't load " + typeof(T).Name.Substring(1) + " \"" + elName + "\" in screen " + ThemeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CLoadThemeErrorHandler : CXmlDeserializer.CXmlDefaultErrorHandler
|
||||
{
|
||||
private static readonly string[] _AllowedMissing = new string[]
|
||||
{
|
||||
"Backgrounds", "Statics", "Texts", "Buttons", "SongMenus", "Lyrics", "SelectSlides", "SingNotes",
|
||||
"NameSelections", "Equalizers", "Playlists", "ParticleEffects", "ScreenSettings"
|
||||
"NameSelections", "Equalizers", "Playlists", "ParticleEffects", "ScreenSettings", "ProgressBars"
|
||||
};
|
||||
|
||||
public override void HandleError(CXmlException e)
|
||||
@@ -175,12 +164,6 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public virtual void LoadTheme(string xmlPath)
|
||||
{
|
||||
if (CBase.Config.GetLoadOldThemeFiles())
|
||||
{
|
||||
LoadThemeOld(xmlPath);
|
||||
return;
|
||||
}
|
||||
|
||||
ThemePath = xmlPath;
|
||||
|
||||
string file = Path.Combine(xmlPath, ThemeName + ".xml");
|
||||
@@ -211,6 +194,9 @@ namespace VocaluxeLib.Menu
|
||||
foreach (SThemePlaylist pl in Theme.Playlists)
|
||||
_AddPlaylist(new CPlaylist(pl, PartyModeID), pl.Name);
|
||||
|
||||
foreach (SThemeProgressBar pb in Theme.ProgressBars)
|
||||
_AddProgressBar(new CProgressBar(pb, PartyModeID), pb.Name);
|
||||
|
||||
foreach (SThemeScreenSetting ss in Theme.ScreenSettings)
|
||||
_AddScreenSetting(new CScreenSetting(ss, PartyModeID), ss.Name);
|
||||
|
||||
@@ -262,61 +248,6 @@ namespace VocaluxeLib.Menu
|
||||
_ScreenSettings.Add(name, screenSetting);
|
||||
}
|
||||
|
||||
public void LoadThemeOld(string xmlPath)
|
||||
{
|
||||
string file = Path.Combine(xmlPath, ThemeName + ".xml");
|
||||
|
||||
CXmlReader xmlReader = CXmlReader.OpenFile(file);
|
||||
if (xmlReader == null)
|
||||
return;
|
||||
|
||||
bool versionCheck = _CheckVersion(_ScreenVersion, xmlReader);
|
||||
|
||||
if (versionCheck)
|
||||
{
|
||||
ThemePath = xmlPath;
|
||||
_LoadThemeBasics(xmlReader);
|
||||
|
||||
_LoadThemeElement<CBackground>(_ThemeBackgrounds, _AddBackground, xmlReader);
|
||||
_LoadThemeElement<CStatic>(_ThemeStatics, _AddStatic, xmlReader);
|
||||
_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<CSongMenuFramework>(_ThemeSongMenus, _AddSongMenu, xmlReader);
|
||||
_LoadThemeElement<CLyric>(_ThemeLyrics, _AddLyric, xmlReader);
|
||||
_LoadThemeElement<CSingNotes>(_ThemeSingNotes, _AddSingNote, xmlReader);
|
||||
_LoadThemeElement<CNameSelection>(_ThemeNameSelections, _AddNameSelection, xmlReader);
|
||||
_LoadThemeElement<CEqualizer>(_ThemeEqualizers, _AddEqualizer, xmlReader);
|
||||
_LoadThemeElement<CPlaylist>(_ThemePlaylists, _AddPlaylist, xmlReader);
|
||||
_LoadThemeElement<CParticleEffect>(_ThemeParticleEffects, _AddParticleEffect, xmlReader);
|
||||
_LoadThemeElement<CScreenSetting>(_ThemeScreenSettings, _AddScreenSetting, xmlReader);
|
||||
}
|
||||
|
||||
Theme.Informations.ScreenName = ThemeName;
|
||||
Theme.Informations.ScreenVersion = _ScreenVersion;
|
||||
Theme.Backgrounds = new List<SThemeBackground>();
|
||||
Theme.Statics = new List<SThemeStatic>();
|
||||
Theme.Texts = new List<SThemeText>();
|
||||
Theme.Buttons = new List<SThemeButton>();
|
||||
Theme.SongMenus = new List<SThemeSongMenu>();
|
||||
Theme.Lyrics = new List<SThemeLyrics>();
|
||||
Theme.SelectSlides = new List<SThemeSelectSlide>();
|
||||
Theme.SingNotes = new List<SThemeSingBar>();
|
||||
Theme.NameSelections = new List<SThemeNameSelection>();
|
||||
Theme.Equalizers = new List<SThemeEqualizer>();
|
||||
Theme.Playlists = new List<SThemePlaylist>();
|
||||
Theme.ParticleEffects = new List<SThemeParticleEffect>();
|
||||
Theme.ScreenSettings = new List<SThemeScreenSetting>();
|
||||
}
|
||||
|
||||
private static void _AddThemeablesToList<T, TT>(ICollection<TT> themeList, IEnumerable<T> objects) where T : IThemeable
|
||||
{
|
||||
themeList.Clear();
|
||||
@@ -351,6 +282,7 @@ namespace VocaluxeLib.Menu
|
||||
_AddThemeablesToList(Theme.NameSelections, _NameSelections);
|
||||
_AddThemeablesToList(Theme.ParticleEffects, _ParticleEffects);
|
||||
_AddThemeablesToList(Theme.Playlists, _Playlists);
|
||||
_AddThemeablesToList(Theme.ProgressBars, _ProgressBars);
|
||||
_AddThemeablesToList(Theme.ScreenSettings, _ScreenSettings.Values);
|
||||
_AddThemeablesToList(Theme.SelectSlides, _SelectSlides);
|
||||
_AddThemeablesToList(Theme.Statics, _Statics);
|
||||
@@ -471,6 +403,16 @@ namespace VocaluxeLib.Menu
|
||||
return new CParticleEffect(PartyModeID, maxNumber, color, area, texture, size, type);
|
||||
}
|
||||
|
||||
public CProgressBar GetNewProgressBar()
|
||||
{
|
||||
return new CProgressBar(PartyModeID);
|
||||
}
|
||||
|
||||
public CProgressBar GetNewProgressBar(CProgressBar pb)
|
||||
{
|
||||
return new CProgressBar(pb);
|
||||
}
|
||||
|
||||
// ReSharper restore MemberCanBeProtected.Global
|
||||
// ReSharper restore UnusedMember.Global
|
||||
#endregion Create Elements
|
||||
@@ -536,67 +478,6 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
#region Theme Handling
|
||||
private bool _CheckVersion(int reqVersion, CXmlReader xmlReader)
|
||||
{
|
||||
int actualVersion = 0;
|
||||
xmlReader.TryGetIntValue("//root/" + ThemeName + "/ScreenVersion", ref actualVersion);
|
||||
|
||||
if (actualVersion == reqVersion)
|
||||
return true;
|
||||
string msg = "Can't load screen file of screen \"" + ThemeName + "\", ";
|
||||
if (actualVersion < reqVersion)
|
||||
msg += "the file ist outdated! ";
|
||||
else
|
||||
msg += "the file is for newer program versions! ";
|
||||
|
||||
msg += "Current screen version is " + reqVersion;
|
||||
CBase.Log.LogError(msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void _LoadThemeBasics(CXmlReader xmlReader)
|
||||
{
|
||||
// Backgrounds
|
||||
var background = new CBackground(PartyModeID);
|
||||
int i = 1;
|
||||
while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader))
|
||||
{
|
||||
_AddBackground(background);
|
||||
background = new CBackground(PartyModeID);
|
||||
i++;
|
||||
}
|
||||
|
||||
// Statics
|
||||
var stat = new CStatic(PartyModeID);
|
||||
i = 1;
|
||||
while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader))
|
||||
{
|
||||
_AddStatic(stat);
|
||||
stat = new CStatic(PartyModeID);
|
||||
i++;
|
||||
}
|
||||
|
||||
// Texts
|
||||
var text = new CText(PartyModeID);
|
||||
i = 1;
|
||||
while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader))
|
||||
{
|
||||
_AddText(text);
|
||||
text = new CText(PartyModeID);
|
||||
i++;
|
||||
}
|
||||
|
||||
// ParticleEffects
|
||||
var partef = new CParticleEffect(PartyModeID);
|
||||
i = 1;
|
||||
while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader))
|
||||
{
|
||||
_AddParticleEffect(partef);
|
||||
partef = new CParticleEffect(PartyModeID);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private void _ReloadThemeEditMode()
|
||||
{
|
||||
CBase.Themes.Reload();
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
|
||||
private bool _Teams;
|
||||
protected bool _Teams = true;
|
||||
protected int _NumTeams = -1;
|
||||
protected int _NumPlayer = -1;
|
||||
protected int[] _NumPlayerTeams;
|
||||
@@ -107,8 +107,6 @@ namespace VocaluxeLib.Menu
|
||||
for (int i = 0; i < _TeamList.Length; i++)
|
||||
_TeamList[i] = new List<Guid>();
|
||||
|
||||
_Teams = _NumTeams > 0;
|
||||
|
||||
_UpdateSlides();
|
||||
_LoadProfiles();
|
||||
_UpdateButtonVisibility();
|
||||
@@ -619,6 +617,7 @@ namespace VocaluxeLib.Menu
|
||||
_UpdatePlayerSlide();
|
||||
}
|
||||
_UpdateButtonState();
|
||||
_UpdateNextButtonVisibility();
|
||||
}
|
||||
|
||||
public void DecreasePlayerNum(int team)
|
||||
@@ -634,6 +633,7 @@ namespace VocaluxeLib.Menu
|
||||
_UpdatePlayerSlide();
|
||||
}
|
||||
_UpdateButtonState();
|
||||
_UpdateNextButtonVisibility();
|
||||
}
|
||||
|
||||
#region private methods
|
||||
@@ -726,7 +726,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
if (_NumPlayerTeams[team] == _TeamList[team].Count && !_ChangePlayerNumDynamic)
|
||||
return;
|
||||
if (_NumPlayerTeams[team] == _PartyMode.MaxPlayersPerTeam)
|
||||
if (_NumPlayerTeams[team] > _PartyMode.MaxPlayersPerTeam)
|
||||
return;
|
||||
|
||||
_NameSelections[_NameSelection].UseProfile(profileID);
|
||||
@@ -778,7 +778,8 @@ namespace VocaluxeLib.Menu
|
||||
for (int p = 0; p < _NumPlayerTeams[t]; p++)
|
||||
{
|
||||
Guid profileID = _NameSelections[_NameSelection].GetRandomUnusedProfile();
|
||||
_AddPlayer(t, profileID, false);
|
||||
if(profileID != Guid.Empty)
|
||||
_AddPlayer(t, profileID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
#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 System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Songs;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
public abstract class CMenuPartySongSelection : CMenuParty
|
||||
{
|
||||
private const string _ButtonNext = "ButtonNext";
|
||||
private const string _ButtonBack = "ButtonBack";
|
||||
|
||||
private const string _SelectSlideSongMode = "SelectSlideSongMode";
|
||||
private const string _SelectSlideSource = "SelectSlideSource";
|
||||
private const string _SelectSlidePlaylist = "SelectSlidePlaylist";
|
||||
private const string _SelectSlideSorting = "SelectSlideSorting";
|
||||
private const string _SelectSlideCategory = "SelectSlideCategory";
|
||||
private const string _SelectSlideNumMedleySongs = "SelectSlideNumMedleySongs";
|
||||
|
||||
protected int Playlist;
|
||||
protected EGameMode SongMode
|
||||
{
|
||||
get { return AllowedSongModes[_SongMode]; }
|
||||
set
|
||||
{
|
||||
_SongMode = 0;
|
||||
for (int i = 0; i < AllowedSongModes.Length; i++)
|
||||
{
|
||||
if (AllowedSongModes[i] == value)
|
||||
{
|
||||
_SongMode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private int _SongMode;
|
||||
|
||||
protected ESongSource Source
|
||||
{
|
||||
get { return AllowedSongSources[_Source]; }
|
||||
set
|
||||
{
|
||||
_Source = 0;
|
||||
for (int i = 0; i < AllowedSongSources.Length; i++)
|
||||
{
|
||||
if (AllowedSongSources[i] == value)
|
||||
{
|
||||
_Source = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private int _Source;
|
||||
|
||||
protected ESongSorting Sorting
|
||||
{
|
||||
get { return AllowedSongSorting[_Sorting]; }
|
||||
set
|
||||
{
|
||||
_Sorting = 0;
|
||||
for (int i = 0; i < AllowedSongSorting.Length; i++)
|
||||
{
|
||||
if (AllowedSongSorting[i] == value)
|
||||
{
|
||||
_Sorting = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private int _Sorting;
|
||||
|
||||
protected int Category;
|
||||
|
||||
protected EGameMode[] AllowedSongModes;
|
||||
protected ESongSource[] AllowedSongSources;
|
||||
protected ESongSorting[] AllowedSongSorting;
|
||||
|
||||
protected int NumMedleySongs = 5;
|
||||
protected int NumMinMedleySongs = 3;
|
||||
protected int NumMaxMedleySongs = 10;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeButtons = new string[]{ _ButtonNext, _ButtonBack};
|
||||
_ThemeSelectSlides = new string[] { _SelectSlideSongMode, _SelectSlideSource, _SelectSlidePlaylist, _SelectSlideSorting, _SelectSlideCategory, _SelectSlideNumMedleySongs };
|
||||
|
||||
_SetAllowedOptions();
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
{
|
||||
base.HandleInput(keyEvent);
|
||||
|
||||
switch (keyEvent.Key)
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
Back();
|
||||
break;
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
Next();
|
||||
else if (_Buttons[_ButtonBack].Selected)
|
||||
Back();
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
_GetSelectedOptions();
|
||||
_UpdateSelectSlideVisibility();
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool HandleMouse(SMouseEvent mouseEvent)
|
||||
{
|
||||
base.HandleMouse(mouseEvent);
|
||||
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
{
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
Back();
|
||||
else if (_Buttons[_ButtonNext].Selected)
|
||||
Next();
|
||||
else
|
||||
{
|
||||
_GetSelectedOptions();
|
||||
_UpdateSelectSlideVisibility();
|
||||
}
|
||||
}
|
||||
else if (mouseEvent.RB)
|
||||
Back();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void Back();
|
||||
public abstract void Next();
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
|
||||
CBase.Songs.SortSongs(Sorting, EOffOn.TR_CONFIG_ON, CBase.Config.GetIgnoreArticles(), "", EDuetOptions.All, -1);
|
||||
|
||||
_FillSlides();
|
||||
_SetSelectedOptions();
|
||||
_UpdateSelectSlideVisibility();
|
||||
}
|
||||
|
||||
private void _FillSlides()
|
||||
{
|
||||
_SelectSlides[_SelectSlideSongMode].Clear();
|
||||
foreach (EGameMode gm in AllowedSongModes)
|
||||
_SelectSlides[_SelectSlideSongMode].AddValue(gm.ToString());
|
||||
|
||||
_SelectSlides[_SelectSlideSource].Clear();
|
||||
foreach (ESongSource ss in AllowedSongSources)
|
||||
_SelectSlides[_SelectSlideSource].AddValue(ss.ToString());
|
||||
|
||||
_SelectSlides[_SelectSlideSorting].Clear();
|
||||
foreach (ESongSorting ss in AllowedSongSorting)
|
||||
_SelectSlides[_SelectSlideSorting].AddValue(ss.ToString());
|
||||
|
||||
_SelectSlides[_SelectSlidePlaylist].Clear();
|
||||
List<string> playlists = CBase.Playlist.GetNames();
|
||||
for (int i = 0; i < playlists.Count; i++)
|
||||
{
|
||||
string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
|
||||
_SelectSlides[_SelectSlidePlaylist].AddValue(value);
|
||||
}
|
||||
|
||||
_SelectSlides[_SelectSlideNumMedleySongs].Clear();
|
||||
for(int num = NumMinMedleySongs; num <= NumMaxMedleySongs; num++)
|
||||
{
|
||||
_SelectSlides[_SelectSlideNumMedleySongs].AddValue(num + " " + CBase.Language.Translate("TR_SONGS", PartyModeID));
|
||||
}
|
||||
|
||||
_FillCategorySlide();
|
||||
}
|
||||
|
||||
private void _FillCategorySlide()
|
||||
{
|
||||
_SelectSlides[_SelectSlideCategory].Clear();
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
||||
{
|
||||
CCategory cat = CBase.Songs.GetCategory(i);
|
||||
string value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
|
||||
_SelectSlides[_SelectSlideCategory].AddValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
private void _GetSelectedOptions()
|
||||
{
|
||||
_SongMode = _SelectSlides[_SelectSlideSongMode].Selection;
|
||||
_Source = _SelectSlides[_SelectSlideSource].Selection;
|
||||
NumMedleySongs = NumMinMedleySongs + _SelectSlides[_SelectSlideNumMedleySongs].Selection;
|
||||
Playlist = _SelectSlides[_SelectSlidePlaylist].Selection;
|
||||
|
||||
if (_SelectSlides[_SelectSlideSorting].Selection != _Sorting)
|
||||
{
|
||||
_Sorting = _SelectSlides[_SelectSlideSorting].Selection;
|
||||
CBase.Songs.SortSongs(Sorting, EOffOn.TR_CONFIG_ON, CBase.Config.GetIgnoreArticles(), "", EDuetOptions.All, -1);
|
||||
_FillCategorySlide();
|
||||
|
||||
_SelectSlides[_SelectSlideCategory].Selection = 0;
|
||||
}
|
||||
|
||||
Category = _SelectSlides[_SelectSlideCategory].Selection;
|
||||
}
|
||||
|
||||
private void _SetSelectedOptions()
|
||||
{
|
||||
_SelectSlides[_SelectSlideSongMode].Selection = _SongMode;
|
||||
_SelectSlides[_SelectSlideSource].Selection = _Source;
|
||||
_SelectSlides[_SelectSlideNumMedleySongs].Selection = NumMedleySongs - NumMinMedleySongs;
|
||||
_SelectSlides[_SelectSlidePlaylist].Selection = Playlist;
|
||||
_SelectSlides[_SelectSlideSorting].Selection = _Sorting;
|
||||
_SelectSlides[_SelectSlideCategory].Selection = Category;
|
||||
}
|
||||
|
||||
private void _UpdateSelectSlideVisibility()
|
||||
{
|
||||
_SelectSlides[_SelectSlideNumMedleySongs].Visible = SongMode == EGameMode.TR_GAMEMODE_MEDLEY;
|
||||
_SelectSlides[_SelectSlidePlaylist].Visible = Source == ESongSource.TR_SONGSOURCE_PLAYLIST;
|
||||
_SelectSlides[_SelectSlideSorting].Visible = Source == ESongSource.TR_SONGSOURCE_CATEGORY;
|
||||
_SelectSlides[_SelectSlideCategory].Visible = Source == ESongSource.TR_SONGSOURCE_CATEGORY;
|
||||
}
|
||||
|
||||
protected virtual void _SetAllowedOptions()
|
||||
{
|
||||
AllowedSongModes = (EGameMode[])Enum.GetValues(typeof(EGameMode));
|
||||
AllowedSongSources = (ESongSource[])Enum.GetValues(typeof(ESongSource));
|
||||
AllowedSongSorting = (ESongSorting[])Enum.GetValues(typeof(ESongSorting));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ using System.Windows.Forms;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Profile;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -153,64 +152,6 @@ namespace VocaluxeLib.Menu
|
||||
UpdateList(0);
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", out _Theme.SkinEmptyTile, String.Empty);
|
||||
|
||||
if (xmlReader.GetValue(item + "/ColorEmptyTile", out _Theme.ColorEmptyTile.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.ColorEmptyTile.Get(_PartyModeID, out _ColorEmptyTile);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _ColorEmptyTile.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref _ColorEmptyTile.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _ColorEmptyTile.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _ColorEmptyTile.A);
|
||||
}
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", out _Theme.SkinTileSelected, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/W", ref _Theme.Tiles.W);
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/H", ref _Theme.Tiles.H);
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/NumW", ref _Theme.Tiles.NumW);
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/NumH", ref _Theme.Tiles.NumH);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceW", ref _Theme.Tiles.SpaceW);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceH", ref _Theme.Tiles.SpaceH);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/Space", ref _Theme.Tiles.Name.Space);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/H", ref _Theme.Tiles.Name.Height);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", out _Theme.Tiles.Name.Font, "Normal");
|
||||
ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Tiles/Name/Style", ref _Theme.Tiles.Name.Style);
|
||||
if (xmlReader.GetValue(item + "/Tiles/Name/Color", out _Theme.Tiles.Name.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Tiles.Name.Color.Get(_PartyModeID, out _ColorNameTile);
|
||||
else
|
||||
{
|
||||
if (xmlReader.TryGetFloatValue(item + "/Tiles/Name/R", ref _ColorNameTile.R))
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/G", ref _ColorNameTile.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/B", ref _ColorNameTile.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/A", ref _ColorNameTile.A);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
_Theme.Tiles.Name.Color.Color = _ColorNameTile;
|
||||
_Theme.ColorEmptyTile.Color = _ColorEmptyTile;
|
||||
LoadSkin();
|
||||
}
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace VocaluxeLib.Menu
|
||||
protected readonly COrderedDictionaryLite<CEqualizer> _Equalizers;
|
||||
protected readonly COrderedDictionaryLite<CPlaylist> _Playlists;
|
||||
protected readonly COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
|
||||
protected readonly COrderedDictionaryLite<CProgressBar> _ProgressBars;
|
||||
private readonly SColorF _HighlightColor = new SColorF(1, 0, 0, 0);
|
||||
|
||||
protected CObjectInteractions()
|
||||
@@ -62,6 +63,7 @@ namespace VocaluxeLib.Menu
|
||||
_Equalizers = new COrderedDictionaryLite<CEqualizer>(this);
|
||||
_Playlists = new COrderedDictionaryLite<CPlaylist>(this);
|
||||
_ParticleEffects = new COrderedDictionaryLite<CParticleEffect>(this);
|
||||
_ProgressBars = new COrderedDictionaryLite<CProgressBar>(this);
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
@@ -86,6 +88,7 @@ namespace VocaluxeLib.Menu
|
||||
_Equalizers.Clear();
|
||||
_Playlists.Clear();
|
||||
_ParticleEffects.Clear();
|
||||
_ProgressBars.Clear();
|
||||
}
|
||||
|
||||
private void _SetSelected(int newSelection)
|
||||
@@ -119,18 +122,24 @@ namespace VocaluxeLib.Menu
|
||||
keyEvent.Handled = PrevValue();
|
||||
else
|
||||
keyEvent.Handled = _NextElement(keyEvent);
|
||||
}
|
||||
|
||||
if (keyEvent.Key == Keys.Right)
|
||||
return true;
|
||||
}
|
||||
else if (keyEvent.Key == Keys.Right)
|
||||
{
|
||||
if (_IsSelectionValid() && _Elements[_Selection].Type == EType.SelectSlide && keyEvent.Mod != EModifier.Shift)
|
||||
keyEvent.Handled = NextValue();
|
||||
else
|
||||
keyEvent.Handled = _NextElement(keyEvent);
|
||||
}
|
||||
|
||||
if (keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down)
|
||||
return true;
|
||||
}
|
||||
else if (keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down)
|
||||
{
|
||||
keyEvent.Handled = _NextElement(keyEvent);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,16 +149,25 @@ namespace VocaluxeLib.Menu
|
||||
PrevElement();
|
||||
else
|
||||
NextElement();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (keyEvent.Key == Keys.Left)
|
||||
{
|
||||
PrevValue();
|
||||
|
||||
if (keyEvent.Key == Keys.Right)
|
||||
return true;
|
||||
}
|
||||
else if (keyEvent.Key == Keys.Right)
|
||||
{
|
||||
NextValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool HandleMouse(SMouseEvent mouseEvent)
|
||||
@@ -282,6 +300,8 @@ namespace VocaluxeLib.Menu
|
||||
return _Playlists[element.Num];
|
||||
case EType.ParticleEffect:
|
||||
return _ParticleEffects[element.Num];
|
||||
case EType.ProgressBar:
|
||||
return _ProgressBars[element.Num];
|
||||
}
|
||||
throw new ArgumentException("Invalid element type: " + element.Type);
|
||||
}
|
||||
@@ -386,6 +406,11 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_AddElement(_ParticleEffects.Add(pe, key), EType.ParticleEffect);
|
||||
}
|
||||
|
||||
protected void _AddProgressBar(CProgressBar pb, String key = null)
|
||||
{
|
||||
_AddElement(_ProgressBars.Add(pb, key), EType.ProgressBar);
|
||||
}
|
||||
#endregion Element-Adding
|
||||
|
||||
#region InteractionHandling
|
||||
|
||||
@@ -265,14 +265,14 @@ namespace VocaluxeLib.Menu
|
||||
_Timer.Start();
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
public void Draw(bool allMonitors = true)
|
||||
{
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if (!String.IsNullOrEmpty(_TextureName))
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
CBase.Drawing.DrawTexture(CBase.Themes.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
|
||||
CBase.Drawing.DrawTexture(CBase.Themes.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha), allMonitors);
|
||||
else
|
||||
CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
|
||||
CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha), allMonitors);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,14 +20,14 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
[XmlType("ParticleEffect")]
|
||||
public struct SThemeParticleEffect
|
||||
{
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
|
||||
public string Skin;
|
||||
public SRectF Rect;
|
||||
@@ -35,6 +35,7 @@ namespace VocaluxeLib.Menu
|
||||
public EParticleType Type;
|
||||
public float Size;
|
||||
public int MaxNumber;
|
||||
public bool? AllMonitors;
|
||||
}
|
||||
|
||||
public enum EParticleType
|
||||
@@ -60,6 +61,8 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public float Alpha = 1f;
|
||||
|
||||
public bool AllMonitors = true;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
@@ -127,42 +130,6 @@ namespace VocaluxeLib.Menu
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
}
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Size", ref _Theme.Size);
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/MaxNumber", ref _Theme.MaxNumber);
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
_Theme.Color.Color = Color;
|
||||
LoadSkin();
|
||||
}
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
bool doSpawn = false;
|
||||
@@ -301,7 +268,7 @@ namespace VocaluxeLib.Menu
|
||||
foreach (CParticle star in _Stars)
|
||||
{
|
||||
star.Alpha2 = Alpha;
|
||||
star.Draw();
|
||||
star.Draw(AllMonitors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Songs;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -270,67 +269,6 @@ namespace VocaluxeLib.Menu
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackground", out _Theme.SkinBackground, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundSelected", out _Theme.SkinBackgroundSelected, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
|
||||
if (xmlReader.GetValue(item + "/ColorBackground", out _Theme.ColorBackground.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.ColorBackground.Get(_PartyModeID, out _BackgroundColor);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundR", ref _BackgroundColor.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundG", ref _BackgroundColor.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundB", ref _BackgroundColor.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref _BackgroundColor.A);
|
||||
}
|
||||
if (xmlReader.GetValue(item + "/SColorBackground", out _Theme.SelColorBackground.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.SelColorBackground.Get(_PartyModeID, out _BackgroundSelColor);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundR", ref _BackgroundSelColor.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundG", ref _BackgroundSelColor.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundB", ref _BackgroundSelColor.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundA", ref _BackgroundSelColor.A);
|
||||
}
|
||||
|
||||
ThemeLoaded &= _Text1.LoadTheme(item, "TextPart1", xmlReader);
|
||||
|
||||
CStatic tmpStatic = new CStatic(_PartyModeID);
|
||||
ThemeLoaded &= tmpStatic.LoadTheme(item, "StaticCover", xmlReader);
|
||||
ThemeLoaded &= _StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", xmlReader);
|
||||
ThemeLoaded &= _StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", xmlReader);
|
||||
|
||||
ThemeLoaded &= _ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", xmlReader);
|
||||
ThemeLoaded &= _ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", xmlReader);
|
||||
ThemeLoaded &= _ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", xmlReader);
|
||||
ThemeLoaded &= _ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader);
|
||||
ThemeLoaded &= _ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader);
|
||||
|
||||
ThemeLoaded &= _SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/EntryHeight", ref _Theme.EntryHeight);
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
_Theme.ColorBackground.Color = _BackgroundColor;
|
||||
_Theme.SelColorBackground.Color = _BackgroundSelColor;
|
||||
_Theme.StaticCover = (SThemeStatic)tmpStatic.GetTheme();
|
||||
_ReadSubThemeElements();
|
||||
|
||||
LoadSkin();
|
||||
}
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
private void _ReadSubThemeElements()
|
||||
{
|
||||
_Theme.Text1 = (SThemeText)_Text1.GetTheme();
|
||||
@@ -1087,6 +1025,7 @@ namespace VocaluxeLib.Menu
|
||||
};
|
||||
_PlaylistElementContents.Add(pec);
|
||||
}
|
||||
_SetSelectionToFirstEntry();
|
||||
_Update();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,509 @@
|
||||
#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 System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
[XmlType("ProgressColor")]
|
||||
public struct SThemeProgressBarColor
|
||||
{
|
||||
public float From;
|
||||
public SThemeColor Color;
|
||||
}
|
||||
|
||||
[XmlType("ProgressBar")]
|
||||
public struct SThemeProgressBar
|
||||
{
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
public string SkinBackground;
|
||||
public string SkinForeground;
|
||||
public string SkinProgressLeft;
|
||||
public string SkinProgressMid;
|
||||
public string SkinProgressRight;
|
||||
public SThemeColor ColorBackground;
|
||||
public SThemeColor ColorForeground;
|
||||
public EDirection Direction;
|
||||
public EOffOn AnimateMovement;
|
||||
public EOffOn AnimateColoring;
|
||||
public SRectF Rect;
|
||||
[XmlArrayItem("ProgressColor"), XmlArray] public List<SThemeProgressBarColor> ProgressColors;
|
||||
public SReflection? Reflection;
|
||||
public bool? AllMonitors;
|
||||
}
|
||||
|
||||
public sealed class CProgressBar : CMenuElementBase, IMenuElement, IThemeable
|
||||
{
|
||||
private readonly int _PartyModeID;
|
||||
|
||||
private SThemeProgressBar _Theme;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool ThemeLoaded { get; private set; }
|
||||
|
||||
public bool Selectable
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
private CTextureRef _TextureBackground;
|
||||
public CTextureRef TextureBackground
|
||||
{
|
||||
get { return _TextureBackground ?? CBase.Themes.GetSkinTexture(_Theme.SkinBackground, _PartyModeID); }
|
||||
|
||||
set { _TextureBackground = value; }
|
||||
}
|
||||
|
||||
private CTextureRef _TextureForeground;
|
||||
public CTextureRef TextureForeground
|
||||
{
|
||||
get { return _TextureForeground ?? CBase.Themes.GetSkinTexture(_Theme.SkinForeground, _PartyModeID); }
|
||||
|
||||
set { _TextureForeground = value; }
|
||||
}
|
||||
|
||||
private CTextureRef _TextureProgressLeft;
|
||||
public CTextureRef TextureProgressLeft
|
||||
{
|
||||
get { return _TextureProgressLeft ?? CBase.Themes.GetSkinTexture(_Theme.SkinProgressLeft, _PartyModeID); }
|
||||
|
||||
set { _TextureProgressLeft = value; }
|
||||
}
|
||||
|
||||
private CTextureRef _TextureProgressMid;
|
||||
public CTextureRef TextureProgressMid
|
||||
{
|
||||
get { return _TextureProgressMid ?? CBase.Themes.GetSkinTexture(_Theme.SkinProgressMid, _PartyModeID); }
|
||||
|
||||
set { _TextureProgressMid = value; }
|
||||
}
|
||||
|
||||
private CTextureRef _TextureProgressRight;
|
||||
public CTextureRef TextureProgressRight
|
||||
{
|
||||
get { return _TextureProgressRight ?? CBase.Themes.GetSkinTexture(_Theme.SkinProgressRight, _PartyModeID); }
|
||||
|
||||
set { _TextureProgressRight = value; }
|
||||
}
|
||||
|
||||
private EDirection _Direction;
|
||||
private EOffOn _AnimateMovement;
|
||||
private EOffOn _AnimateColoring;
|
||||
private List<SThemeProgressBarColor> _ProgressColors;
|
||||
|
||||
public SColorF ColorBackground;
|
||||
public SColorF ColorForeground;
|
||||
|
||||
public bool Reflection;
|
||||
public float ReflectionSpace;
|
||||
public float ReflectionHeight;
|
||||
|
||||
public bool AllMonitors = true;
|
||||
|
||||
public float Alpha = 1;
|
||||
|
||||
private float _ProgressTarget;
|
||||
public float Progress
|
||||
{
|
||||
get { return _ProgressTarget; }
|
||||
set
|
||||
{
|
||||
//Animation is still running, so use current state for calculations
|
||||
if(_ProgressCurrent != _ProgressTarget)
|
||||
{
|
||||
_ProgressLast = _ProgressCurrent;
|
||||
_ColorProgressLast = _ColorProgressCurrent;
|
||||
}
|
||||
_ProgressTarget = value;
|
||||
}
|
||||
}
|
||||
private float _ProgressCurrent;
|
||||
private float _ProgressLast;
|
||||
|
||||
private SColorF _ColorProgressCurrent;
|
||||
private SColorF _ColorProgressTarget;
|
||||
private SColorF _ColorProgressLast;
|
||||
|
||||
private SRectF _RectProgressBegin;
|
||||
private SRectF _RectProgressMid;
|
||||
private SRectF _RectProgressEnd;
|
||||
|
||||
private CTextureRef _TextureProgressBegin;
|
||||
private CTextureRef _TextureProgressEnd;
|
||||
|
||||
private Stopwatch _AnimTimer;
|
||||
private float _AnimDuration;
|
||||
private bool _Animate;
|
||||
|
||||
public CProgressBar(int partyModeID)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
_AnimTimer = new Stopwatch();
|
||||
}
|
||||
|
||||
public CProgressBar(CProgressBar pb)
|
||||
{
|
||||
_PartyModeID = pb._PartyModeID;
|
||||
|
||||
_TextureBackground = pb.TextureBackground;
|
||||
_TextureForeground = pb.TextureForeground;
|
||||
_TextureProgressLeft = pb.TextureProgressLeft;
|
||||
_TextureProgressMid = pb._TextureProgressMid;
|
||||
_TextureProgressRight = pb._TextureProgressRight;
|
||||
_AnimateMovement = pb._AnimateMovement;
|
||||
_AnimateColoring = pb._AnimateColoring;
|
||||
_Direction = pb._Direction;
|
||||
_ProgressColors = pb._ProgressColors;
|
||||
|
||||
ColorBackground = pb.ColorBackground;
|
||||
ColorForeground = pb.ColorForeground;
|
||||
|
||||
MaxRect = pb.MaxRect;
|
||||
Reflection = pb.Reflection;
|
||||
ReflectionSpace = pb.ReflectionHeight;
|
||||
ReflectionHeight = pb.ReflectionSpace;
|
||||
|
||||
AllMonitors = pb.AllMonitors;
|
||||
|
||||
Alpha = pb.Alpha;
|
||||
Visible = pb.Visible;
|
||||
|
||||
_AnimTimer = new Stopwatch();
|
||||
}
|
||||
|
||||
public CProgressBar(SThemeProgressBar theme, int partyModeID)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
_Theme = theme;
|
||||
_Theme.ProgressColors.Sort((x, y) => x.From.CompareTo(y.From));
|
||||
_ProgressColors = _Theme.ProgressColors;
|
||||
_Direction = _Theme.Direction;
|
||||
_AnimateMovement = _Theme.AnimateMovement;
|
||||
_AnimateColoring = _Theme.AnimateColoring;
|
||||
_UpdateProgress();
|
||||
ThemeLoaded = true;
|
||||
|
||||
_AnimTimer = new Stopwatch();
|
||||
}
|
||||
|
||||
public void Reset(bool animateInit = false)
|
||||
{
|
||||
_Animate = animateInit;
|
||||
|
||||
_ProgressColors[0].Color.Get(_PartyModeID, out _ColorProgressLast);
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
Draw(1f);
|
||||
}
|
||||
|
||||
public void Draw(float scale = 1f, float zModify = 0f, bool forceDraw = false)
|
||||
{
|
||||
if (scale <= 0)
|
||||
return;
|
||||
|
||||
if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
|
||||
{
|
||||
_UpdateProgress();
|
||||
|
||||
//Draw background
|
||||
SColorF color = new SColorF(ColorBackground.R, ColorBackground.G, ColorBackground.B, ColorBackground.A * Alpha);
|
||||
if (_TextureBackground != null)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(_TextureBackground, Rect, color, AllMonitors);
|
||||
if (Reflection)
|
||||
CBase.Drawing.DrawTextureReflection(_TextureBackground, Rect, color, Rect, ReflectionSpace, ReflectionHeight, AllMonitors);
|
||||
}
|
||||
|
||||
//Draw progress
|
||||
color = new SColorF(_ColorProgressCurrent.R, _ColorProgressCurrent.G, _ColorProgressCurrent.B, _ColorProgressCurrent.A * Alpha);
|
||||
if (_TextureProgressBegin != null)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(_TextureProgressBegin, _RectProgressBegin, color, AllMonitors);
|
||||
if (Reflection)
|
||||
CBase.Drawing.DrawTextureReflection(_TextureProgressBegin, _RectProgressBegin, color, _RectProgressBegin, ReflectionSpace, ReflectionHeight, AllMonitors);
|
||||
}
|
||||
|
||||
if (_TextureProgressMid != null)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(_TextureProgressMid, _RectProgressMid, color, AllMonitors);
|
||||
if (Reflection)
|
||||
CBase.Drawing.DrawTextureReflection(_TextureProgressMid, _RectProgressMid, color, _RectProgressMid, ReflectionSpace, ReflectionHeight, AllMonitors);
|
||||
}
|
||||
else
|
||||
CBase.Drawing.DrawRect(_ColorProgressCurrent, _RectProgressMid);
|
||||
|
||||
if (_TextureProgressEnd != null)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(_TextureProgressEnd, _RectProgressEnd, color, AllMonitors);
|
||||
if (Reflection)
|
||||
CBase.Drawing.DrawTextureReflection(_TextureProgressEnd, _RectProgressEnd, color, _RectProgressEnd, ReflectionSpace, ReflectionHeight, AllMonitors);
|
||||
}
|
||||
|
||||
//Draw foreground
|
||||
color = new SColorF(ColorForeground.R, ColorForeground.G, ColorForeground.B, ColorForeground.A * Alpha);
|
||||
if (_TextureForeground != null)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(_TextureForeground, Rect, color, AllMonitors);
|
||||
if (Reflection)
|
||||
CBase.Drawing.DrawTextureReflection(_TextureForeground, Rect, color, Rect, ReflectionSpace, ReflectionHeight, AllMonitors);
|
||||
}
|
||||
}
|
||||
|
||||
if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
|
||||
CBase.Drawing.DrawRect(new SColorF(1f, 1f, 1f, 0.5f), Rect);
|
||||
}
|
||||
|
||||
public void UnloadSkin() {}
|
||||
|
||||
public void LoadSkin()
|
||||
{
|
||||
if (!ThemeLoaded)
|
||||
return;
|
||||
_Theme.ColorBackground.Get(_PartyModeID, out ColorBackground);
|
||||
_Theme.ColorForeground.Get(_PartyModeID, out ColorForeground);
|
||||
|
||||
TextureBackground = CBase.Themes.GetSkinTexture(_Theme.SkinBackground, _PartyModeID);
|
||||
TextureForeground = CBase.Themes.GetSkinTexture(_Theme.SkinForeground, _PartyModeID);
|
||||
TextureProgressLeft = CBase.Themes.GetSkinTexture(_Theme.SkinProgressLeft, _PartyModeID);
|
||||
TextureProgressMid = CBase.Themes.GetSkinTexture(_Theme.SkinProgressMid, _PartyModeID);
|
||||
TextureProgressRight = CBase.Themes.GetSkinTexture(_Theme.SkinProgressRight, _PartyModeID);
|
||||
|
||||
MaxRect = _Theme.Rect;
|
||||
Reflection = _Theme.Reflection.HasValue;
|
||||
if (Reflection)
|
||||
{
|
||||
Debug.Assert(_Theme.Reflection != null);
|
||||
ReflectionSpace = _Theme.Reflection.Value.Space;
|
||||
ReflectionHeight = _Theme.Reflection.Value.Height;
|
||||
}
|
||||
}
|
||||
|
||||
public void ReloadSkin()
|
||||
{
|
||||
UnloadSkin();
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public object GetTheme()
|
||||
{
|
||||
return _Theme;
|
||||
}
|
||||
|
||||
private void _UpdateProgress()
|
||||
{
|
||||
if (_ProgressCurrent == _ProgressTarget)
|
||||
return;
|
||||
|
||||
if (_Animate)
|
||||
_CheckAnimation();
|
||||
else
|
||||
_ProgressCurrent = _ProgressLast = _ProgressTarget;
|
||||
|
||||
_UpdateProgressColor();
|
||||
|
||||
_UpdateProgressLeft();
|
||||
_UpdateProgressMid();
|
||||
_UpdateProgressRight();
|
||||
}
|
||||
|
||||
private void _CheckAnimation()
|
||||
{
|
||||
//Check if animation needs to be started
|
||||
if (_AnimateColoring == EOffOn.TR_CONFIG_ON || _AnimateMovement == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
if (!_AnimTimer.IsRunning)
|
||||
{
|
||||
_AnimTimer.Restart();
|
||||
//Calc animation duration in ms based on rect size and progress change
|
||||
if (_Direction == EDirection.Left || _Direction == EDirection.Right)
|
||||
_AnimDuration = Math.Max(100f, (Rect.W * 0.015f * 1000) * Math.Abs(_ProgressTarget - _ProgressCurrent));
|
||||
else
|
||||
_AnimDuration = Math.Max(100f, (Rect.H * 0.015f * 1000) * Math.Abs(_ProgressTarget - _ProgressCurrent));
|
||||
}
|
||||
}
|
||||
//Movement animation
|
||||
if (_AnimateMovement == EOffOn.TR_CONFIG_ON)
|
||||
_ProgressCurrent = _ProgressLast + (_AnimTimer.ElapsedMilliseconds / _AnimDuration).Clamp(0, 1) * (_ProgressTarget - _ProgressLast);
|
||||
|
||||
//Check if animation needs to be stopped
|
||||
if (_ProgressCurrent == _ProgressTarget)
|
||||
{
|
||||
_AnimTimer.Stop();
|
||||
|
||||
_ProgressLast = _ProgressCurrent = _ProgressTarget;
|
||||
_ColorProgressLast = _ColorProgressCurrent = _ColorProgressTarget;
|
||||
}
|
||||
|
||||
_Animate = true;
|
||||
}
|
||||
|
||||
private void _UpdateProgressColor()
|
||||
{
|
||||
foreach (SThemeProgressBarColor col in _ProgressColors)
|
||||
if (col.From < _ProgressTarget)
|
||||
col.Color.Get(_PartyModeID, out _ColorProgressTarget);
|
||||
|
||||
if(_Animate && _AnimateColoring == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
float animFactor = (_AnimTimer.ElapsedMilliseconds / _AnimDuration).Clamp(0, 1);
|
||||
|
||||
_ColorProgressCurrent.R = _ColorProgressLast.R + animFactor * (_ColorProgressTarget.R - _ColorProgressLast.R);
|
||||
_ColorProgressCurrent.G = _ColorProgressLast.G + animFactor * (_ColorProgressTarget.G - _ColorProgressLast.G);
|
||||
_ColorProgressCurrent.B = _ColorProgressLast.B + animFactor * (_ColorProgressTarget.B - _ColorProgressLast.B);
|
||||
_ColorProgressCurrent.A = _ColorProgressLast.A + animFactor * (_ColorProgressTarget.A - _ColorProgressLast.A);
|
||||
}
|
||||
else
|
||||
_ColorProgressCurrent = _ColorProgressLast = _ColorProgressTarget;
|
||||
}
|
||||
|
||||
private void _UpdateProgressLeft()
|
||||
{
|
||||
switch (_Direction)
|
||||
{
|
||||
case EDirection.Right:
|
||||
_TextureProgressBegin = TextureProgressLeft;
|
||||
if (_TextureProgressBegin == null)
|
||||
_RectProgressBegin = new SRectF(Rect.X, Rect.Y, 0, 0, Rect.Z);
|
||||
else
|
||||
_RectProgressBegin = new SRectF(Rect.X, Rect.Y, Rect.H * _TextureProgressBegin.OrigAspect, Rect.H, Rect.Z);
|
||||
break;
|
||||
|
||||
case EDirection.Up:
|
||||
_TextureProgressBegin = TextureProgressRight;
|
||||
if (_TextureProgressBegin == null)
|
||||
_RectProgressBegin = new SRectF(Rect.X, Rect.Y + Rect.H, 0, 0, Rect.Z);
|
||||
else
|
||||
_RectProgressBegin = new SRectF(Rect.X, Rect.Y + Rect.H - Rect.W * _TextureProgressBegin.OrigAspect, Rect.W, Rect.W * _TextureProgressBegin.OrigAspect, Rect.Z);
|
||||
break;
|
||||
|
||||
case EDirection.Left:
|
||||
_TextureProgressBegin = TextureProgressRight;
|
||||
if (_TextureProgressBegin == null)
|
||||
_RectProgressBegin = new SRectF(Rect.X + Rect.W, Rect.Y, 0, 0, Rect.Z);
|
||||
else
|
||||
_RectProgressBegin = new SRectF(Rect.X + Rect.W - Rect.H * _TextureProgressBegin.OrigAspect, Rect.Y, Rect.H *_TextureProgressBegin.OrigAspect, Rect.H, Rect.Z);
|
||||
break;
|
||||
|
||||
case EDirection.Down:
|
||||
_TextureProgressBegin = TextureProgressLeft;
|
||||
if (_TextureProgressBegin == null)
|
||||
_RectProgressBegin = new SRectF(Rect.X, Rect.Y, 0, 0, Rect.Z);
|
||||
else
|
||||
_RectProgressBegin = new SRectF(Rect.X, Rect.Y, Rect.W, Rect.W * _TextureProgressBegin.OrigAspect, Rect.Z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void _UpdateProgressMid()
|
||||
{
|
||||
switch (_Direction)
|
||||
{
|
||||
case EDirection.Right:
|
||||
_RectProgressMid = new SRectF(_RectProgressBegin.X + _RectProgressBegin.W, Rect.Y, (Rect.W - 2 * _RectProgressBegin.W) * _ProgressCurrent, Rect.H, Rect.Z);
|
||||
break;
|
||||
|
||||
case EDirection.Up:
|
||||
float newHeight = (Rect.H - 2 * _RectProgressBegin.H) * _ProgressCurrent;
|
||||
_RectProgressMid = new SRectF(Rect.X, _RectProgressBegin.Y - newHeight, Rect.W, newHeight, Rect.Z);
|
||||
break;
|
||||
|
||||
case EDirection.Left:
|
||||
float newWidth = (Rect.W - 2 * _RectProgressBegin.H) * _ProgressCurrent;
|
||||
_RectProgressMid = new SRectF(_RectProgressBegin.X - newWidth, Rect.Y, newWidth, Rect.H, Rect.Z);
|
||||
break;
|
||||
|
||||
case EDirection.Down:
|
||||
_RectProgressMid = new SRectF(Rect.X, _RectProgressBegin.Y + _RectProgressBegin.H, (Rect.H - 2 * _RectProgressBegin.W) * _ProgressCurrent, Rect.W, Rect.Z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void _UpdateProgressRight()
|
||||
{
|
||||
switch (_Direction)
|
||||
{
|
||||
case EDirection.Right:
|
||||
_TextureProgressEnd = _TextureProgressRight;
|
||||
if (_TextureProgressEnd == null)
|
||||
_RectProgressEnd = new SRectF(_RectProgressMid.X + _RectProgressMid.W, Rect.Y, 0, 0, Rect.Z);
|
||||
else
|
||||
_RectProgressEnd = new SRectF(_RectProgressMid.X + _RectProgressMid.W, Rect.Y, Rect.H * _TextureProgressBegin.OrigAspect, Rect.H, Rect.Z);
|
||||
break;
|
||||
|
||||
case EDirection.Up:
|
||||
_TextureProgressEnd = _TextureProgressLeft;
|
||||
if (_TextureProgressEnd == null)
|
||||
_RectProgressEnd = new SRectF(Rect.X, _RectProgressMid.Y + Rect.W, 0, 0, Rect.Z);
|
||||
else
|
||||
_RectProgressEnd = new SRectF(Rect.X, _RectProgressMid.Y + Rect.W, Rect.W, Rect.W * _TextureProgressBegin.OrigAspect, Rect.Z);
|
||||
break;
|
||||
|
||||
case EDirection.Left:
|
||||
_TextureProgressEnd = _TextureProgressLeft;
|
||||
if (_TextureProgressEnd == null)
|
||||
_RectProgressEnd = new SRectF(_RectProgressMid.X - Rect.H, Rect.Y, 0, 0, Rect.Z);
|
||||
else
|
||||
_RectProgressEnd = new SRectF(_RectProgressMid.X - Rect.H, Rect.Y, Rect.H * _TextureProgressBegin.OrigAspect, Rect.H, Rect.Z);
|
||||
break;
|
||||
|
||||
case EDirection.Down:
|
||||
_TextureProgressEnd = _TextureProgressRight;
|
||||
if (_TextureProgressEnd == null)
|
||||
_RectProgressEnd = new SRectF(Rect.X, _RectProgressMid.Y + _RectProgressMid.H, 0, 0, Rect.Z);
|
||||
else
|
||||
_RectProgressEnd = new SRectF(Rect.X, _RectProgressMid.Y + _RectProgressMid.H, Rect.W, Rect.W * _TextureProgressBegin.OrigAspect, Rect.Z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
X += stepX;
|
||||
Y += stepY;
|
||||
|
||||
_Theme.Rect.X += stepX;
|
||||
_Theme.Rect.Y += stepY;
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
W += stepW;
|
||||
if (W <= 0)
|
||||
W = 1;
|
||||
|
||||
H += stepH;
|
||||
if (H <= 0)
|
||||
H = 1;
|
||||
|
||||
_Theme.Rect.W = Rect.W;
|
||||
_Theme.Rect.H = Rect.H;
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -71,19 +70,6 @@ namespace VocaluxeLib.Menu
|
||||
_Theme = theme;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Value", out _Theme.Value, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
|
||||
|
||||
if (_ThemeLoaded)
|
||||
_Theme.Name = elementName;
|
||||
return _ThemeLoaded;
|
||||
}
|
||||
|
||||
public object GetValue()
|
||||
{
|
||||
switch (_Theme.Type)
|
||||
|
||||
@@ -22,7 +22,6 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
@@ -270,122 +269,6 @@ namespace VocaluxeLib.Menu
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeft", out _Theme.SkinArrowLeft, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRight", out _Theme.SkinArrowRight, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", out _Theme.SkinSelected, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeftSelected", out _Theme.SkinArrowLeftSelected, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRightSelected", out _Theme.SkinArrowRightSelected, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out _Color);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref _Color.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _Color.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColor.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.SelColor.Get(_PartyModeID, out _SelColor);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref _SelColor.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref _SelColor.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref _SelColor.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref _SelColor.A);
|
||||
}
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftX", ref RectArrowLeft.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftY", ref RectArrowLeft.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftZ", ref RectArrowLeft.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftW", ref RectArrowLeft.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowLeftH", ref RectArrowLeft.H);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightX", ref RectArrowRight.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightY", ref RectArrowRight.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightZ", ref RectArrowRight.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightW", ref RectArrowRight.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/ArrowColor", out _Theme.ArrowColor.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.ArrowColor.Get(_PartyModeID, out _ColorArrow);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowR", ref _ColorArrow.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowG", ref _ColorArrow.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowB", ref _ColorArrow.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowA", ref _ColorArrow.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/ArrowSColor", out _Theme.ArrowSelColor.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.ArrowSelColor.Get(_PartyModeID, out _SelColorArrow);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSR", ref _SelColorArrow.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSG", ref _SelColorArrow.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSB", ref _SelColorArrow.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSA", ref _SelColorArrow.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/TextColor", out _Theme.TextColor.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.TextColor.Get(_PartyModeID, out _TextColor);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextR", ref _TextColor.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextG", ref _TextColor.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextB", ref _TextColor.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextA", ref _TextColor.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/TextSColor", out _Theme.TextSelColor.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.TextSelColor.Get(_PartyModeID, out _SelTextColor);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSR", ref _SelTextColor.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSG", ref _SelTextColor.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSB", ref _SelTextColor.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSA", ref _SelTextColor.A);
|
||||
}
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextH", ref _Theme.TextH);
|
||||
xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref _Theme.TextRelativeX);
|
||||
xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref _Theme.TextRelativeY);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextMaxW", ref _Theme.TextMaxW);
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/TextFont", out _Theme.TextFont, "Normal");
|
||||
ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/TextStyle", ref _Theme.TextStyle);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/NumVisible", ref _Theme.NumVisible);
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
_Theme.ArrowColor.Color = _ColorArrow;
|
||||
_Theme.ArrowSelColor.Color = _SelColorArrow;
|
||||
_Theme.Color.Color = _Color;
|
||||
_Theme.RectArrowLeft = RectArrowLeft;
|
||||
_Theme.RectArrowRight = RectArrowRight;
|
||||
_Theme.SelColor.Color = _SelColor;
|
||||
_Theme.TextColor.Color = _TextColor;
|
||||
_Theme.TextSelColor.Color = _SelTextColor;
|
||||
LoadSkin();
|
||||
}
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
private void _Invalidate()
|
||||
{
|
||||
_NeedsRevalidate = true;
|
||||
@@ -436,6 +319,22 @@ namespace VocaluxeLib.Menu
|
||||
AddValue(value);
|
||||
}
|
||||
|
||||
public void AddValues(IEnumerable<string> values, IEnumerable<int> tags)
|
||||
{
|
||||
using (var e1 = values.GetEnumerator())
|
||||
using (var e2 = tags.GetEnumerator())
|
||||
{
|
||||
while (e1.MoveNext() && e2.MoveNext())
|
||||
{
|
||||
AddValue(e1.Current, tag: e2.Current);
|
||||
}
|
||||
if (e1.MoveNext() || e2.MoveNext())
|
||||
{
|
||||
throw new ArgumentException("the lists must have the same length");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddValues(string[] values, CTextureRef[] textures)
|
||||
{
|
||||
Debug.Assert(values.Length == textures.Length);
|
||||
@@ -566,10 +465,11 @@ namespace VocaluxeLib.Menu
|
||||
for (int i = 0; i < numvis; i++)
|
||||
{
|
||||
var el = new CElement
|
||||
{
|
||||
Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID),
|
||||
Img = new CStatic(_PartyModeID)
|
||||
};
|
||||
{
|
||||
Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID),
|
||||
Img = new CStatic(_PartyModeID)
|
||||
};
|
||||
el.Img.Aspect = EAspect.Crop;
|
||||
_VisibleElements.Add(el);
|
||||
}
|
||||
}
|
||||
|
||||
+31
-52
@@ -15,22 +15,22 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
[XmlType("Static")]
|
||||
public struct SThemeStatic
|
||||
{
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
public string Skin;
|
||||
public SThemeColor Color;
|
||||
public SRectF Rect;
|
||||
public SReflection? Reflection;
|
||||
public bool? AllMonitors;
|
||||
}
|
||||
|
||||
public sealed class CStatic : CMenuElementBase, IMenuElement, IThemeable
|
||||
@@ -65,10 +65,21 @@ namespace VocaluxeLib.Menu
|
||||
public float ReflectionSpace;
|
||||
public float ReflectionHeight;
|
||||
|
||||
public bool AllMonitors = true;
|
||||
|
||||
public float Alpha = 1;
|
||||
|
||||
public EAspect Aspect = EAspect.Stretch;
|
||||
|
||||
/// <summary>
|
||||
/// Adjust this value if you want to draw only a part of your texture, width
|
||||
/// </summary>
|
||||
public float ModW = -1f;
|
||||
/// <summary>
|
||||
/// Adjust this value if you want to draw only a part of your texture, height
|
||||
/// </summary>
|
||||
public float ModH = -1f;
|
||||
|
||||
public CStatic(int partyModeID)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
@@ -84,6 +95,7 @@ namespace VocaluxeLib.Menu
|
||||
Reflection = s.Reflection;
|
||||
ReflectionSpace = s.ReflectionHeight;
|
||||
ReflectionHeight = s.ReflectionSpace;
|
||||
AllMonitors = s.AllMonitors;
|
||||
|
||||
Alpha = s.Alpha;
|
||||
Visible = s.Visible;
|
||||
@@ -113,52 +125,6 @@ namespace VocaluxeLib.Menu
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.Rect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Rect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Rect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _Theme.Rect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
}
|
||||
|
||||
_Theme.Color.Color = Color;
|
||||
|
||||
if (xmlReader.ItemExists(item + "/Reflection"))
|
||||
{
|
||||
Reflection = true;
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref ReflectionHeight);
|
||||
_Theme.Reflection = new SReflection(ReflectionHeight, ReflectionSpace);
|
||||
}
|
||||
else
|
||||
{
|
||||
Reflection = false;
|
||||
_Theme.Reflection = null;
|
||||
}
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
LoadSkin();
|
||||
}
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
Draw(Aspect);
|
||||
@@ -168,16 +134,29 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
CTextureRef texture = Texture;
|
||||
SRectF bounds = Rect.Scale(scale);
|
||||
|
||||
//Change bounds if rect size should be modified without adjusting texture
|
||||
if (ModH != -1)
|
||||
bounds.H = ModH * scale;
|
||||
if (ModW != -1)
|
||||
bounds.W = ModW * scale;
|
||||
|
||||
bounds.Z += zModify;
|
||||
|
||||
SRectF rect = texture == null ? bounds : CHelper.FitInBounds(bounds, texture.OrigAspect, aspect);
|
||||
|
||||
//Use original rect
|
||||
if (ModH != -1 || ModW != -1)
|
||||
rect = Rect.Scale(scale);
|
||||
|
||||
var color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
|
||||
if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
|
||||
{
|
||||
if (texture != null)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(texture, rect, color, bounds);
|
||||
CBase.Drawing.DrawTexture(texture, rect, color, bounds, false, AllMonitors);
|
||||
if (Reflection)
|
||||
CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
|
||||
CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight, AllMonitors);
|
||||
}
|
||||
else
|
||||
CBase.Drawing.DrawRect(color, rect);
|
||||
@@ -187,7 +166,7 @@ namespace VocaluxeLib.Menu
|
||||
CBase.Drawing.DrawRect(new SColorF(1f, 1f, 1f, 0.5f), rect);
|
||||
}
|
||||
|
||||
public void UnloadSkin() {}
|
||||
public void UnloadSkin() { }
|
||||
|
||||
public void LoadSkin()
|
||||
{
|
||||
|
||||
+16
-81
@@ -18,28 +18,33 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
[XmlType("Text")]
|
||||
public struct SThemeText
|
||||
{
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
|
||||
public float X;
|
||||
public float Y;
|
||||
public float Z;
|
||||
[XmlElement("H")] public float FontHeight;
|
||||
[XmlElement("MaxW")] public float MaxWidth;
|
||||
[XmlElement("H")]
|
||||
public float FontHeight;
|
||||
[XmlElement("MaxW")]
|
||||
public float MaxWidth;
|
||||
public SThemeColor Color;
|
||||
public SThemeColor SelColor; //for Buttons
|
||||
public EAlignment Align;
|
||||
public EHAlignment ResizeAlign;
|
||||
[XmlElement("Style")] public EStyle FontStyle;
|
||||
[XmlElement("Font")] public string FontFamily;
|
||||
[XmlElement("Style")]
|
||||
public EStyle FontStyle;
|
||||
[XmlElement("Font")]
|
||||
public string FontFamily;
|
||||
public string Text;
|
||||
public SReflection? Reflection;
|
||||
public bool? AllMonitors;
|
||||
}
|
||||
|
||||
public sealed class CText : CMenuElementBase, IMenuElement, IThemeable, IFontObserver
|
||||
@@ -162,6 +167,8 @@ namespace VocaluxeLib.Menu
|
||||
private float _ReflectionSpace;
|
||||
private float _ReflectionHeight;
|
||||
|
||||
public bool AllMonitors = true;
|
||||
|
||||
private string _Text = String.Empty;
|
||||
public string Text
|
||||
{
|
||||
@@ -249,6 +256,7 @@ namespace VocaluxeLib.Menu
|
||||
SelColor = text.SelColor;
|
||||
_ReflectionSpace = text._ReflectionSpace;
|
||||
_ReflectionHeight = text._ReflectionHeight;
|
||||
AllMonitors = text.AllMonitors;
|
||||
|
||||
Text = text.Text;
|
||||
Visible = text.Visible;
|
||||
@@ -294,79 +302,6 @@ namespace VocaluxeLib.Menu
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
return LoadTheme(xmlPath, elementName, xmlReader, false);
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader, bool buttonText)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref _Theme.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref _Theme.Y);
|
||||
|
||||
if (!buttonText)
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref _Theme.Z);
|
||||
|
||||
xmlReader.TryGetFloatValue(item + "/MaxW", ref _Theme.MaxWidth);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColor.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.SelColor.Get(_PartyModeID, out SelColor);
|
||||
else
|
||||
{
|
||||
if (xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R))
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref SelColor.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref SelColor.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A);
|
||||
}
|
||||
}
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Align", ref _Align);
|
||||
xmlReader.TryGetEnumValue(item + "/ResizeAlign", ref _ResizeAlign);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.FontHeight);
|
||||
ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Theme.FontStyle);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/Font", out _Theme.FontFamily);
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/Text", out _Theme.Text);
|
||||
|
||||
if (xmlReader.ItemExists(item + "/Reflection") && !buttonText)
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref _ReflectionSpace);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref _ReflectionHeight);
|
||||
_Theme.Reflection = new SReflection(_ReflectionHeight, _ReflectionSpace);
|
||||
}
|
||||
else
|
||||
_Theme.Reflection = null;
|
||||
|
||||
|
||||
// Set values
|
||||
_Theme.Name = elementName;
|
||||
_Theme.Align = _Align;
|
||||
_Theme.Color.Color = Color;
|
||||
_Theme.ResizeAlign = _ResizeAlign;
|
||||
_Theme.SelColor.Color = SelColor;
|
||||
|
||||
_ButtonText = buttonText;
|
||||
_PositionNeedsUpdate = true;
|
||||
|
||||
if (ThemeLoaded)
|
||||
LoadSkin();
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
_Draw(false);
|
||||
@@ -383,7 +318,7 @@ namespace VocaluxeLib.Menu
|
||||
SColorF currentColor = (Selected) ? SelColor : Color;
|
||||
var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
|
||||
|
||||
CBase.Fonts.DrawText(_Text, CalculatedFont, Rect.X, Rect.Y, Z, color);
|
||||
CBase.Fonts.DrawText(_Text, CalculatedFont, Rect.X, Rect.Y, Z, color, AllMonitors);
|
||||
|
||||
if (_ReflectionHeight > 0)
|
||||
CBase.Fonts.DrawTextReflection(_Text, CalculatedFont, Rect.X, Rect.Y, Z, color, _ReflectionSpace, _ReflectionHeight);
|
||||
@@ -428,7 +363,7 @@ namespace VocaluxeLib.Menu
|
||||
Y -= ry;
|
||||
}
|
||||
|
||||
public void UnloadSkin() {}
|
||||
public void UnloadSkin() { }
|
||||
|
||||
public void LoadSkin()
|
||||
{
|
||||
|
||||
@@ -25,8 +25,6 @@ namespace VocaluxeLib.Menu
|
||||
object GetTheme();
|
||||
bool ThemeLoaded { get; }
|
||||
|
||||
bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader);
|
||||
|
||||
void UnloadSkin();
|
||||
void LoadSkin();
|
||||
void ReloadSkin();
|
||||
|
||||
@@ -32,6 +32,8 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
private readonly int _Player;
|
||||
public readonly SRectF Rect;
|
||||
private readonly SColorF _Color;
|
||||
private readonly SColorF _NoteLinesColor;
|
||||
private readonly SColorF _NoteBaseColor;
|
||||
public float Alpha = 1;
|
||||
private readonly CSongLine[] _Lines;
|
||||
|
||||
@@ -61,6 +63,12 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
_Color = CBase.Themes.GetPlayerColor(player + 1);
|
||||
|
||||
if (!CBase.Themes.GetColor("NoteLinesColor", _PartyModeID, out _NoteLinesColor))
|
||||
_NoteLinesColor = new SColorF(Color.Gray, 0.5f);
|
||||
|
||||
if (!CBase.Themes.GetColor("NoteBaseColor", _PartyModeID, out _NoteBaseColor))
|
||||
_NoteBaseColor = new SColorF(Color.White);
|
||||
|
||||
SPlayer playerData = CBase.Game.GetPlayers()[player];
|
||||
_Lines = CBase.Game.GetSong().Notes.GetVoice(playerData.VoiceNr).Lines;
|
||||
_NoteLineHeight = Rect.H / CBase.Settings.GetNumNoteLines();
|
||||
@@ -88,7 +96,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
CSongLine line = _Lines[_CurrentLine];
|
||||
|
||||
if (CBase.Config.GetDrawNoteLines() == EOffOn.TR_CONFIG_ON)
|
||||
_DrawNoteLines(new SColorF(Color.Gray, 0.5f * Alpha));
|
||||
_DrawNoteLines(new SColorF(_NoteLinesColor, _NoteLinesColor.A * Alpha));
|
||||
|
||||
float beats = line.LastNoteBeat - line.FirstNoteBeat + 1;
|
||||
|
||||
@@ -102,7 +110,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
SRectF rect = _GetNoteRect(note);
|
||||
|
||||
_DrawNoteBG(rect, color);
|
||||
_DrawNote(rect, new SColorF(Color.White, 0.7f * Alpha), 0.7f);
|
||||
_DrawNoteBase(rect, new SColorF(_NoteBaseColor, _NoteBaseColor.A * Alpha), 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,9 +126,9 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (note.EndBeat == CBase.Game.GetRecordedBeat())
|
||||
rect.W -= (1 - (CBase.Game.GetMidRecordedBeat() - CBase.Game.GetRecordedBeat())) * Rect.W / beats;
|
||||
|
||||
float factor = (note.Hit) ? 0.7f : 0.4f;
|
||||
float factor = (note.Hit) ? 1f : 0.6f;
|
||||
|
||||
_DrawNote(rect, color, factor);
|
||||
_DrawNoteFill(rect, color, factor);
|
||||
|
||||
if (note.EndBeat >= CBase.Game.GetRecordedBeat() && note.Hit && note.HitNote.Type == ENoteType.Golden)
|
||||
{
|
||||
@@ -186,8 +194,8 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
lineRect.H = 1.5f;
|
||||
for (int i = 0; i < CBase.Settings.GetNumNoteLines(); i++)
|
||||
{
|
||||
lineRect.Y = Rect.Y + Rect.H / CBase.Settings.GetNumNoteLines() * (i + 1);
|
||||
CBase.Drawing.DrawRect(color, lineRect);
|
||||
lineRect.Y = (Rect.Y + Rect.H / CBase.Settings.GetNumNoteLines() * (i + 1)) - (lineRect.H / 2);
|
||||
CBase.Drawing.DrawRect(color, lineRect, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,39 +226,67 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
var color = new SColorF(_Color, _Color.A * Alpha);
|
||||
|
||||
CTextureRef toneHelper = CBase.Themes.GetSkinTexture(_Theme.SkinToneHelper, _PartyModeID);
|
||||
CBase.Drawing.DrawTexture(toneHelper, drawRect, color);
|
||||
CBase.Drawing.DrawTexture(toneHelper, drawRect, color, false);
|
||||
}
|
||||
|
||||
private void _DrawNote(SRectF rect, SColorF color, float factor)
|
||||
private void _DrawNote(SRectF rect, SColorF color, CTextureRef noteBegin, CTextureRef noteMiddle, CTextureRef noteEnd, float factor)
|
||||
{
|
||||
if (factor <= 0)
|
||||
return;
|
||||
|
||||
float dh = (1f - factor) * rect.H / 2;
|
||||
float dw = Math.Min(dh, rect.W / 2);
|
||||
//Width-related variables rounded and then floored to prevent 1px gaps in notes
|
||||
rect.X = (float)Math.Round(rect.X);
|
||||
rect.W = (float)Math.Round(rect.W);
|
||||
|
||||
int dh = (int)((1f - factor) * rect.H / 2);
|
||||
int dw = (int)Math.Min(dh, rect.W / 2);
|
||||
|
||||
var noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z);
|
||||
|
||||
//Width of each of the ends (round parts)
|
||||
//Need 2 of them so use minimum
|
||||
int endsW = (int)Math.Min(noteRect.H * noteBegin.OrigAspect, noteRect.W / 2);
|
||||
|
||||
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color, false);
|
||||
|
||||
SRectF middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
|
||||
|
||||
int midW = (int)Math.Round(noteRect.H * noteMiddle.OrigAspect);
|
||||
|
||||
int midCount = (int)middleRect.W / midW;
|
||||
|
||||
for (int i = 0; i < midCount; ++i)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(noteMiddle, new SRectF(middleRect.X + (i * midW), noteRect.Y, midW, noteRect.H, noteRect.Z), color, false);
|
||||
}
|
||||
|
||||
SRectF lastMidRect = new SRectF(middleRect.X + midCount * midW, noteRect.Y, middleRect.W - (midCount * midW), noteRect.H, noteRect.Z);
|
||||
|
||||
CBase.Drawing.DrawTexture(noteMiddle, new SRectF(middleRect.X + (midCount * midW), middleRect.Y, midW, middleRect.H, middleRect.Z), color, lastMidRect, false, false);
|
||||
|
||||
CBase.Drawing.DrawTexture(noteEnd, new SRectF(noteRect.X + noteRect.W - endsW, noteRect.Y, endsW, noteRect.H, noteRect.Z), color, false);
|
||||
}
|
||||
|
||||
private void _DrawNoteBase(SRectF rect, SColorF color, float factor)
|
||||
{
|
||||
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinLeft, _PartyModeID);
|
||||
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinMiddle, _PartyModeID);
|
||||
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(_Theme.SkinRight, _PartyModeID);
|
||||
|
||||
//Width of each of the ends (round parts)
|
||||
//Need 2 of them so use minimum
|
||||
float endsW = Math.Min(noteRect.H * noteBegin.OrigAspect, noteRect.W / 2);
|
||||
|
||||
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
|
||||
|
||||
var middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
|
||||
if (noteRect.W >= 4 * endsW)
|
||||
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color);
|
||||
else
|
||||
CBase.Drawing.DrawTexture(noteMiddle, new SRectF(middleRect.X, middleRect.Y, 2 * endsW, middleRect.H, middleRect.Z), color, middleRect);
|
||||
|
||||
CBase.Drawing.DrawTexture(noteEnd, new SRectF(noteRect.X + noteRect.W - endsW, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
|
||||
_DrawNote(rect, color, noteBegin, noteMiddle, noteEnd, factor);
|
||||
}
|
||||
|
||||
private void _DrawNoteBG(SRectF noteRect, SColorF color)
|
||||
private void _DrawNoteFill(SRectF rect, SColorF color, float factor)
|
||||
{
|
||||
|
||||
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinFillLeft, _PartyModeID);
|
||||
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinFillMiddle, _PartyModeID);
|
||||
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(_Theme.SkinFillRight, _PartyModeID);
|
||||
|
||||
_DrawNote(rect, color, noteBegin, noteMiddle, noteEnd, factor);
|
||||
}
|
||||
|
||||
private void _DrawNoteBG(SRectF rect, SColorF color)
|
||||
{
|
||||
const float period = 1500; //[ms]
|
||||
|
||||
@@ -262,33 +298,20 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
float alpha = (float)(Math.Cos(_Timer.ElapsedMilliseconds / period * Math.PI * 2) + 1) / 4 + 0.5f;
|
||||
|
||||
CTextureRef noteBackgroundBegin = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundLeft, _PartyModeID);
|
||||
CTextureRef noteBackgroundMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundMiddle, _PartyModeID);
|
||||
CTextureRef noteBackgroundEnd = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundRight, _PartyModeID);
|
||||
|
||||
float dx = noteRect.H * noteBackgroundBegin.OrigAspect;
|
||||
if (2 * dx > noteRect.W)
|
||||
dx = noteRect.W / 2;
|
||||
|
||||
var col = new SColorF(color, color.A * alpha);
|
||||
|
||||
CBase.Drawing.DrawTexture(noteBackgroundBegin, new SRectF(noteRect.X, noteRect.Y, dx, noteRect.H, noteRect.Z), col);
|
||||
CTextureRef noteBegin = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundLeft, _PartyModeID);
|
||||
CTextureRef noteMiddle = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundMiddle, _PartyModeID);
|
||||
CTextureRef noteEnd = CBase.Themes.GetSkinTexture(_Theme.SkinBackgroundRight, _PartyModeID);
|
||||
|
||||
if (noteRect.W - 2 * dx >= 2 * dx)
|
||||
CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(noteRect.X + dx, noteRect.Y, noteRect.W - 2 * dx, noteRect.H, noteRect.Z), col);
|
||||
else
|
||||
{
|
||||
CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(noteRect.X + dx, noteRect.Y, 2 * dx, noteRect.H, noteRect.Z), col,
|
||||
new SRectF(noteRect.X + dx, noteRect.Y, noteRect.W - 2 * dx, noteRect.H, noteRect.Z));
|
||||
}
|
||||
|
||||
CBase.Drawing.DrawTexture(noteBackgroundEnd, new SRectF(noteRect.X + noteRect.W - dx, noteRect.Y, dx, noteRect.H, noteRect.Z), col);
|
||||
_DrawNote(rect, col, noteBegin, noteMiddle, noteEnd, 1f);
|
||||
}
|
||||
|
||||
private void _AddGoldenNote(SRectF noteRect)
|
||||
{
|
||||
var numstars = (int)(noteRect.W * 0.25f);
|
||||
var stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(Color.Yellow), noteRect, _Theme.SkinGoldenStar, 20, EParticleType.Star);
|
||||
stars.AllMonitors = false;
|
||||
_GoldenStars.Add(stars);
|
||||
}
|
||||
|
||||
@@ -297,6 +320,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
var rect = new SRectF(noteRect.Right, noteRect.Y, 0f, noteRect.H, noteRect.Z);
|
||||
|
||||
var flares = new CParticleEffect(_PartyModeID, 15, new SColorF(Color.White), rect, _Theme.SkinGoldenStar, 20, EParticleType.Flare);
|
||||
flares.AllMonitors = false;
|
||||
_Flares.Add(flares);
|
||||
}
|
||||
|
||||
@@ -311,12 +335,14 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
var stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(Color.White), r, _Theme.SkinPerfectNoteStart, 35,
|
||||
EParticleType.PerfNoteStar);
|
||||
stars.AllMonitors = false;
|
||||
_PerfectNoteEffect.Add(stars);
|
||||
}
|
||||
|
||||
private void _AddPerfectLine()
|
||||
{
|
||||
var twinkle = new CParticleEffect(_PartyModeID, 200, _Color, Rect, _Theme.SkinGoldenStar, 25, EParticleType.Twinkle);
|
||||
twinkle.AllMonitors = false;
|
||||
_PerfectLineTwinkle.Add(twinkle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,26 +20,31 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
[XmlType("Position")]
|
||||
public struct SBarPosition
|
||||
{
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
public SRectF Rect;
|
||||
}
|
||||
|
||||
[XmlType("SingBar")]
|
||||
public struct SThemeSingBar
|
||||
{
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
|
||||
public string SkinLeft;
|
||||
public string SkinMiddle;
|
||||
public string SkinRight;
|
||||
|
||||
public string SkinFillLeft;
|
||||
public string SkinFillMiddle;
|
||||
public string SkinFillRight;
|
||||
|
||||
public string SkinBackgroundLeft;
|
||||
public string SkinBackgroundMiddle;
|
||||
public string SkinBackgroundRight;
|
||||
@@ -48,7 +53,8 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
public string SkinToneHelper;
|
||||
public string SkinPerfectNoteStart;
|
||||
|
||||
[XmlArray("BarPositions")] public SBarPosition[] BarPos;
|
||||
[XmlArray("BarPositions")]
|
||||
public SBarPosition[] BarPos;
|
||||
}
|
||||
|
||||
public class CSingNotes : CMenuElementBase, IMenuElement, IThemeable
|
||||
@@ -75,12 +81,12 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
/// <remarks>
|
||||
/// first index = player number; second index = num players seen on screen
|
||||
/// </remarks>
|
||||
private SRectF[,] _BarPos { get; set; }
|
||||
private SRectF[,,] _BarPos { get; set; }
|
||||
|
||||
public CSingNotes(int partyModeID)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
_Theme = new SThemeSingBar {BarPos = new SBarPosition[CHelper.Sum(CBase.Settings.GetMaxNumPlayer())]};
|
||||
_Theme = new SThemeSingBar { BarPos = new SBarPosition[CHelper.Sum(CBase.Settings.GetMaxNumPlayer() * CBase.Settings.GetMaxNumScreens())] };
|
||||
ThemeLoaded = false;
|
||||
}
|
||||
|
||||
@@ -89,7 +95,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
_PartyModeID = partyModeID;
|
||||
_Theme = theme;
|
||||
|
||||
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
|
||||
_BarPos = new SRectF[CBase.Settings.GetMaxNumScreens(), CBase.Settings.GetMaxNumPlayer(), CBase.Settings.GetMaxNumPlayer()];
|
||||
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
@@ -101,62 +107,51 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
public bool ThemeLoaded { get; private set; }
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
public void Init(int numPlayers, int numScreens = 0)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinLeft", out _Theme.SkinLeft, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinMiddle", out _Theme.SkinMiddle, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinRight", out _Theme.SkinRight, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundLeft", out _Theme.SkinBackgroundLeft, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundMiddle", out _Theme.SkinBackgroundMiddle, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundRight", out _Theme.SkinBackgroundRight, String.Empty);
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinGoldenStar", out _Theme.SkinGoldenStar, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", out _Theme.SkinToneHelper, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStart, String.Empty);
|
||||
|
||||
int i = 0;
|
||||
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
|
||||
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
|
||||
PlayerNotes.Clear();
|
||||
if (numPlayers > 0 && numScreens > 0)
|
||||
{
|
||||
for (int player = 0; player <= numplayer; player++)
|
||||
int[] screenAssignment = new int[numPlayers];
|
||||
int screenPlayers = numPlayers / numScreens;
|
||||
int remainingPlayers = numPlayers - (screenPlayers * numScreens);
|
||||
int player = 0;
|
||||
|
||||
for (int s = 0; s < numScreens; s++)
|
||||
{
|
||||
_BarPos[player, numplayer] = new SRectF();
|
||||
string target = "/BarPositions/P" + (player + 1) + "N" + (numplayer + 1);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref _BarPos[player, numplayer].W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref _BarPos[player, numplayer].H);
|
||||
_Theme.BarPos[i].Name = "P" + (player + 1) + "N" + (numplayer + 1);
|
||||
_Theme.BarPos[i].Rect = _BarPos[player, numplayer];
|
||||
i++;
|
||||
for (int p = 0; p < screenPlayers; p++)
|
||||
{
|
||||
if (remainingPlayers > 0)
|
||||
{
|
||||
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, p, screenPlayers], _Theme));
|
||||
if (p == screenPlayers - 1)
|
||||
{
|
||||
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, p + 1, screenPlayers], _Theme));
|
||||
remainingPlayers--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, p, screenPlayers - 1], _Theme));
|
||||
}
|
||||
|
||||
}
|
||||
//Handle when players < screens
|
||||
if (screenPlayers == 0 && remainingPlayers > 0)
|
||||
{
|
||||
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, 0, 0], _Theme));
|
||||
remainingPlayers--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
return ThemeLoaded;
|
||||
}
|
||||
|
||||
public void Init(int numPlayers)
|
||||
{
|
||||
PlayerNotes.Clear();
|
||||
for (int p = 0; p < numPlayers; p++)
|
||||
PlayerNotes.Add(new CNoteBars(_PartyModeID, p, _BarPos[p, numPlayers - 1], _Theme));
|
||||
if (numPlayers == 0)
|
||||
_Rect = new SRectF(0, 0, 0, 0, Rect.Z);
|
||||
else
|
||||
{
|
||||
_Rect.X = PlayerNotes.Select(bp => bp.Rect.X).Min();
|
||||
_Rect.Y = PlayerNotes.Select(bp => bp.Rect.X).Min();
|
||||
_Rect.Y = PlayerNotes.Select(bp => bp.Rect.Y).Min();
|
||||
_Rect.Right = PlayerNotes.Select(bp => bp.Rect.Right).Max();
|
||||
_Rect.Bottom = PlayerNotes.Select(bp => bp.Rect.Bottom).Max();
|
||||
_Rect.Z = PlayerNotes.Select(bp => bp.Rect.Z).Average();
|
||||
@@ -169,7 +164,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
noteBars.Draw();
|
||||
}
|
||||
|
||||
public void UnloadSkin() {}
|
||||
public void UnloadSkin() { }
|
||||
|
||||
public void LoadSkin()
|
||||
{
|
||||
@@ -183,8 +178,11 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
int n = Int32.Parse(bp.Name.Substring(3, 1)) - 1;
|
||||
int p = Int32.Parse(bp.Name.Substring(1, 1)) - 1;
|
||||
|
||||
_BarPos[p, n] = bp.Rect;
|
||||
for (int s = 0; s < CBase.Settings.GetMaxNumScreens(); s++)
|
||||
{
|
||||
_BarPos[s, p, n] = bp.Rect;
|
||||
_BarPos[s, p, n].X += s * CBase.Settings.GetRenderW();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,9 +198,9 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY) {}
|
||||
public void MoveElement(int stepX, int stepY) { }
|
||||
|
||||
public void ResizeElement(int stepW, int stepH) {}
|
||||
public void ResizeElement(int stepW, int stepH) { }
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,10 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Serialization;
|
||||
using VocaluxeLib.PartyModes;
|
||||
using VocaluxeLib.Songs;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
@@ -201,80 +199,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
return _Theme;
|
||||
}
|
||||
|
||||
public virtual bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
ThemeLoaded = true;
|
||||
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/CoverBackground", out _Theme.CoverBackground, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/CoverBigBackground", out _Theme.CoverBigBackground, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/DuetIcon", out _Theme.DuetIcon, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/VideoIcon", out _Theme.VideoIcon, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/MedleyCalcIcon", out _Theme.MedleyCalcIcon, String.Empty);
|
||||
ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", out _Theme.MedleyTagIcon, String.Empty);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
|
||||
ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out _ColorInternal);
|
||||
else
|
||||
{
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _ColorInternal.R);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref _ColorInternal.G);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _ColorInternal.B);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _ColorInternal.A);
|
||||
}
|
||||
_Theme.Color.Color = _ColorInternal;
|
||||
|
||||
#region SongMenuTileBoard
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumW", ref _Theme.SongMenuTileBoard.NumW);
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumH", ref _Theme.SongMenuTileBoard.NumH);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/SpaceW", ref _Theme.SongMenuTileBoard.SpaceW);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/SpaceH", ref _Theme.SongMenuTileBoard.SpaceH);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumWsmall", ref _Theme.SongMenuTileBoard.NumWsmall);
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumHsmall", ref _Theme.SongMenuTileBoard.NumHsmall);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectX", ref _Theme.SongMenuTileBoard.TileRect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectY", ref _Theme.SongMenuTileBoard.TileRect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectZ", ref _Theme.SongMenuTileBoard.TileRect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectW", ref _Theme.SongMenuTileBoard.TileRect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectH", ref _Theme.SongMenuTileBoard.TileRect.H);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallX", ref _Theme.SongMenuTileBoard.TileRectSmall.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallY", ref _Theme.SongMenuTileBoard.TileRectSmall.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallZ", ref _Theme.SongMenuTileBoard.TileRectSmall.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallW", ref _Theme.SongMenuTileBoard.TileRectSmall.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallH", ref _Theme.SongMenuTileBoard.TileRectSmall.H);
|
||||
#endregion SongMenuTileBoard
|
||||
|
||||
#region SongMenuList
|
||||
ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuList/ListLength", ref _Theme.SongMenuList.ListLength);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/SpaceW", ref _Theme.SongMenuList.SpaceW);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/SpaceH", ref _Theme.SongMenuList.SpaceH);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRect/X", ref _Theme.SongMenuList.TileRect.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRect/Y", ref _Theme.SongMenuList.TileRect.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRect/Z", ref _Theme.SongMenuList.TileRect.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRect/W", ref _Theme.SongMenuList.TileRect.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRect/H", ref _Theme.SongMenuList.TileRect.H);
|
||||
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRectSmall/X", ref _Theme.SongMenuList.TileRectSmall.X);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRectSmall/Y", ref _Theme.SongMenuList.TileRectSmall.Y);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRectSmall/Z", ref _Theme.SongMenuList.TileRectSmall.Z);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRectSmall/W", ref _Theme.SongMenuList.TileRectSmall.W);
|
||||
ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuList/TileRectSmall/H", ref _Theme.SongMenuList.TileRectSmall.H);
|
||||
#endregion SongMenuList
|
||||
|
||||
if (ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
|
||||
LoadSkin();
|
||||
Init();
|
||||
}
|
||||
|
||||
return ThemeLoaded;
|
||||
}
|
||||
#endregion Theme
|
||||
|
||||
public virtual void Init()
|
||||
@@ -415,7 +339,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (song == null)
|
||||
return;
|
||||
|
||||
CBase.BackgroundMusic.LoadPreview(song);
|
||||
CBase.BackgroundMusic.LoadPreview(song, song.Preview.StartTime);
|
||||
}
|
||||
|
||||
protected void _ResetPreview(bool playBGagain = true)
|
||||
|
||||
@@ -22,7 +22,6 @@ using System.Windows.Forms;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.PartyModes;
|
||||
using VocaluxeLib.Songs;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
@@ -128,39 +127,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_SubElements.AddRange(new IMenuElement[] {_Artist, _Title, _SongLength, _DuetIcon, _VideoIcon, _MedleyCalcIcon, _MedleyTagIcon});
|
||||
}
|
||||
|
||||
public override bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
|
||||
bool themeLoaded = true;
|
||||
themeLoaded &= base.LoadTheme(xmlPath, elementName, xmlReader);
|
||||
|
||||
|
||||
themeLoaded &= _Artist.LoadTheme(item + "/SongMenuList", "TextArtist", xmlReader);
|
||||
themeLoaded &= _Title.LoadTheme(item + "/SongMenuList", "TextTitle", xmlReader);
|
||||
themeLoaded &= _SongLength.LoadTheme(item + "/SongMenuList", "TextSongLength", xmlReader);
|
||||
|
||||
themeLoaded &= _CoverBig.LoadTheme(item + "/SongMenuList", "StaticCoverBig", xmlReader);
|
||||
themeLoaded &= _TextBG.LoadTheme(item + "/SongMenuList", "StaticTextBG", xmlReader);
|
||||
themeLoaded &= _DuetIcon.LoadTheme(item + "/SongMenuList", "StaticDuetIcon", xmlReader);
|
||||
themeLoaded &= _VideoIcon.LoadTheme(item + "/SongMenuList", "StaticVideoIcon", xmlReader);
|
||||
themeLoaded &= _MedleyCalcIcon.LoadTheme(item + "/SongMenuList", "StaticMedleyCalcIcon", xmlReader);
|
||||
themeLoaded &= _MedleyTagIcon.LoadTheme(item + "/SongMenuList", "StaticMedleyTagIcon", xmlReader);
|
||||
|
||||
if (themeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
|
||||
_ReadSubTheme();
|
||||
_SubElements.Clear();
|
||||
_SubElements.AddRange(new IMenuElement[] { _Artist, _Title, _SongLength, _DuetIcon, _VideoIcon, _MedleyCalcIcon, _MedleyTagIcon });
|
||||
LoadSkin();
|
||||
Init();
|
||||
}
|
||||
|
||||
return themeLoaded;
|
||||
}
|
||||
|
||||
private void _ReadSubTheme()
|
||||
{
|
||||
_Theme.SongMenuList.TextArtist = (SThemeText)_Artist.GetTheme();
|
||||
|
||||
@@ -22,7 +22,6 @@ using System.Windows.Forms;
|
||||
using VocaluxeLib.Draw;
|
||||
using VocaluxeLib.PartyModes;
|
||||
using VocaluxeLib.Songs;
|
||||
using VocaluxeLib.Xml;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
@@ -132,39 +131,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Tiles[tileNr].Selected = true;
|
||||
}
|
||||
|
||||
public override bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
{
|
||||
string item = xmlPath + "/" + elementName;
|
||||
|
||||
bool themeLoaded = true;
|
||||
themeLoaded &= base.LoadTheme(xmlPath, elementName, xmlReader);
|
||||
|
||||
|
||||
themeLoaded &= _Artist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader);
|
||||
themeLoaded &= _Title.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader);
|
||||
themeLoaded &= _SongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader);
|
||||
|
||||
themeLoaded &= _CoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader);
|
||||
themeLoaded &= _TextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader);
|
||||
themeLoaded &= _DuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader);
|
||||
themeLoaded &= _VideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader);
|
||||
themeLoaded &= _MedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader);
|
||||
themeLoaded &= _MedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader);
|
||||
|
||||
if (themeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
|
||||
_ReadSubTheme();
|
||||
_SubElements.Clear();
|
||||
_SubElements.AddRange(new IMenuElement[] {_Artist, _Title, _SongLength, _DuetIcon, _VideoIcon, _MedleyCalcIcon, _MedleyTagIcon});
|
||||
LoadSkin();
|
||||
Init();
|
||||
}
|
||||
|
||||
return themeLoaded;
|
||||
}
|
||||
|
||||
private void _ReadSubTheme()
|
||||
{
|
||||
_Theme.SongMenuTileBoard.TextArtist = (SThemeText)_Artist.GetTheme();
|
||||
|
||||
Reference in new issue
Block a user