Merge branch 'Better_Graphics_Handling' into Automatic_Covers

Conflicts:
	Vocaluxe/Base/CCover.cs
	Vocaluxe/Base/CGraphics.cs
	Vocaluxe/Base/Fonts/CFontStyle.cs
	Vocaluxe/Base/Fonts/CGlyph.cs
	VocaluxeLib/Menu/CText.cs
	VocaluxeLib/Structs.cs
This commit is contained in:
Flamefire committed 2014-09-25 19:43:21 +02:00
commit dd1231ad34
603 files changed
+25356 -25970

No files matched your search

+70 -107
View File
@@ -16,8 +16,8 @@
#endregion
using System;
using System.Drawing;
using System.Xml;
using System.Xml.Serialization;
using System.Diagnostics;
using System.Collections.Generic;
using VocaluxeLib.Draw;
@@ -33,18 +33,20 @@ namespace VocaluxeLib.Menu
Video
}
struct SThemeBackground
[XmlType("Background")]
public struct SThemeBackground
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
[XmlElement("Type")]
public EBackgroundTypes Type;
[XmlArray]
public List<string> SlideShowTextures;
[XmlElement("Video")]
public string VideoName;
[XmlElement("Skin")]
public string TextureName;
public string ColorName;
public SThemeColor Color;
}
public class CBackground : IMenuElement
@@ -55,9 +57,13 @@ namespace VocaluxeLib.Menu
private int _SlideShowCurrent;
private readonly Stopwatch _SlideShowTimer = new Stopwatch();
private readonly List<CTexture> _SlideShowTextures = new List<CTexture>();
private readonly List<CTextureRef> _SlideShowTextures = new List<CTextureRef>();
public SColorF Color;
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public string GetThemeName()
{
@@ -73,6 +79,14 @@ namespace VocaluxeLib.Menu
Color = new SColorF(0f, 0f, 0f, 1f);
}
public CBackground(SThemeBackground theme, int partyModeID)
{
_Theme = theme;
_PartyModeID = partyModeID;
LoadTextures();
}
#endregion Constructors
#region public
@@ -87,8 +101,8 @@ namespace VocaluxeLib.Menu
bool tex = xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
_ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
else
{
bool success = true;
@@ -101,6 +115,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= success;
}
_Theme.Color.Color = new SColorF(Color);
int i = 1;
while (xmlReader.ItemExists(item + "/SlideShow" + i))
@@ -120,46 +136,6 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<Type>: Background type: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundTypes))));
writer.WriteElementString("Type", Enum.GetName(typeof(EBackgroundTypes), _Theme.Type));
writer.WriteComment("<Video>: Background video name");
writer.WriteElementString("Video", _Theme.VideoName);
writer.WriteComment("<Skin>: Background Texture name");
writer.WriteElementString("Skin", _Theme.TextureName);
writer.WriteComment("<SlideShow%>: Texture name for slide-show");
for (int i = 0; i < _Theme.SlideShowTextures.Count; i++)
writer.WriteElementString("SlideShow" + (i + 1), _Theme.SlideShowTextures[i]);
writer.WriteComment("<Color>: Background color for type \"Color\" from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
if (_Theme.Type != EBackgroundTypes.None)
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00"));
}
}
writer.WriteEndElement();
return true;
}
return false;
}
public void Resume()
{
if (_Theme.Type == EBackgroundTypes.Video && !String.IsNullOrEmpty(_Theme.VideoName) && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
@@ -172,36 +148,31 @@ namespace VocaluxeLib.Menu
CBase.Theme.SkinVideoPause(_Theme.VideoName, _PartyModeID);
}
public bool Draw()
public void Draw()
{
bool ok = false;
if (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON &&
CBase.Config.GetVideosToBackground() == EOffOn.TR_CONFIG_ON && CBase.BackgroundMusic.IsPlaying() && CBase.BackgroundMusic.SongHasVideo() &&
CBase.BackgroundMusic.VideoEnabled() && !CBase.BackgroundMusic.IsDisabled())
if (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
{
Pause();
ok = _DrawBackgroundMusicVideo();
if (CBase.Config.GetVideosToBackground() == EOffOn.TR_CONFIG_ON && CBase.BackgroundMusic.IsPlaying() && CBase.BackgroundMusic.SongHasVideo() &&
CBase.BackgroundMusic.VideoEnabled())
{
Pause();
ok = _DrawBackgroundMusicVideo();
}
else
{
Resume();
ok = _DrawVideo();
}
}
else if (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
{
Resume();
ok = _DrawVideo();
}
if (_Theme.Type == EBackgroundTypes.SlideShow && _Theme.SlideShowTextures.Count > 0)
else if (_Theme.Type == EBackgroundTypes.SlideShow && _Theme.SlideShowTextures.Count > 0)
ok = _DrawSlideShow();
if (!String.IsNullOrEmpty(_Theme.TextureName) &&
(_Theme.Type == EBackgroundTypes.Texture ||
(_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF)))
if (!String.IsNullOrEmpty(_Theme.TextureName) && (_Theme.Type == EBackgroundTypes.Texture || !ok))
ok = _DrawTexture();
if (_Theme.Type == EBackgroundTypes.Color || _Theme.Type == EBackgroundTypes.Texture && !ok ||
(_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF && !ok))
if (_Theme.Type == EBackgroundTypes.Color || !ok)
_DrawColor();
return true;
}
public void UnloadTextures()
@@ -211,8 +182,8 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
foreach (string s in _Theme.SlideShowTextures)
_SlideShowTextures.Add(CBase.Theme.GetSkinTexture(s, _PartyModeID));
@@ -223,7 +194,7 @@ namespace VocaluxeLib.Menu
_Theme.Type = EBackgroundTypes.SlideShow;
if (!String.IsNullOrEmpty(image))
{
CTexture texture = CBase.Drawing.AddTexture(image);
CTextureRef texture = CBase.Drawing.AddTexture(image);
if (texture != null)
_SlideShowTextures.Add(texture);
}
@@ -231,9 +202,9 @@ namespace VocaluxeLib.Menu
public void RemoveSlideShowTextures()
{
foreach (CTexture tex in _SlideShowTextures)
foreach (CTextureRef tex in _SlideShowTextures)
{
CTexture texture = tex;
CTextureRef texture = tex;
CBase.Drawing.RemoveTexture(ref texture);
}
_SlideShowTextures.Clear();
@@ -244,26 +215,30 @@ namespace VocaluxeLib.Menu
UnloadTextures();
LoadTextures();
}
public SThemeBackground GetTheme()
{
return _Theme;
}
#endregion public
#region internal
private static SRectF _GetDrawRect()
{
return new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4);
}
private void _DrawColor()
{
var bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4);
CBase.Drawing.DrawColor(Color, bounds);
CBase.Drawing.DrawRect(Color, _GetDrawRect());
}
private bool _DrawTexture()
{
CTexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
CTextureRef texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
if (texture != null)
{
var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
CBase.Drawing.DrawTexture(texture, _GetDrawRect(), EAspect.Crop);
return true;
}
return false;
@@ -284,20 +259,16 @@ namespace VocaluxeLib.Menu
_SlideShowTimer.Restart();
if (_SlideShowCurrent + 1 < _SlideShowTextures.Count)
_SlideShowCurrent++;
else if (_SlideShowCurrent != 0)
else
_SlideShowCurrent = 0;
}
CTexture texture = _SlideShowTextures[_SlideShowCurrent];
CTextureRef texture = _SlideShowTextures[_SlideShowCurrent];
if (texture == null)
return false;
var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
CBase.Drawing.DrawTexture(texture, _GetDrawRect(), EAspect.Crop);
if (_SlideShowTimer.ElapsedMilliseconds >= CBase.Settings.GetSlideShowImageTime())
{
@@ -310,9 +281,9 @@ namespace VocaluxeLib.Menu
if (texture != null)
{
float alpha = (_SlideShowTimer.ElapsedMilliseconds - CBase.Settings.GetSlideShowImageTime()) / CBase.Settings.GetSlideShowFadeTime();
CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, (CBase.Settings.GetZFar() / 4) - 1), new SColorF(1, 1, 1, alpha));
SColorF color = texture.Color;
color.A = (_SlideShowTimer.ElapsedMilliseconds - CBase.Settings.GetSlideShowImageTime()) / CBase.Settings.GetSlideShowFadeTime();
CBase.Drawing.DrawTexture(texture, _GetDrawRect(), EAspect.Crop, color);
}
}
@@ -323,14 +294,10 @@ namespace VocaluxeLib.Menu
private bool _DrawVideo()
{
CTexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
CTextureRef videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
if (videoTexture != null)
{
var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
CBase.Drawing.DrawTexture(videoTexture, _GetDrawRect(), EAspect.Crop);
return true;
}
return false;
@@ -338,14 +305,10 @@ namespace VocaluxeLib.Menu
private bool _DrawBackgroundMusicVideo()
{
CTexture videoTexture = CBase.BackgroundMusic.GetVideoTexture();
CTextureRef videoTexture = CBase.BackgroundMusic.GetVideoTexture();
if (videoTexture != null)
{
var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
CBase.Drawing.DrawTexture(videoTexture, _GetDrawRect(), EAspect.Crop);
return true;
}
return false;
+130 -105
View File
@@ -17,19 +17,35 @@
using System;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
struct SThemeButton
[XmlType("Button")]
public struct SThemeButton
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
public string ColorName;
public string SelColorName;
[XmlElement("Skin")]
public string TextureName;
[XmlElement("SkinSelected")]
public string SelTextureName;
public SRectF Rect;
[XmlElement("Color")]
public SThemeColor Color;
[XmlElement("SelColor")]
public SThemeColor SelColor;
[XmlElement("Text")]
public SThemeText Text;
[XmlElement("SText")]
public SThemeText SText;
public bool STextSpecified;
[XmlElement("Reflection")]
public SReflection Reflection;
[XmlElement("SelReflection")]
public SReflection SelReflection;
}
public class CButton : IMenuElement
@@ -38,15 +54,14 @@ namespace VocaluxeLib.Menu
private bool _ThemeLoaded;
private readonly int _PartyModeID;
public CTexture Texture;
public CTexture SelTexture;
public CTextureRef Texture;
public CTextureRef SelTexture;
public SRectF Rect;
public SColorF Color;
public SColorF SelColor;
private bool _IsSelText;
public readonly CText Text;
private readonly CText _SelText;
public CText Text;
private CText _SelText;
private bool _Reflection;
private float _ReflectionSpace;
@@ -79,13 +94,29 @@ namespace VocaluxeLib.Menu
}
}
public bool Visible = true;
public bool Enabled = true;
private bool _Enabled = true;
public bool Enabled
{
get { return _Enabled; }
set
{
_Enabled = value;
if (!_Enabled)
_Selected = false;
}
}
public string GetThemeName()
{
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public CButton(int partyModeID)
{
_PartyModeID = partyModeID;
@@ -95,13 +126,25 @@ namespace VocaluxeLib.Menu
EditMode = false;
}
public CButton(SThemeButton theme, int partyModeID, bool buttonText = false)
{
_PartyModeID = partyModeID;
_Theme = theme;
Text = new CText(_Theme.Text, _PartyModeID, buttonText);
_SelText = new CText(_Theme.SText, _PartyModeID, buttonText);
Selected = false;
EditMode = false;
LoadTextures();
}
public CButton(CButton button)
{
_PartyModeID = button._PartyModeID;
_Theme = new SThemeButton
{
ColorName = button._Theme.ColorName,
SelColorName = button._Theme.SelColorName,
TextureName = button._Theme.TextureName,
SelTextureName = button._Theme.SelTextureName
};
@@ -116,7 +159,7 @@ namespace VocaluxeLib.Menu
_SelText = new CText(button._SelText);
Selected = false;
EditMode = false;
Enabled = button.Enabled;
_Enabled = button._Enabled;
_Reflection = button._Reflection;
_ReflectionHeight = button._ReflectionHeight;
@@ -141,8 +184,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -151,8 +194,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor);
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColor.Name, skinIndex, out SelColor);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R);
@@ -165,7 +208,7 @@ namespace VocaluxeLib.Menu
Text.Z = Rect.Z;
if (xmlReader.ItemExists(item + "/SText"))
{
_IsSelText = true;
_Theme.STextSpecified = true;
_ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, skinIndex, true);
_SelText.Z = Rect.Z;
}
@@ -177,111 +220,52 @@ namespace VocaluxeLib.Menu
_Reflection = true;
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref _ReflectionSpace);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref _ReflectionHeight);
_Theme.Reflection = new SReflection(true, _ReflectionHeight, _ReflectionSpace);
}
else
{
_Reflection = false;
_Theme.Reflection = new SReflection(false, 0f, 0f);
}
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(true, _SelReflectionHeight, _SelReflectionSpace);
}
else
{
_SelReflection = false;
_Theme.SelReflection = new SReflection(false, 0f, 0f);
}
if (_ThemeLoaded)
{
_Theme.Name = elementName;
_Theme.Rect = new SRectF(Rect);
_Theme.Color.Color = new SColorF(Color);
_Theme.SelColor.Color = new SColorF(SelColor);
_Theme.Text = Text.GetTheme();
_Theme.SText = _SelText.GetTheme();
LoadTextures();
}
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<Skin>: Texture name");
writer.WriteElementString("Skin", _Theme.TextureName);
writer.WriteComment("<SkinSelected>: Texture name for selected button");
writer.WriteElementString("SkinSelected", _Theme.SelTextureName);
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: Button position, width and height");
writer.WriteElementString("X", Rect.X.ToString("#0"));
writer.WriteElementString("Y", Rect.Y.ToString("#0"));
writer.WriteElementString("Z", Rect.Z.ToString("#0.00"));
writer.WriteElementString("W", Rect.W.ToString("#0"));
writer.WriteElementString("H", Rect.H.ToString("#0"));
writer.WriteComment("<Color>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00"));
}
writer.WriteComment("<SColor>: Selected button color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.SelColorName))
writer.WriteElementString("SColor", _Theme.SelColorName);
else
{
writer.WriteElementString("SR", SelColor.R.ToString("#0.00"));
writer.WriteElementString("SG", SelColor.G.ToString("#0.00"));
writer.WriteElementString("SB", SelColor.B.ToString("#0.00"));
writer.WriteElementString("SA", SelColor.A.ToString("#0.00"));
}
Text.SaveTheme(writer);
if (_IsSelText)
_SelText.SaveTheme(writer);
writer.WriteComment("<Reflection> If exists:");
writer.WriteComment(" <Space>: Reflection Space");
writer.WriteComment(" <Height>: Reflection Height");
if (_Reflection)
{
writer.WriteStartElement("Reflection");
writer.WriteElementString("Space", _ReflectionSpace.ToString("#0"));
writer.WriteElementString("Height", _ReflectionHeight.ToString("#0"));
writer.WriteEndElement();
}
writer.WriteComment("<SReflection> If exists:");
writer.WriteComment(" <Space>: Reflection Space of selected button");
writer.WriteComment(" <Height>: Reflection Height of selected button");
if (_SelReflection)
{
writer.WriteStartElement("SReflection");
writer.WriteElementString("Space", _ReflectionSpace.ToString("#0"));
writer.WriteElementString("Height", _ReflectionHeight.ToString("#0"));
writer.WriteEndElement();
}
writer.WriteEndElement();
return true;
}
return false;
}
public void Draw(bool forceDraw = false)
{
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme && !forceDraw)
return;
CTexture texture;
CTextureRef texture;
if (!Selected && !Pressed || !Enabled)
if (!Selected && !Pressed || !_Enabled)
{
texture = Texture ?? CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
@@ -289,13 +273,13 @@ namespace VocaluxeLib.Menu
if (_Reflection)
{
CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, _ReflectionSpace, _ReflectionHeight);
CBase.Drawing.DrawTextureReflection(texture, Rect, Color, _ReflectionSpace, _ReflectionHeight);
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
}
else
Text.DrawRelative(Rect.X, Rect.Y);
}
else if (!_IsSelText)
else if (!_Theme.STextSpecified)
{
texture = Texture ?? CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
@@ -303,13 +287,13 @@ namespace VocaluxeLib.Menu
if (_Reflection)
{
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight);
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, _ReflectionSpace, _ReflectionHeight);
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
}
else
Text.DrawRelative(Rect.X, Rect.Y);
}
else if (_IsSelText)
else if (_Theme.STextSpecified)
{
texture = SelTexture ?? CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
@@ -317,7 +301,7 @@ namespace VocaluxeLib.Menu
if (_Reflection)
{
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight);
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, _ReflectionSpace, _ReflectionHeight);
_SelText.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
}
else
@@ -337,13 +321,43 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
Text = new CText(_Theme.Text, _PartyModeID);
Text.LoadTextures();
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.STextSpecified)
{
_SelText = new CText(_Theme.SText, _PartyModeID);
_SelText.LoadTextures();
}
if (!String.IsNullOrEmpty(_Theme.SelColorName))
SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
else
Color = _Theme.Color.Color;
if (!String.IsNullOrEmpty(_Theme.SelColor.Name))
SelColor = CBase.Theme.GetColor(_Theme.SelColor.Name, _PartyModeID);
else
SelColor = _Theme.SelColor.Color;
Rect = _Theme.Rect;
_Reflection = _Theme.Reflection.Enabled;
if (_Reflection)
{
_ReflectionHeight = _Theme.Reflection.Height;
_ReflectionSpace = _Theme.Reflection.Space;
}
_SelReflection = _Theme.Reflection.Enabled;
if (_SelReflection)
{
_SelReflectionHeight = _Theme.SelReflection.Height;
_SelReflectionSpace = _Theme.SelReflection.Space;
}
if (_Theme.Rect.Z < Text.Z)
Text.Z = _Theme.Rect.Z;
}
public void ReloadTextures()
@@ -352,11 +366,19 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public SThemeButton GetTheme()
{
return _Theme;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
}
public void ResizeElement(int stepW, int stepH)
@@ -368,6 +390,9 @@ namespace VocaluxeLib.Menu
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
}
#endregion ThemeEdit
}
+86 -83
View File
@@ -17,26 +17,42 @@
using System;
using System.Xml;
using System.Xml.Serialization;
namespace VocaluxeLib.Menu
{
enum EEqualizerStyle
public enum EEqualizerStyle
{
Columns
}
struct SThemeEqualizer
[XmlType("Equalizer")]
public struct SThemeEqualizer
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
public string ColorName;
public string MaxColorName;
[XmlElement("Skin")]
public string TextureName;
public int NumBars;
[XmlElement("Rect")]
public SRectF Rect;
[XmlElement("NumBars")]
public int NumBars;
[XmlElement("Space")]
public float Space;
[XmlElement("Style")]
public EEqualizerStyle Style;
[XmlElement("DrawNegative")]
public EOffOn DrawNegative;
[XmlElement("Color")]
public SThemeColor Color;
[XmlElement("MaxColor")]
public SThemeColor MaxColor;
[XmlElement("Reflection")]
public SReflection Reflection;
}
public class CEqualizer : IMenuElement
@@ -63,6 +79,11 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
private float[] _Bars;
private int _MaxBar;
private float _MaxVolume;
@@ -86,6 +107,17 @@ namespace VocaluxeLib.Menu
ReflectionHeight = 0f;
}
public CEqualizer(SThemeEqualizer theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
Visible = true;
ScreenHandles = false;
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
@@ -107,8 +139,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/DrawNegative", ref _Theme.DrawNegative);
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -117,8 +149,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
if (xmlReader.GetValue(item + "/MaxColor", out _Theme.MaxColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
if (xmlReader.GetValue(item + "/MaxColor", out _Theme.MaxColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.MaxColor.Name, skinIndex, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/MaxR", ref MaxColor.R);
@@ -133,86 +165,28 @@ namespace VocaluxeLib.Menu
Reflection = true;
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref ReflectionHeight);
_Theme.Reflection = new SReflection(true, ReflectionHeight, ReflectionSpace);
}
else
{
Reflection = false;
_Theme.Reflection = new SReflection(false, 0f, 0f);
}
if (_ThemeLoaded)
{
_Theme.Name = elementName;
_Bars = new float[_Theme.NumBars];
for (int i = 0; i < _Bars.Length; i++)
_Bars[i] = 0f;
_Theme.Space = Space;
_Theme.Color.Color = new SColorF(Color);
_Theme.MaxColor.Color = new SColorF(MaxColor);
_Theme.Rect = Rect;
LoadTextures();
}
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<Skin>: Texture name");
writer.WriteElementString("Skin", _Theme.TextureName);
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: Equalizer position, width and height");
writer.WriteElementString("X", Rect.X.ToString("#0"));
writer.WriteElementString("Y", Rect.Y.ToString("#0"));
writer.WriteElementString("Z", Rect.Z.ToString("#0.00"));
writer.WriteElementString("W", Rect.W.ToString("#0"));
writer.WriteElementString("H", Rect.H.ToString("#0"));
writer.WriteComment("<NumBars>: Number of equalizer-elements.");
writer.WriteElementString("NumBars", _Theme.NumBars.ToString("#0"));
writer.WriteComment("<Space>: Space between equalizer-elements.");
writer.WriteElementString("Space", Space.ToString("#0.00"));
writer.WriteComment("<Style>: Style of equalizer-elements: " + CHelper.ListStrings(Enum.GetNames(typeof(EEqualizerStyle))));
writer.WriteElementString("Style", Enum.GetName(typeof(EEqualizerStyle), _Theme.Style));
writer.WriteComment("<DrawNegative>: Draw negative values: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("DrawNegative", Enum.GetName(typeof(EOffOn), _Theme.DrawNegative));
writer.WriteComment("<Color>: Equalizer color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00"));
}
writer.WriteComment("<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)");
writer.WriteComment("or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("MaxColor", _Theme.ColorName);
else
{
writer.WriteElementString("MaxR", Color.R.ToString("#0.00"));
writer.WriteElementString("MaxG", Color.G.ToString("#0.00"));
writer.WriteElementString("MaxB", Color.B.ToString("#0.00"));
writer.WriteElementString("MaxA", Color.A.ToString("#0.00"));
}
writer.WriteComment("<Reflection> If exists:");
writer.WriteComment(" <Space>: Reflection Space");
writer.WriteComment(" <Height>: Reflection Height");
if (Reflection)
{
writer.WriteStartElement("Reflection");
writer.WriteElementString("Space", ReflectionSpace.ToString("#0"));
writer.WriteElementString("Height", ReflectionHeight.ToString("#0"));
writer.WriteEndElement();
}
writer.WriteEndElement();
return true;
}
return false;
}
public void Update(float[] weights, float volume)
{
if (weights == null || weights.Length == 0 || _Bars == null)
@@ -275,10 +249,10 @@ namespace VocaluxeLib.Menu
if (i == _MaxBar)
color = MaxColor;
CBase.Drawing.DrawColor(color, bar);
CBase.Drawing.DrawRect(color, bar);
if (Reflection)
CBase.Drawing.DrawColorReflection(color, bar, ReflectionSpace, ReflectionHeight);
CBase.Drawing.DrawRectReflection(color, bar, ReflectionSpace, ReflectionHeight);
}
}
@@ -286,11 +260,28 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
else
Color = _Theme.Color.Color;
if (!String.IsNullOrEmpty(_Theme.MaxColorName))
MaxColor = CBase.Theme.GetColor(_Theme.MaxColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.MaxColor.Name))
MaxColor = CBase.Theme.GetColor(_Theme.MaxColor.Name, _PartyModeID);
else
MaxColor = _Theme.MaxColor.Color;
Rect = _Theme.Rect;
Space = _Theme.Space;
Reflection = _Theme.Reflection.Enabled;
if(Reflection)
{
ReflectionHeight = _Theme.Reflection.Height;
ReflectionSpace = _Theme.Reflection.Space;
}
_Bars = new float[_Theme.NumBars];
for (int i = 0; i < _Bars.Length; i++)
_Bars[i] = 0f;
}
public void ReloadTextures()
@@ -299,11 +290,19 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public SThemeEqualizer GetTheme()
{
return _Theme;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
}
public void ResizeElement(int stepW, int stepH)
@@ -312,9 +311,13 @@ namespace VocaluxeLib.Menu
if (Rect.W <= 0)
Rect.W = 1;
_Theme.Rect.W = Rect.W;
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
_Theme.Rect.H = Rect.H;
}
#endregion ThemeEdit
}
+56 -55
View File
@@ -17,16 +17,24 @@
using System;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Songs;
namespace VocaluxeLib.Menu
{
struct SThemeLyrics
[XmlType("Lyric")]
public struct SThemeLyrics
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
public string ColorName;
public string SelColorName;
[XmlElement("Rect")]
public SRectF Rect;
[XmlElement("Color")]
public SThemeColor Color;
[XmlElement("SColor")]
public SThemeColor SColor;
}
public class CLyric : IMenuElement
@@ -56,6 +64,11 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public SRectF Rect
{
get { return new SRectF(_X, _Y, _MaxW, _H, _Z); }
@@ -107,6 +120,20 @@ namespace VocaluxeLib.Menu
LyricStyle = ELyricStyle.Fill;
}
public CLyric(SThemeLyrics theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
_Line = new CSongLine();
_Text = new CText(_PartyModeID);
_Width = 1f;
LyricStyle = ELyricStyle.Fill;
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
@@ -118,8 +145,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _MaxW);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _H);
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _Color);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out _Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R);
@@ -128,8 +155,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _Color.A);
}
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out _ColorProcessed);
if (xmlReader.GetValue(item + "/SColor", out _Theme.SColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColor.Name, skinIndex, out _ColorProcessed);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref _ColorProcessed.R);
@@ -141,56 +168,16 @@ namespace VocaluxeLib.Menu
if (_ThemeLoaded)
{
_Theme.Name = elementName;
_Theme.Color.Color = new SColorF(_Color);
_Theme.SColor.Color = new SColorF(_ColorProcessed);
_Theme.Rect = new SRectF(Rect);
LoadTextures();
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
}
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: Lyric position, width and height");
writer.WriteElementString("X", _X.ToString("#0"));
writer.WriteElementString("Y", _Y.ToString("#0"));
writer.WriteElementString("Z", _Z.ToString("#0.00"));
writer.WriteElementString("W", _MaxW.ToString("#0"));
writer.WriteElementString("H", _H.ToString("#0"));
writer.WriteComment("<Color>: Lyric text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
writer.WriteElementString("R", _Color.R.ToString("#0.00"));
writer.WriteElementString("G", _Color.G.ToString("#0.00"));
writer.WriteElementString("B", _Color.B.ToString("#0.00"));
writer.WriteElementString("A", _Color.A.ToString("#0.00"));
}
writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.SelColorName))
writer.WriteElementString("SColor", _Theme.SelColorName);
else
{
writer.WriteElementString("SR", _ColorProcessed.R.ToString("#0.00"));
writer.WriteElementString("SG", _ColorProcessed.G.ToString("#0.00"));
writer.WriteElementString("SB", _ColorProcessed.B.ToString("#0.00"));
writer.WriteElementString("SA", _ColorProcessed.A.ToString("#0.00"));
}
writer.WriteEndElement();
return true;
}
return false;
}
public void SetLine(CSongLine line)
{
_Line = line;
@@ -464,11 +451,18 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (!String.IsNullOrEmpty(_Theme.ColorName))
_Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
_Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
else
_Color = _Theme.Color.Color;
if (!String.IsNullOrEmpty(_Theme.SelColorName))
_ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.SColor.Name))
_ColorProcessed = CBase.Theme.GetColor(_Theme.SColor.Name, _PartyModeID);
else
_ColorProcessed = _Theme.SColor.Color;
Rect = _Theme.Rect;
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
}
public void ReloadTextures()
@@ -477,6 +471,11 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public SThemeLyrics GetTheme()
{
return _Theme;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
@@ -484,6 +483,7 @@ namespace VocaluxeLib.Menu
rect.X += stepX;
rect.Y += stepY;
Rect = rect;
_Theme.Rect = rect;
}
public void ResizeElement(int stepW, int stepH)
@@ -498,6 +498,7 @@ namespace VocaluxeLib.Menu
rect.H = 1;
Rect = rect;
_Theme.Rect = rect;
}
#endregion ThemeEdit
}
+186 -75
View File
@@ -21,12 +21,51 @@ using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Menu.SongMenu;
namespace VocaluxeLib.Menu
{
public struct SScreenInformation
{
public string ScreenName;
public int ScreenVersion;
}
[XmlType("Screen")]
public struct STheme
{
[XmlElement("Informations")]
public SScreenInformation ScreenInformation;
[XmlArray("Backgrounds")]
public List<SThemeBackground> Backgrounds;
[XmlArray("Statics")]
public List<SThemeStatic> Statics;
[XmlArray("Texts")]
public List<SThemeText> Texts;
[XmlArray("Buttons")]
public List<SThemeButton> Buttons;
[XmlArray("SongMenus")]
public List<SThemeSongMenu> SongMenus;
[XmlArray("Lyrics")]
public List<SThemeLyrics> Lyrics;
[XmlArray("SelectSlides")]
public List<SThemeSelectSlide> SelectSlides;
[XmlArray("SingNotes")]
public List<SThemeSingBar> SingNotes;
[XmlArray("NameSelections")]
public List<SThemeNameSelection> NameSelections;
[XmlArray("Equalizers")]
public List<SThemeEqualizer> Equalizers;
[XmlArray("Playlists")]
public List<SThemePlaylist> Playlists;
[XmlArray("ParticleEffects")]
public List<SThemeParticleEffect> ParticleEffects;
[XmlArray("ScreenSettings")]
public List<SScreenSetting> ScreenSettings;
}
struct SZSort
{
public int ID;
@@ -37,7 +76,7 @@ namespace VocaluxeLib.Menu
{
private List<CInteraction> _Interactions;
private int _Selection;
private string _ThemePath = String.Empty;
public string ThemePath { get; private set; }
protected int _PartyModeID = -1;
private int _PrevMouseX;
@@ -49,7 +88,8 @@ namespace VocaluxeLib.Menu
protected bool _Active;
protected abstract int _ScreenVersion { get; }
public string ThemeName { get; private set; }
public string ThemeName { get; set; }
public STheme Theme;
// ReSharper disable MemberCanBePrivate.Global
protected string[] _ThemeBackgrounds;
@@ -158,6 +198,89 @@ 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");
int skinIndex = CBase.Theme.GetSkinIndex(_PartyModeID);
Theme.ScreenInformation = new SScreenInformation();
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<SScreenSetting>();
try
{
TextReader textReader = new StreamReader(file);
XmlSerializer deserializer = new XmlSerializer(typeof(STheme));
Theme = (STheme)deserializer.Deserialize(textReader);
foreach (SThemeBackground bg in Theme.Backgrounds)
_AddBackground(new CBackground(bg, _PartyModeID), bg.Name);
foreach (SThemeButton bt in Theme.Buttons)
_AddButton(new CButton(bt, _PartyModeID), bt.Name);
foreach (SThemeEqualizer eq in Theme.Equalizers)
_AddEqualizer(new CEqualizer(eq, _PartyModeID), eq.Name);
foreach (SThemeLyrics ly in Theme.Lyrics)
_AddLyric(new CLyric(ly, _PartyModeID), ly.Name);
foreach (SThemeNameSelection ns in Theme.NameSelections)
_AddNameSelection(new CNameSelection(ns, _PartyModeID), ns.Name);
foreach (SThemeParticleEffect pe in Theme.ParticleEffects)
_AddParticleEffect(new CParticleEffect(pe, _PartyModeID), pe.Name);
foreach(SThemePlaylist pl in Theme.Playlists)
_AddPlaylist(new CPlaylist(pl, _PartyModeID), pl.Name);
foreach (SScreenSetting ss in Theme.ScreenSettings)
_AddScreenSetting(new CScreenSetting(ss, _PartyModeID), ss.Name);
foreach (SThemeSelectSlide sl in Theme.SelectSlides)
_AddSelectSlide(new CSelectSlide(sl, _PartyModeID), sl.Name);
foreach (SThemeSingBar sb in Theme.SingNotes)
_AddSingNote(new CSingNotesClassic(sb, _PartyModeID), sb.Name);
foreach (SThemeSongMenu sm in Theme.SongMenus)
_AddSongMenu(new CSongMenu(sm, _PartyModeID), sm.Name);
foreach (SThemeStatic st in Theme.Statics)
_AddStatic(new CStatic(st, _PartyModeID), st.Name);
foreach (SThemeText te in Theme.Texts)
_AddText(new CText(te, _PartyModeID), te.Name);
}
catch (InvalidOperationException e)
{
CBase.Log.LogError("Error while reading " + ThemeName + ".xml", true, true);
}
catch (Exception e)
{
CBase.Log.LogError(e.Message + e.StackTrace, true, true);
}
}
public virtual void LoadThemeOld(string xmlPath)
{
string file = Path.Combine(xmlPath, ThemeName + ".xml");
@@ -171,7 +294,7 @@ namespace VocaluxeLib.Menu
if (versionCheck && skinIndex != -1)
{
_ThemePath = xmlPath;
ThemePath = xmlPath;
_LoadThemeBasics(xmlReader, skinIndex);
_LoadThemeElement<CBackground>(_ThemeBackgrounds, _AddBackground, xmlReader, skinIndex);
@@ -188,84 +311,72 @@ namespace VocaluxeLib.Menu
_LoadThemeElement<CParticleEffect>(_ThemeParticleEffects, _AddParticleEffect, xmlReader, skinIndex);
_LoadThemeElement<CScreenSetting>(_ThemeScreenSettings, _AddScreenSetting, xmlReader, skinIndex);
}
Theme.ScreenInformation.ScreenName = ThemeName;
Theme.ScreenInformation.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<SScreenSetting>();
}
public virtual void SaveTheme()
{
if (_ThemePath == "")
if (CBase.Config.GetLoadOldThemeFiles())
{
//Have to add theme-stuff manually, later it will be done while de-serialization
foreach (CBackground el in _Backgrounds)
Theme.Backgrounds.Add(el.GetTheme());
foreach (CButton el in _Buttons)
Theme.Buttons.Add(el.GetTheme());
foreach (CEqualizer el in _Equalizers)
Theme.Equalizers.Add(el.GetTheme());
foreach (CLyric el in _Lyrics)
Theme.Lyrics.Add(el.GetTheme());
foreach (CNameSelection el in _NameSelections)
Theme.NameSelections.Add(el.GetTheme());
foreach (CParticleEffect el in _ParticleEffects)
Theme.ParticleEffects.Add(el.GetTheme());
foreach (CPlaylist el in _Playlists)
Theme.Playlists.Add(el.GetTheme());
foreach (CScreenSetting el in _ScreenSettings)
Theme.ScreenSettings.Add(el.GetTheme());
foreach (CSelectSlide el in _SelectSlides)
Theme.SelectSlides.Add(el.GetTheme());
foreach (CStatic el in _Statics)
Theme.Statics.Add(el.GetTheme());
foreach (CText el in _Texts)
Theme.Texts.Add(el.GetTheme());
foreach (CSongMenu el in _SongMenus)
Theme.SongMenus.Add(el.GetTheme());
foreach (CSingNotes el in _SingNotes)
Theme.SingNotes.Add(el.GetTheme());
}
if (ThemePath == "" || ThemePath == null)
return;
string file = Path.Combine(_ThemePath, ThemeName + ".xml");
using (XmlWriter writer = XmlWriter.Create(file, CBase.Config.GetXMLSettings()))
try
{
writer.WriteStartDocument();
writer.WriteStartElement("root");
TextWriter textWriter = new StreamWriter(@Path.Combine(ThemePath, ThemeName + ".xml"));
writer.WriteStartElement(ThemeName);
XmlSerializer serializer = new XmlSerializer(typeof(STheme));
serializer.Serialize(textWriter, Theme);
// Screen Version
writer.WriteElementString("ScreenVersion", _ScreenVersion.ToString());
// Backgrounds
foreach (CBackground bg in _Backgrounds)
bg.SaveTheme(writer);
// Statics
foreach (CStatic st in _Statics)
st.SaveTheme(writer);
// Texts
foreach (CText txt in _Texts)
txt.SaveTheme(writer);
// Buttons
foreach (CButton bt in _Buttons)
bt.SaveTheme(writer);
// SelectSlides
foreach (CSelectSlide ss in _SelectSlides)
ss.SaveTheme(writer);
// SongMenus
foreach (CSongMenu sm in _SongMenus)
sm.SaveTheme(writer);
// Lyrics
foreach (CLyric ly in _Lyrics)
ly.SaveTheme(writer);
// SingBars
foreach (CSingNotes sn in _SingNotes)
sn.SaveTheme(writer);
// NameSelections
foreach (CNameSelection ns in _NameSelections)
ns.SaveTheme(writer);
//Equalizers
foreach (CEqualizer eq in _Equalizers)
eq.SaveTheme(writer);
//Playlists
foreach (CPlaylist pl in _Playlists)
pl.SaveTheme(writer);
//ParticleEffects
foreach (CParticleEffect pa in _ParticleEffects)
pa.SaveTheme(writer);
//ScreenSettings
foreach (CScreenSetting cs in _ScreenSettings)
cs.SaveTheme(writer);
writer.WriteEndElement();
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
textWriter.Close();
}
catch (Exception e)
{
CBase.Log.LogError("Error while saving theme-file: " + ThemeName + " " + e.Message, true);
}
}
@@ -355,7 +466,7 @@ namespace VocaluxeLib.Menu
public virtual void ReloadTheme(string xmlPath)
{
if (_ThemePath == "")
if (ThemePath == "")
return;
UnloadTextures();
@@ -476,7 +587,7 @@ namespace VocaluxeLib.Menu
return new CStatic(oldStatic);
}
public CStatic GetNewStatic(CTexture texture, SColorF color, SRectF rect)
public CStatic GetNewStatic(CTextureRef texture, SColorF color, SRectF rect)
{
return new CStatic(_PartyModeID, texture, color, rect);
}
@@ -521,7 +632,7 @@ namespace VocaluxeLib.Menu
return new CPlaylist(_PartyModeID);
}
public CParticleEffect GetNewParticleEffect(int maxNumber, SColorF color, SRectF area, CTexture texture, float size, EParticleType type)
public CParticleEffect GetNewParticleEffect(int maxNumber, SColorF color, SRectF area, CTextureRef texture, float size, EParticleType type)
{
return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type);
}
+1 -1
View File
@@ -683,7 +683,7 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < _TeamList[_CurrentTeam].Count; i++)
{
string name = CBase.Profiles.GetPlayerName(_TeamList[_CurrentTeam][i]);
CTexture avatar = CBase.Profiles.GetAvatar(_TeamList[_CurrentTeam][i]);
CTextureRef avatar = CBase.Profiles.GetAvatar(_TeamList[_CurrentTeam][i]);
_SelectSlides[_SelectSlidePlayer].AddValue(name, avatar);
}
for (int i = _TeamList[_CurrentTeam].Count; i < _NumPlayerTeams[_CurrentTeam]; i++)
+120 -125
View File
@@ -19,23 +19,59 @@ using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
using VocaluxeLib.Profile;
namespace VocaluxeLib.Menu
{
struct SThemeNameSelection
[XmlType("NameSelection")]
public struct SThemeNameSelection
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
[XmlElement("Rect")]
public SRectF Rect;
[XmlElement("SkinEmptyTile")]
public string TextureEmptyTileName;
public string ColorEmptyTileName;
[XmlElement("ColorEmptyTile")]
public SThemeColor ColorEmptyTile;
[XmlElement("SkinTileSelected")]
public string TextureTileSelectedName;
public float NameSpace;
public float NameHeight;
public string NameFont;
public EStyle NameStyle;
public SColorF NameColor;
public string NameColorName;
[XmlElement("Tiles")]
public SThemeNameSelectionTiles Tiles;
}
public struct SThemeNameSelectionTiles
{
[XmlElement("W")]
public int W;
[XmlElement("H")]
public int H;
[XmlElement("NumW")]
public int NumW;
[XmlElement("NumH")]
public int NumH;
[XmlElement("SpaceW")]
public float SpaceW;
[XmlElement("SpaceH")]
public float SpaceH;
[XmlElement("Name")]
public SThemeNameSelectionName Name;
}
public struct SThemeNameSelectionName
{
[XmlElement("Space")]
public float Space;
[XmlElement("H")]
public float Height;
[XmlElement("Font")]
public string Font;
[XmlElement("Style")]
public EStyle Style;
[XmlElement("Color")]
public SThemeColor Color;
}
public class CNameSelection : IMenuElement
@@ -63,29 +99,26 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public bool Selected;
public bool Visible = true;
public SRectF Rect;
private readonly List<CTile> _Tiles;
private CTexture _TextureEmptyTile;
private CTexture _TextureTileSelected;
public CTexture TextureEmptyTile
private CTextureRef _TextureEmptyTile;
private CTextureRef _TextureTileSelected;
public CTextureRef TextureEmptyTile
{
get { return _TextureEmptyTile; }
}
public SColorF ColorEmptyTile;
private int _NumW;
private int _NumH;
private float _SpaceW;
private float _SpaceH;
private int _TileW;
private int _TileH;
public int Offset;
private int _ActualSelection = -1;
@@ -102,12 +135,26 @@ namespace VocaluxeLib.Menu
{
_PartyModeID = partyModeID;
_Theme = new SThemeNameSelection();
_Theme.Tiles = new SThemeNameSelectionTiles();
_Theme.Tiles.Name = new SThemeNameSelectionName();
_Tiles = new List<CTile>();
_VisibleProfiles = new List<int>();
_UsedProfiles = new List<int>();
}
public CNameSelection(SThemeNameSelection theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
_Tiles = new List<CTile>();
_VisibleProfiles = new List<int>();
_UsedProfiles = new List<int>();
LoadTextures();
}
public void Init()
{
_PrepareTiles();
@@ -115,7 +162,7 @@ namespace VocaluxeLib.Menu
_PlayerSelector = new CStatic(_PartyModeID)
{
Texture = _TextureTileSelected,
Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f),
Rect = new SRectF(0, 0, _Theme.Tiles.W + 6, _Theme.Tiles.H + 6, Rect.Z - 0.5f),
Visible = false
};
@@ -137,8 +184,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", out _Theme.TextureEmptyTileName, String.Empty);
if (xmlReader.GetValue(item + "/ColorEmptyTile", out _Theme.ColorEmptyTileName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, skinIndex, out ColorEmptyTile);
if (xmlReader.GetValue(item + "/ColorEmptyTile", out _Theme.ColorEmptyTile.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTile.Name, skinIndex, out ColorEmptyTile);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref ColorEmptyTile.R);
@@ -149,25 +196,25 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", out _Theme.TextureTileSelectedName, String.Empty);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/W", ref _TileW);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/H", ref _TileH);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/NumW", ref _NumW);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/NumH", ref _NumH);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceW", ref _SpaceW);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceH", ref _SpaceH);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/Space", ref _Theme.NameSpace);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/H", ref _Theme.NameHeight);
_ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", out _Theme.NameFont, "Normal");
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Tiles/Name/Style", ref _Theme.NameStyle);
if (xmlReader.GetValue(item + "/Tiles/Name/Color", out _Theme.NameColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, skinIndex, out _Theme.NameColor);
_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 &= CBase.Theme.GetColor(_Theme.Tiles.Name.Color.Name, skinIndex, out _Theme.Tiles.Name.Color.Color);
else
{
if (xmlReader.TryGetFloatValue(item + "/Tiles/Name/R", ref _Theme.NameColor.R))
if (xmlReader.TryGetFloatValue(item + "/Tiles/Name/R", ref _Theme.Tiles.Name.Color.Color.R))
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/G", ref _Theme.NameColor.G);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/B", ref _Theme.NameColor.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/A", ref _Theme.NameColor.A);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/G", ref _Theme.Tiles.Name.Color.Color.G);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/B", ref _Theme.Tiles.Name.Color.Color.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/A", ref _Theme.Tiles.Name.Color.Color.A);
}
}
@@ -175,82 +222,15 @@ namespace VocaluxeLib.Menu
if (_ThemeLoaded)
{
_Theme.Name = elementName;
_Theme.Rect = new SRectF(Rect);
_Theme.ColorEmptyTile.Color = new SColorF(ColorEmptyTile);
LoadTextures();
}
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: NameSelection position, width and height");
writer.WriteElementString("X", Rect.X.ToString("#0"));
writer.WriteElementString("Y", Rect.Y.ToString("#0"));
writer.WriteElementString("Z", Rect.Z.ToString("#0.00"));
writer.WriteElementString("W", Rect.W.ToString("#0"));
writer.WriteElementString("H", Rect.H.ToString("#0"));
writer.WriteComment("<SkinEmptyTile>: Texture name");
writer.WriteElementString("SkinEmptyTile", _Theme.TextureEmptyTileName);
writer.WriteComment("<ColorEmptyTile>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorEmptyTileName))
writer.WriteElementString("ColorEmptyTile", _Theme.ColorEmptyTileName);
else
{
writer.WriteElementString("R", ColorEmptyTile.R.ToString("#0.00"));
writer.WriteElementString("G", ColorEmptyTile.G.ToString("#0.00"));
writer.WriteElementString("B", ColorEmptyTile.B.ToString("#0.00"));
writer.WriteElementString("A", ColorEmptyTile.A.ToString("#0.00"));
}
writer.WriteComment("<SkinTileSelected>: Texture name");
writer.WriteElementString("SkinTileSelected", _Theme.TextureTileSelectedName);
writer.WriteComment("<Tiles>: Options for tiles");
writer.WriteStartElement("Tiles");
writer.WriteComment("<W>, <H>: Width and height of tile");
writer.WriteElementString("W", _TileW.ToString());
writer.WriteElementString("H", _TileH.ToString());
writer.WriteComment("<NumW>, <NumH>: Number of tiles");
writer.WriteElementString("NumW", _NumW.ToString());
writer.WriteElementString("NumH", _NumH.ToString());
writer.WriteComment("<SpaceW>, <SpaceH>: Space between tiles");
writer.WriteElementString("SpaceW", _SpaceW.ToString("#0.00"));
writer.WriteElementString("SpaceH", _SpaceH.ToString("#0.00"));
writer.WriteComment("<Name>: Options for player-name");
writer.WriteStartElement("Name");
writer.WriteComment("<Space>: Space between name and tile");
writer.WriteElementString("Space", _Theme.NameSpace.ToString("#0.0"));
writer.WriteComment("<Font>: Text font name");
writer.WriteElementString("Font", _Theme.NameFont);
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
if (!String.IsNullOrEmpty(_Theme.NameColorName))
writer.WriteElementString("Color", _Theme.NameColorName);
else
{
writer.WriteElementString("R", _Theme.NameColor.R.ToString("#0.00"));
writer.WriteElementString("G", _Theme.NameColor.G.ToString("#0.00"));
writer.WriteElementString("B", _Theme.NameColor.B.ToString("#0.00"));
writer.WriteElementString("A", _Theme.NameColor.A.ToString("#0.00"));
}
writer.WriteComment("<Style>: Text style: " + CHelper.ListStrings(Enum.GetNames(typeof(EStyle))));
writer.WriteElementString("Style", _Theme.NameStyle.ToString());
writer.WriteComment("<H>: Text height");
writer.WriteElementString("H", _Theme.NameHeight.ToString("#0"));
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndElement();
return true;
}
return false;
}
public void Draw()
{
int i = 0;
@@ -308,20 +288,20 @@ namespace VocaluxeLib.Menu
break;
case Keys.Up:
if (_ActualSelection - _NumW > -1)
_ActualSelection -= _NumW;
if (_ActualSelection - _Theme.Tiles.NumW > -1)
_ActualSelection -= _Theme.Tiles.NumW;
else if (Offset > 0)
{
UpdateList(Offset - 1);
_ActualSelection += _Tiles.Count - _NumW;
_ActualSelection += _Tiles.Count - _Theme.Tiles.NumW;
}
break;
case Keys.Down:
if (_ActualSelection + _NumW < _Tiles.Count)
if (_ActualSelection + _Theme.Tiles.NumW < _Tiles.Count)
{
if (_Tiles[_ActualSelection + _NumW].ProfileID != -1)
_ActualSelection += _NumW;
if (_Tiles[_ActualSelection + _Theme.Tiles.NumW].ProfileID != -1)
_ActualSelection += _Theme.Tiles.NumW;
}
else
{
@@ -329,7 +309,7 @@ namespace VocaluxeLib.Menu
UpdateList(Offset + 1);
if (offset != Offset)
{
_ActualSelection = _ActualSelection - _Tiles.Count + _NumW;
_ActualSelection = _ActualSelection - _Tiles.Count + _Theme.Tiles.NumW;
if (_Tiles[_ActualSelection].ProfileID == -1)
{
for (int i = _Tiles.Count - 1; i >= 0; i--)
@@ -469,11 +449,15 @@ namespace VocaluxeLib.Menu
_TextureEmptyTile = CBase.Theme.GetSkinTexture(_Theme.TextureEmptyTileName, _PartyModeID);
_TextureTileSelected = CBase.Theme.GetSkinTexture(_Theme.TextureTileSelectedName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.ColorEmptyTileName))
ColorEmptyTile = CBase.Theme.GetColor(_Theme.ColorEmptyTileName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.ColorEmptyTile.Name))
ColorEmptyTile = CBase.Theme.GetColor(_Theme.ColorEmptyTile.Name, _PartyModeID);
else
ColorEmptyTile = _Theme.ColorEmptyTile.Color;
if (!String.IsNullOrEmpty(_Theme.NameColorName))
_Theme.NameColor = CBase.Theme.GetColor(_Theme.NameColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Tiles.Name.Color.Name))
_Theme.Tiles.Name.Color.Color = CBase.Theme.GetColor(_Theme.Tiles.Name.Color.Name, _PartyModeID);
Rect = _Theme.Rect;
}
public void ReloadTextures()
@@ -529,14 +513,14 @@ namespace VocaluxeLib.Menu
private void _PrepareTiles()
{
_Tiles.Clear();
for (int i = 0; i < _NumH; i++)
for (int i = 0; i < _Theme.Tiles.NumH; i++)
{
for (int j = 0; j < _NumW; j++)
for (int j = 0; j < _Theme.Tiles.NumW; j++)
{
var rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z);
var rect = new SRectF(Rect.X + j * (_Theme.Tiles.W + _Theme.Tiles.SpaceW), Rect.Y + i * (_Theme.Tiles.H + _Theme.Tiles.SpaceH), _Theme.Tiles.W, _Theme.Tiles.H, Rect.Z);
var tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect) {Aspect = EAspect.Crop};
var tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.NameSpace, rect.Z, _Theme.NameHeight, rect.W, EAlignment.Center, _Theme.NameStyle,
_Theme.NameFont, _Theme.NameColor, "");
var tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.Tiles.Name.Space, rect.Z, _Theme.Tiles.Name.Height, rect.W, EAlignment.Center, _Theme.Tiles.Name.Style,
_Theme.Tiles.Name.Font, _Theme.Tiles.Name.Color.Color, "");
_Tiles.Add(new CTile(tileStatic, tileText, -1));
}
}
@@ -560,11 +544,19 @@ namespace VocaluxeLib.Menu
}
}
public SThemeNameSelection GetTheme()
{
return _Theme;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
}
public void ResizeElement(int stepW, int stepH)
@@ -576,6 +568,9 @@ namespace VocaluxeLib.Menu
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
}
#endregion ThemeEdit
}
+82 -75
View File
@@ -19,15 +19,29 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
struct SThemeParticleEffect
[XmlType("ParticleEffect")]
public struct SThemeParticleEffect
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
[XmlElement("Skin")]
public string TextureName;
public string ColorName;
[XmlElement("Rect")]
public SRectF Rect;
[XmlElement("Color")]
public SThemeColor Color;
[XmlElement("Type")]
public EParticleType Type;
[XmlElement("Size")]
public float Size;
[XmlElement("MaxNumber")]
public int MaxNumber;
}
public enum EParticleType
@@ -44,7 +58,7 @@ namespace VocaluxeLib.Menu
#region private vars
private readonly int _PartyModeID;
private readonly string _TextureName;
private readonly CTexture _Texture;
private readonly CTextureRef _Texture;
private SRectF _Rect;
private float _Size;
private SColorF _Color;
@@ -127,7 +141,7 @@ namespace VocaluxeLib.Menu
_Rotation = (float)(CBase.Game.GetRandomDouble() * 360.0);
}
public CParticle(int partyModeID, CTexture texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize,
public CParticle(int partyModeID, CTextureRef texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize,
EParticleType type)
{
_PartyModeID = partyModeID;
@@ -145,6 +159,8 @@ namespace VocaluxeLib.Menu
_MaxAge = maxage;
_Rotation = (float)(CBase.Game.GetRandomDouble() * 360.0);
}
#endregion Constructors
public void Update()
@@ -300,7 +316,7 @@ namespace VocaluxeLib.Menu
private SThemeParticleEffect _Theme;
private bool _ThemeLoaded;
public CTexture Texture;
public CTextureRef Texture;
public SColorF Color;
public SRectF Rect;
@@ -308,9 +324,6 @@ namespace VocaluxeLib.Menu
public bool Visible;
private readonly List<CParticle> _Stars;
private int _MaxNumber;
private float _Size;
private EParticleType _Type;
private readonly Stopwatch _SpawnTimer;
private float _NextSpawnTime;
@@ -321,6 +334,11 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public bool IsAlive
{
get { return _Stars.Count > 0 || !_SpawnTimer.IsRunning; }
@@ -344,15 +362,15 @@ namespace VocaluxeLib.Menu
Rect = rect;
Color = color;
_Theme.TextureName = textureName;
_MaxNumber = maxNumber;
_Size = size;
_Type = type;
_Theme.MaxNumber = maxNumber;
_Theme.Size = size;
_Theme.Type = type;
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
}
public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, CTexture texture, float size, EParticleType type)
public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, CTextureRef texture, float size, EParticleType type)
{
_PartyModeID = partyModeID;
_Theme = new SThemeParticleEffect();
@@ -361,14 +379,26 @@ namespace VocaluxeLib.Menu
Color = color;
_Theme.TextureName = String.Empty;
Texture = texture;
_MaxNumber = maxNumber;
_Size = size;
_Type = type;
_Theme.MaxNumber = maxNumber;
_Theme.Size = size;
_Theme.Type = type;
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
}
public CParticleEffect(SThemeParticleEffect theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
_Stars = new List<CParticle>();
_SpawnTimer = new Stopwatch();
_NextSpawnTime = 0f;
Visible = true;
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
@@ -382,8 +412,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -392,59 +422,20 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Type);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Size", ref _Size);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/MaxNumber", ref _MaxNumber);
_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.Rect = new SRectF(Rect);
_Theme.Color.Color = new SColorF(Color);
LoadTextures();
}
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<Skin>: Texture name");
writer.WriteElementString("Skin", _Theme.TextureName);
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: ParticleEffect position, width and height");
writer.WriteElementString("X", Rect.X.ToString("#0"));
writer.WriteElementString("Y", Rect.Y.ToString("#0"));
writer.WriteElementString("Z", Rect.Z.ToString("#0.00"));
writer.WriteElementString("W", Rect.W.ToString("#0"));
writer.WriteElementString("H", Rect.H.ToString("#0"));
writer.WriteComment("<Color>: ParticleEffect color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00"));
}
writer.WriteComment("<Type>: Type of ParticleEffect: " + CHelper.ListStrings(Enum.GetNames(typeof(EParticleType))));
writer.WriteElementString("Type", Enum.GetName(typeof(EParticleType), _Type));
writer.WriteComment("<Size>: Size of particle");
writer.WriteElementString("Size", _Size.ToString("#0.00"));
writer.WriteComment("<MaxNumber>: Max number of drawn particles");
writer.WriteElementString("MaxNumber", _MaxNumber.ToString("#0"));
writer.WriteEndElement();
return true;
}
return false;
}
public void Update()
{
bool doSpawn = false;
@@ -462,9 +453,9 @@ namespace VocaluxeLib.Menu
_SpawnTimer.Start();
}
while (_Stars.Count < _MaxNumber && doSpawn)
while (_Stars.Count < _Theme.MaxNumber && doSpawn)
{
float size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2;
float size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
float lifetime = 0f;
float vx = 0f;
float vy = 0f;
@@ -472,10 +463,10 @@ namespace VocaluxeLib.Menu
float vsize = 0f;
_NextSpawnTime = 0f;
switch (_Type)
switch (_Theme.Type)
{
case EParticleType.Twinkle:
size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2;
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(500) / 1000f + 0.5f;
vx = -CBase.Game.GetRandom(10000) / 50f + 100f;
vy = -CBase.Game.GetRandom(10000) / 50f + 100f;
@@ -484,7 +475,7 @@ namespace VocaluxeLib.Menu
break;
case EParticleType.Star:
size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2;
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(1000) / 500f + 0.2f;
vx = -CBase.Game.GetRandom(1000) / 50f + 10f;
vy = -CBase.Game.GetRandom(1000) / 50f + 10f;
@@ -493,19 +484,19 @@ namespace VocaluxeLib.Menu
break;
case EParticleType.Snow:
size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2;
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(5000) / 50f + 10f;
vx = -CBase.Game.GetRandom(1000) / 50f + 10f;
vy = CBase.Game.GetRandom(1000) / 50f + Math.Abs(vx) + 10f;
vr = -CBase.Game.GetRandom(200) / 50f + 2f;
vsize = lifetime * 2f;
_NextSpawnTime = lifetime / _MaxNumber;
_NextSpawnTime = lifetime / _Theme.MaxNumber;
doSpawn = false;
break;
case EParticleType.Flare:
size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2;
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(500) / 1000f + 0.1f;
vx = -CBase.Game.GetRandom(2000) / 50f;
vy = -CBase.Game.GetRandom(2000) / 50f + 20f;
@@ -514,7 +505,7 @@ namespace VocaluxeLib.Menu
break;
case EParticleType.PerfNoteStar:
size = CBase.Game.GetRandom((int)_Size / 2) + _Size / 2;
size = CBase.Game.GetRandom((int)_Theme.Size / 2) + _Theme.Size / 2;
lifetime = CBase.Game.GetRandom(1000) / 500f + 1.2f;
vx = 0f;
vy = 0f;
@@ -538,20 +529,20 @@ namespace VocaluxeLib.Menu
star = new CParticle(_PartyModeID, _Theme.TextureName, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Theme.Type);
}
else
{
star = new CParticle(_PartyModeID, Texture, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Theme.Type);
}
_Stars.Add(star);
}
if (_Type == EParticleType.Flare || _Type == EParticleType.PerfNoteStar || _Type == EParticleType.Twinkle)
if (_Theme.Type == EParticleType.Flare || _Theme.Type == EParticleType.PerfNoteStar || _Theme.Type == EParticleType.Twinkle)
_NextSpawnTime = -1f;
int i = 0;
@@ -594,10 +585,15 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
else
Color = _Theme.Color.Color;
if (!String.IsNullOrEmpty(_Theme.TextureName))
Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
Rect = _Theme.Rect;
}
public void ReloadTextures()
@@ -606,11 +602,19 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public SThemeParticleEffect GetTheme()
{
return _Theme;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
Rect.X += stepX;
Rect.Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
}
public void ResizeElement(int stepW, int stepH)
@@ -622,6 +626,9 @@ namespace VocaluxeLib.Menu
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
}
#endregion ThemeEdit
}
+250 -221
View File
@@ -19,6 +19,7 @@ using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Songs;
namespace VocaluxeLib.Menu
@@ -53,31 +54,51 @@ namespace VocaluxeLib.Menu
}
}
struct SThemePlaylist
[XmlType("Playlist")]
public struct SThemePlaylist
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
public string ColorBackgroundName;
public string SelColorBackgroundName;
public string TextureBackgroundName;
public string SelTextureBackgroundName;
[XmlElement("Rect")]
public SRectF Rect;
[XmlElement("EntryHeight")]
public float EntryHeight;
public CText Text1;
[XmlElement("SkinBackground")]
public string TextureBackgroundName;
[XmlElement("SkinBackgroundSelected")]
public string SelTextureBackgroundName;
public CStatic StaticCover;
public CStatic StaticPlaylistHeader;
public CStatic StaticPlaylistFooter;
[XmlElement("ColorBackground")]
public SThemeColor ColorBackground;
[XmlElement("SColorBackground")]
public SThemeColor SelColorBackground;
public CButton ButtonPlaylistName;
public CButton ButtonPlaylistClose;
public CButton ButtonPlaylistSave;
public CButton ButtonPlaylistDelete;
public CButton ButtonPlaylistSing;
[XmlElement("Text1")]
public SThemeText SText1;
public CSelectSlide SelectSlideGameMode;
[XmlElement("StaticCover")]
public SThemeStatic SStaticCover;
[XmlElement("StaticPlaylistHeader")]
public SThemeStatic SStaticPlaylistHeader;
[XmlElement("StaticPlaylistFooter")]
public SThemeStatic SStaticPlaylistFooter;
[XmlElement("ButtonPlaylistName")]
public SThemeButton SButtonPlaylistName;
[XmlElement("ButtonPlaylistClose")]
public SThemeButton SButtonPlaylistClose;
[XmlElement("ButtonPlaylistSave")]
public SThemeButton SButtonPlaylistSave;
[XmlElement("ButtonPlaylistDelete")]
public SThemeButton SButtonPlaylistDelete;
[XmlElement("ButtonPlaylistSing")]
public SThemeButton SButtonPlaylistSing;
[XmlElement("SelectSlideGameMode")]
public SThemeSelectSlide SSelectSlideGameMode;
}
public class CPlaylist : IMenuElement
@@ -150,6 +171,11 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
private readonly CObjectInteractions _Interactions;
private readonly List<CPlaylistElement> _PlaylistElements;
@@ -160,6 +186,17 @@ namespace VocaluxeLib.Menu
public SColorF BackgroundColor;
public SColorF BackgroundSelColor;
public CButton ButtonPlaylistName;
public CButton ButtonPlaylistClose;
public CButton ButtonPlaylistSave;
public CButton ButtonPlaylistDelete;
public CButton ButtonPlaylistSing;
public CText Text1;
public CSelectSlide SelectSlideGameMode;
public CStatic StaticCover;
public CStatic StaticPlaylistHeader;
public CStatic StaticPlaylistFooter;
public bool Visible;
private bool _Selected;
@@ -201,19 +238,17 @@ namespace VocaluxeLib.Menu
public CPlaylist(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemePlaylist
{
Text1 = new CText(_PartyModeID),
StaticCover = new CStatic(_PartyModeID),
StaticPlaylistFooter = new CStatic(_PartyModeID),
StaticPlaylistHeader = new CStatic(_PartyModeID),
ButtonPlaylistName = new CButton(_PartyModeID),
ButtonPlaylistClose = new CButton(_PartyModeID),
ButtonPlaylistDelete = new CButton(_PartyModeID),
ButtonPlaylistSave = new CButton(_PartyModeID),
ButtonPlaylistSing = new CButton(_PartyModeID),
SelectSlideGameMode = new CSelectSlide(_PartyModeID)
};
Text1 = new CText(_PartyModeID);
StaticCover = new CStatic(_PartyModeID);
StaticPlaylistFooter = new CStatic(_PartyModeID);
StaticPlaylistHeader = new CStatic(_PartyModeID);
ButtonPlaylistName = new CButton(_PartyModeID);
ButtonPlaylistClose = new CButton(_PartyModeID);
ButtonPlaylistDelete = new CButton(_PartyModeID);
ButtonPlaylistSave = new CButton(_PartyModeID);
ButtonPlaylistSing = new CButton(_PartyModeID);
SelectSlideGameMode = new CSelectSlide(_PartyModeID);
CompleteRect = new SRectF();
Rect = new SRectF();
@@ -230,18 +265,48 @@ namespace VocaluxeLib.Menu
Selected = false;
}
public CPlaylist(SThemePlaylist theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
CompleteRect = new SRectF();
_PlaylistElements = new List<CPlaylistElement>();
_PlaylistElementContents = new List<CPlaylistElementContent>();
_Interactions = new CObjectInteractions();
_ChangeOrderElement = new CPlaylistElement();
Text1 = new CText(_Theme.SText1, _PartyModeID);
StaticCover = new CStatic(_Theme.SStaticCover, _PartyModeID);
StaticPlaylistFooter = new CStatic(_Theme.SStaticPlaylistFooter, _PartyModeID);
StaticPlaylistHeader = new CStatic(_Theme.SStaticPlaylistHeader, _PartyModeID);
ButtonPlaylistName = new CButton(_Theme.SButtonPlaylistName, _PartyModeID);
ButtonPlaylistClose = new CButton(_Theme.SButtonPlaylistClose, _PartyModeID);
ButtonPlaylistDelete = new CButton(_Theme.SButtonPlaylistDelete, _PartyModeID);
ButtonPlaylistSave = new CButton(_Theme.SButtonPlaylistSave, _PartyModeID);
ButtonPlaylistSing = new CButton(_Theme.SButtonPlaylistSing, _PartyModeID);
SelectSlideGameMode = new CSelectSlide(_Theme.SSelectSlideGameMode, _PartyModeID);
Visible = false;
Selected = false;
LoadTextures();
}
public void Init()
{
_Interactions.Clear();
_PrepareList();
_Interactions.AddStatic(_Theme.StaticCover);
_Interactions.AddStatic(_Theme.StaticPlaylistFooter);
_Interactions.AddStatic(_Theme.StaticPlaylistHeader);
_Interactions.AddButton(_Theme.ButtonPlaylistName);
_Interactions.AddButton(_Theme.ButtonPlaylistClose);
_Interactions.AddButton(_Theme.ButtonPlaylistDelete);
_Interactions.AddButton(_Theme.ButtonPlaylistSave);
_Interactions.AddButton(_Theme.ButtonPlaylistSing);
_Interactions.AddStatic(StaticCover);
_Interactions.AddStatic(StaticPlaylistFooter);
_Interactions.AddStatic(StaticPlaylistHeader);
_Interactions.AddButton(ButtonPlaylistName);
_Interactions.AddButton(ButtonPlaylistClose);
_Interactions.AddButton(ButtonPlaylistDelete);
_Interactions.AddButton(ButtonPlaylistSave);
_Interactions.AddButton(ButtonPlaylistSing);
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
@@ -257,8 +322,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref Rect.Z);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/ColorBackground", out _Theme.ColorBackgroundName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, skinIndex, out BackgroundColor);
if (xmlReader.GetValue(item + "/ColorBackground", out _Theme.ColorBackground.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackground.Name, skinIndex, out BackgroundColor);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundR", ref BackgroundColor.R);
@@ -266,8 +331,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundB", ref BackgroundColor.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A);
}
if (xmlReader.GetValue(item + "/SColorBackground", out _Theme.SelColorBackgroundName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorBackgroundName, skinIndex, out BackgroundSelColor);
if (xmlReader.GetValue(item + "/SColorBackground", out _Theme.SelColorBackground.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorBackground.Name, skinIndex, out BackgroundSelColor);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundR", ref BackgroundSelColor.R);
@@ -276,142 +341,42 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundA", ref BackgroundSelColor.A);
}
_ThemeLoaded &= _Theme.Text1.LoadTheme(item, "TextPart1", xmlReader, skinIndex);
_ThemeLoaded &= Text1.LoadTheme(item, "TextPart1", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.StaticCover.LoadTheme(item, "StaticCover", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", xmlReader, skinIndex);
_ThemeLoaded &= StaticCover.LoadTheme(item, "StaticCover", xmlReader, skinIndex);
_ThemeLoaded &= StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", xmlReader, skinIndex);
_ThemeLoaded &= StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader, skinIndex);
_ThemeLoaded &= ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader, skinIndex);
_ThemeLoaded &=SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader, skinIndex);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/EntryHeight", ref _Theme.EntryHeight);
if (_ThemeLoaded)
{
_Theme.Name = elementName;
_Theme.Rect = Rect;
_Theme.ColorBackground.Color = BackgroundColor;
_Theme.SelColorBackground.Color = BackgroundSelColor;
_Theme.SText1 = Text1.GetTheme();
_Theme.SStaticCover = StaticCover.GetTheme();
_Theme.SStaticPlaylistFooter = StaticPlaylistFooter.GetTheme();
_Theme.SStaticPlaylistHeader = StaticPlaylistHeader.GetTheme();
_Theme.SButtonPlaylistName =ButtonPlaylistName.GetTheme();
_Theme.SButtonPlaylistSing =ButtonPlaylistSing.GetTheme();
_Theme.SButtonPlaylistClose =ButtonPlaylistClose.GetTheme();
_Theme.SButtonPlaylistSave =ButtonPlaylistSave.GetTheme();
_Theme.SButtonPlaylistDelete =ButtonPlaylistDelete.GetTheme();
//Check for highest x/y-coords
CompleteRect = Rect;
//ButtonPlaylistClose
if (_Theme.ButtonPlaylistClose.Rect.X < CompleteRect.X)
CompleteRect.X = _Theme.ButtonPlaylistClose.Rect.X;
if (_Theme.ButtonPlaylistClose.Rect.Y < CompleteRect.Y)
CompleteRect.Y = _Theme.ButtonPlaylistClose.Rect.Y;
if (_Theme.ButtonPlaylistClose.Rect.W + _Theme.ButtonPlaylistClose.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = _Theme.ButtonPlaylistClose.Rect.W + _Theme.ButtonPlaylistClose.Rect.X - CompleteRect.X;
if (_Theme.ButtonPlaylistClose.Rect.Y + _Theme.ButtonPlaylistClose.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = _Theme.ButtonPlaylistClose.Rect.H + _Theme.ButtonPlaylistClose.Rect.Y - CompleteRect.Y;
//ButtonPlaylistName
if (_Theme.ButtonPlaylistName.Rect.X < CompleteRect.X)
CompleteRect.X = _Theme.ButtonPlaylistName.Rect.X;
if (_Theme.ButtonPlaylistName.Rect.Y < CompleteRect.Y)
CompleteRect.Y = _Theme.ButtonPlaylistName.Rect.Y;
if (_Theme.ButtonPlaylistName.Rect.W + _Theme.ButtonPlaylistName.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = _Theme.ButtonPlaylistName.Rect.W + _Theme.ButtonPlaylistName.Rect.X - CompleteRect.X;
if (_Theme.ButtonPlaylistName.Rect.Y + _Theme.ButtonPlaylistName.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = _Theme.ButtonPlaylistName.Rect.H + _Theme.ButtonPlaylistName.Rect.Y - CompleteRect.Y;
//ButtonPlaylistSing
if (_Theme.ButtonPlaylistSing.Rect.X < CompleteRect.X)
CompleteRect.X = _Theme.ButtonPlaylistSing.Rect.X;
if (_Theme.ButtonPlaylistSing.Rect.Y < CompleteRect.Y)
CompleteRect.Y = _Theme.ButtonPlaylistSing.Rect.Y;
if (_Theme.ButtonPlaylistSing.Rect.W + _Theme.ButtonPlaylistSing.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = _Theme.ButtonPlaylistSing.Rect.W + _Theme.ButtonPlaylistSing.Rect.X - CompleteRect.X;
if (_Theme.ButtonPlaylistSing.Rect.Y + _Theme.ButtonPlaylistSing.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = _Theme.ButtonPlaylistSing.Rect.H + _Theme.ButtonPlaylistSing.Rect.Y - CompleteRect.Y;
//ButtonPlaylistSave
if (_Theme.ButtonPlaylistSave.Rect.X < CompleteRect.X)
CompleteRect.X = _Theme.ButtonPlaylistSave.Rect.X;
if (_Theme.ButtonPlaylistSave.Rect.Y < CompleteRect.Y)
CompleteRect.Y = _Theme.ButtonPlaylistSave.Rect.Y;
if (_Theme.ButtonPlaylistSave.Rect.W + _Theme.ButtonPlaylistSave.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = _Theme.ButtonPlaylistSave.Rect.W + _Theme.ButtonPlaylistSave.Rect.X - CompleteRect.X;
if (_Theme.ButtonPlaylistSave.Rect.Y + _Theme.ButtonPlaylistSave.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = _Theme.ButtonPlaylistSave.Rect.H + _Theme.ButtonPlaylistSave.Rect.Y - CompleteRect.Y;
//ButtonPlaylistDelete
if (_Theme.ButtonPlaylistDelete.Rect.X < CompleteRect.X)
CompleteRect.X = _Theme.ButtonPlaylistDelete.Rect.X;
if (_Theme.ButtonPlaylistDelete.Rect.Y < CompleteRect.Y)
CompleteRect.Y = _Theme.ButtonPlaylistDelete.Rect.Y;
if (_Theme.ButtonPlaylistDelete.Rect.W + _Theme.ButtonPlaylistDelete.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = _Theme.ButtonPlaylistDelete.Rect.W + _Theme.ButtonPlaylistDelete.Rect.X - CompleteRect.X;
if (_Theme.ButtonPlaylistDelete.Rect.Y + _Theme.ButtonPlaylistDelete.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = _Theme.ButtonPlaylistDelete.Rect.H + _Theme.ButtonPlaylistDelete.Rect.Y - CompleteRect.Y;
LoadTextures();
}
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: Playlist position, width and height");
writer.WriteElementString("X", Rect.X.ToString("#0"));
writer.WriteElementString("Y", Rect.Y.ToString("#0"));
writer.WriteElementString("Z", Rect.Z.ToString("#0.00"));
writer.WriteElementString("W", Rect.W.ToString("#0"));
writer.WriteElementString("H", Rect.H.ToString("#0"));
writer.WriteElementString("EntryHeight", _Theme.EntryHeight.ToString("#0.00"));
writer.WriteComment("<SkinBackground>: Texture name");
writer.WriteElementString("SkinBackground", _Theme.TextureBackgroundName);
writer.WriteComment("<SkinBackgroundSelected>: Texture name for selected playlist-entry");
writer.WriteElementString("SkinBackgroundSelected", _Theme.SelTextureBackgroundName);
writer.WriteComment("<ColorBackground>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <BackgroundR>, <BackgroundG>, <BackgroundB>, <BackgroundA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorBackgroundName))
writer.WriteElementString("ColorBackground", _Theme.ColorBackgroundName);
else
{
writer.WriteElementString("BackgroundR", BackgroundColor.R.ToString("#0.00"));
writer.WriteElementString("BackgroundG", BackgroundColor.G.ToString("#0.00"));
writer.WriteElementString("BackgroundB", BackgroundColor.B.ToString("#0.00"));
writer.WriteElementString("BackgroundA", BackgroundColor.A.ToString("#0.00"));
}
writer.WriteComment("<SColorBackground>: Selected paylist-entry color from ColorScheme (high priority)");
writer.WriteComment("or <SBackgroundR>, <SBackgroundG>, <SBackgroundB>, <SBackgroundA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.SelColorBackgroundName))
writer.WriteElementString("SColorBackground", _Theme.SelColorBackgroundName);
else
{
writer.WriteElementString("SBackgroundR", BackgroundSelColor.R.ToString("#0.00"));
writer.WriteElementString("SBackgroundG", BackgroundSelColor.G.ToString("#0.00"));
writer.WriteElementString("SBackgroundB", BackgroundSelColor.B.ToString("#0.00"));
writer.WriteElementString("SBackgroundA", BackgroundSelColor.A.ToString("#0.00"));
}
writer.WriteComment("Positions of <TextPart1>, <TextPart2>, <TextPart3>, <StaticCover> and <SelectSlideGameMode> are relative to playlist-entry!");
writer.WriteComment("Use placeholders for Text of <TextPart1>, <TextPart2> and <TextPart3>: %t, %a, %l");
_Theme.Text1.SaveTheme(writer);
_Theme.StaticPlaylistFooter.SaveTheme(writer);
_Theme.StaticPlaylistHeader.SaveTheme(writer);
_Theme.StaticCover.SaveTheme(writer);
_Theme.SelectSlideGameMode.SaveTheme(writer);
_Theme.ButtonPlaylistName.SaveTheme(writer);
_Theme.ButtonPlaylistClose.SaveTheme(writer);
_Theme.ButtonPlaylistDelete.SaveTheme(writer);
_Theme.ButtonPlaylistSave.SaveTheme(writer);
_Theme.ButtonPlaylistSing.SaveTheme(writer);
writer.WriteEndElement();
return true;
}
return false;
}
public void Draw(bool forceDraw = false)
{
if (_PlaylistElements.Count <= 0)
@@ -440,45 +405,53 @@ namespace VocaluxeLib.Menu
public bool IsMouseOver(SMouseEvent mouseEvent)
{
return CHelper.IsInBounds(CompleteRect, mouseEvent.X, mouseEvent.Y) || _Interactions.IsMouseOver(mouseEvent);
return CHelper.IsInBounds(CompleteRect, mouseEvent) || _Interactions.IsMouseOver(mouseEvent);
}
public void UnloadTextures()
{
_Theme.Text1.UnloadTextures();
_Theme.ButtonPlaylistClose.UnloadTextures();
_Theme.ButtonPlaylistDelete.UnloadTextures();
_Theme.ButtonPlaylistName.UnloadTextures();
_Theme.ButtonPlaylistSave.UnloadTextures();
_Theme.ButtonPlaylistSing.UnloadTextures();
Text1.UnloadTextures();
ButtonPlaylistClose.UnloadTextures();
ButtonPlaylistDelete.UnloadTextures();
ButtonPlaylistName.UnloadTextures();
ButtonPlaylistSave.UnloadTextures();
ButtonPlaylistSing.UnloadTextures();
_Theme.StaticCover.UnloadTextures();
_Theme.StaticPlaylistFooter.UnloadTextures();
_Theme.StaticPlaylistHeader.UnloadTextures();
StaticCover.UnloadTextures();
StaticPlaylistFooter.UnloadTextures();
StaticPlaylistHeader.UnloadTextures();
_Theme.SelectSlideGameMode.UnloadTextures();
SelectSlideGameMode.UnloadTextures();
}
public void LoadTextures()
{
if (!String.IsNullOrEmpty(_Theme.ColorBackgroundName))
BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackgroundName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.ColorBackground.Name))
BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackground.Name, _PartyModeID);
else
BackgroundColor = _Theme.ColorBackground.Color;
if (!String.IsNullOrEmpty(_Theme.SelColorBackgroundName))
BackgroundSelColor = CBase.Theme.GetColor(_Theme.SelColorBackgroundName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.SelColorBackground.Name))
BackgroundSelColor = CBase.Theme.GetColor(_Theme.SelColorBackground.Name, _PartyModeID);
else
BackgroundSelColor = _Theme.SelColorBackground.Color;
_Theme.Text1.LoadTextures();
_Theme.ButtonPlaylistClose.LoadTextures();
_Theme.ButtonPlaylistDelete.LoadTextures();
_Theme.ButtonPlaylistName.LoadTextures();
_Theme.ButtonPlaylistSave.LoadTextures();
_Theme.ButtonPlaylistSing.LoadTextures();
Rect = _Theme.Rect;
_Theme.StaticCover.LoadTextures();
_Theme.StaticPlaylistFooter.LoadTextures();
_Theme.StaticPlaylistHeader.LoadTextures();
Text1.LoadTextures();
ButtonPlaylistClose.LoadTextures();
ButtonPlaylistDelete.LoadTextures();
ButtonPlaylistName.LoadTextures();
ButtonPlaylistSave.LoadTextures();
ButtonPlaylistSing.LoadTextures();
_Theme.SelectSlideGameMode.LoadTextures();
StaticCover.LoadTextures();
StaticPlaylistFooter.LoadTextures();
StaticPlaylistHeader.LoadTextures();
SelectSlideGameMode.LoadTextures();
_UpdateRect();
Init();
}
@@ -497,26 +470,26 @@ namespace VocaluxeLib.Menu
if (EditMode == EEditMode.PlaylistName)
{
if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode))
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + keyEvent.Unicode;
ButtonPlaylistName.Text.Text = ButtonPlaylistName.Text.Text + keyEvent.Unicode;
else
{
switch (keyEvent.Key)
{
case Keys.Enter:
CBase.Playlist.SetName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
CBase.Playlist.SetName(ActivePlaylistID, ButtonPlaylistName.Text.Text);
CBase.Playlist.Save(ActivePlaylistID);
EditMode = EEditMode.None;
_Theme.ButtonPlaylistName.EditMode = false;
ButtonPlaylistName.EditMode = false;
break;
case Keys.Escape:
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
EditMode = EEditMode.None;
_Theme.ButtonPlaylistName.EditMode = false;
ButtonPlaylistName.EditMode = false;
break;
case Keys.Delete:
case Keys.Back:
if (!String.IsNullOrEmpty(_Theme.ButtonPlaylistName.Text.Text))
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1);
if (!String.IsNullOrEmpty(ButtonPlaylistName.Text.Text))
ButtonPlaylistName.Text.Text = ButtonPlaylistName.Text.Text.Remove(ButtonPlaylistName.Text.Text.Length - 1);
break;
}
}
@@ -749,38 +722,38 @@ namespace VocaluxeLib.Menu
switch (keyEvent.Key)
{
case Keys.Back:
if (_Theme.ButtonPlaylistName.Selected)
if (ButtonPlaylistName.Selected)
{
EditMode = EEditMode.PlaylistName;
_Theme.ButtonPlaylistName.EditMode = true;
ButtonPlaylistName.EditMode = true;
}
else
ClosePlaylist();
break;
case Keys.Enter:
if (_Theme.ButtonPlaylistClose.Selected)
if (ButtonPlaylistClose.Selected)
ClosePlaylist();
else if (_Theme.ButtonPlaylistSing.Selected)
else if (ButtonPlaylistSing.Selected)
_StartPlaylistSongs();
else if (_Theme.ButtonPlaylistSave.Selected)
else if (ButtonPlaylistSave.Selected)
CBase.Playlist.Save(ActivePlaylistID);
else if (_Theme.ButtonPlaylistDelete.Selected)
else if (ButtonPlaylistDelete.Selected)
{
CBase.Playlist.Delete(ActivePlaylistID);
ClosePlaylist();
}
else if (_Theme.ButtonPlaylistName.Selected)
else if (ButtonPlaylistName.Selected)
{
if (EditMode != EEditMode.PlaylistName)
{
EditMode = EEditMode.PlaylistName;
_Theme.ButtonPlaylistName.EditMode = true;
ButtonPlaylistName.EditMode = true;
}
else
{
EditMode = EEditMode.None;
_Theme.ButtonPlaylistName.EditMode = false;
ButtonPlaylistName.EditMode = false;
}
}
break;
@@ -910,31 +883,31 @@ namespace VocaluxeLib.Menu
_PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
UpdatePlaylist();
}
if (_Theme.ButtonPlaylistClose.Selected)
if (ButtonPlaylistClose.Selected)
{
ClosePlaylist();
return true;
}
if (_Theme.ButtonPlaylistSing.Selected)
if (ButtonPlaylistSing.Selected)
{
_StartPlaylistSongs();
return true;
}
if (_Theme.ButtonPlaylistSave.Selected)
if (ButtonPlaylistSave.Selected)
{
CBase.Playlist.Save(ActivePlaylistID);
return true;
}
if (_Theme.ButtonPlaylistDelete.Selected)
if (ButtonPlaylistDelete.Selected)
{
CBase.Playlist.Delete(ActivePlaylistID);
ClosePlaylist();
return true;
}
if (_Theme.ButtonPlaylistName.Selected)
if (ButtonPlaylistName.Selected)
{
EditMode = EEditMode.PlaylistName;
_Theme.ButtonPlaylistName.EditMode = true;
ButtonPlaylistName.EditMode = true;
return true;
}
}
@@ -1022,13 +995,13 @@ namespace VocaluxeLib.Menu
break;
case EEditMode.PlaylistName:
_Interactions.SetInteractionToButton(_Theme.ButtonPlaylistName);
_Interactions.SetInteractionToButton(ButtonPlaylistName);
CurrentPlaylistElement = -1;
if (mouseEvent.LB)
{
if (_Theme.ButtonPlaylistName.Selected)
if (ButtonPlaylistName.Selected)
{
CBase.Playlist.SetName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
CBase.Playlist.SetName(ActivePlaylistID, ButtonPlaylistName.Text.Text);
CBase.Playlist.Save(ActivePlaylistID);
EditMode = EEditMode.None;
return true;
@@ -1036,11 +1009,11 @@ namespace VocaluxeLib.Menu
}
else if (mouseEvent.RB)
{
if (_Theme.ButtonPlaylistName.Selected)
if (ButtonPlaylistName.Selected)
{
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
EditMode = EEditMode.None;
_Theme.ButtonPlaylistName.EditMode = false;
ButtonPlaylistName.EditMode = false;
return true;
}
}
@@ -1104,17 +1077,17 @@ namespace VocaluxeLib.Menu
{
Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor,
new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)),
Cover = new CStatic(_Theme.StaticCover)
Cover = new CStatic(StaticCover)
};
en.Cover.Rect.Y += Rect.Y + (i * _Theme.EntryHeight);
en.Cover.Rect.X += Rect.X;
en.Text1 = new CText(_Theme.Text1);
en.Text1 = new CText(Text1);
en.Text1.X += Rect.X;
en.Text1.Y += Rect.Y + (i * _Theme.EntryHeight);
en.SelectSlide = new CSelectSlide(_Theme.SelectSlideGameMode);
en.SelectSlide = new CSelectSlide(SelectSlideGameMode);
en.SelectSlide.Rect.X += Rect.X;
en.SelectSlide.Rect.Y += Rect.Y + (i * _Theme.EntryHeight);
en.SelectSlide.RectArrowLeft.X += Rect.X;
@@ -1137,7 +1110,7 @@ namespace VocaluxeLib.Menu
if (!CBase.Playlist.Exists(playlistID))
return false;
ActivePlaylistID = playlistID;
_Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
ButtonPlaylistName.Text.Text = CBase.Playlist.GetName(ActivePlaylistID);
_PlaylistElementContents.Clear();
for (int i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistID); i++)
{
@@ -1215,7 +1188,7 @@ namespace VocaluxeLib.Menu
CPlaylistElementContent pec = _PlaylistElementContents[Offset + i];
CSong song = CBase.Songs.GetSongByID(pec.SongID);
_PlaylistElements[i].Cover.Texture = song.CoverTextureSmall;
string t1 = CBase.Language.Translate(_Theme.Text1.Text).Replace("%a", song.Artist).Replace("%t", song.Title);
string t1 = CBase.Language.Translate(Text1.Text).Replace("%a", song.Artist).Replace("%t", song.Title);
_PlaylistElements[i].Text1.Text = /*(Offset + i + 1) + ") " + */ t1; //TODO: Add text field for the number
_PlaylistElements[i].SelectSlide.Clear();
for (int g = 0; g < pec.Modes.Count; g++)
@@ -1237,6 +1210,62 @@ namespace VocaluxeLib.Menu
}
}
public SThemePlaylist GetTheme()
{
return _Theme;
}
private void _UpdateRect()
{
//Check for highest x/y-coords
CompleteRect = Rect;
//ButtonPlaylistClose
if (ButtonPlaylistClose.Rect.X < CompleteRect.X)
CompleteRect.X = ButtonPlaylistClose.Rect.X;
if (ButtonPlaylistClose.Rect.Y < CompleteRect.Y)
CompleteRect.Y = ButtonPlaylistClose.Rect.Y;
if (ButtonPlaylistClose.Rect.W + ButtonPlaylistClose.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = ButtonPlaylistClose.Rect.W + ButtonPlaylistClose.Rect.X - CompleteRect.X;
if (ButtonPlaylistClose.Rect.Y + ButtonPlaylistClose.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = ButtonPlaylistClose.Rect.H + ButtonPlaylistClose.Rect.Y - CompleteRect.Y;
//ButtonPlaylistName
if (ButtonPlaylistName.Rect.X < CompleteRect.X)
CompleteRect.X = ButtonPlaylistName.Rect.X;
if (ButtonPlaylistName.Rect.Y < CompleteRect.Y)
CompleteRect.Y = ButtonPlaylistName.Rect.Y;
if (ButtonPlaylistName.Rect.W + ButtonPlaylistName.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = ButtonPlaylistName.Rect.W + ButtonPlaylistName.Rect.X - CompleteRect.X;
if (ButtonPlaylistName.Rect.Y + ButtonPlaylistName.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = ButtonPlaylistName.Rect.H + ButtonPlaylistName.Rect.Y - CompleteRect.Y;
//ButtonPlaylistSing
if (ButtonPlaylistSing.Rect.X < CompleteRect.X)
CompleteRect.X = ButtonPlaylistSing.Rect.X;
if (ButtonPlaylistSing.Rect.Y < CompleteRect.Y)
CompleteRect.Y = ButtonPlaylistSing.Rect.Y;
if (ButtonPlaylistSing.Rect.W + ButtonPlaylistSing.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = ButtonPlaylistSing.Rect.W + ButtonPlaylistSing.Rect.X - CompleteRect.X;
if (ButtonPlaylistSing.Rect.Y + ButtonPlaylistSing.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = ButtonPlaylistSing.Rect.H + ButtonPlaylistSing.Rect.Y - CompleteRect.Y;
//ButtonPlaylistSave
if (ButtonPlaylistSave.Rect.X < CompleteRect.X)
CompleteRect.X = ButtonPlaylistSave.Rect.X;
if (ButtonPlaylistSave.Rect.Y < CompleteRect.Y)
CompleteRect.Y = ButtonPlaylistSave.Rect.Y;
if (ButtonPlaylistSave.Rect.W + ButtonPlaylistSave.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = ButtonPlaylistSave.Rect.W + ButtonPlaylistSave.Rect.X - CompleteRect.X;
if (ButtonPlaylistSave.Rect.Y + ButtonPlaylistSave.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = ButtonPlaylistSave.Rect.H + ButtonPlaylistSave.Rect.Y - CompleteRect.Y;
//ButtonPlaylistDelete
if (ButtonPlaylistDelete.Rect.X < CompleteRect.X)
CompleteRect.X = ButtonPlaylistDelete.Rect.X;
if (ButtonPlaylistDelete.Rect.Y < CompleteRect.Y)
CompleteRect.Y = ButtonPlaylistDelete.Rect.Y;
if (ButtonPlaylistDelete.Rect.W + ButtonPlaylistDelete.Rect.X > CompleteRect.W + CompleteRect.X)
CompleteRect.W = ButtonPlaylistDelete.Rect.W + ButtonPlaylistDelete.Rect.X - CompleteRect.X;
if (ButtonPlaylistDelete.Rect.Y + ButtonPlaylistDelete.Rect.H > CompleteRect.Y + CompleteRect.H)
CompleteRect.H = ButtonPlaylistDelete.Rect.H + ButtonPlaylistDelete.Rect.Y - CompleteRect.Y;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
+24 -19
View File
@@ -17,11 +17,12 @@
using System;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
enum ESettingType
public enum ESettingType
{
Int,
String,
@@ -29,10 +30,14 @@ namespace VocaluxeLib.Menu
Texture
}
struct SScreenSetting
[XmlType("ScreenSetting")]
public struct SScreenSetting
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
[XmlElement("Value")]
public string Value;
[XmlElement("Type")]
public ESettingType Type;
}
@@ -51,6 +56,11 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public CScreenSetting(int partyModeID)
{
_PartyModeID = partyModeID;
@@ -58,6 +68,12 @@ namespace VocaluxeLib.Menu
_ThemeLoaded = false;
}
public CScreenSetting(SScreenSetting theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
@@ -71,22 +87,6 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<Type>: Type of theme-setting-value: " + CHelper.ListStrings(Enum.GetNames(typeof(ESettingType))));
writer.WriteElementString("Type", Enum.GetName(typeof(ESettingType), _Theme.Type));
writer.WriteComment("<Value>: Value of theme-setting");
writer.WriteElementString("Value", _Theme.Value);
writer.WriteEndElement();
return true;
}
return false;
}
public object GetValue()
{
switch (_Theme.Type)
@@ -113,6 +113,11 @@ namespace VocaluxeLib.Menu
public void ReloadTextures() {}
public SScreenSetting GetTheme()
{
return _Theme;
}
#region Private
private int _GetIntValue(string value)
{
@@ -126,7 +131,7 @@ namespace VocaluxeLib.Menu
}
}
private CTexture _GetTextureValue(string value)
private CTextureRef _GetTextureValue(string value)
{
return CBase.Theme.GetSkinTexture(value, _PartyModeID);
}
+164 -232
View File
@@ -18,37 +18,49 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
struct SThemeSelectSlide
[XmlType("SelectSlide")]
public struct SThemeSelectSlide
{
public string Name;
[XmlAttribute(AttributeName = "Name")] public string Name;
public string TextureName;
public string TextureArrowLeftName;
public string TextureArrowRightName;
[XmlElement("Skin")] public string TextureName;
[XmlElement("SkinArrowLeft")] public string TextureArrowLeftName;
[XmlElement("SkinArrowRight")] public string TextureArrowRightName;
public string SelTextureName;
public string SelTextureArrowLeftName;
public string SelTextureArrowRightName;
[XmlElement("SkinSelected")] public string SelTextureName;
[XmlElement("SkinArrowLeftSelected")] public string SelTextureArrowLeftName;
[XmlElement("SkinArrowRightSelected")] public string SelTextureArrowRightName;
public string HighlightTextureName;
[XmlElement("SkinHighlighted")] public string HighlightTextureName;
public string ColorName;
public string SelColorName;
public string HighlightColorName;
[XmlElement("Rect")] public SRectF Rect;
[XmlElement("RectArrowLeft")] public SRectF RectArrowLeft;
[XmlElement("RectArrowRight")] public SRectF RectArrowRight;
public string ArrowColorName;
public string SelArrowColorName;
[XmlElement("Color")] public SThemeColor Color;
[XmlElement("SColor")] public SThemeColor SColor;
[XmlElement("HColor")] public SThemeColor HColor;
public string TextColorName;
public string SelTextColorName;
[XmlElement("ArrowColor")] public SThemeColor ArrowColor;
[XmlElement("ArrowSColor")] public SThemeColor ArrowSColor;
public string TextFont;
public EStyle TextStyle;
[XmlElement("TextColor")] public SThemeColor TextColor;
[XmlElement("TextSColor")] public SThemeColor TextSColor;
[XmlElement("TextH")] public float TextH;
[XmlElement("TextRelativeX")] public float TextRelativeX;
[XmlElement("TextRelativeY")] public float TextRelativeY;
[XmlElement("TextMaxW")] public float TextMaxW;
[XmlElement("TextFont")] public string TextFont;
[XmlElement("TextStyle")] public EStyle TextStyle;
[XmlElement("NumVisible")] public int NumVisible;
}
public class CSelectSlide : IMenuElement, ICloneable
@@ -62,6 +74,11 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public SRectF Rect;
public SRectF RectArrowLeft;
public SRectF RectArrowRight;
@@ -111,7 +128,7 @@ namespace VocaluxeLib.Menu
private readonly List<string> _ValueNames;
private readonly List<int> _ValuePartyModeIDs;
private readonly List<CTexture> _Textures;
private readonly List<CTextureRef> _Textures;
private readonly List<int> _ValueIndexes;
private readonly List<SRectF> _ValueBounds = new List<SRectF>();
@@ -179,7 +196,7 @@ namespace VocaluxeLib.Menu
MaxW = 0f;
_Selected = false;
_Textures = new List<CTexture>();
_Textures = new List<CTextureRef>();
_ValueIndexes = new List<int>();
_ValueNames = new List<string>();
_ValuePartyModeIDs = new List<int>();
@@ -192,17 +209,17 @@ namespace VocaluxeLib.Menu
{
TextureArrowLeftName = slide._Theme.TextureArrowLeftName,
TextureArrowRightName = slide._Theme.TextureArrowRightName,
Color = slide._Theme.Color,
SColor = slide._Theme.SColor,
HColor = slide._Theme.HColor,
ArrowColor = slide._Theme.ArrowColor,
ArrowSColor = slide._Theme.ArrowSColor,
TextColor = slide._Theme.TextColor,
TextSColor = slide._Theme.TextSColor,
SelTextureName = slide._Theme.SelTextureName,
SelTextureArrowLeftName = slide._Theme.SelTextureArrowLeftName,
SelTextureArrowRightName = slide._Theme.SelTextureArrowRightName,
HighlightTextureName = slide._Theme.HighlightTextureName,
ColorName = slide._Theme.ColorName,
SelColorName = slide._Theme.SelColorName,
HighlightColorName = slide._Theme.HighlightColorName,
ArrowColorName = slide._Theme.ArrowColorName,
SelArrowColorName = slide._Theme.SelArrowColorName,
TextColorName = slide._Theme.TextColorName,
SelTextColorName = slide._Theme.SelTextColorName,
TextFont = slide._Theme.TextFont,
TextStyle = slide._Theme.TextStyle
};
@@ -227,7 +244,7 @@ namespace VocaluxeLib.Menu
MaxW = slide.MaxW;
_Selected = slide._Selected;
_Textures = new List<CTexture>(slide._Textures);
_Textures = new List<CTextureRef>(slide._Textures);
_ValueIndexes = new List<int>(slide._ValueIndexes);
_ValueNames = new List<string>(slide._ValueNames);
_ValueBounds = new List<SRectF>(slide._ValueBounds);
@@ -239,6 +256,20 @@ namespace VocaluxeLib.Menu
Visible = slide.Visible;
}
public CSelectSlide(SThemeSelectSlide theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
_Selected = false;
_Textures = new List<CTextureRef>();
_ValueIndexes = new List<int>();
_ValueNames = new List<string>();
_ValuePartyModeIDs = new List<int>();
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
@@ -260,8 +291,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -270,8 +301,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor);
if (xmlReader.GetValue(item + "/SColor", out _Theme.SColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColor.Name, skinIndex, out SelColor);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R);
@@ -280,8 +311,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A);
}
if (xmlReader.GetValue(item + "/HColor", out _Theme.HighlightColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.HighlightColorName, skinIndex, out HighlightColor);
if (xmlReader.GetValue(item + "/HColor", out _Theme.HColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.HColor.Name, skinIndex, out HighlightColor);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HR", ref HighlightColor.R);
@@ -302,8 +333,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightW", ref RectArrowRight.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H);
if (xmlReader.GetValue(item + "/ArrowColor", out _Theme.ArrowColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, skinIndex, out ColorArrow);
if (xmlReader.GetValue(item + "/ArrowColor", out _Theme.ArrowColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColor.Name, skinIndex, out ColorArrow);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowR", ref ColorArrow.R);
@@ -312,8 +343,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowA", ref ColorArrow.A);
}
if (xmlReader.GetValue(item + "/ArrowSColor", out _Theme.SelArrowColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelArrowColorName, skinIndex, out SelColorArrow);
if (xmlReader.GetValue(item + "/ArrowSColor", out _Theme.ArrowSColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowSColor.Name, skinIndex, out SelColorArrow);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSR", ref SelColorArrow.R);
@@ -322,8 +353,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSA", ref SelColorArrow.A);
}
if (xmlReader.GetValue(item + "/TextColor", out _Theme.TextColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, skinIndex, out TextColor);
if (xmlReader.GetValue(item + "/TextColor", out _Theme.TextColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColor.Name, skinIndex, out TextColor);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextR", ref TextColor.R);
@@ -332,8 +363,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextA", ref TextColor.A);
}
if (xmlReader.GetValue(item + "/TextSColor", out _Theme.SelTextColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelTextColorName, skinIndex, out SelTextColor);
if (xmlReader.GetValue(item + "/TextSColor", out _Theme.TextSColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextSColor.Name, skinIndex, out SelTextColor);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSR", ref SelTextColor.R);
@@ -356,174 +387,27 @@ namespace VocaluxeLib.Menu
if (_ThemeLoaded)
{
_Theme.Name = elementName;
_Theme.ArrowColor.Color = new SColorF(ColorArrow);
_Theme.ArrowSColor.Color = new SColorF(SelColorArrow);
_Theme.Color.Color = new SColorF(Color);
_Theme.HColor.Color = new SColorF(HighlightColor);
_Theme.NumVisible = _NumVisible;
_Theme.Rect = new SRectF(Rect);
_Theme.RectArrowLeft = new SRectF(RectArrowLeft);
_Theme.RectArrowRight = new SRectF(RectArrowRight);
_Theme.SColor.Color = new SColorF(SelColor);
_Theme.TextColor.Color = new SColorF(TextColor);
_Theme.TextH = TextH;
_Theme.TextMaxW = MaxW;
_Theme.TextRelativeX = TextRelativeX;
_Theme.TextRelativeY = TextRelativeY;
_Theme.TextSColor.Color = new SColorF(SelTextColor);
LoadTextures();
}
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<Skin>: Texture name");
writer.WriteElementString("Skin", _Theme.TextureName);
writer.WriteComment("<SkinArrowLeft>: Texture name of left arrow");
writer.WriteElementString("SkinArrowLeft", _Theme.TextureArrowLeftName);
writer.WriteComment("<SkinArrowRight>: Texture name of right arrow");
writer.WriteElementString("SkinArrowRight", _Theme.TextureArrowRightName);
writer.WriteComment("<SkinSelected>: Texture name for selected SelectSlide");
writer.WriteElementString("SkinSelected", _Theme.SelTextureName);
writer.WriteComment("<SkinArrowLeftSelected>: Texture name of selected left arrow");
writer.WriteElementString("SkinArrowLeftSelected", _Theme.SelTextureArrowLeftName);
writer.WriteComment("<SkinArrowRightSelected>: Texture name of selected right arrow");
writer.WriteElementString("SkinArrowRightSelected", _Theme.SelTextureArrowRightName);
writer.WriteComment("<SkinHighlighted>: Texture name for highlighted SelectSlide");
writer.WriteElementString("SkinHighlighted", _Theme.HighlightTextureName);
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: SelectSlide position, width and height");
writer.WriteElementString("X", Rect.X.ToString("#0"));
writer.WriteElementString("Y", Rect.Y.ToString("#0"));
writer.WriteElementString("Z", Rect.Z.ToString("#0.00"));
writer.WriteElementString("W", Rect.W.ToString("#0"));
writer.WriteElementString("H", Rect.H.ToString("#0"));
writer.WriteComment("<ArrowLeftX>, <ArrowLeftY>, <ArrowLeftZ>, <ArrowLeftW>, <ArrowLeftH>: Left arrow position, width and height");
writer.WriteElementString("ArrowLeftX", RectArrowLeft.X.ToString("#0"));
writer.WriteElementString("ArrowLeftY", RectArrowLeft.Y.ToString("#0"));
writer.WriteElementString("ArrowLeftZ", RectArrowLeft.Z.ToString("#0.00"));
writer.WriteElementString("ArrowLeftW", RectArrowLeft.W.ToString("#0"));
writer.WriteElementString("ArrowLeftH", RectArrowLeft.H.ToString("#0"));
writer.WriteComment("<ArrowRightX>, <ArrowRightY>, <ArrowRightZ>, <ArrowRightW>, <ArrowRightH>: Right arrow position, width and height");
writer.WriteElementString("ArrowRightX", RectArrowRight.X.ToString("#0"));
writer.WriteElementString("ArrowRightY", RectArrowRight.Y.ToString("#0"));
writer.WriteElementString("ArrowRightZ", RectArrowRight.Z.ToString("#0.00"));
writer.WriteElementString("ArrowRightW", RectArrowRight.W.ToString("#0"));
writer.WriteElementString("ArrowRightH", RectArrowRight.H.ToString("#0"));
writer.WriteComment("<Color>: SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00"));
}
writer.WriteComment("<SColor>: Selected SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.SelColorName))
writer.WriteElementString("SColor", _Theme.SelColorName);
else
{
writer.WriteElementString("SR", SelColor.R.ToString("#0.00"));
writer.WriteElementString("SG", SelColor.G.ToString("#0.00"));
writer.WriteElementString("SB", SelColor.B.ToString("#0.00"));
writer.WriteElementString("SA", SelColor.A.ToString("#0.00"));
}
writer.WriteComment("<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <HR>, <HG>, <HB>, <HA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.HighlightColorName))
writer.WriteElementString("HColor", _Theme.HighlightColorName);
else
{
writer.WriteElementString("HR", HighlightColor.R.ToString("#0.00"));
writer.WriteElementString("HG", HighlightColor.G.ToString("#0.00"));
writer.WriteElementString("HB", HighlightColor.B.ToString("#0.00"));
writer.WriteElementString("HA", HighlightColor.A.ToString("#0.00"));
}
writer.WriteComment("<ArrowColor>: Arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ArrowColorName))
writer.WriteElementString("ArrowColor", _Theme.ArrowColorName);
else
{
writer.WriteElementString("ArrowR", ColorArrow.R.ToString("#0.00"));
writer.WriteElementString("ArrowG", ColorArrow.G.ToString("#0.00"));
writer.WriteElementString("ArrowB", ColorArrow.B.ToString("#0.00"));
writer.WriteElementString("ArrowA", ColorArrow.A.ToString("#0.00"));
}
writer.WriteComment("<ArrowSColor>: Selected arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.SelArrowColorName))
writer.WriteElementString("ArrowSColor", _Theme.SelArrowColorName);
else
{
writer.WriteElementString("ArrowSR", SelColorArrow.R.ToString("#0.00"));
writer.WriteElementString("ArrowSG", SelColorArrow.G.ToString("#0.00"));
writer.WriteElementString("ArrowSB", SelColorArrow.B.ToString("#0.00"));
writer.WriteElementString("ArrowSA", SelColorArrow.A.ToString("#0.00"));
}
writer.WriteComment("<TextColor>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.TextColorName))
writer.WriteElementString("TextColor", _Theme.TextColorName);
else
{
writer.WriteElementString("TextR", TextColor.R.ToString("#0.00"));
writer.WriteElementString("TextG", TextColor.G.ToString("#0.00"));
writer.WriteElementString("TextB", TextColor.B.ToString("#0.00"));
writer.WriteElementString("TextA", TextColor.A.ToString("#0.00"));
}
writer.WriteComment("<TextSColor>: Selected text color from ColorScheme (high priority)");
writer.WriteComment("or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.SelTextColorName))
writer.WriteElementString("TextSColor", _Theme.SelTextColorName);
else
{
writer.WriteElementString("TextSR", SelTextColor.R.ToString("#0.00"));
writer.WriteElementString("TextSG", SelTextColor.G.ToString("#0.00"));
writer.WriteElementString("TextSB", SelTextColor.B.ToString("#0.00"));
writer.WriteElementString("TextSA", SelTextColor.A.ToString("#0.00"));
}
writer.WriteComment("<TextH>: Text height");
writer.WriteElementString("TextH", TextH.ToString("#0.00"));
writer.WriteComment("<TextRelativeX>: Text relative x-position");
if (Math.Abs(TextRelativeX) > 0.01)
writer.WriteElementString("TextRelativeX", TextRelativeX.ToString("#0.00"));
writer.WriteComment("<TextRelativeY>: Text relative y-position");
if (Math.Abs(TextRelativeY) > 0.01)
writer.WriteElementString("TextRelativeY", TextRelativeY.ToString("#0.00"));
writer.WriteComment("<TextMaxW>: Maximum text width (if exists)");
writer.WriteElementString("TextMaxW", MaxW.ToString("#0.00"));
writer.WriteComment("<TextFont>: Text font name");
writer.WriteElementString("TextFont", _Theme.TextFont);
writer.WriteComment("<TextStyle>: Text style: " + CHelper.ListStrings(Enum.GetNames(typeof(EStyle))));
writer.WriteElementString("TextStyle", Enum.GetName(typeof(EStyle), _Theme.TextStyle));
writer.WriteComment("<NumVisible>: Number of visible elements in the slide");
writer.WriteElementString("NumVisible", _NumVisible.ToString());
writer.WriteEndElement();
return true;
}
return false;
}
public void AddValue(string value)
{
AddValue(value, _PartyModeID);
@@ -534,17 +418,17 @@ namespace VocaluxeLib.Menu
AddValue(value, null, _ValueIndexes.Count, partyModeID);
}
public void AddValue(string value, CTexture texture)
public void AddValue(string value, CTextureRef texture)
{
AddValue(value, texture, _ValueIndexes.Count, _PartyModeID);
}
private void _AddValue(string value, CTexture texture, int valueIndex)
private void _AddValue(string value, CTextureRef texture, int valueIndex)
{
AddValue(value, texture, valueIndex, _PartyModeID);
}
public void AddValue(string value, CTexture texture, int valueIndex, int partyModeID)
public void AddValue(string value, CTextureRef texture, int valueIndex, int partyModeID)
{
_ValueNames.Add(value);
_Textures.Add(texture);
@@ -565,7 +449,7 @@ namespace VocaluxeLib.Menu
_ValueBounds.Clear();
}
public void AddValues(string[] values, CTexture[] textures)
public void AddValues(string[] values, CTextureRef[] textures)
{
if (values.Length != textures.Length)
return;
@@ -589,7 +473,7 @@ namespace VocaluxeLib.Menu
RenameValue(Selection, newName);
}
public void RenameValue(int selection, string newName, CTexture newTexture = null)
public void RenameValue(int selection, string newName, CTextureRef newTexture = null)
{
if (selection < 0 && selection >= _ValueNames.Count)
return;
@@ -713,15 +597,15 @@ namespace VocaluxeLib.Menu
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
return;
CTexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
CTexture textureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.TextureArrowLeftName, _PartyModeID);
CTexture textureArrowRight = CBase.Theme.GetSkinTexture(_Theme.TextureArrowRightName, _PartyModeID);
CTextureRef texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
CTextureRef textureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.TextureArrowLeftName, _PartyModeID);
CTextureRef textureArrowRight = CBase.Theme.GetSkinTexture(_Theme.TextureArrowRightName, _PartyModeID);
CTexture selTexture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
CTexture selTextureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowLeftName, _PartyModeID);
CTexture selTextureArrowRight = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowRightName, _PartyModeID);
CTextureRef selTexture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
CTextureRef selTextureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowLeftName, _PartyModeID);
CTextureRef selTextureArrowRight = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowRightName, _PartyModeID);
CTexture highlightTexture = CBase.Theme.GetSkinTexture(_Theme.HighlightTextureName, _PartyModeID);
CTextureRef highlightTexture = CBase.Theme.GetSkinTexture(_Theme.HighlightTextureName, _PartyModeID);
if (Selected)
{
@@ -809,30 +693,60 @@ namespace VocaluxeLib.Menu
}
}
public SThemeSelectSlide GetTheme()
{
return _Theme;
}
public void UnloadTextures() {}
public void LoadTextures()
{
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
else
Color = _Theme.Color.Color;
if (!String.IsNullOrEmpty(_Theme.SelColorName))
SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.SColor.Name))
SelColor = CBase.Theme.GetColor(_Theme.SColor.Name, _PartyModeID);
else
SelColor = _Theme.SColor.Color;
if (!String.IsNullOrEmpty(_Theme.HighlightColorName))
HighlightColor = CBase.Theme.GetColor(_Theme.HighlightColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.HColor.Name))
HighlightColor = CBase.Theme.GetColor(_Theme.HColor.Name, _PartyModeID);
else
HighlightColor = _Theme.HColor.Color;
if (!String.IsNullOrEmpty(_Theme.ArrowColorName))
ColorArrow = CBase.Theme.GetColor(_Theme.ArrowColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.ArrowColor.Name))
ColorArrow = CBase.Theme.GetColor(_Theme.ArrowColor.Name, _PartyModeID);
else
ColorArrow = _Theme.ArrowColor.Color;
if (!String.IsNullOrEmpty(_Theme.SelArrowColorName))
SelColorArrow = CBase.Theme.GetColor(_Theme.SelArrowColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.ArrowSColor.Name))
SelColorArrow = CBase.Theme.GetColor(_Theme.ArrowSColor.Name, _PartyModeID);
else
SelColorArrow = _Theme.ArrowSColor.Color;
if (!String.IsNullOrEmpty(_Theme.TextColorName))
TextColor = CBase.Theme.GetColor(_Theme.TextColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.TextColor.Name))
TextColor = CBase.Theme.GetColor(_Theme.TextColor.Name, _PartyModeID);
else
TextColor = _Theme.TextColor.Color;
if (!String.IsNullOrEmpty(_Theme.SelColorName))
SelTextColor = CBase.Theme.GetColor(_Theme.SelTextColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.TextSColor.Name))
SelTextColor = CBase.Theme.GetColor(_Theme.TextSColor.Name, _PartyModeID);
else
SelTextColor = _Theme.TextSColor.Color;
Rect = _Theme.Rect;
RectArrowLeft = _Theme.RectArrowLeft;
RectArrowRight = _Theme.RectArrowRight;
NumVisible = _Theme.NumVisible;
TextH = _Theme.TextH;
TextRelativeX = _Theme.TextRelativeX;
TextRelativeY = _Theme.TextRelativeY;
MaxW = _Theme.TextMaxW;
}
public void ReloadTextures()
@@ -853,18 +767,27 @@ namespace VocaluxeLib.Menu
{
Rect.X += stepX;
Rect.Y += stepY;
_Theme.Rect.X += stepX;
_Theme.Rect.Y += stepY;
}
if (_ArrowLeftSelected)
{
RectArrowLeft.X += stepX;
RectArrowLeft.Y += stepY;
_Theme.RectArrowLeft.X += stepX;
_Theme.RectArrowLeft.Y += stepY;
}
if (_ArrowRightSelected)
{
RectArrowRight.X += stepX;
RectArrowRight.Y += stepY;
_Theme.RectArrowRight.X += stepX;
_Theme.RectArrowRight.Y += stepY;
}
}
@@ -879,6 +802,9 @@ namespace VocaluxeLib.Menu
Rect.H += stepH;
if (Rect.H <= 0)
Rect.H = 1;
_Theme.Rect.W = Rect.W;
_Theme.Rect.H = Rect.H;
}
if (_ArrowLeftSelected)
@@ -890,6 +816,9 @@ namespace VocaluxeLib.Menu
RectArrowLeft.H += stepH;
if (RectArrowLeft.H <= 0)
RectArrowLeft.H = 1;
_Theme.RectArrowLeft.W = RectArrowLeft.W;
_Theme.RectArrowLeft.H = RectArrowLeft.H;
}
if (_ArrowRightSelected)
@@ -901,6 +830,9 @@ namespace VocaluxeLib.Menu
RectArrowRight.H += stepH;
if (RectArrowRight.H <= 0)
RectArrowRight.H = 1;
_Theme.RectArrowRight.W = RectArrowRight.W;
_Theme.RectArrowRight.H = RectArrowRight.H;
}
}
#endregion ThemeEdit
+70 -67
View File
@@ -17,15 +17,21 @@
using System;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
struct SThemeStatic
[XmlType("Static")]
public struct SThemeStatic
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
[XmlElement("Skin")]
public string TextureName;
public string ColorName;
public SThemeColor Color;
public SRectF Rect;
public SReflection Reflection;
}
public class CStatic : IMenuElement
@@ -40,8 +46,13 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
private CTexture _Texture;
public CTexture Texture
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
private CTextureRef _Texture;
public CTextureRef Texture
{
get { return _Texture ?? CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); }
@@ -62,6 +73,11 @@ namespace VocaluxeLib.Menu
public EAspect Aspect = EAspect.Stretch;
public CStatic()
{
}
public CStatic(int partyModeID)
{
_PartyModeID = partyModeID;
@@ -83,7 +99,7 @@ namespace VocaluxeLib.Menu
Visible = s.Visible;
}
public CStatic(int partyModeID, CTexture texture, SColorF color, SRectF rect)
public CStatic(int partyModeID, CTextureRef texture, SColorF color, SRectF rect)
{
_PartyModeID = partyModeID;
@@ -100,6 +116,14 @@ namespace VocaluxeLib.Menu
Rect = rect;
}
public CStatic(SThemeStatic theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
@@ -113,8 +137,10 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
_Theme.Rect = new SRectF(Rect);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -123,14 +149,20 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
_Theme.Color.Color = new SColorF(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(true, ReflectionHeight, ReflectionSpace);
}
else
{
Reflection = false;
_Theme.Reflection = new SReflection(false, 0f, 0f);
}
if (_ThemeLoaded)
{
@@ -140,51 +172,6 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<Skin>: Texture name");
writer.WriteElementString("Skin", _Theme.TextureName);
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: Static position, width and height");
writer.WriteElementString("X", Rect.X.ToString("#0"));
writer.WriteElementString("Y", Rect.Y.ToString("#0"));
writer.WriteElementString("Z", Rect.Z.ToString("#0.00"));
writer.WriteElementString("W", Rect.W.ToString("#0"));
writer.WriteElementString("H", Rect.H.ToString("#0"));
writer.WriteComment("<Color>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00"));
}
writer.WriteComment("<Reflection> If exists:");
writer.WriteComment(" <Space>: Reflection Space");
writer.WriteComment(" <Height>: Reflection Height");
if (Reflection)
{
writer.WriteStartElement("Reflection");
writer.WriteElementString("Space", ReflectionSpace.ToString("#0"));
writer.WriteElementString("Height", ReflectionHeight.ToString("#0"));
writer.WriteEndElement();
}
writer.WriteEndElement();
return true;
}
return false;
}
public void Draw(bool forceDraw = false)
{
Draw(Aspect, 1f, 0f, forceDraw);
@@ -192,34 +179,45 @@ namespace VocaluxeLib.Menu
public void Draw(EAspect aspect, float scale = 1f, float zModify = 0f, bool forceDraw = false)
{
CTexture texture = Texture ?? new CTexture((int)Rect.W, (int)Rect.H);
SRectF bounds = Rect.Scale(scale);
SRectF rect;
if (aspect != EAspect.Stretch)
CHelper.SetRect(bounds, out rect, texture.OrigAspect, aspect);
else
rect = bounds;
rect.Z = Rect.Z + zModify;
CTextureRef texture = Texture;
SRectF rect = Rect.Scale(scale);
rect.Z += zModify;
if (texture != null)
rect = CHelper.FitInBounds(rect, texture.OrigAspect, aspect);
var color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
if (Visible || forceDraw || (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
{
CBase.Drawing.DrawTexture(texture, rect, color, bounds);
if (Reflection)
CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
if (texture != null)
{
CBase.Drawing.DrawTexture(texture, rect, color);
if (Reflection)
CBase.Drawing.DrawTextureReflection(texture, rect, color, ReflectionSpace, ReflectionHeight);
}
else
CBase.Drawing.DrawRect(color, rect);
}
if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
CBase.Drawing.DrawColor(new SColorF(1f, 1f, 1f, 0.5f), rect);
CBase.Drawing.DrawRect(new SColorF(1f, 1f, 1f, 0.5f), rect);
}
public void UnloadTextures() {}
public void LoadTextures()
{
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
else
Color = _Theme.Color.Color;
Rect = new SRectF(_Theme.Rect);
Reflection = _Theme.Reflection.Enabled;
if (Reflection)
{
ReflectionSpace = _Theme.Reflection.Space;
ReflectionHeight = _Theme.Reflection.Height;
}
}
public void ReloadTextures()
@@ -228,6 +226,11 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public SThemeStatic GetTheme()
{
return _Theme;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
+86 -104
View File
@@ -17,20 +17,28 @@
using System;
using System.Drawing;
using System.Xml;
using System.Xml.Serialization;
namespace VocaluxeLib.Menu
{
struct SThemeText
[XmlType("Text")]
public struct SThemeText
{
public string Name;
[XmlAttribute(AttributeName = "Name")] public string Name;
public string Text;
public string ColorName;
public string SelColorName; //for Buttons
public string FontFamily;
public EStyle FontStyle;
public float FontHeight;
[XmlElement("X")] public float X;
[XmlElement("Y")] public float Y;
[XmlElement("Z")] public float Z;
[XmlElement("H")] public float FontHeight;
[XmlElement("MaxW")] public float MaxWidth;
public SThemeColor Color;
public SThemeColor SColor; //for Buttons
[XmlElement("Align")] public EAlignment Align;
[XmlElement("ResizeAlign")] public EHAlignment ResizeAlign;
[XmlElement("Style")] public EStyle FontStyle;
[XmlElement("Font")] public string FontFamily;
[XmlElement("Text")] public string Text;
public SReflection Reflection;
}
public class CText : IMenuElement, IFontObserver
@@ -45,6 +53,11 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
private bool _ButtonText;
private bool _PositionNeedsUpdate = true;
@@ -287,6 +300,17 @@ namespace VocaluxeLib.Menu
ReflectionHeight = rheight;
}
public CText(SThemeText theme, int partyModeID, bool buttonText = false)
{
_PartyModeID = partyModeID;
_TranslationID = partyModeID;
_Theme = theme;
_ButtonText = buttonText;
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
return LoadTheme(xmlPath, elementName, xmlReader, skinIndex, false);
@@ -305,8 +329,8 @@ namespace VocaluxeLib.Menu
xmlReader.TryGetFloatValue(item + "/MaxW", ref _MaxWidth);
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -315,8 +339,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor);
if (xmlReader.GetValue(item + "/SColor", out _Theme.SColor.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColor.Name, skinIndex, out SelColor);
else
{
if (xmlReader.TryGetFloatValue(item + "/SR", ref SelColor.R))
@@ -332,7 +356,6 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Theme.FontHeight);
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Theme.FontStyle);
_ThemeLoaded &= xmlReader.GetValue(item + "/Font", out _Theme.FontFamily);
Font = new CFont(_Theme.FontFamily, _Theme.FontStyle, _Theme.FontHeight);
_ThemeLoaded &= xmlReader.GetValue(item + "/Text", out _Theme.Text, String.Empty);
@@ -340,10 +363,22 @@ namespace VocaluxeLib.Menu
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref ReflectionHeight);
_Theme.Reflection = new SReflection(true, ReflectionHeight, ReflectionSpace);
}
else
_Theme.Reflection = new SReflection(false, 0f, 0f);
// Set values
_Theme.Name = elementName;
_Theme.Align = _Align;
_Theme.Color.Color = Color;
_Theme.ResizeAlign = _ResizeAlign;
_Theme.SColor.Color = SelColor;
_Theme.MaxWidth = _MaxWidth;
_Theme.X = _X;
_Theme.Y = _Y;
_Theme.Z = _Z;
_ButtonText = buttonText;
_PositionNeedsUpdate = true;
@@ -352,90 +387,6 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded || _ButtonText)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<X>, <Y>: Text position");
writer.WriteElementString("X", X.ToString("#0"));
writer.WriteElementString("Y", Y.ToString("#0"));
if (!_ButtonText)
{
writer.WriteComment("<Z>: Text position");
writer.WriteElementString("Z", Z.ToString("#0.00"));
}
writer.WriteComment("<H>: Text height");
writer.WriteElementString("H", _Theme.FontHeight.ToString("#0"));
writer.WriteComment("<MaxW>: Maximum text width (if exists)");
if (MaxWidth > 0)
writer.WriteElementString("MaxW", MaxWidth.ToString("#0"));
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00"));
}
writer.WriteComment("<SColor>: Selected Text color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.SelColorName))
writer.WriteElementString("SColor", _Theme.SelColorName);
else
{
writer.WriteElementString("SR", SelColor.R.ToString("#0.00"));
writer.WriteElementString("SG", SelColor.G.ToString("#0.00"));
writer.WriteElementString("SB", SelColor.B.ToString("#0.00"));
writer.WriteElementString("SA", SelColor.A.ToString("#0.00"));
}
writer.WriteComment("<Align>: Text align horizontal: " + CHelper.ListStrings(Enum.GetNames(typeof(EAlignment))));
writer.WriteElementString("Align", Enum.GetName(typeof(EAlignment), Align));
writer.WriteComment("<ResizeAlign>: Text align vertical (on downsizing): " + CHelper.ListStrings(Enum.GetNames(typeof(EHAlignment))));
writer.WriteElementString("ResizeAlign", Enum.GetName(typeof(EHAlignment), ResizeAlign));
writer.WriteComment("<Style>: Text style: " + CHelper.ListStrings(Enum.GetNames(typeof(EStyle))));
writer.WriteElementString("Style", Enum.GetName(typeof(EStyle), _Theme.FontStyle));
writer.WriteComment("<Font>: Text font name");
writer.WriteElementString("Font", _Theme.FontFamily);
writer.WriteComment("<Text>: Nothing or translation tag");
writer.WriteElementString("Text", CBase.Language.TranslationExists(_Theme.Text) ? _Theme.Text : string.Empty);
if (!_ButtonText)
{
writer.WriteComment("<Reflection> If exists:");
writer.WriteComment(" <Space>: Reflection Space");
writer.WriteComment(" <Height>: Reflection Height");
}
if (ReflectionHeight > 0 && !_ButtonText)
{
writer.WriteStartElement("Reflection");
writer.WriteElementString("Space", ReflectionSpace.ToString("#0"));
writer.WriteElementString("Height", ReflectionHeight.ToString("#0"));
writer.WriteEndElement();
}
writer.WriteEndElement();
return true;
}
return false;
}
public void Draw(bool forceDraw = false)
{
if (!forceDraw && !Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
@@ -453,7 +404,7 @@ namespace VocaluxeLib.Menu
CBase.Fonts.DrawTextReflection(_Text, Font, Rect.X, Rect.Y, Z, color, ReflectionSpace, ReflectionHeight);
if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(Rect.X, Rect.Y, Rect.W, Rect.H, Z));
CBase.Drawing.DrawRect(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(Rect.X, Rect.Y, Rect.W, Rect.H, Z));
}
public void Draw(float begin, float end)
@@ -469,7 +420,7 @@ namespace VocaluxeLib.Menu
}
if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(X, Y, Rect.W, Rect.H, Z));
CBase.Drawing.DrawRect(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(X, Y, Rect.W, Rect.H, Z));
}
public void DrawRelative(float rx, float ry, float reflectionHeight = 0f, float reflectionSpace = 0f, float rectHeight = 0f)
@@ -496,11 +447,34 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
else
Color = new SColorF(_Theme.Color.Color);
if (!String.IsNullOrEmpty(_Theme.SelColorName))
SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.SColor.Name))
SelColor = CBase.Theme.GetColor(_Theme.SColor.Name, _PartyModeID);
else
SelColor = new SColorF(_Theme.SColor.Color);
_X = _Theme.X;
_Y = _Theme.Y;
_Z = _Theme.Z;
_MaxWidth = _Theme.MaxWidth;
_Align = _Theme.Align;
_ResizeAlign = _Theme.ResizeAlign;
Font = new CFont(_Theme.FontFamily, _Theme.FontStyle, _Theme.FontHeight);
if (_Theme.Reflection.Enabled)
{
ReflectionSpace = _Theme.Reflection.Space;
ReflectionHeight = _Theme.Reflection.Height;
}
Text = _Theme.Text;
Selected = false;
_ThemeLoaded = true;
}
public void ReloadTextures()
@@ -509,11 +483,19 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public SThemeText GetTheme()
{
return _Theme;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
X += stepX;
Y += stepY;
_Theme.X = X;
_Theme.Y = Y;
}
public void ResizeElement(int stepW, int stepH)
-1
View File
@@ -24,7 +24,6 @@ namespace VocaluxeLib.Menu
string GetThemeName();
bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex);
bool SaveTheme(XmlWriter writer);
void UnloadTextures();
void LoadTextures();
+82 -99
View File
@@ -18,7 +18,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
using VocaluxeLib.Songs;
@@ -40,21 +40,31 @@ namespace VocaluxeLib.Menu.SingNotes
public List<CParticleEffect> PerfectLineTwinkle;
}
struct SThemeSingBar
[XmlType("Position")]
public struct SBarPosition
{
public string Name;
[XmlAttribute(AttributeName = "Name")] public string Name;
public SRectF Rect;
}
public string SkinLeftName;
public string SkinMiddleName;
public string SkinRightName;
[XmlType("SingBar")]
public struct SThemeSingBar
{
[XmlAttribute(AttributeName = "Name")] public string Name;
public string SkinBackgroundLeftName;
public string SkinBackgroundMiddleName;
public string SkinBackgroundRightName;
[XmlElement("SkinLeft")] public string SkinLeftName;
[XmlElement("SkinMiddle")] public string SkinMiddleName;
[XmlElement("SkinRight")] public string SkinRightName;
public string SkinGoldenStarName;
public string SkinToneHelperName;
public string SkinPerfectNoteStarName;
[XmlElement("SkinBackgroundLeft")] public string SkinBackgroundLeftName;
[XmlElement("SkinBackgroundMiddle")] public string SkinBackgroundMiddleName;
[XmlElement("SkinBackgroundRight")] public string SkinBackgroundRightName;
[XmlElement("SkinGoldenStar")] public string SkinGoldenStarName;
[XmlElement("SkinToneHelper")] public string SkinToneHelperName;
[XmlElement("SkinPerfectNoteStart")] public string SkinPerfectNoteStarName;
[XmlArray("BarPositions")] public SBarPosition[] BarPos;
}
public abstract class CSingNotes : IMenuElement
@@ -78,17 +88,36 @@ namespace VocaluxeLib.Menu.SingNotes
{
_PartyModeID = partyModeID;
_Theme = new SThemeSingBar();
_Theme.BarPos = new SBarPosition[CHelper.Sum(CBase.Settings.GetMaxNumPlayer())];
_ThemeLoaded = false;
_PlayerNotes = new List<SPlayerNotes>();
_ActID = 0;
}
protected CSingNotes(SThemeSingBar theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
_PlayerNotes = new List<SPlayerNotes>();
_ActID = 0;
BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
LoadTextures();
}
public string GetThemeName()
{
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
@@ -106,21 +135,22 @@ namespace VocaluxeLib.Menu.SingNotes
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", out _Theme.SkinToneHelperName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStarName, String.Empty);
int i = 0;
BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
{
for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++)
for (int player = 0; player <= numplayer; player++)
{
if (player <= numplayer)
{
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);
}
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 = new SRectF(BarPos[player, numplayer]);
i++;
}
}
@@ -133,68 +163,6 @@ namespace VocaluxeLib.Menu.SingNotes
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<SkinLeft>: Texture name of note begin");
writer.WriteElementString("SkinLeft", _Theme.SkinLeftName);
writer.WriteComment("<SkinMiddle>: Texture name of note middle");
writer.WriteElementString("SkinMiddle", _Theme.SkinMiddleName);
writer.WriteComment("<SkinRight>: Texture name of note end");
writer.WriteElementString("SkinRight", _Theme.SkinRightName);
writer.WriteComment("<SkinBackgroundLeft>: Texture name of note background begin");
writer.WriteElementString("SkinBackgroundLeft", _Theme.SkinBackgroundLeftName);
writer.WriteComment("<SkinBackgroundMiddle>: Texture name of note background middle");
writer.WriteElementString("SkinBackgroundMiddle", _Theme.SkinBackgroundMiddleName);
writer.WriteComment("<SkinBackgroundRight>: Texture name of note background right");
writer.WriteElementString("SkinBackgroundRight", _Theme.SkinBackgroundRightName);
writer.WriteComment("<SkinGoldenStar>: Texture name of golden star");
writer.WriteElementString("SkinGoldenStar", _Theme.SkinGoldenStarName);
writer.WriteComment("<SkinToneHelper>: Texture name of tone helper");
writer.WriteElementString("SkinToneHelper", _Theme.SkinToneHelperName);
writer.WriteComment("<SkinPerfectNoteStar>: Texture name of perfect star");
writer.WriteElementString("SkinPerfectNoteStar", _Theme.SkinPerfectNoteStarName);
writer.WriteComment("<BarPositions>");
writer.WriteComment(" <P$N$X>, <P$N$Y>, <P$N$Z>, <P$N$W>, <P$N$H>");
writer.WriteComment(" position, width and height of note bars: first index = player number; second index = num players seen on screen");
writer.WriteStartElement("BarPositions");
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
{
for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++)
{
if (player > numplayer)
continue;
string target = "P" + (player + 1) + "N" + (numplayer + 1);
writer.WriteElementString(target + "X", BarPos[player, numplayer].X.ToString("#0"));
writer.WriteElementString(target + "Y", BarPos[player, numplayer].Y.ToString("#0"));
writer.WriteElementString(target + "Z", BarPos[player, numplayer].Z.ToString("#0.00"));
writer.WriteElementString(target + "W", BarPos[player, numplayer].W.ToString("#0"));
writer.WriteElementString(target + "H", BarPos[player, numplayer].H.ToString("#0"));
}
}
writer.WriteEndElement(); //BarPositions
writer.WriteEndElement();
return true;
}
return false;
}
public void Reset()
{
_PlayerNotes.Clear();
@@ -332,7 +300,7 @@ namespace VocaluxeLib.Menu.SingNotes
);
_DrawNoteBG(rect, color, 1f, _PlayerNotes[n].Timer);
_DrawNote(rect, new SColorF(5f, 5f, 5f, 0.7f * _PlayerNotes[n].Alpha), 0.7f);
_DrawNote(rect, new SColorF(1f, 1f, 1f, 0.7f * _PlayerNotes[n].Alpha), 0.7f);
if (note.Type == ENoteType.Golden)
{
@@ -443,7 +411,16 @@ namespace VocaluxeLib.Menu.SingNotes
public void UnloadTextures() {}
public void LoadTextures() {}
public void LoadTextures()
{
foreach (SBarPosition bp in _Theme.BarPos)
{
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;
}
}
public void ReloadTextures()
{
@@ -451,6 +428,11 @@ namespace VocaluxeLib.Menu.SingNotes
LoadTextures();
}
public SThemeSingBar GetTheme()
{
return _Theme;
}
private int _FindPlayerNotes(int id)
{
for (int i = 0; i < _PlayerNotes.Count; i++)
@@ -472,9 +454,9 @@ namespace VocaluxeLib.Menu.SingNotes
var noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z);
CTexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
CTexture noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID);
CTexture noteEnd = CBase.Theme.GetSkinTexture(_Theme.SkinRightName, _PartyModeID);
CTextureRef noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
CTextureRef noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID);
CTextureRef noteEnd = CBase.Theme.GetSkinTexture(_Theme.SkinRightName, _PartyModeID);
//Width of each of the ends (round parts)
//Need 2 of them so use minimum
@@ -519,9 +501,9 @@ namespace VocaluxeLib.Menu.SingNotes
rect.Z
);
CTexture noteBackgroundBegin = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundLeftName, _PartyModeID);
CTexture noteBackgroundMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName, _PartyModeID);
CTexture noteBackgroundEnd = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName, _PartyModeID);
CTextureRef noteBackgroundBegin = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundLeftName, _PartyModeID);
CTextureRef noteBackgroundMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName, _PartyModeID);
CTextureRef noteBackgroundEnd = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName, _PartyModeID);
float dx = r.H * noteBackgroundBegin.OrigAspect;
if (2 * dx > r.W)
@@ -539,12 +521,13 @@ namespace VocaluxeLib.Menu.SingNotes
CBase.Drawing.DrawTexture(noteBackgroundEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), col);
}
protected void _DrawNoteLines(SRectF rect, SColorF color)
private static void _DrawNoteLines(SRectF rect, SColorF color)
{
for (int i = 0; i < CBase.Settings.GetNumNoteLines() - 1; i++)
SRectF lineRect = new SRectF(rect) {H = 1.5f};
for (int i = 0; i < CBase.Settings.GetNumNoteLines(); i++)
{
float y = rect.Y + rect.H / CBase.Settings.GetNumNoteLines() * (i + 1);
CBase.Drawing.DrawColor(color, new SRectF(rect.X, y, rect.W, 1, -1.0f));
lineRect.Y = rect.Y + rect.H / CBase.Settings.GetNumNoteLines() * (i + 1);
CBase.Drawing.DrawRect(color, lineRect);
}
}
@@ -614,7 +597,7 @@ namespace VocaluxeLib.Menu.SingNotes
rect.Z
);
CTexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
CTextureRef noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
float dx = r.H * noteBegin.OrigAspect;
if (2 * dx > r.W)
dx = r.W / 2;
@@ -671,7 +654,7 @@ namespace VocaluxeLib.Menu.SingNotes
_PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
CTexture toneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID);
CTextureRef toneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID);
CBase.Drawing.DrawTexture(toneHelper, drawRect, color);
@@ -21,5 +21,8 @@ namespace VocaluxeLib.Menu.SingNotes
{
public CSingNotesClassic(int partyModeID)
: base(partyModeID) {}
public CSingNotesClassic(SThemeSingBar theme, int partyModeID)
: base(theme, partyModeID) {}
}
}
+19 -8
View File
@@ -30,7 +30,13 @@ namespace VocaluxeLib.Menu.SongMenu
public CSongMenu(int partyModeID)
{
_PartyModeID = partyModeID;
_CreateSongMenu();
_CreateSongMenu(new SThemeSongMenu());
}
public CSongMenu(SThemeSongMenu theme, int partyModeID)
{
_PartyModeID = partyModeID;
_CreateSongMenu(theme);
}
#region ISongMenu
@@ -63,6 +69,11 @@ namespace VocaluxeLib.Menu.SongMenu
get { return _SongMenu.Rect; }
}
public bool ThemeLoaded
{
get { return _SongMenu.ThemeLoaded; }
}
public void Update(SScreenSongOptions songOptions)
{
_SongMenu.Update(songOptions);
@@ -150,11 +161,6 @@ namespace VocaluxeLib.Menu.SongMenu
return _SongMenu.LoadTheme(xmlPath, elementName, xmlReader, skinIndex);
}
public bool SaveTheme(XmlWriter writer)
{
return _SongMenu.SaveTheme(writer);
}
public void UnloadTextures()
{
_SongMenu.UnloadTextures();
@@ -179,9 +185,14 @@ namespace VocaluxeLib.Menu.SongMenu
{
_SongMenu.ResizeElement(stepW, stepH);
}
public SThemeSongMenu GetTheme()
{
return _SongMenu.GetTheme();
}
#endregion IMenuElement
private void _CreateSongMenu()
private void _CreateSongMenu(SThemeSongMenu theme)
{
if (_SongMenu != null)
_SongMenu.OnHide();
@@ -197,7 +208,7 @@ namespace VocaluxeLib.Menu.SongMenu
// _SongMenu = new CSongMenuDreidel();
// break;
case ESongMenu.TR_CONFIG_TILE_BOARD:
_SongMenu = new CSongMenuTileBoard(_PartyModeID);
_SongMenu = new CSongMenuTileBoard(theme, _PartyModeID);
break;
//case ESongMenu.TR_CONFIG_BOOK:
+83 -138
View File
@@ -19,77 +19,116 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
using VocaluxeLib.PartyModes;
using VocaluxeLib.Songs;
namespace VocaluxeLib.Menu.SongMenu
{
struct SThemeSongMenu
[XmlType("SongMenu")]
public struct SThemeSongMenu
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
[XmlElement("CoverBackground")]
public string CoverBackgroundName;
[XmlElement("CoverBigBackground")]
public string CoverBigBackgroundName;
[XmlElement("DuetIcon")]
public string DuetIconName;
[XmlElement("VideoIcon")]
public string VideoIconName;
[XmlElement("MedleyCalcIcon")]
public string MedleyCalcIcon;
[XmlElement("MedleyTagIcon")]
public string MedleyTagIcon;
public string ColorName;
[XmlElement("Color")]
public SThemeColor Color;
//public SThemeSongMenuBook songMenuBook;
//public SThemeSongMenuDreidel songMenuDreidel;
//public SThemeSongMenuList songMenuList;
[XmlElement("SongMenuTileBoard")]
public SThemeSongMenuTileBoard SongMenuTileBoard;
public SThemeSongMenu(SThemeSongMenu theme)
{
Name = theme.Name;
CoverBackgroundName = theme.CoverBackgroundName;
CoverBigBackgroundName = theme.CoverBigBackgroundName;
DuetIconName = theme.DuetIconName;
VideoIconName = theme.VideoIconName;
MedleyCalcIcon = theme.MedleyCalcIcon;
MedleyTagIcon = theme.MedleyTagIcon;
Color = new SThemeColor(theme.Color);
SongMenuTileBoard = theme.SongMenuTileBoard;
}
}
struct SThemeSongMenuTileBoard
public struct SThemeSongMenuTileBoard
{
[XmlElement("NumW")]
/// <summary>
/// Number of tiles horizontal
/// </summary>
public int NumW;
[XmlElement("NumH")]
/// <summary>
/// Number of tiles vertical
/// </summary>
public int NumH;
[XmlElement("NumWsmall")]
/// <summary>
/// Number of tiles horizontal in small-modus
/// </summary>
public int NumWsmall;
[XmlElement("NumHsmall")]
/// <summary>
/// Number of tiles vertical in small-modus
/// </summary>
public int NumHsmall;
[XmlElement("SpaceW")]
/// <summary>
/// Space between tiles horizontal
/// </summary>
public float SpaceW;
[XmlElement("SpaceH")]
/// <summary>
/// Space between tiles vertical
/// </summary>
public float SpaceH;
[XmlElement("TileRect")]
public SRectF TileRect;
[XmlElement("TileRectSmall")]
public SRectF TileRectSmall;
public CText TextArtist;
public CText TextTitle;
public CText TextSongLength;
[XmlElement("TextArtist")]
public SThemeText TextArtist;
[XmlElement("TextTitle")]
public SThemeText TextTitle;
[XmlElement("TextSongLength")]
public SThemeText TextSongLength;
public CStatic StaticCoverBig;
public CStatic StaticTextBG;
public CStatic StaticDuetIcon;
public CStatic StaticVideoIcon;
public CStatic StaticMedleyCalcIcon;
public CStatic StaticMedleyTagIcon;
[XmlElement("StaticCoverBig")]
public SThemeStatic StaticCoverBig;
[XmlElement("StaticTextBG")]
public SThemeStatic StaticTextBG;
[XmlElement("StaticDuetIcon")]
public SThemeStatic StaticDuetIcon;
[XmlElement("StaticVideoIcon")]
public SThemeStatic StaticVideoIcon;
[XmlElement("StaticMedleyCalcIcon")]
public SThemeStatic StaticMedleyCalcIcon;
[XmlElement("StaticMedleyTagIcon")]
public SThemeStatic StaticMedleyTagIcon;
}
abstract class CSongMenuFramework : ISongMenu
@@ -98,6 +137,11 @@ namespace VocaluxeLib.Menu.SongMenu
protected SThemeSongMenu _Theme;
private bool _ThemeLoaded;
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
protected bool _Initialized;
private int _PreviewNrInternal = -1;
@@ -157,21 +201,15 @@ namespace VocaluxeLib.Menu.SongMenu
{
Visible = true;
_PartyModeID = partyModeID;
_Theme = new SThemeSongMenu
{
SongMenuTileBoard =
{
TextArtist = new CText(_PartyModeID),
TextTitle = new CText(_PartyModeID),
TextSongLength = new CText(_PartyModeID),
StaticCoverBig = new CStatic(_PartyModeID),
StaticTextBG = new CStatic(_PartyModeID),
StaticDuetIcon = new CStatic(_PartyModeID),
StaticVideoIcon = new CStatic(_PartyModeID),
StaticMedleyCalcIcon = new CStatic(_PartyModeID),
StaticMedleyTagIcon = new CStatic(_PartyModeID)
}
};
}
protected CSongMenuFramework(SThemeSongMenu theme, int partyModeID)
{
Visible = true;
_PartyModeID = partyModeID;
_Theme = new SThemeSongMenu(theme);
LoadTextures();
}
#region Theme
@@ -180,7 +218,12 @@ namespace VocaluxeLib.Menu.SongMenu
return _Theme.Name;
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
public SThemeSongMenu GetTheme()
{
return new SThemeSongMenu(_Theme);
}
public virtual bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
_ThemeLoaded = true;
@@ -192,8 +235,8 @@ namespace VocaluxeLib.Menu.SongMenu
_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.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _ColorInternal);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out _ColorInternal);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _ColorInternal.R);
@@ -201,6 +244,7 @@ namespace VocaluxeLib.Menu.SongMenu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _ColorInternal.B);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _ColorInternal.A);
}
_Theme.Color.Color = new SColorF(_ColorInternal);
#region SongMenuTileBoard
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumW", ref _Theme.SongMenuTileBoard.NumW);
@@ -211,17 +255,6 @@ namespace VocaluxeLib.Menu.SongMenu
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumWsmall", ref _Theme.SongMenuTileBoard.NumWsmall);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/SongMenuTileBoard/NumHsmall", ref _Theme.SongMenuTileBoard.NumHsmall);
_ThemeLoaded &= _Theme.SongMenuTileBoard.TextArtist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.SongMenuTileBoard.TextTitle.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.SongMenuTileBoard.TextSongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.SongMenuTileBoard.StaticCoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.SongMenuTileBoard.StaticTextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.SongMenuTileBoard.StaticDuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.SongMenuTileBoard.StaticVideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.SongMenuTileBoard.StaticMedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader, skinIndex);
_ThemeLoaded &= _Theme.SongMenuTileBoard.StaticMedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader, skinIndex);
_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);
@@ -238,6 +271,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (_ThemeLoaded)
{
_Theme.Name = elementName;
LoadTextures();
Init();
}
@@ -245,98 +279,6 @@ namespace VocaluxeLib.Menu.SongMenu
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<CoverBackground>: Texture name of cover background/tiles");
writer.WriteElementString("CoverBackground", _Theme.CoverBackgroundName);
writer.WriteComment("<CoverBigBackground>: Texture name of big cover background and info texts");
writer.WriteElementString("CoverBigBackground", _Theme.CoverBigBackgroundName);
writer.WriteComment("<DuetIcon>: Texture name of duet icon");
writer.WriteElementString("DuetIcon", _Theme.DuetIconName);
writer.WriteComment("<VideoIcon>: Texture name of video icon");
writer.WriteElementString("VideoIcon", _Theme.VideoIconName);
writer.WriteComment("<MedleyCalcIcon>: Texture name of medley calc (calculated) icon");
writer.WriteElementString("MedleyCalcIcon", _Theme.MedleyCalcIcon);
writer.WriteComment("<MedleyTagIcon>: Texture name of medley tag (manuelly set) icon");
writer.WriteElementString("MedleyTagIcon", _Theme.MedleyTagIcon);
writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
writer.WriteElementString("R", _Color.R.ToString("#0.00"));
writer.WriteElementString("G", _Color.G.ToString("#0.00"));
writer.WriteElementString("B", _Color.B.ToString("#0.00"));
writer.WriteElementString("A", _Color.A.ToString("#0.00"));
}
#region SongMenuTileBoard
writer.WriteComment("<SongMenuTileBoard>: Config for TileBoard view");
writer.WriteStartElement("SongMenuTileBoard");
writer.WriteComment("<NumW>: Number of tiles horizontal");
writer.WriteElementString("NumW", _Theme.SongMenuTileBoard.NumW.ToString());
writer.WriteComment("<NumH>: Number of tiles vertical");
writer.WriteElementString("NumH", _Theme.SongMenuTileBoard.NumH.ToString());
writer.WriteComment("<SpaceW>: Space between tiles horizontal");
writer.WriteElementString("SpaceW", _Theme.SongMenuTileBoard.SpaceW.ToString("#0.00"));
writer.WriteComment("<SpaceH>: Space between tiles vertical");
writer.WriteElementString("SpaceH", _Theme.SongMenuTileBoard.SpaceH.ToString("#0.00"));
writer.WriteComment("<NumWsmall>: Number of tiles horizontal in small-mode");
writer.WriteElementString("NumWsmall", _Theme.SongMenuTileBoard.NumWsmall.ToString());
writer.WriteComment("<NumHsmall>: Number of tiles vertical in small-mode");
writer.WriteElementString("NumHsmall", _Theme.SongMenuTileBoard.NumHsmall.ToString());
writer.WriteComment("<TileRectX>, <TileRectY>, <TileRectZ>, <TileRectW>, <TileRectH>: SongMenu position, width and height");
writer.WriteElementString("TileRectX", _Theme.SongMenuTileBoard.TileRect.X.ToString("#0"));
writer.WriteElementString("TileRectY", _Theme.SongMenuTileBoard.TileRect.Y.ToString("#0"));
writer.WriteElementString("TileRectZ", _Theme.SongMenuTileBoard.TileRect.Z.ToString("#0.00"));
writer.WriteElementString("TileRectW", _Theme.SongMenuTileBoard.TileRect.W.ToString("#0"));
writer.WriteElementString("TileRectH", _Theme.SongMenuTileBoard.TileRect.H.ToString("#0"));
writer.WriteComment("<TileRectSmallX>, <TileRectSmallY>, <TileRectSmallZ>, <TileRectSmallW>, <TileRectSmallH>: SongMenu position, width and height in small-mode");
writer.WriteElementString("TileRectSmallX", _Theme.SongMenuTileBoard.TileRectSmall.X.ToString("#0"));
writer.WriteElementString("TileRectSmallY", _Theme.SongMenuTileBoard.TileRectSmall.Y.ToString("#0"));
writer.WriteElementString("TileRectSmallZ", _Theme.SongMenuTileBoard.TileRectSmall.Z.ToString("#0.00"));
writer.WriteElementString("TileRectSmallW", _Theme.SongMenuTileBoard.TileRectSmall.W.ToString("#0"));
writer.WriteElementString("TileRectSmallH", _Theme.SongMenuTileBoard.TileRectSmall.H.ToString("#0"));
_Theme.SongMenuTileBoard.TextArtist.SaveTheme(writer);
_Theme.SongMenuTileBoard.TextTitle.SaveTheme(writer);
_Theme.SongMenuTileBoard.TextSongLength.SaveTheme(writer);
_Theme.SongMenuTileBoard.StaticCoverBig.SaveTheme(writer);
_Theme.SongMenuTileBoard.StaticTextBG.SaveTheme(writer);
_Theme.SongMenuTileBoard.StaticDuetIcon.SaveTheme(writer);
_Theme.SongMenuTileBoard.StaticVideoIcon.SaveTheme(writer);
_Theme.SongMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer);
_Theme.SongMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer);
writer.WriteEndElement();
#endregion SongMenuTileBoard
writer.WriteEndElement();
return true;
}
return false;
}
#endregion Theme
public virtual void Init()
@@ -427,8 +369,11 @@ namespace VocaluxeLib.Menu.SongMenu
{
Init();
if (!String.IsNullOrEmpty(_Theme.ColorName))
_ColorInternal = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
_ColorInternal = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
else
_ColorInternal = _Theme.Color.Color;
}
public void ReloadTextures()
+63 -40
View File
@@ -17,9 +17,9 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using System.Xml;
using VocaluxeLib.Draw;
using VocaluxeLib.PartyModes;
using VocaluxeLib.Songs;
@@ -37,8 +37,8 @@ namespace VocaluxeLib.Menu.SongMenu
private CStatic _MedleyCalcIcon;
private CStatic _MedleyTagIcon;
private CTexture _CoverBigBGTexture;
private CTexture _CoverBGTexture;
private CTextureRef _CoverBigBGTexture;
private CTextureRef _CoverBGTexture;
private CText _Artist;
private CText _Title;
@@ -47,9 +47,6 @@ namespace VocaluxeLib.Menu.SongMenu
private int _NumW;
private int _NumH;
private float _SpaceW;
private float _SpaceH;
private int _TileW;
private int _TileH;
@@ -105,6 +102,9 @@ namespace VocaluxeLib.Menu.SongMenu
public CSongMenuTileBoard(int partyModeID)
: base(partyModeID) {}
public CSongMenuTileBoard(SThemeSongMenu theme, int partyModeID)
: base(theme, partyModeID) {}
protected override int _PreviewNr
{
set
@@ -120,24 +120,50 @@ namespace VocaluxeLib.Menu.SongMenu
}
}
public override bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
bool themeLoaded = true;
themeLoaded &= base.LoadTheme(xmlPath, elementName, xmlReader, skinIndex);
themeLoaded &= _Artist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader, skinIndex);
themeLoaded &= _Title.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader, skinIndex);
themeLoaded &= _SongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader, skinIndex);
themeLoaded &= _CoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader, skinIndex);
themeLoaded &= _TextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader, skinIndex);
themeLoaded &= _DuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader, skinIndex);
themeLoaded &= _VideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader, skinIndex);
themeLoaded &= _MedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader, skinIndex);
themeLoaded &= _MedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader, skinIndex);
if (themeLoaded)
{
_Theme.Name = elementName;
_Theme.SongMenuTileBoard.TextArtist = _Artist.GetTheme();
_Theme.SongMenuTileBoard.TextSongLength = _SongLength.GetTheme();
_Theme.SongMenuTileBoard.TextTitle = _Title.GetTheme();
_Theme.SongMenuTileBoard.StaticCoverBig = _CoverBig.GetTheme();
_Theme.SongMenuTileBoard.StaticDuetIcon = _DuetIcon.GetTheme();
_Theme.SongMenuTileBoard.StaticMedleyCalcIcon = _MedleyCalcIcon.GetTheme();
_Theme.SongMenuTileBoard.StaticMedleyTagIcon = _MedleyTagIcon.GetTheme();
_Theme.SongMenuTileBoard.StaticTextBG = _TextBG.GetTheme();
_Theme.SongMenuTileBoard.StaticVideoIcon = _VideoIcon.GetTheme();
LoadTextures();
Init();
}
return themeLoaded;
}
public override void Init()
{
base.Init();
_SpaceW = _Theme.SongMenuTileBoard.SpaceW;
_SpaceH = _Theme.SongMenuTileBoard.SpaceH;
_CoverBig = _Theme.SongMenuTileBoard.StaticCoverBig;
_TextBG = _Theme.SongMenuTileBoard.StaticTextBG;
_DuetIcon = _Theme.SongMenuTileBoard.StaticDuetIcon;
_VideoIcon = _Theme.SongMenuTileBoard.StaticVideoIcon;
_MedleyCalcIcon = _Theme.SongMenuTileBoard.StaticMedleyCalcIcon;
_MedleyTagIcon = _Theme.SongMenuTileBoard.StaticMedleyTagIcon;
_Artist = _Theme.SongMenuTileBoard.TextArtist;
_Title = _Theme.SongMenuTileBoard.TextTitle;
_SongLength = _Theme.SongMenuTileBoard.TextSongLength;
_PreviewNr = -1;
_InitTiles();
}
@@ -157,8 +183,8 @@ namespace VocaluxeLib.Menu.SongMenu
Rect = _Theme.SongMenuTileBoard.TileRect;
}
_TileW = (int)((Rect.W - _SpaceW * (_NumW - 1)) / _NumW);
_TileH = (int)((Rect.H - _SpaceH * (_NumH - 1)) / _NumH);
_TileW = (int)((Rect.W - _Theme.SongMenuTileBoard.SpaceW * (_NumW - 1)) / _NumW);
_TileH = (int)((Rect.H - _Theme.SongMenuTileBoard.SpaceH * (_NumH - 1)) / _NumH);
_CoverBGTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBackgroundName, _PartyModeID);
_CoverBigBGTexture = CBase.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName, _PartyModeID);
@@ -168,7 +194,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
for (int j = 0; j < _NumW; j++)
{
var rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z);
var rect = new SRectF(Rect.X + j * (_TileW + _Theme.SongMenuTileBoard.SpaceW), Rect.Y + i * (_TileH + _Theme.SongMenuTileBoard.SpaceH), _TileW, _TileH, Rect.Z);
var tile = new CStatic(_PartyModeID, _CoverBGTexture, _Color, rect);
_Tiles.Add(tile);
}
@@ -467,20 +493,16 @@ namespace VocaluxeLib.Menu.SongMenu
_TextBG.Draw();
CTexture vidtex = CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null;
CTextureRef vidtex = CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null;
if (vidtex != null)
{
if (vidtex.Color.A < 1)
_CoverBig.Draw(EAspect.Crop);
var bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
RectangleF rect;
CHelper.SetRect(bounds, out rect, vidtex.OrigAspect, EAspect.Crop);
var vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
var vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
SRectF rect = CHelper.FitInBounds(_CoverBig.Rect, vidtex.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(vidtex, vidRect, vidtex.Color, vidRectBounds);
CBase.Drawing.DrawTextureReflection(vidtex, vidRect, vidtex.Color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
CBase.Drawing.DrawTexture(vidtex, rect);
CBase.Drawing.DrawTextureReflection(vidtex, rect, vidtex.Color, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
}
else
_CoverBig.Draw(EAspect.Crop);
@@ -593,16 +615,17 @@ namespace VocaluxeLib.Menu.SongMenu
{
base.LoadTextures();
_Theme.SongMenuTileBoard.StaticCoverBig.ReloadTextures();
_Theme.SongMenuTileBoard.StaticTextBG.ReloadTextures();
_Theme.SongMenuTileBoard.StaticDuetIcon.ReloadTextures();
_Theme.SongMenuTileBoard.StaticVideoIcon.ReloadTextures();
_Theme.SongMenuTileBoard.StaticMedleyCalcIcon.ReloadTextures();
_Theme.SongMenuTileBoard.StaticMedleyTagIcon.ReloadTextures();
_Artist = new CText(_Theme.SongMenuTileBoard.TextArtist, _PartyModeID);
_Title = new CText(_Theme.SongMenuTileBoard.TextTitle, _PartyModeID);
_SongLength = new CText(_Theme.SongMenuTileBoard.TextSongLength, _PartyModeID);
_CoverBig = new CStatic(_Theme.SongMenuTileBoard.StaticCoverBig, _PartyModeID);
_TextBG = new CStatic(_Theme.SongMenuTileBoard.StaticTextBG, _PartyModeID);
_DuetIcon = new CStatic(_Theme.SongMenuTileBoard.StaticDuetIcon, _PartyModeID);
_VideoIcon = new CStatic(_Theme.SongMenuTileBoard.StaticVideoIcon, _PartyModeID);
_MedleyCalcIcon = new CStatic(_Theme.SongMenuTileBoard.StaticMedleyCalcIcon, _PartyModeID);
_MedleyTagIcon = new CStatic(_Theme.SongMenuTileBoard.StaticMedleyTagIcon, _PartyModeID);
_Theme.SongMenuTileBoard.TextArtist.ReloadTextures();
_Theme.SongMenuTileBoard.TextTitle.ReloadTextures();
_Theme.SongMenuTileBoard.TextSongLength.ReloadTextures();
Init();
}
}
}
+3
View File
@@ -50,5 +50,8 @@ namespace VocaluxeLib.Menu.SongMenu
bool Selected { get; set; }
bool Visible { get; set; }
bool SmallView { get; set; }
bool ThemeLoaded { get; }
SThemeSongMenu GetTheme();
}
}