moved menu and party mode files to the new lib
This commit is contained in:
1 parent
69420d6977
commit
d6c97568c9
35 files changed
+74
-70
No files matched your search
@@ -0,0 +1,250 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
public enum EBackgroundTypes
|
||||
{
|
||||
None,
|
||||
Color,
|
||||
Texture,
|
||||
Video
|
||||
}
|
||||
|
||||
struct SThemeBackground
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public EBackgroundTypes Type;
|
||||
|
||||
public string VideoName;
|
||||
public string TextureName;
|
||||
|
||||
public string ColorName;
|
||||
}
|
||||
|
||||
public class CBackground : IMenuElement
|
||||
{
|
||||
private Basic _Base;
|
||||
private SThemeBackground _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public SColorF Color;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
#region Constructors
|
||||
public CBackground(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_ThemeLoaded = false;
|
||||
_Theme = new SThemeBackground();
|
||||
|
||||
Color = new SColorF(0f, 0f, 0f, 1f);
|
||||
}
|
||||
#endregion Constructors
|
||||
|
||||
#region public
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EBackgroundTypes>(item + "/Type", navigator, ref _Theme.Type);
|
||||
|
||||
bool vid = CHelper.GetValueFromXML(item + "/Video", navigator, ref _Theme.VideoName, String.Empty);
|
||||
bool tex = CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool success = true;
|
||||
success &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
|
||||
success &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
|
||||
success &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
|
||||
success &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
|
||||
|
||||
if (_Theme.Type != EBackgroundTypes.None)
|
||||
_ThemeLoaded &= success;
|
||||
}
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
LoadTextures();
|
||||
}
|
||||
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("<Color>: Background color for type \"Color\" from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
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 && _Theme.VideoName != String.Empty && _Base.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
|
||||
_Base.Theme.SkinVideoResume(_Theme.VideoName);
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
if (_Theme.VideoName != String.Empty)
|
||||
_Base.Theme.SkinVideoPause(_Theme.VideoName);
|
||||
}
|
||||
|
||||
public bool Draw()
|
||||
{
|
||||
bool ok = false;
|
||||
if (_Theme.Type == EBackgroundTypes.Video && _Base.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON &&
|
||||
_Base.Config.GetVideosToBackground() == EOffOn.TR_CONFIG_ON && _Base.BackgroundMusic.IsPlaying() && _Base.BackgroundMusic.SongHasVideo() &&
|
||||
_Base.BackgroundMusic.VideoEnabled() && !_Base.BackgroundMusic.IsDisabled())
|
||||
{
|
||||
Pause();
|
||||
ok = DrawBackgroundMusicVideo();
|
||||
}
|
||||
else if (_Theme.Type == EBackgroundTypes.Video && _Base.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
Resume();
|
||||
ok = DrawVideo();
|
||||
}
|
||||
|
||||
if (_Theme.TextureName != String.Empty &&
|
||||
(_Theme.Type == EBackgroundTypes.Texture ||
|
||||
(_Theme.Type == EBackgroundTypes.Video && (_Base.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok))))
|
||||
ok = DrawTexture();
|
||||
|
||||
if (_Theme.Type == EBackgroundTypes.Color || _Theme.Type == EBackgroundTypes.Texture && !ok ||
|
||||
(_Theme.Type == EBackgroundTypes.Video && _Base.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF && !ok))
|
||||
DrawColor();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
#endregion public
|
||||
|
||||
#region internal
|
||||
private void DrawColor()
|
||||
{
|
||||
SRectF bounds = new SRectF(0f, 0f, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Base.Settings.GetZFar()/4);
|
||||
|
||||
_Base.Drawing.DrawColor(Color, bounds);
|
||||
}
|
||||
|
||||
private bool DrawTexture()
|
||||
{
|
||||
STexture Texture = _Base.Theme.GetSkinTexture(_Theme.TextureName);
|
||||
if (Texture.height > 0)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0f, 0f, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH());
|
||||
RectangleF rect = new RectangleF(0f, 0f, Texture.width, Texture.height);
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
|
||||
_Base.Drawing.DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _Base.Settings.GetZFar() / 4));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool DrawVideo()
|
||||
{
|
||||
STexture VideoTexture = _Base.Theme.GetSkinVideoTexture(_Theme.VideoName);
|
||||
if (VideoTexture.height > 0)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0f, 0f, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH());
|
||||
RectangleF rect = new RectangleF(0f, 0f, VideoTexture.width, VideoTexture.height);
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
|
||||
_Base.Drawing.DrawTexture(VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _Base.Settings.GetZFar() / 4));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool DrawBackgroundMusicVideo()
|
||||
{
|
||||
STexture VideoTexture = _Base.BackgroundMusic.GetVideoTexture();
|
||||
if (VideoTexture.height > 0)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0f, 0f, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH());
|
||||
RectangleF rect = new RectangleF(0f, 0f, VideoTexture.width, VideoTexture.height);
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
|
||||
_Base.Drawing.DrawTexture(VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _Base.Settings.GetZFar() / 4));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endregion internal
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
struct SThemeButton
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string ColorName;
|
||||
public string SColorName;
|
||||
|
||||
public string TextureName;
|
||||
public string STextureName;
|
||||
}
|
||||
|
||||
public class CButton : IMenuElement
|
||||
{
|
||||
private Basic _Base;
|
||||
private SThemeButton _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public SRectF Rect;
|
||||
public SColorF Color;
|
||||
public SColorF SColor;
|
||||
|
||||
public bool SelText;
|
||||
public CText Text;
|
||||
public CText SText;
|
||||
|
||||
public bool Reflection;
|
||||
public float ReflectionSpace;
|
||||
public float ReflectionHeight;
|
||||
|
||||
public bool SReflection;
|
||||
public float SReflectionSpace;
|
||||
public float SReflectionHeight;
|
||||
|
||||
public bool Pressed;
|
||||
|
||||
public bool EditMode
|
||||
{
|
||||
get { return Text.EditMode; }
|
||||
set
|
||||
{
|
||||
Text.EditMode = value;
|
||||
SText.EditMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _Selected;
|
||||
public bool Selected
|
||||
{
|
||||
get { return _Selected; }
|
||||
set
|
||||
{
|
||||
_Selected = value;
|
||||
Text.Selected = value;
|
||||
}
|
||||
}
|
||||
public bool Visible;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public CButton(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeButton();
|
||||
Rect = new SRectF();
|
||||
Color = new SColorF();
|
||||
SColor = new SColorF();
|
||||
|
||||
SelText = false;
|
||||
Text = new CText(_Base);
|
||||
SText = new CText(_Base);
|
||||
Selected = false;
|
||||
Visible = true;
|
||||
EditMode = false;
|
||||
|
||||
Reflection = false;
|
||||
ReflectionSpace = 0f;
|
||||
ReflectionHeight = 0f;
|
||||
|
||||
SReflection = false;
|
||||
SReflectionSpace = 0f;
|
||||
SReflectionHeight = 0f;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinSelected", navigator, ref _Theme.STextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref Rect.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref Rect.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref Rect.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref Rect.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
|
||||
}
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/SColor", navigator, ref _Theme.SColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.SColorName, SkinIndex, ref SColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SR", navigator, ref SColor.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SG", navigator, ref SColor.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SB", navigator, ref SColor.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SA", navigator, ref SColor.A);
|
||||
}
|
||||
|
||||
_ThemeLoaded &= Text.LoadTheme(item, "Text", navigator, SkinIndex, true);
|
||||
Text.Z = Rect.Z;
|
||||
if (CHelper.ItemExistsInXML(item + "/SText", navigator))
|
||||
{
|
||||
SelText = true;
|
||||
_ThemeLoaded &= SText.LoadTheme(item, "SText", navigator, SkinIndex, true);
|
||||
SText.Z = Rect.Z;
|
||||
}
|
||||
|
||||
|
||||
//Reflections
|
||||
if (CHelper.ItemExistsInXML(item + "/Reflection", navigator))
|
||||
{
|
||||
Reflection = true;
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Space", navigator, ref ReflectionSpace);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Height", navigator, ref ReflectionHeight);
|
||||
}
|
||||
else
|
||||
Reflection = false;
|
||||
|
||||
if (CHelper.ItemExistsInXML(item + "/SReflection", navigator))
|
||||
{
|
||||
SReflection = true;
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SReflection/Space", navigator, ref SReflectionSpace);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SReflection/Height", navigator, ref SReflectionHeight);
|
||||
}
|
||||
else
|
||||
SReflection = false;
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
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.STextureName);
|
||||
|
||||
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 (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", Color.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<SColor>: Selected button color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
|
||||
if (_Theme.SColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("SColor", _Theme.SColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("SR", SColor.R.ToString("#0.00"));
|
||||
writer.WriteElementString("SG", SColor.G.ToString("#0.00"));
|
||||
writer.WriteElementString("SB", SColor.B.ToString("#0.00"));
|
||||
writer.WriteElementString("SA", SColor.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
Text.SaveTheme(writer);
|
||||
if (SelText)
|
||||
SText.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 (SReflection)
|
||||
{
|
||||
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()
|
||||
{
|
||||
Draw(false);
|
||||
}
|
||||
|
||||
public void ForceDraw()
|
||||
{
|
||||
Draw(true);
|
||||
}
|
||||
|
||||
public void Draw(bool ForceDraw)
|
||||
{
|
||||
if (!Visible && _Base.Settings.GetGameState() != EGameState.EditTheme && !ForceDraw)
|
||||
return;
|
||||
|
||||
STexture texture = new STexture(-1);
|
||||
|
||||
if (!Selected && !Pressed)
|
||||
{
|
||||
texture = _Base.Theme.GetSkinTexture(_Theme.TextureName);
|
||||
_Base.Drawing.DrawTexture(texture, Rect, Color);
|
||||
Text.DrawRelative(Rect.X, Rect.Y);
|
||||
if (Reflection)
|
||||
{
|
||||
_Base.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, ReflectionSpace, ReflectionHeight);
|
||||
Text.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H);
|
||||
}
|
||||
}
|
||||
else if(!SelText)
|
||||
{
|
||||
texture = _Base.Theme.GetSkinTexture(_Theme.STextureName);
|
||||
_Base.Drawing.DrawTexture(texture, Rect, SColor);
|
||||
Text.DrawRelative(Rect.X, Rect.Y);
|
||||
if (Reflection)
|
||||
{
|
||||
_Base.Drawing.DrawTextureReflection(texture, Rect, SColor, Rect, ReflectionSpace, ReflectionHeight);
|
||||
Text.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H);
|
||||
}
|
||||
}
|
||||
else if(SelText)
|
||||
{
|
||||
texture = _Base.Theme.GetSkinTexture(_Theme.STextureName);
|
||||
_Base.Drawing.DrawTexture(texture, Rect, SColor);
|
||||
SText.DrawRelative(Rect.X, Rect.Y);
|
||||
if (Reflection)
|
||||
{
|
||||
_Base.Drawing.DrawTextureReflection(texture, Rect, SColor, Rect, ReflectionSpace, ReflectionHeight);
|
||||
SText.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessMouseMove(int x, int y)
|
||||
{
|
||||
Selected = CHelper.IsInBounds(Rect, x, y);
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
Text.UnloadTextures();
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
Text.LoadTextures();
|
||||
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
|
||||
if (_Theme.SColorName != String.Empty)
|
||||
SColor = _Base.Theme.GetColor(_Theme.SColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
Rect.X += stepX;
|
||||
Rect.Y += stepY;
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
Rect.W += stepW;
|
||||
if (Rect.W <= 0)
|
||||
Rect.W = 1;
|
||||
|
||||
Rect.H += stepH;
|
||||
if (Rect.H <= 0)
|
||||
Rect.H = 1;
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
enum EEqualizerStyle
|
||||
{
|
||||
Collums
|
||||
}
|
||||
|
||||
struct SThemeEqualizer
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string ColorName;
|
||||
public string MaxColorName;
|
||||
public string TextureName;
|
||||
|
||||
public int NumBars;
|
||||
|
||||
public EEqualizerStyle Style;
|
||||
public EOffOn DrawNegative;
|
||||
}
|
||||
|
||||
public class CEqualizer : IMenuElement
|
||||
{
|
||||
private Basic _Base;
|
||||
private SThemeEqualizer _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public SRectF Rect;
|
||||
public SColorF Color;
|
||||
public SColorF MaxColor;
|
||||
public float Space;
|
||||
|
||||
public bool Reflection;
|
||||
public float ReflectionSpace;
|
||||
public float ReflectionHeight;
|
||||
|
||||
public bool Selected;
|
||||
public bool Visible;
|
||||
public bool ScreenHandles;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
private float[] _Bars;
|
||||
|
||||
public CEqualizer(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeEqualizer();
|
||||
_ThemeLoaded = false;
|
||||
|
||||
Rect = new SRectF();
|
||||
Color = new SColorF();
|
||||
MaxColor = new SColorF();
|
||||
|
||||
Selected = false;
|
||||
Visible = true;
|
||||
ScreenHandles = false;
|
||||
|
||||
Reflection = false;
|
||||
ReflectionSpace = 0f;
|
||||
ReflectionHeight = 0f;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref Rect.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref Rect.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref Rect.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref Rect.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/NumBars", navigator, ref _Theme.NumBars);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Space", navigator, ref Space);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EEqualizerStyle>(item + "/Style", navigator, ref _Theme.Style);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EOffOn>(item + "/DrawNegative", navigator, ref _Theme.DrawNegative);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
|
||||
}
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/MaxColor", navigator, ref _Theme.MaxColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/MaxR", navigator, ref MaxColor.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/MaxG", navigator, ref MaxColor.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/MaxB", navigator, ref MaxColor.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/MaxA", navigator, ref MaxColor.A);
|
||||
}
|
||||
|
||||
//Reflection
|
||||
if (CHelper.ItemExistsInXML(item + "/Reflection", navigator))
|
||||
{
|
||||
Reflection = true;
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Space", navigator, ref ReflectionSpace);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Height", navigator, ref ReflectionHeight);
|
||||
}
|
||||
else
|
||||
Reflection = false;
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
_Bars = new float[_Theme.NumBars];
|
||||
for (int i = 0; i < _Bars.Length; i++)
|
||||
{
|
||||
_Bars[i] = 0f;
|
||||
}
|
||||
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 (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", Color.A.ToString("#0.00"));
|
||||
}
|
||||
writer.WriteComment("<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)");
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (weights == null || weights.Length == 0 || _Bars == null)
|
||||
return;
|
||||
for (int i = 0; i < _Bars.Length; i++)
|
||||
{
|
||||
if (weights.Length > i){
|
||||
_Bars[i] = 1f - weights[i];
|
||||
if (_Theme.DrawNegative == EOffOn.TR_CONFIG_OFF && weights[i] < 0)
|
||||
_Bars[i] = (1f + weights[i]);
|
||||
}
|
||||
else
|
||||
_Bars[i] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
if (_Bars == null || _Bars.Length == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < _Bars.Length; i++)
|
||||
{
|
||||
_Bars[i] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (_Bars == null)
|
||||
return;
|
||||
|
||||
float dx = (Rect.W ) / _Bars.Length;
|
||||
int max = _Bars.Length - 1;
|
||||
float maxB = _Bars[max];
|
||||
for (int i = 0; i < _Bars.Length - 1; i++)
|
||||
{
|
||||
if (_Bars[i] > maxB)
|
||||
{
|
||||
maxB = _Bars[i];
|
||||
max = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _Bars.Length; i++)
|
||||
{
|
||||
SRectF bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z);
|
||||
SColorF color = Color;
|
||||
if (i == max)
|
||||
{
|
||||
color = MaxColor;
|
||||
}
|
||||
|
||||
_Base.Drawing.DrawColor(color, bar);
|
||||
|
||||
if (Reflection)
|
||||
_Base.Drawing.DrawColorReflection(color, bar, ReflectionSpace, ReflectionHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
|
||||
if (_Theme.MaxColorName != String.Empty)
|
||||
MaxColor = _Base.Theme.GetColor(_Theme.MaxColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
Rect.X += stepX;
|
||||
Rect.Y += stepY;
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
Rect.W += stepW;
|
||||
if (Rect.W <= 0)
|
||||
Rect.W = 1;
|
||||
|
||||
Rect.H += stepH;
|
||||
if (Rect.H <= 0)
|
||||
Rect.H = 1;
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
public class CHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Concat strings into one string with ", " as separator.
|
||||
/// </summary>
|
||||
public static string ListStrings(string[] str)
|
||||
{
|
||||
string _Result = string.Empty;
|
||||
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
_Result += str[i];
|
||||
if (i < str.Length - 1)
|
||||
_Result += ", ";
|
||||
}
|
||||
|
||||
return _Result;
|
||||
}
|
||||
|
||||
public static int TryReadInt(StreamReader sr)
|
||||
{
|
||||
char chr = '0';
|
||||
string value = String.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
chr = (char)sr.Peek();
|
||||
while ((chr.CompareTo(' ') != 0) && ((int)chr != 19) && ((int)chr != 16) && ((int)chr != 13))
|
||||
{
|
||||
chr = (char)sr.Read();
|
||||
value += chr.ToString();
|
||||
chr = (char)sr.Peek();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int result = 0;
|
||||
int.TryParse(value, out result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void SetRect(RectangleF Bounds, ref RectangleF Rect, float RectAspect, EAspect Aspect)
|
||||
{
|
||||
float rW = Bounds.Right - Bounds.Left;
|
||||
float rH = Bounds.Bottom - Bounds.Top;
|
||||
float rA = rW / rH;
|
||||
|
||||
float ScaledWidth = rW;
|
||||
float ScaledHeight = rH;
|
||||
|
||||
switch (Aspect)
|
||||
{
|
||||
case EAspect.Crop:
|
||||
if (rA >= RectAspect)
|
||||
{
|
||||
ScaledWidth = rW;
|
||||
ScaledHeight = rH * rA / RectAspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScaledHeight = rH;
|
||||
ScaledWidth = rW * RectAspect / rA;
|
||||
}
|
||||
break;
|
||||
case EAspect.LetterBox:
|
||||
if (RectAspect >= 1)
|
||||
{
|
||||
ScaledWidth = rW;
|
||||
ScaledHeight = rH * rA / RectAspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScaledHeight = rH;
|
||||
ScaledWidth = rW * RectAspect / rA;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ScaledWidth = rW;
|
||||
ScaledHeight = rH;
|
||||
break;
|
||||
}
|
||||
|
||||
float Left = (rW - ScaledWidth) / 2 + Bounds.Left;
|
||||
float Rigth = Left + ScaledWidth;
|
||||
|
||||
float Upper = (rH - ScaledHeight) / 2 + Bounds.Top;
|
||||
float Lower = Upper + ScaledHeight;
|
||||
|
||||
Rect = new RectangleF(Left, Upper, Rigth - Left, Lower - Upper);
|
||||
}
|
||||
|
||||
public static bool TryGetEnumValueFromXML<T>(string Cast, XPathNavigator Navigator, ref T value)
|
||||
where T : struct
|
||||
{
|
||||
string val = String.Empty;
|
||||
if (GetValueFromXML(Cast, Navigator, ref val, Enum.GetName(typeof(T), value)))
|
||||
{
|
||||
TryParse<T>(val, out value, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool TryGetIntValueFromXML(string Cast, XPathNavigator Navigator, ref int value)
|
||||
{
|
||||
string val = String.Empty;
|
||||
if (GetValueFromXML(Cast, Navigator, ref val, value.ToString()))
|
||||
{
|
||||
int res = 0;
|
||||
if (int.TryParse(val, out res))
|
||||
{
|
||||
value = res;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool TryGetFloatValueFromXML(string Cast, XPathNavigator Navigator, ref float value)
|
||||
{
|
||||
string val = String.Empty;
|
||||
if (GetValueFromXML(Cast, Navigator, ref val, value.ToString()))
|
||||
{
|
||||
float res = 0;
|
||||
if (TryParse(val, out res))
|
||||
{
|
||||
value = res;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool GetValueFromXML(string Cast, XPathNavigator Navigator, ref string Value, string DefaultValue)
|
||||
{
|
||||
XPathNodeIterator iterator;
|
||||
int results = 0;
|
||||
string val = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
Navigator.MoveToFirstChild();
|
||||
iterator = Navigator.Select(Cast);
|
||||
|
||||
while (iterator.MoveNext())
|
||||
{
|
||||
val = iterator.Current.Value;
|
||||
results++;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
results = 0;
|
||||
}
|
||||
|
||||
if ((results == 0) || (results > 1))
|
||||
{
|
||||
Value = DefaultValue;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Value = val;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static List<string> GetValuesFromXML(string Cast, XPathNavigator Navigator)
|
||||
{
|
||||
List<string> values = new List<string>();
|
||||
|
||||
try
|
||||
{
|
||||
Navigator.MoveToRoot();
|
||||
Navigator.MoveToFirstChild();
|
||||
Navigator.MoveToFirstChild();
|
||||
|
||||
while (Navigator.Name != Cast)
|
||||
Navigator.MoveToNext();
|
||||
|
||||
Navigator.MoveToFirstChild();
|
||||
|
||||
values.Add(Navigator.LocalName);
|
||||
while (Navigator.MoveToNext())
|
||||
values.Add(Navigator.LocalName);
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
public static bool ItemExistsInXML(string Cast, XPathNavigator Navigator)
|
||||
{
|
||||
XPathNodeIterator iterator;
|
||||
int results = 0;
|
||||
|
||||
try
|
||||
{
|
||||
Navigator.MoveToFirstChild();
|
||||
iterator = Navigator.Select(Cast);
|
||||
|
||||
while (iterator.MoveNext())
|
||||
results++;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
results = 0;
|
||||
}
|
||||
|
||||
if (results == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<string> ListFiles(string path, string cast)
|
||||
{
|
||||
return ListFiles(path, cast, false, false);
|
||||
}
|
||||
|
||||
public List<string> ListFiles(string path, string cast, bool recursive)
|
||||
{
|
||||
return ListFiles(path, cast, recursive, false);
|
||||
}
|
||||
|
||||
public List<string> ListFiles(string path, string cast, bool recursive, bool fullpath)
|
||||
{
|
||||
List<string> files = new List<string>();
|
||||
DirectoryInfo dir = new DirectoryInfo(path);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
foreach (FileInfo file in dir.GetFiles(cast))
|
||||
{
|
||||
if (!fullpath)
|
||||
files.Add(file.Name);
|
||||
else
|
||||
//files.Add(Path.Combine(file.DirectoryName, file.Name));
|
||||
files.Add(file.FullName);
|
||||
}
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
foreach (DirectoryInfo di in dir.GetDirectories())
|
||||
{
|
||||
files.AddRange(ListFiles(di.FullName, cast, recursive, fullpath));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
public static bool TryParse<T>(string value, out T result)
|
||||
where T : struct
|
||||
{
|
||||
return TryParse<T>(value, out result, false);
|
||||
}
|
||||
|
||||
public static bool TryParse<T>(string value, out T result, bool ignoreCase)
|
||||
where T : struct
|
||||
{
|
||||
result = default(T);
|
||||
try
|
||||
{
|
||||
result = (T)Enum.Parse(typeof(T), value, ignoreCase);
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool TryParse(string value, out float result)
|
||||
{
|
||||
value = value.Replace(',', '.');
|
||||
return float.TryParse(value, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, NumberFormatInfo.InvariantInfo, out result);
|
||||
}
|
||||
|
||||
public static bool IsInBounds(SRectF bounds, MouseEvent MouseEvent)
|
||||
{
|
||||
return IsInBounds(bounds, MouseEvent.X, MouseEvent.Y);
|
||||
}
|
||||
|
||||
public static bool IsInBounds(SRectF bounds, int x, int y)
|
||||
{
|
||||
return ((bounds.X <= x) && (bounds.X + bounds.W >= x) && (bounds.Y <= y) && (bounds.Y + bounds.H >= y));
|
||||
}
|
||||
}
|
||||
|
||||
static class CEncoding
|
||||
{
|
||||
public static Encoding GetEncoding(string EncodingName)
|
||||
{
|
||||
switch (EncodingName)
|
||||
{
|
||||
case "AUTO":
|
||||
return Encoding.Default;
|
||||
case "CP1250":
|
||||
return Encoding.GetEncoding(1250);
|
||||
case "CP1252":
|
||||
return Encoding.GetEncoding(1252);
|
||||
case "LOCALE":
|
||||
return Encoding.Default;
|
||||
case "UTF8":
|
||||
return Encoding.UTF8;
|
||||
default:
|
||||
return Encoding.UTF8;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetEncodingName(Encoding Enc)
|
||||
{
|
||||
string Result = "UTF8";
|
||||
|
||||
if (Enc.CodePage == 1250)
|
||||
Result = "CP1250";
|
||||
|
||||
if (Enc.CodePage == 1252)
|
||||
Result = "CP1252";
|
||||
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
public enum EType
|
||||
{
|
||||
TBackground,
|
||||
TButton,
|
||||
TSelectSlide,
|
||||
TText,
|
||||
TStatic,
|
||||
TSongMenu,
|
||||
TLyric,
|
||||
TSingNote,
|
||||
TNameSelection,
|
||||
TEqualizer,
|
||||
TPlaylist
|
||||
}
|
||||
|
||||
class CInteraction
|
||||
{
|
||||
private int _Num;
|
||||
private EType _Type;
|
||||
|
||||
public int Num
|
||||
{
|
||||
get { return _Num; }
|
||||
}
|
||||
|
||||
public EType Type
|
||||
{
|
||||
get { return _Type; }
|
||||
}
|
||||
|
||||
public bool ThemeEditorOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Type == EType.TBackground ||
|
||||
_Type == EType.TNameSelection ||
|
||||
_Type == EType.TText ||
|
||||
_Type == EType.TStatic ||
|
||||
_Type == EType.TSongMenu ||
|
||||
_Type == EType.TLyric ||
|
||||
_Type == EType.TSingNote ||
|
||||
_Type == EType.TEqualizer ||
|
||||
_Type == EType.TPlaylist);
|
||||
}
|
||||
}
|
||||
|
||||
public CInteraction(int num, EType type)
|
||||
{
|
||||
_Num = num;
|
||||
_Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,588 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
using Vocaluxe.Menu.SingNotes;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
struct SNote
|
||||
{
|
||||
public string Text;
|
||||
public int StartBeat;
|
||||
public int EndBeat;
|
||||
public int Duration;
|
||||
public ENoteType Type;
|
||||
}
|
||||
|
||||
struct SThemeLyrics
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string ColorName;
|
||||
public string SColorName;
|
||||
}
|
||||
|
||||
public class CLyric : IMenuElement
|
||||
{
|
||||
private Basic _Base;
|
||||
private SThemeLyrics _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
private List<SNote> _Notes;
|
||||
private CText _Text;
|
||||
|
||||
private float _X;
|
||||
private float _Y;
|
||||
private float _MaxW;
|
||||
private float _Z;
|
||||
private float _H;
|
||||
|
||||
private float _width;
|
||||
private ELyricStyle _Style;
|
||||
|
||||
private float _Alpha = 1f;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return new SRectF(_X, _Y, _MaxW, _H, _Z); }
|
||||
set
|
||||
{
|
||||
_X = value.X;
|
||||
_Y = value.Y;
|
||||
_MaxW = value.W;
|
||||
_H = value.H;
|
||||
_Z = value.Z;
|
||||
}
|
||||
}
|
||||
|
||||
public SColorF Color;
|
||||
public SColorF ColorProcessed;
|
||||
|
||||
public bool Selected;
|
||||
public bool Visible = true;
|
||||
|
||||
public float Alpha
|
||||
{
|
||||
get { return _Alpha; }
|
||||
set
|
||||
{
|
||||
_Alpha = value;
|
||||
_Text.Alpha = _Alpha;
|
||||
}
|
||||
}
|
||||
|
||||
public ELyricStyle LyricStyle
|
||||
{
|
||||
get { return _Style; }
|
||||
set { _Style = value; }
|
||||
}
|
||||
|
||||
public CLyric(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeLyrics();
|
||||
_ThemeLoaded = false;
|
||||
Color = new SColorF();
|
||||
ColorProcessed = new SColorF();
|
||||
|
||||
_X = 0f;
|
||||
_Y = 0f;
|
||||
_Z = 0f;
|
||||
_MaxW = 1f;
|
||||
_H = 1f;
|
||||
_width = 1f;
|
||||
_Notes = new List<SNote>();
|
||||
_Text = new CText(_Base);
|
||||
|
||||
_Style = ELyricStyle.Fill;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref _X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref _Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref _Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref _MaxW);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref _H);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
|
||||
}
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/SColor", navigator, ref _Theme.SColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.SColorName, SkinIndex, ref ColorProcessed);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SR", navigator, ref ColorProcessed.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SG", navigator, ref ColorProcessed.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SB", navigator, ref ColorProcessed.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SA", navigator, ref ColorProcessed.A);
|
||||
}
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
LoadTextures();
|
||||
_Text = new CText(_Base, _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 (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", Color.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
|
||||
if (_Theme.SColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("SColor", _Theme.SColorName);
|
||||
}
|
||||
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(CLine Line)
|
||||
{
|
||||
_Notes.Clear();
|
||||
|
||||
_width = 0f;
|
||||
foreach (CNote note in Line.Notes)
|
||||
{
|
||||
SNote n = new SNote();
|
||||
|
||||
n.Text = note.Text;
|
||||
n.StartBeat = note.StartBeat;
|
||||
n.EndBeat = note.EndBeat;
|
||||
n.Duration = note.Duration;
|
||||
n.Type = note.NoteType;
|
||||
|
||||
_Text.Text = note.Text;
|
||||
_Text.Style = EStyle.Bold;
|
||||
|
||||
if (n.Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
RectangleF rect = _Base.Drawing.GetTextBounds(_Text);
|
||||
_width += rect.Width;
|
||||
_Notes.Add(n);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_Notes.Clear();
|
||||
}
|
||||
|
||||
public float GetCurrentLyricPosX()
|
||||
{
|
||||
return _X - _width / 2;
|
||||
}
|
||||
|
||||
#region draw
|
||||
public void Draw(float ActualBeat)
|
||||
{
|
||||
if (Visible || _Base.Settings.GetGameState() == EGameState.EditTheme)
|
||||
{
|
||||
switch (_Style)
|
||||
{
|
||||
case ELyricStyle.Fill:
|
||||
DrawFill(ActualBeat);
|
||||
break;
|
||||
case ELyricStyle.Jump:
|
||||
DrawJump(ActualBeat);
|
||||
break;
|
||||
case ELyricStyle.Slide:
|
||||
DrawSlide(ActualBeat);
|
||||
break;
|
||||
case ELyricStyle.Zoom:
|
||||
DrawZoom(ActualBeat);
|
||||
break;
|
||||
default:
|
||||
DrawSlide(ActualBeat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSlide(float CurrentBeat)
|
||||
{
|
||||
float x = _X - _width / 2;
|
||||
|
||||
foreach (SNote note in _Notes)
|
||||
{
|
||||
_Text.X = x;
|
||||
_Text.Style = EStyle.Bold;
|
||||
_Text.Text = note.Text;
|
||||
RectangleF rect = _Base.Drawing.GetTextBounds(_Text);
|
||||
|
||||
if (note.Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
if (CurrentBeat >= note.StartBeat)
|
||||
{
|
||||
if (CurrentBeat <= note.EndBeat)
|
||||
{
|
||||
_Text.Color = ColorProcessed;
|
||||
|
||||
|
||||
float diff = note.EndBeat - note.StartBeat;
|
||||
if (diff == 0)
|
||||
_Text.Draw(0f, 1f);
|
||||
else
|
||||
{
|
||||
_Text.Draw(0f, (CurrentBeat - note.StartBeat) / diff);
|
||||
_Text.Color = Color;
|
||||
_Text.Draw((CurrentBeat - note.StartBeat) / diff, 1f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_Text.Color = Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
x += rect.Width;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawZoom(float CurrentBeat)
|
||||
{
|
||||
float x = _X - _width / 2; // most left position
|
||||
|
||||
//find last active note
|
||||
int last_note = -1;
|
||||
for (int i = 0; i < _Notes.Count; i++)
|
||||
{
|
||||
if (CurrentBeat >= _Notes[i].StartBeat)
|
||||
last_note = i;
|
||||
}
|
||||
|
||||
int zoom_note = -1;
|
||||
int end_beat = -1;
|
||||
float zoomx = 0f;
|
||||
|
||||
for (int note = 0; note < _Notes.Count; note++)
|
||||
{
|
||||
_Text.X = x;
|
||||
_Text.Style = EStyle.Bold;
|
||||
_Text.Text = _Notes[note].Text;
|
||||
RectangleF rect = _Base.Drawing.GetTextBounds(_Text);
|
||||
|
||||
if (_Notes[note].Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
if (CurrentBeat >= _Notes[note].StartBeat)
|
||||
{
|
||||
bool last = note == _Notes.Count -1;
|
||||
int endbeat = _Notes[note].EndBeat;
|
||||
if (note < _Notes.Count -1)
|
||||
endbeat = _Notes[note + 1].StartBeat - 1;
|
||||
|
||||
if (CurrentBeat <= endbeat)
|
||||
{
|
||||
zoom_note = note;
|
||||
end_beat = endbeat;
|
||||
zoomx = _Text.X;
|
||||
}
|
||||
else
|
||||
{
|
||||
// already passed
|
||||
if (note == last_note)
|
||||
_Text.Color = ColorProcessed;
|
||||
else
|
||||
_Text.Color = Color;
|
||||
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// not passed
|
||||
_Text.Color = Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
x += rect.Width;
|
||||
}
|
||||
|
||||
if (zoom_note > -1)
|
||||
{
|
||||
if (_Notes[zoom_note].Duration == 0)
|
||||
return;
|
||||
|
||||
_Text.X = zoomx;
|
||||
_Text.Text = _Notes[zoom_note].Text;
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Style = EStyle.Bold;
|
||||
|
||||
if (_Notes[zoom_note].Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
RectangleF rect = _Base.Drawing.GetTextBounds(_Text);
|
||||
|
||||
float diff = end_beat - _Notes[zoom_note].StartBeat;
|
||||
if (diff <= 0f)
|
||||
diff = 1f;
|
||||
|
||||
float p = (CurrentBeat - _Notes[zoom_note].StartBeat) / diff;
|
||||
if (p > 1f)
|
||||
p = 1f;
|
||||
|
||||
p = 1f - p;
|
||||
|
||||
float ty = _Text.Y;
|
||||
float tx = _Text.X;
|
||||
float th = _Text.Height;
|
||||
float tz = _Text.Z;
|
||||
|
||||
_Text.Height += _Text.Height * p * 0.4f;
|
||||
RectangleF rectz = _Base.Drawing.GetTextBounds(_Text);
|
||||
_Text.X -= (rectz.Width - rect.Width) / 2f;
|
||||
_Text.Y -= (rectz.Height - rect.Height) / 2f;
|
||||
_Text.Z -= 0.1f;
|
||||
|
||||
_Text.Draw();
|
||||
|
||||
_Text.Y = ty;
|
||||
_Text.X = tx;
|
||||
_Text.Height = th;
|
||||
_Text.Z = tz;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawFill(float CurrentBeat)
|
||||
{
|
||||
float x = _X - _width / 2; // most left position
|
||||
|
||||
foreach (SNote note in _Notes)
|
||||
{
|
||||
_Text.X = x;
|
||||
_Text.Style = EStyle.Bold;
|
||||
_Text.Text = note.Text;
|
||||
RectangleF rect = _Base.Drawing.GetTextBounds(_Text);
|
||||
|
||||
if (note.Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
if (CurrentBeat >= note.StartBeat)
|
||||
{
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
// not passed
|
||||
_Text.Color = Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
x += rect.Width;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawJump(float CurrentBeat)
|
||||
{
|
||||
float x = _X - _width / 2; // most left position
|
||||
|
||||
//find last active note
|
||||
int last_note = -1;
|
||||
for (int i = 0; i < _Notes.Count; i++)
|
||||
{
|
||||
if (CurrentBeat >= _Notes[i].StartBeat)
|
||||
last_note = i;
|
||||
}
|
||||
|
||||
int jump_note = -1;
|
||||
int end_beat = -1;
|
||||
float jumpx = 0f;
|
||||
|
||||
for (int note = 0; note < _Notes.Count; note++)
|
||||
{
|
||||
_Text.X = x;
|
||||
_Text.Style = EStyle.Bold;
|
||||
_Text.Text = _Notes[note].Text;
|
||||
RectangleF rect = _Base.Drawing.GetTextBounds(_Text);
|
||||
|
||||
if (_Notes[note].Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
if (CurrentBeat >= _Notes[note].StartBeat)
|
||||
{
|
||||
bool last = note == _Notes.Count - 1;
|
||||
int endbeat = _Notes[note].EndBeat;
|
||||
if (note < _Notes.Count - 1)
|
||||
endbeat = _Notes[note + 1].StartBeat - 1;
|
||||
|
||||
if (CurrentBeat <= _Notes[note].EndBeat)
|
||||
{
|
||||
jump_note = note;
|
||||
end_beat = endbeat;
|
||||
jumpx = _Text.X;
|
||||
}
|
||||
else
|
||||
{
|
||||
// already passed
|
||||
if (note == last_note)
|
||||
_Text.Color = ColorProcessed;
|
||||
else
|
||||
_Text.Color = Color;
|
||||
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// not passed
|
||||
_Text.Color = Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
x += rect.Width;
|
||||
}
|
||||
|
||||
if (jump_note > 0)
|
||||
{
|
||||
if (_Notes[jump_note].Duration == 0)
|
||||
return;
|
||||
|
||||
_Text.X = jumpx;
|
||||
_Text.Text = _Notes[jump_note].Text;
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Style = EStyle.Bold;
|
||||
|
||||
if (_Notes[jump_note].Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
float diff = _Notes[jump_note].EndBeat - _Notes[jump_note].StartBeat;
|
||||
if (diff <= 0f)
|
||||
diff = 1f;
|
||||
|
||||
float p = (CurrentBeat - _Notes[jump_note].StartBeat) / diff;
|
||||
if (p > 1f)
|
||||
p = 1f;
|
||||
|
||||
p = 1f - p;
|
||||
|
||||
if (diff == 1)
|
||||
_Text.Draw();
|
||||
else
|
||||
{
|
||||
float y = _Text.Y;
|
||||
_Text.Y -= _Text.Height * 0.1f * p;
|
||||
_Text.Draw();
|
||||
_Text.Y = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion draw
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
|
||||
if (_Theme.SColorName != String.Empty)
|
||||
ColorProcessed = _Base.Theme.GetColor(_Theme.SColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
SRectF rect = Rect;
|
||||
rect.X += stepX;
|
||||
rect.Y += stepY;
|
||||
Rect = rect;
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
SRectF rect = Rect;
|
||||
rect.W += stepW;
|
||||
if (rect.W <= 0)
|
||||
rect.W = 1;
|
||||
|
||||
rect.H += stepH;
|
||||
if (rect.H <= 0)
|
||||
rect.H = 1;
|
||||
|
||||
Rect = rect;
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
abstract class CMenuParty : CMenu
|
||||
{
|
||||
public CMenuParty()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
public sealed override void LoadTheme()
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override void ReloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override void ReloadTheme()
|
||||
{
|
||||
}
|
||||
|
||||
public override void UnloadTextures()
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,557 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
struct SThemeNameSelection
|
||||
{
|
||||
public string Name;
|
||||
public string TextureEmptyTileName;
|
||||
public string ColorEmptyTileName;
|
||||
public string TextureTileSelectedName;
|
||||
public float NameSpace;
|
||||
public float NameHeight;
|
||||
public string NameFont;
|
||||
public EStyle NameStyle;
|
||||
public SColorF NameColor;
|
||||
public string NameColorName;
|
||||
}
|
||||
|
||||
public class CNameSelection : IMenuElement
|
||||
{
|
||||
class CTile
|
||||
{
|
||||
private Basic _Base;
|
||||
public int PlayerNr;
|
||||
public CStatic Avatar;
|
||||
public CText Name;
|
||||
|
||||
public CTile(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
|
||||
public CTile(CStatic av, CText tex, int pl)
|
||||
{
|
||||
Avatar = av;
|
||||
Name = tex;
|
||||
PlayerNr = pl;
|
||||
}
|
||||
}
|
||||
|
||||
private Basic _Base;
|
||||
private SThemeNameSelection _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool Selected = false;
|
||||
public bool Visible = true;
|
||||
|
||||
public SRectF Rect;
|
||||
private List<CTile> _Tiles;
|
||||
|
||||
private STexture _TextureEmptyTile;
|
||||
private STexture _TextureTileSelected;
|
||||
|
||||
public SColorF ColorEmptyTile;
|
||||
|
||||
private int _NumW;
|
||||
private int _NumH;
|
||||
|
||||
private float _SpaceW;
|
||||
private float _SpaceH;
|
||||
|
||||
private int _TileW;
|
||||
private int _TileH;
|
||||
|
||||
public int _Offset = 0;
|
||||
private int _actualSelection = -1;
|
||||
public int Selection = -1;
|
||||
|
||||
int _player = -1;
|
||||
|
||||
private List<int> VisibleProfiles;
|
||||
|
||||
private CStatic PlayerSelector;
|
||||
|
||||
|
||||
public CNameSelection(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeNameSelection();
|
||||
|
||||
_Tiles = new List<CTile>();
|
||||
VisibleProfiles = new List<int>();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
PrepareTiles();
|
||||
|
||||
PlayerSelector = new CStatic(_Base);
|
||||
PlayerSelector.Texture = _TextureTileSelected;
|
||||
PlayerSelector.Rect = new SRectF(0, 0, (_TileW + 6), (_TileH + 6), (Rect.Z - 0.5f));
|
||||
PlayerSelector.Visible = false;
|
||||
|
||||
UpdateVisibleProfiles();
|
||||
|
||||
UpdateList(0);
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref Rect.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref Rect.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref Rect.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref Rect.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H);
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinEmptyTile", navigator, ref _Theme.TextureEmptyTileName, String.Empty);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/ColorEmptyTile", navigator, ref _Theme.ColorEmptyTileName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorEmptyTileName, SkinIndex, ref ColorEmptyTile);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref ColorEmptyTile.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref ColorEmptyTile.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref ColorEmptyTile.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref ColorEmptyTile.A);
|
||||
}
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinTileSelected", navigator, ref _Theme.TextureTileSelectedName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/Tiles/W", navigator, ref _TileW);
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/Tiles/H", navigator, ref _TileH);
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/Tiles/NumW", navigator, ref _NumW);
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/Tiles/NumH", navigator, ref _NumH);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Tiles/SpaceW", navigator, ref _SpaceW);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Tiles/SpaceH", navigator, ref _SpaceH);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Tiles/Name/Space", navigator, ref _Theme.NameSpace);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Tiles/Name/H", navigator, ref _Theme.NameHeight);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/Tiles/Name/Font", navigator, ref _Theme.NameFont, "Normal");
|
||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EStyle>(item + "/Tiles/Name/Style", navigator, ref _Theme.NameStyle);
|
||||
if (CHelper.GetValueFromXML(item + "/Tiles/Name/Color", navigator, ref _Theme.NameColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.NameColorName, SkinIndex, ref _Theme.NameColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CHelper.TryGetFloatValueFromXML(item + "/Tiles/Name/R", navigator, ref _Theme.NameColor.R))
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Tiles/Name/G", navigator, ref _Theme.NameColor.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Tiles/Name/B", navigator, ref _Theme.NameColor.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Tiles/Name/A", navigator, ref _Theme.NameColor.A);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
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 (_Theme.ColorEmptyTileName != String.Empty)
|
||||
{
|
||||
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 (_Theme.NameColorName != String.Empty)
|
||||
{
|
||||
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()
|
||||
{
|
||||
Draw(false);
|
||||
}
|
||||
|
||||
public void ForceDraw()
|
||||
{
|
||||
Draw(true);
|
||||
}
|
||||
|
||||
public void Draw(bool ForceDraw)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (CTile tile in _Tiles)
|
||||
{
|
||||
tile.Avatar.Draw();
|
||||
tile.Name.Draw();
|
||||
|
||||
if (PlayerSelector.Visible)
|
||||
{
|
||||
//Update PlayerSelector-Coords
|
||||
if (_player > -1 && _actualSelection == i)
|
||||
{
|
||||
PlayerSelector.Rect.X = tile.Avatar.Rect.X - 3;
|
||||
PlayerSelector.Rect.Y = tile.Avatar.Rect.Y - 3;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
if (PlayerSelector.Visible)
|
||||
{
|
||||
//Draw PlayerSelector
|
||||
PlayerSelector.Draw();
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleInput(KeyEvent kevent)
|
||||
{
|
||||
switch (kevent.Key)
|
||||
{
|
||||
case Keys.Right:
|
||||
if (_actualSelection + 1 < _Tiles.Count)
|
||||
{
|
||||
if (_Tiles[_actualSelection + 1].PlayerNr != -1)
|
||||
{
|
||||
_actualSelection++;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int offset = _Offset;
|
||||
UpdateList(_Offset + 1);
|
||||
if (offset != _Offset)
|
||||
{
|
||||
_actualSelection = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
if (_actualSelection - 1 > -1)
|
||||
{
|
||||
_actualSelection--;
|
||||
}
|
||||
else if (_Offset > 0)
|
||||
{
|
||||
UpdateList(_Offset - 1);
|
||||
_actualSelection = _Tiles.Count-1;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Up:
|
||||
if (_actualSelection - _NumW > -1)
|
||||
{
|
||||
_actualSelection -= _NumW;
|
||||
}
|
||||
else if (_Offset > 0)
|
||||
{
|
||||
UpdateList(_Offset - 1);
|
||||
_actualSelection += _Tiles.Count- _NumW;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Down:
|
||||
if (_actualSelection + _NumW < _Tiles.Count)
|
||||
{
|
||||
if (_Tiles[_actualSelection + _NumW].PlayerNr != -1)
|
||||
{
|
||||
_actualSelection += _NumW;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int offset = _Offset;
|
||||
UpdateList(_Offset + 1);
|
||||
if (offset != _Offset)
|
||||
{
|
||||
_actualSelection = _actualSelection - _Tiles.Count + _NumW;
|
||||
if (_Tiles[_actualSelection].PlayerNr == -1)
|
||||
{
|
||||
for (int i = (_Tiles.Count - 1); i >= 0; i--)
|
||||
{
|
||||
if (_Tiles[i].PlayerNr != -1)
|
||||
{
|
||||
_actualSelection = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Selection = VisibleProfiles[_Offset * _Tiles.Count + _actualSelection];
|
||||
}
|
||||
|
||||
public void KeyboardSelection(bool active, int player)
|
||||
{
|
||||
//Overwrite player-selection; Same profile, but other player
|
||||
if (active && Selection != -1)
|
||||
{
|
||||
_player = player;
|
||||
PlayerSelector.Color = _Base.Theme.GetPlayerColor(player);
|
||||
}
|
||||
//Normal activation
|
||||
else if (active)
|
||||
{
|
||||
Selection = 0;
|
||||
_actualSelection = 0;
|
||||
_player = player;
|
||||
PlayerSelector.Color = _Base.Theme.GetPlayerColor(player);
|
||||
PlayerSelector.Visible = true;
|
||||
}
|
||||
//Deactivate
|
||||
else
|
||||
{
|
||||
Selection = -1;
|
||||
_actualSelection = -1;
|
||||
_player = -1;
|
||||
PlayerSelector.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateList()
|
||||
{
|
||||
UpdateVisibleProfiles();
|
||||
if (_Tiles.Count * (_Offset + 1) - VisibleProfiles.Count >= _Tiles.Count * _Offset)
|
||||
{
|
||||
UpdateList(_Offset - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateList(_Offset);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateList(int offset)
|
||||
{
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
|
||||
if ( _Tiles.Count * (offset + 1) - VisibleProfiles.Count < _Tiles.Count)
|
||||
{
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
if ((i + offset * _Tiles.Count) < VisibleProfiles.Count)
|
||||
{
|
||||
_Tiles[i].Avatar.Texture = _Base.Profiles.GetProfiles()[VisibleProfiles[i + offset * _Tiles.Count]].Avatar.Texture;
|
||||
_Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1);
|
||||
_Tiles[i].Name.Text = _Base.Profiles.GetProfiles()[VisibleProfiles[i + offset * _Tiles.Count]].PlayerName;
|
||||
_Tiles[i].PlayerNr = VisibleProfiles[i + offset * _Tiles.Count];
|
||||
}
|
||||
else
|
||||
{
|
||||
_Tiles[i].Avatar.Texture = _TextureEmptyTile;
|
||||
_Tiles[i].Avatar.Color = ColorEmptyTile;
|
||||
_Tiles[i].Name.Text = "";
|
||||
_Tiles[i].PlayerNr = -1;
|
||||
}
|
||||
}
|
||||
_Offset = offset;
|
||||
}
|
||||
}
|
||||
|
||||
public bool isOverTile(MouseEvent mevent)
|
||||
{
|
||||
bool isOver = false;
|
||||
foreach (CTile tile in _Tiles)
|
||||
{
|
||||
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
|
||||
{
|
||||
isOver = true;
|
||||
}
|
||||
}
|
||||
return isOver;
|
||||
}
|
||||
|
||||
public int TilePlayerNr(MouseEvent mevent)
|
||||
{
|
||||
foreach (CTile tile in _Tiles)
|
||||
{
|
||||
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
|
||||
{
|
||||
return tile.PlayerNr;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public CStatic TilePlayerAvatar(MouseEvent mevent)
|
||||
{
|
||||
foreach (CTile tile in _Tiles)
|
||||
{
|
||||
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
|
||||
{
|
||||
return tile.Avatar;
|
||||
}
|
||||
}
|
||||
|
||||
return new CStatic(_Base);
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
_TextureEmptyTile = _Base.Theme.GetSkinTexture(_Theme.TextureEmptyTileName);
|
||||
_TextureTileSelected = _Base.Theme.GetSkinTexture(_Theme.TextureTileSelectedName);
|
||||
|
||||
if (_Theme.ColorEmptyTileName != String.Empty)
|
||||
ColorEmptyTile = _Base.Theme.GetColor(_Theme.ColorEmptyTileName);
|
||||
|
||||
if (_Theme.NameColorName != String.Empty)
|
||||
_Theme.NameColor = _Base.Theme.GetColor(_Theme.NameColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
|
||||
PrepareTiles();
|
||||
}
|
||||
|
||||
private void PrepareTiles()
|
||||
{
|
||||
_Tiles.Clear();
|
||||
for (int i = 0; i < _NumH; i++)
|
||||
{
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
SRectF rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z);
|
||||
CStatic tileStatic = new CStatic(_Base, _TextureEmptyTile, ColorEmptyTile, rect);
|
||||
CText tileText = new CText(_Base, 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, "");
|
||||
_Tiles.Add(new CTile(tileStatic, tileText, -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateVisibleProfiles()
|
||||
{
|
||||
VisibleProfiles.Clear();
|
||||
for (int i = 0; i < _Base.Profiles.GetProfiles().Length; i++)
|
||||
{
|
||||
bool visible = false;
|
||||
//Show profile only if active
|
||||
if (_Base.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
visible = true;
|
||||
}
|
||||
for (int p = 0; p < _Base.Game.GetNumPlayer(); p++)
|
||||
{
|
||||
//Don't show profile if is selected, but if selected and guest
|
||||
if (_Base.Game.GetPlayer()[p].ProfileID == i && _Base.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
|
||||
{
|
||||
visible = false;
|
||||
}
|
||||
}
|
||||
if (visible)
|
||||
{
|
||||
VisibleProfiles.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
Rect.X += stepX;
|
||||
Rect.Y += stepY;
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
Rect.W += stepW;
|
||||
if (Rect.W <= 0)
|
||||
Rect.W = 1;
|
||||
|
||||
Rect.H += stepH;
|
||||
if (Rect.H <= 0)
|
||||
Rect.H = 1;
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,499 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
public enum EParticeType
|
||||
{
|
||||
Twinkle,
|
||||
Star,
|
||||
Snow,
|
||||
Flare,
|
||||
PerfNoteStar
|
||||
}
|
||||
|
||||
class CParticle
|
||||
{
|
||||
#region private vars
|
||||
private Basic _Base;
|
||||
private string _TextureName;
|
||||
private STexture _Texture;
|
||||
private SRectF _Rect;
|
||||
private float _Size;
|
||||
private SColorF _Color;
|
||||
private float _Alpha;
|
||||
private float _Angle; //0..360°
|
||||
private float _MaxAge; //[s]
|
||||
private float _Age; //[s]
|
||||
private float _Vx; //movement speed in x-axis [pix/s]
|
||||
private float _Vy; //movement speed in y-axis [pix/s]
|
||||
private float _Vr; //rotation speed [rpm]
|
||||
private float _Rotation; //start rotation 0..360°
|
||||
private float _Vsize; //size changing speed: period [s]
|
||||
private float _LastTime;
|
||||
private EParticeType _Type;
|
||||
|
||||
private Stopwatch _Timer;
|
||||
#endregion private vars
|
||||
|
||||
#region public vars
|
||||
//public bool Visible;
|
||||
public float Alpha2 = 1f;
|
||||
|
||||
public float X
|
||||
{
|
||||
get { return _Rect.X; }
|
||||
set { _Rect.X = value; }
|
||||
}
|
||||
|
||||
public float Y
|
||||
{
|
||||
get { return _Rect.Y; }
|
||||
set { _Rect.Y = value; }
|
||||
}
|
||||
|
||||
public float Size
|
||||
{
|
||||
get { return _Size; }
|
||||
set
|
||||
{
|
||||
_Rect.W = value;
|
||||
_Rect.H = value;
|
||||
_Size = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float Alpha
|
||||
{
|
||||
get { return _Alpha; }
|
||||
set { _Alpha = value; }
|
||||
}
|
||||
|
||||
public SColorF Color
|
||||
{
|
||||
get { return _Color; }
|
||||
set { _Color = value; }
|
||||
}
|
||||
|
||||
public bool IsAlive
|
||||
{
|
||||
get { return (_Age < _MaxAge || _MaxAge == 0f); }
|
||||
}
|
||||
#endregion public vars
|
||||
|
||||
#region Constructors
|
||||
public CParticle(Basic Base, string textureName, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, EParticeType type)
|
||||
{
|
||||
_Base = Base;
|
||||
_TextureName = textureName;
|
||||
_Texture = new STexture(-1);
|
||||
_Color = color;
|
||||
_Rect = new SRectF(x, y, size, size, z);
|
||||
_Size = size;
|
||||
_Alpha = 1f;
|
||||
_Angle = 0f;
|
||||
_Vx = vx;
|
||||
_Vy = vy;
|
||||
_Vr = vr;
|
||||
_Vsize = vsize;
|
||||
_LastTime = 0f;
|
||||
_Type = type;
|
||||
|
||||
_Timer = new Stopwatch();
|
||||
_Age = 0f;
|
||||
_MaxAge = maxage;
|
||||
_Rotation = (float)(_Base.Game.GetRandomDouble() * 360.0);
|
||||
}
|
||||
|
||||
public CParticle(Basic Base, STexture texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, EParticeType type)
|
||||
{
|
||||
_Base = Base;
|
||||
_TextureName = String.Empty;
|
||||
_Texture = texture;
|
||||
_Color = color;
|
||||
_Rect = new SRectF(x, y, size, size, z);
|
||||
_Size = size;
|
||||
_Alpha = 1f;
|
||||
_Angle = 0f;
|
||||
_Vx = vx;
|
||||
_Vy = vy;
|
||||
_Vr = vr;
|
||||
_Vsize = vsize;
|
||||
_LastTime = 0f;
|
||||
_Type = type;
|
||||
|
||||
_Timer = new Stopwatch();
|
||||
_Age = 0f;
|
||||
_MaxAge = maxage;
|
||||
_Rotation = (float)(_Base.Game.GetRandomDouble() * 360.0);
|
||||
}
|
||||
#endregion Constructors
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!IsAlive)
|
||||
return;
|
||||
|
||||
if (!_Timer.IsRunning)
|
||||
_Timer.Start();
|
||||
|
||||
float CurrentTime = _Timer.ElapsedMilliseconds / 1000f;
|
||||
float timediff = CurrentTime - _LastTime;
|
||||
|
||||
_Age = CurrentTime;
|
||||
|
||||
// update alpha
|
||||
if (_MaxAge > 0f)
|
||||
{
|
||||
switch (_Type)
|
||||
{
|
||||
case EParticeType.Twinkle:
|
||||
_Alpha = 1f - _Age / _MaxAge;
|
||||
break;
|
||||
|
||||
case EParticeType.Star:
|
||||
_Alpha = 1f - _Age / _MaxAge;
|
||||
break;
|
||||
|
||||
case EParticeType.Snow:
|
||||
_Alpha = (float)Math.Sqrt((Math.Sin(_Age / _MaxAge * Math.PI * 2 - 0.5 * Math.PI) + 1) / 2);
|
||||
break;
|
||||
|
||||
case EParticeType.Flare:
|
||||
_Alpha = 1f - _Age / _MaxAge;
|
||||
break;
|
||||
|
||||
case EParticeType.PerfNoteStar:
|
||||
_Alpha = 1f - _Age / _MaxAge;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// update position
|
||||
switch (_Type)
|
||||
{
|
||||
case EParticeType.Twinkle:
|
||||
X += _Vx * timediff;
|
||||
Y += _Vy * timediff;
|
||||
break;
|
||||
|
||||
case EParticeType.Star:
|
||||
X += _Vx * timediff;
|
||||
Y += _Vy * timediff;
|
||||
break;
|
||||
|
||||
case EParticeType.Snow:
|
||||
int maxy = (int)Math.Round(_Base.Settings.GetRenderH() - _Size * 0.4f);
|
||||
|
||||
if (Math.Round(Y) < maxy)
|
||||
{
|
||||
float vdx = 0f;
|
||||
if (_Vx != 0)
|
||||
vdx = (float)Math.Sin(CurrentTime / _Vx * Math.PI);
|
||||
|
||||
X += _Vx * timediff * (0.5f + vdx);
|
||||
|
||||
Y += _Vy * timediff * (vdx * vdx / 2f + 0.5f);
|
||||
if (Y >= maxy)
|
||||
Y = maxy;
|
||||
}
|
||||
break;
|
||||
|
||||
case EParticeType.Flare:
|
||||
X += _Vx * timediff;
|
||||
Y += _Vy * timediff;
|
||||
break;
|
||||
|
||||
case EParticeType.PerfNoteStar:
|
||||
X += _Vx * timediff;
|
||||
Y += _Vy * timediff;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// update size
|
||||
if (_Vsize != 0f)
|
||||
{
|
||||
float size = _Size;
|
||||
switch (_Type)
|
||||
{
|
||||
case EParticeType.Twinkle:
|
||||
size = _Size * (1f - CurrentTime / _Vsize);
|
||||
break;
|
||||
|
||||
case EParticeType.Star:
|
||||
size = _Size * (1f - CurrentTime / _Vsize);
|
||||
break;
|
||||
|
||||
case EParticeType.Snow:
|
||||
size = _Size * (float)Math.Sqrt((Math.Sin(CurrentTime / _Vsize * Math.PI * 2 - 0.5 * Math.PI) + 1) / 2);
|
||||
break;
|
||||
|
||||
case EParticeType.Flare:
|
||||
size = _Size * (1f - CurrentTime / _Vsize);
|
||||
break;
|
||||
|
||||
case EParticeType.PerfNoteStar:
|
||||
size = _Size * (1f - CurrentTime / _Vsize);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_Rect.X += (_Rect.W - size) / 2f;
|
||||
_Rect.Y += (_Rect.H - size) / 2f;
|
||||
_Rect.W = size;
|
||||
_Rect.H = size;
|
||||
}
|
||||
|
||||
// update rotation
|
||||
if (_Vr != 0f)
|
||||
{
|
||||
float r = CurrentTime * _Vr / 60f;
|
||||
_Angle = _Rotation + 360f * (r - (float)Math.Floor(r));
|
||||
_Rect.Rotation = _Angle;
|
||||
}
|
||||
|
||||
_LastTime = CurrentTime;
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
_Timer.Stop();
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
_Timer.Start();
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (_TextureName != String.Empty)
|
||||
_Base.Drawing.DrawTexture(_Base.Theme.GetSkinTexture(_TextureName), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
|
||||
else
|
||||
_Base.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
|
||||
}
|
||||
}
|
||||
|
||||
public class CParticleEffect
|
||||
{
|
||||
private Basic _Base;
|
||||
private List<CParticle> _Stars;
|
||||
private string _TextureName;
|
||||
private STexture _Texture;
|
||||
private int _MaxNumber;
|
||||
private SRectF _Area;
|
||||
private SColorF _Color;
|
||||
private float _Size;
|
||||
private EParticeType _Type;
|
||||
private Stopwatch _SpawnTimer;
|
||||
private float _NextSpawnTime;
|
||||
|
||||
public float Alpha = 1f;
|
||||
|
||||
public bool IsAlive
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Stars.Count > 0 || !_SpawnTimer.IsRunning);
|
||||
}
|
||||
}
|
||||
|
||||
public SRectF Area
|
||||
{
|
||||
get { return _Area; }
|
||||
set { _Area = value; }
|
||||
}
|
||||
|
||||
public CParticleEffect(Basic Base, int MaxNumber, SColorF Color, SRectF Area, string TextureName, float Size, EParticeType Type)
|
||||
{
|
||||
_Base = Base;
|
||||
_Stars = new List<CParticle>();
|
||||
_Area = Area;
|
||||
_Color = Color;
|
||||
_TextureName = TextureName;
|
||||
_Texture = new STexture(-1);
|
||||
_MaxNumber = MaxNumber;
|
||||
_Size = Size;
|
||||
_Type = Type;
|
||||
_SpawnTimer = new Stopwatch();
|
||||
_NextSpawnTime = 0f;
|
||||
}
|
||||
|
||||
public CParticleEffect(Basic Base, int MaxNumber, SColorF Color, SRectF Area, STexture texture, float Size, EParticeType Type)
|
||||
{
|
||||
_Base = Base;
|
||||
_Stars = new List<CParticle>();
|
||||
_Area = Area;
|
||||
_Color = Color;
|
||||
_TextureName = String.Empty;
|
||||
_Texture = texture;
|
||||
_MaxNumber = MaxNumber;
|
||||
_Size = Size;
|
||||
_Type = Type;
|
||||
_SpawnTimer = new Stopwatch();
|
||||
_NextSpawnTime = 0f;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
bool DoSpawn = false;
|
||||
if (!_SpawnTimer.IsRunning)
|
||||
{
|
||||
_SpawnTimer.Start();
|
||||
_NextSpawnTime = 0f;
|
||||
DoSpawn = true;
|
||||
}
|
||||
|
||||
if (_SpawnTimer.ElapsedMilliseconds / 1000f > _NextSpawnTime && _NextSpawnTime >= 0f)
|
||||
{
|
||||
DoSpawn = true;
|
||||
_SpawnTimer.Reset();
|
||||
_SpawnTimer.Start();
|
||||
}
|
||||
|
||||
while (_Stars.Count < _MaxNumber && DoSpawn)
|
||||
{
|
||||
float size = _Base.Game.GetRandom((int)_Size / 2) + _Size / 2;
|
||||
float lifetime = 0f;
|
||||
float vx = 0f;
|
||||
float vy = 0f;
|
||||
float vr = 0f;
|
||||
float vsize = 0f;
|
||||
_NextSpawnTime = 0f;
|
||||
|
||||
switch (_Type)
|
||||
{
|
||||
case EParticeType.Twinkle:
|
||||
size = _Base.Game.GetRandom((int)_Size / 2) + _Size / 2;
|
||||
lifetime = _Base.Game.GetRandom(500) / 1000f + 0.5f;
|
||||
vx = -_Base.Game.GetRandom(10000) / 50f + 100f;
|
||||
vy = -_Base.Game.GetRandom(10000) / 50f + 100f;
|
||||
vr = -_Base.Game.GetRandom(500) / 100f + 2.5f;
|
||||
vsize = lifetime * 2f;
|
||||
break;
|
||||
|
||||
case EParticeType.Star:
|
||||
size = _Base.Game.GetRandom((int)_Size / 2) + _Size / 2;
|
||||
lifetime = _Base.Game.GetRandom(1000) / 500f + 0.2f;
|
||||
vx = -_Base.Game.GetRandom(1000) / 50f + 10f;
|
||||
vy = -_Base.Game.GetRandom(1000) / 50f + 10f;
|
||||
vr = -_Base.Game.GetRandom(500) / 100f + 2.5f;
|
||||
vsize = lifetime * 2f;
|
||||
break;
|
||||
|
||||
case EParticeType.Snow:
|
||||
size = _Base.Game.GetRandom((int)_Size / 2) + _Size / 2;
|
||||
lifetime = _Base.Game.GetRandom(5000) / 50f + 10f;
|
||||
vx = -_Base.Game.GetRandom(1000) / 50f + 10f;
|
||||
vy = _Base.Game.GetRandom(1000) / 50f + Math.Abs(vx) + 10f;
|
||||
vr = -_Base.Game.GetRandom(200) / 50f + 2f;
|
||||
vsize = lifetime * 2f;
|
||||
|
||||
_NextSpawnTime = lifetime / _MaxNumber;
|
||||
DoSpawn = false;
|
||||
break;
|
||||
|
||||
case EParticeType.Flare:
|
||||
size = _Base.Game.GetRandom((int)_Size / 2) + _Size / 2;
|
||||
lifetime = _Base.Game.GetRandom(500) / 1000f + 0.1f;
|
||||
vx = -_Base.Game.GetRandom(2000) / 50f;
|
||||
vy = -_Base.Game.GetRandom(2000) / 50f + 20f;
|
||||
vr = -_Base.Game.GetRandom(2000) / 50f + 20f;
|
||||
vsize = lifetime * 2f;
|
||||
break;
|
||||
|
||||
case EParticeType.PerfNoteStar:
|
||||
size = _Base.Game.GetRandom((int)_Size / 2) + _Size / 2;
|
||||
lifetime = _Base.Game.GetRandom(1000) / 500f + 1.2f;
|
||||
vx = 0f;
|
||||
vy = 0f;
|
||||
vr = _Base.Game.GetRandom(500) / 50f + 10f;
|
||||
vsize = lifetime * 2f;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
int w = (int)(_Area.W - size / 4f);
|
||||
int h = (int)(_Area.H - size / 4f);
|
||||
|
||||
if (w < 0)
|
||||
w = 0;
|
||||
|
||||
if (h < 0)
|
||||
h = 0;
|
||||
|
||||
CParticle star;
|
||||
if (_TextureName != String.Empty)
|
||||
{
|
||||
star = new CParticle(_Base, _TextureName, _Color,
|
||||
_Base.Game.GetRandom(w) + _Area.X - size / 4f,
|
||||
_Base.Game.GetRandom(h) + _Area.Y - size / 4f,
|
||||
size, lifetime, _Area.Z, vx, vy, vr, vsize, _Type);
|
||||
}
|
||||
else
|
||||
{
|
||||
star = new CParticle(_Base, _Texture, _Color,
|
||||
_Base.Game.GetRandom(w) + _Area.X - size / 4f,
|
||||
_Base.Game.GetRandom(h) + _Area.Y - size / 4f,
|
||||
size, lifetime, _Area.Z, vx, vy, vr, vsize, _Type);
|
||||
}
|
||||
|
||||
_Stars.Add(star);
|
||||
}
|
||||
|
||||
if (_Type == EParticeType.Flare || _Type == EParticeType.PerfNoteStar || _Type == EParticeType.Twinkle)
|
||||
_NextSpawnTime = -1f;
|
||||
|
||||
int i = 0;
|
||||
while (i < _Stars.Count)
|
||||
{
|
||||
_Stars[i].Update();
|
||||
if (!_Stars[i].IsAlive)
|
||||
{
|
||||
_Stars.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
foreach (CParticle star in _Stars)
|
||||
{
|
||||
star.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
foreach (CParticle star in _Stars)
|
||||
{
|
||||
star.Resume();
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
foreach (CParticle star in _Stars)
|
||||
{
|
||||
star.Alpha2 = Alpha;
|
||||
star.Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,897 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
struct SThemeSelectSlide
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string TextureName;
|
||||
public string TextureArrowLeftName;
|
||||
public string TextureArrowRightName;
|
||||
|
||||
public string STextureName;
|
||||
public string STextureArrowLeftName;
|
||||
public string STextureArrowRightName;
|
||||
|
||||
public string HTextureName;
|
||||
|
||||
public string ColorName;
|
||||
public string SColorName;
|
||||
public string HColorName;
|
||||
|
||||
public string ArrowColorName;
|
||||
public string SArrowColorName;
|
||||
|
||||
public string TextColorName;
|
||||
public string STextColorName;
|
||||
|
||||
public string TextFont;
|
||||
public EStyle TextStyle;
|
||||
}
|
||||
|
||||
public class CSelectSlide : IMenuElement, ICloneable
|
||||
{
|
||||
private Basic _Base;
|
||||
private SThemeSelectSlide _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public SRectF Rect;
|
||||
public SRectF RectArrowLeft;
|
||||
public SRectF RectArrowRight;
|
||||
|
||||
public SColorF Color;
|
||||
public SColorF SColor;
|
||||
public SColorF HColor;
|
||||
|
||||
public SColorF ColorArrow;
|
||||
public SColorF SColorArrow;
|
||||
|
||||
public SColorF TextColor;
|
||||
public SColorF STextColor;
|
||||
|
||||
public float TextRelativeX;
|
||||
public float TextRelativeY;
|
||||
public float TextH;
|
||||
public float MaxW;
|
||||
|
||||
private bool _Selected;
|
||||
public bool Selected
|
||||
{
|
||||
get { return _Selected; }
|
||||
set
|
||||
{
|
||||
_Selected = value;
|
||||
|
||||
if (!value)
|
||||
{
|
||||
_ArrowLeftSelected = false;
|
||||
_ArrowRightSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool Visible = true;
|
||||
public bool Highlighted = false;
|
||||
|
||||
private bool _ArrowLeftSelected;
|
||||
private bool _ArrowRightSelected;
|
||||
|
||||
private List<string> _ValueNames;
|
||||
private List<STexture> _Textures;
|
||||
private List<int> _ValueIndexes;
|
||||
|
||||
private List<SRectF> _ValueBounds = new List<SRectF>();
|
||||
|
||||
public bool WithTextures = false;
|
||||
|
||||
private int _Selection = -1;
|
||||
public int Selection
|
||||
{
|
||||
get { return _Selection; }
|
||||
set
|
||||
{
|
||||
if (value >= 0 && value < _ValueNames.Count)
|
||||
{
|
||||
_Selection = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ValueIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Selection >= 0 && _ValueIndexes.Count > _Selection)
|
||||
return _ValueIndexes[_Selection];
|
||||
|
||||
else return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public int NumValues
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ValueNames.Count;
|
||||
}
|
||||
}
|
||||
|
||||
private int _NumVisible = -1;
|
||||
public int NumVisible
|
||||
{
|
||||
get { return _NumVisible; }
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
_NumVisible = value;
|
||||
|
||||
_ValueBounds.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public CSelectSlide(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeSelectSlide();
|
||||
_ThemeLoaded = false;
|
||||
|
||||
Rect = new SRectF();
|
||||
RectArrowLeft = new SRectF();
|
||||
RectArrowRight = new SRectF();
|
||||
|
||||
Color = new SColorF();
|
||||
SColor = new SColorF();
|
||||
|
||||
ColorArrow = new SColorF();
|
||||
SColorArrow = new SColorF();
|
||||
|
||||
TextColor = new SColorF();
|
||||
STextColor = new SColorF();
|
||||
TextH = 1f;
|
||||
MaxW = 0f;
|
||||
|
||||
_Selected = false;
|
||||
_Textures = new List<STexture>();
|
||||
_ValueIndexes = new List<int>();
|
||||
_ValueNames = new List<string>();
|
||||
}
|
||||
|
||||
public CSelectSlide(CSelectSlide slide)
|
||||
{
|
||||
_Base = slide._Base;
|
||||
_Theme = new SThemeSelectSlide();
|
||||
|
||||
_Theme.TextureArrowLeftName = slide._Theme.TextureArrowLeftName;
|
||||
_Theme.TextureArrowRightName = slide._Theme.TextureArrowRightName;
|
||||
|
||||
_Theme.STextureName = slide._Theme.STextureName;
|
||||
_Theme.STextureArrowLeftName = slide._Theme.STextureArrowLeftName;
|
||||
_Theme.STextureArrowRightName = slide._Theme.STextureArrowRightName;
|
||||
|
||||
_Theme.HTextureName = slide._Theme.HTextureName;
|
||||
|
||||
_Theme.ColorName = slide._Theme.ColorName;
|
||||
_Theme.SColorName = slide._Theme.SColorName;
|
||||
_Theme.HColorName = slide._Theme.HColorName;
|
||||
|
||||
_Theme.ArrowColorName = slide._Theme.ArrowColorName;
|
||||
_Theme.SArrowColorName = slide._Theme.SArrowColorName;
|
||||
|
||||
_Theme.TextColorName = slide._Theme.TextColorName;
|
||||
_Theme.STextColorName = slide._Theme.STextColorName;
|
||||
|
||||
_Theme.TextFont = slide._Theme.TextFont;
|
||||
_Theme.TextStyle = slide._Theme.TextStyle;
|
||||
|
||||
_ThemeLoaded = false;
|
||||
|
||||
Rect = new SRectF(slide.Rect);
|
||||
RectArrowLeft = new SRectF(slide.RectArrowLeft);
|
||||
RectArrowRight = new SRectF(slide.RectArrowRight);
|
||||
|
||||
Color = new SColorF(slide.Color);
|
||||
SColor = new SColorF(slide.SColor);
|
||||
|
||||
ColorArrow = new SColorF(slide.ColorArrow);
|
||||
SColorArrow = new SColorF(slide.SColorArrow);
|
||||
|
||||
TextColor = new SColorF(slide.TextColor);
|
||||
STextColor = new SColorF(slide.STextColor);
|
||||
TextH = slide.TextH;
|
||||
TextRelativeX = slide.TextRelativeX;
|
||||
TextRelativeY = slide.TextRelativeY;
|
||||
MaxW = slide.MaxW;
|
||||
|
||||
_Selected = slide._Selected;
|
||||
_Textures = new List<STexture>(slide._Textures);
|
||||
_ValueIndexes = new List<int>(slide._ValueIndexes);
|
||||
_ValueNames = new List<string>(slide._ValueNames);
|
||||
_ValueBounds = new List<SRectF>(slide._ValueBounds);
|
||||
_Selection = slide._Selection;
|
||||
_NumVisible = slide._NumVisible;
|
||||
|
||||
WithTextures = slide.WithTextures;
|
||||
Visible = slide.Visible;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinArrowLeft", navigator, ref _Theme.TextureArrowLeftName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinArrowRight", navigator, ref _Theme.TextureArrowRightName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinSelected", navigator, ref _Theme.STextureName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinArrowLeftSelected", navigator, ref _Theme.STextureArrowLeftName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinArrowRightSelected", navigator, ref _Theme.STextureArrowRightName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinHighlighted", navigator, ref _Theme.HTextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref Rect.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref Rect.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref Rect.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref Rect.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
|
||||
}
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/SColor", navigator, ref _Theme.SColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.SColorName, SkinIndex, ref SColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SR", navigator, ref SColor.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SG", navigator, ref SColor.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SB", navigator, ref SColor.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SA", navigator, ref SColor.A);
|
||||
}
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/HColor", navigator, ref _Theme.HColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.HColorName, SkinIndex, ref HColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/HR", navigator, ref HColor.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/HG", navigator, ref HColor.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/HB", navigator, ref HColor.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/HA", navigator, ref HColor.A);
|
||||
}
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowLeftX", navigator, ref RectArrowLeft.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowLeftY", navigator, ref RectArrowLeft.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowLeftZ", navigator, ref RectArrowLeft.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowLeftW", navigator, ref RectArrowLeft.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowLeftH", navigator, ref RectArrowLeft.H);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowRightX", navigator, ref RectArrowRight.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowRightY", navigator, ref RectArrowRight.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowRightZ", navigator, ref RectArrowRight.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowRightW", navigator, ref RectArrowRight.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowRightH", navigator, ref RectArrowRight.H);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/ArrowColor", navigator, ref _Theme.ArrowColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ArrowColorName, SkinIndex, ref ColorArrow);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowR", navigator, ref ColorArrow.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowG", navigator, ref ColorArrow.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowB", navigator, ref ColorArrow.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowA", navigator, ref ColorArrow.A);
|
||||
}
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/ArrowSColor", navigator, ref _Theme.SArrowColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.SArrowColorName, SkinIndex, ref SColorArrow);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowSR", navigator, ref SColorArrow.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowSG", navigator, ref SColorArrow.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowSB", navigator, ref SColorArrow.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/ArrowSA", navigator, ref SColorArrow.A);
|
||||
}
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/TextColor", navigator, ref _Theme.TextColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.TextColorName, SkinIndex, ref TextColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextR", navigator, ref TextColor.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextG", navigator, ref TextColor.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextB", navigator, ref TextColor.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextA", navigator, ref TextColor.A);
|
||||
}
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/TextSColor", navigator, ref _Theme.STextColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.STextColorName, SkinIndex, ref STextColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextSR", navigator, ref STextColor.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextSG", navigator, ref STextColor.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextSB", navigator, ref STextColor.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextSA", navigator, ref STextColor.A);
|
||||
}
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextH", navigator, ref TextH);
|
||||
if(CHelper.TryGetFloatValueFromXML(item + "/TextRelativeX", navigator, ref TextRelativeX))
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextRelativeX", navigator, ref TextRelativeX);
|
||||
if(CHelper.TryGetFloatValueFromXML(item + "/TextRelativeY", navigator, ref TextRelativeY))
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextRelativeY", navigator, ref TextRelativeY);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/TextMaxW", navigator, ref MaxW);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/TextFont", navigator, ref _Theme.TextFont, "Normal");
|
||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EStyle>(item + "/TextStyle", navigator, ref _Theme.TextStyle);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/NumVisible", navigator, ref _NumVisible);
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
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.STextureName);
|
||||
|
||||
writer.WriteComment("<SkinArrowLeftSelected>: Texture name of selected left arrow");
|
||||
writer.WriteElementString("SkinArrowLeftSelected", _Theme.STextureArrowLeftName);
|
||||
|
||||
writer.WriteComment("<SkinArrowRightSelected>: Texture name of selected right arrow");
|
||||
writer.WriteElementString("SkinArrowRightSelected", _Theme.STextureArrowRightName);
|
||||
|
||||
writer.WriteComment("<SkinHighlighted>: Texture name for highlighted SelectSlide");
|
||||
writer.WriteElementString("SkinHighlighted", _Theme.HTextureName);
|
||||
|
||||
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 (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", Color.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<SColor>: Selected SelectSlide color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
|
||||
if (_Theme.SColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("SColor", _Theme.SColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("SR", SColor.R.ToString("#0.00"));
|
||||
writer.WriteElementString("SG", SColor.G.ToString("#0.00"));
|
||||
writer.WriteElementString("SB", SColor.B.ToString("#0.00"));
|
||||
writer.WriteElementString("SA", SColor.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <HR>, <HG>, <HB>, <HA> (lower priority)");
|
||||
if (_Theme.HColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("HColor", _Theme.HColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("HR", HColor.R.ToString("#0.00"));
|
||||
writer.WriteElementString("HG", HColor.G.ToString("#0.00"));
|
||||
writer.WriteElementString("HB", HColor.B.ToString("#0.00"));
|
||||
writer.WriteElementString("HA", HColor.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<ArrowColor>: Arrow color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)");
|
||||
if (_Theme.ArrowColorName != String.Empty)
|
||||
{
|
||||
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 (_Theme.SArrowColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("ArrowSColor", _Theme.SArrowColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("ArrowSR", SColorArrow.R.ToString("#0.00"));
|
||||
writer.WriteElementString("ArrowSG", SColorArrow.G.ToString("#0.00"));
|
||||
writer.WriteElementString("ArrowSB", SColorArrow.B.ToString("#0.00"));
|
||||
writer.WriteElementString("ArrowSA", SColorArrow.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<TextColor>: Text color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)");
|
||||
if (_Theme.TextColorName != String.Empty)
|
||||
{
|
||||
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 (_Theme.STextColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("TextSColor", _Theme.STextColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("TextSR", STextColor.R.ToString("#0.00"));
|
||||
writer.WriteElementString("TextSG", STextColor.G.ToString("#0.00"));
|
||||
writer.WriteElementString("TextSB", STextColor.B.ToString("#0.00"));
|
||||
writer.WriteElementString("TextSA", STextColor.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<TextH>: Text height");
|
||||
writer.WriteElementString("TextH", TextH.ToString("#0.00"));
|
||||
|
||||
writer.WriteComment("<TextRelativeX>: Text relative x-position");
|
||||
if (TextRelativeX != 0)
|
||||
writer.WriteElementString("TextRelativeX", TextRelativeX.ToString("#0.00"));
|
||||
|
||||
writer.WriteComment("<TextRelativeY>: Text relative y-position");
|
||||
if (TextRelativeY != 0)
|
||||
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, new STexture(-1));
|
||||
_ValueBounds.Clear();
|
||||
}
|
||||
|
||||
public void AddValue(string value, STexture texture)
|
||||
{
|
||||
AddValue(value, texture, _ValueIndexes.Count);
|
||||
}
|
||||
|
||||
public void AddValue(string value, STexture texture, int valueIndex)
|
||||
{
|
||||
_ValueNames.Add(value);
|
||||
_Textures.Add(texture);
|
||||
_ValueIndexes.Add(valueIndex);
|
||||
|
||||
if (Selection == -1)
|
||||
Selection = 0;
|
||||
|
||||
_ValueBounds.Clear();
|
||||
}
|
||||
|
||||
public void AddValues(string[] values)
|
||||
{
|
||||
foreach (string value in values)
|
||||
{
|
||||
AddValue(value, new STexture(-1));
|
||||
}
|
||||
|
||||
_ValueBounds.Clear();
|
||||
}
|
||||
|
||||
public void AddValues(string[] values, STexture[] textures)
|
||||
{
|
||||
if (values.Length != textures.Length)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
{
|
||||
AddValue(values[i], textures[i]);
|
||||
}
|
||||
if (Selection == -1)
|
||||
Selection = 0;
|
||||
|
||||
_ValueBounds.Clear();
|
||||
}
|
||||
|
||||
public void SetValues<T>(int selection)
|
||||
{
|
||||
AddValues(Enum.GetNames(typeof(T)));
|
||||
Selection = selection;
|
||||
}
|
||||
|
||||
public void RenameValue(string NewName)
|
||||
{
|
||||
RenameValue(Selection, NewName);
|
||||
}
|
||||
|
||||
public void RenameValue(int selection, string NewName)
|
||||
{
|
||||
RenameValue(selection, NewName, new STexture(-1));
|
||||
}
|
||||
|
||||
public void RenameValue(int selection, string NewName, STexture NewTexture)
|
||||
{
|
||||
if (selection < 0 && selection >= _ValueNames.Count)
|
||||
return;
|
||||
|
||||
_ValueNames[selection] = NewName;
|
||||
_Textures[selection] = NewTexture;
|
||||
}
|
||||
|
||||
public bool SetSelectionByValueIndex(int ValueIndex)
|
||||
{
|
||||
for (int i = 0; i < _ValueIndexes.Count; i++)
|
||||
{
|
||||
if (_ValueIndexes[i] == ValueIndex)
|
||||
{
|
||||
Selection = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool NextValue()
|
||||
{
|
||||
if (Selection < _ValueNames.Count - 1)
|
||||
{
|
||||
Selection++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool PrevValue()
|
||||
{
|
||||
if (Selection > 0)
|
||||
{
|
||||
Selection--;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void FirstValue()
|
||||
{
|
||||
if (_ValueNames.Count > 0)
|
||||
Selection = 0;
|
||||
}
|
||||
|
||||
public void LastValue()
|
||||
{
|
||||
if (_ValueNames.Count > 0)
|
||||
Selection = _ValueNames.Count - 1;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_Selection = -1;
|
||||
_ValueNames.Clear();
|
||||
_Textures.Clear();
|
||||
_ValueBounds.Clear();
|
||||
_ValueIndexes.Clear();
|
||||
}
|
||||
|
||||
public void ProcessMouseMove(int x, int y)
|
||||
{
|
||||
_ArrowLeftSelected = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0;
|
||||
_ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _ValueNames.Count - 1;
|
||||
}
|
||||
|
||||
public void ProcessMouseLBClick(int x, int y)
|
||||
{
|
||||
ProcessMouseMove(x, y);
|
||||
|
||||
if (_ArrowLeftSelected)
|
||||
PrevValue();
|
||||
|
||||
if (_ArrowRightSelected)
|
||||
NextValue();
|
||||
|
||||
for (int i = 0; i < _ValueBounds.Count; i++)
|
||||
{
|
||||
if (CHelper.IsInBounds(_ValueBounds[i], x, y))
|
||||
{
|
||||
int offset = _Selection - (int)_NumVisible / 2;
|
||||
|
||||
if (_ValueNames.Count - _NumVisible - offset < 0)
|
||||
offset = _ValueNames.Count - _NumVisible;
|
||||
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
|
||||
Selection = i + offset;
|
||||
_ValueBounds.Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (!Visible && _Base.Settings.GetGameState() != EGameState.EditTheme)
|
||||
return;
|
||||
|
||||
STexture Texture = _Base.Theme.GetSkinTexture(_Theme.TextureName);
|
||||
STexture TextureArrowLeft = _Base.Theme.GetSkinTexture(_Theme.TextureArrowLeftName);
|
||||
STexture TextureArrowRight = _Base.Theme.GetSkinTexture(_Theme.TextureArrowRightName);
|
||||
|
||||
STexture STexture = _Base.Theme.GetSkinTexture(_Theme.STextureName);
|
||||
STexture STextureArrowLeft = _Base.Theme.GetSkinTexture(_Theme.STextureArrowLeftName);
|
||||
STexture STextureArrowRight = _Base.Theme.GetSkinTexture(_Theme.STextureArrowRightName);
|
||||
|
||||
STexture HTexture = _Base.Theme.GetSkinTexture(_Theme.HTextureName);
|
||||
|
||||
if (Selected)
|
||||
{
|
||||
if (Highlighted)
|
||||
_Base.Drawing.DrawTexture(HTexture, Rect, HColor);
|
||||
else
|
||||
_Base.Drawing.DrawTexture(STexture, Rect, SColor);
|
||||
}
|
||||
else
|
||||
_Base.Drawing.DrawTexture(Texture, Rect, Color);
|
||||
|
||||
if (_Selection > 0 || _Base.Settings.GetGameState() == EGameState.EditTheme)
|
||||
{
|
||||
if (_ArrowLeftSelected)
|
||||
_Base.Drawing.DrawTexture(STextureArrowLeft, RectArrowLeft, SColorArrow);
|
||||
else
|
||||
_Base.Drawing.DrawTexture(TextureArrowLeft, RectArrowLeft, ColorArrow);
|
||||
}
|
||||
|
||||
if (_Selection < _ValueNames.Count - 1 || _Base.Settings.GetGameState() == EGameState.EditTheme)
|
||||
{
|
||||
if (_ArrowRightSelected)
|
||||
_Base.Drawing.DrawTexture(STextureArrowRight, RectArrowRight, SColorArrow);
|
||||
else
|
||||
_Base.Drawing.DrawTexture(TextureArrowRight, RectArrowRight, ColorArrow);
|
||||
}
|
||||
|
||||
if (_NumVisible < 1 || _ValueNames.Count == 0)
|
||||
return;
|
||||
|
||||
float x = Rect.X + (Rect.W - TextRelativeX) * 0.1f;
|
||||
float dx = (Rect.W - TextRelativeX) * 0.8f / _NumVisible;
|
||||
//float y = Rect.Y + (Rect.H - TextH);
|
||||
|
||||
int offset = _Selection - (int)_NumVisible/2;
|
||||
|
||||
if (_ValueNames.Count - _NumVisible - offset < 0)
|
||||
offset = _ValueNames.Count - _NumVisible;
|
||||
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
|
||||
|
||||
int numvis = _NumVisible;
|
||||
if (_ValueNames.Count < numvis)
|
||||
numvis = _ValueNames.Count;
|
||||
|
||||
_ValueBounds.Clear();
|
||||
for (int i = 0; i < numvis; i++)
|
||||
{
|
||||
CText Text = new CText(_Base, 0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset]);
|
||||
SColorF Alpha = new SColorF(1f, 1f, 1f, 0.35f);
|
||||
if (i + offset == _Selection)
|
||||
{
|
||||
Text.Color = STextColor;
|
||||
Alpha = new SColorF(1f, 1f, 1f, 1f);
|
||||
}
|
||||
|
||||
RectangleF bounds = _Base.Drawing.GetTextBounds(Text);
|
||||
Text.X = (x + dx/2f + dx * i)+TextRelativeX;
|
||||
|
||||
if (!WithTextures)
|
||||
Text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + TextRelativeY);
|
||||
else
|
||||
Text.Y = (int)((Rect.Y + (Rect.H - bounds.Height)) + TextRelativeY);
|
||||
|
||||
Text.Z = Rect.Z;
|
||||
Text.Draw();
|
||||
|
||||
if (WithTextures)
|
||||
{
|
||||
float dh = Text.Y - Rect.Y - Rect.H * 0.1f;
|
||||
SRectF rect = new SRectF(Text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z);
|
||||
_Base.Drawing.DrawTexture(_Textures[i + offset], rect, Alpha);
|
||||
_ValueBounds.Add(rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ValueBounds.Add(new SRectF(Text.X - bounds.Width/2f, Text.Y, bounds.Width, bounds.Height, Rect.Z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
|
||||
if (_Theme.SColorName != String.Empty)
|
||||
SColor = _Base.Theme.GetColor(_Theme.SColorName);
|
||||
|
||||
if (_Theme.HColorName != String.Empty)
|
||||
HColor = _Base.Theme.GetColor(_Theme.HColorName);
|
||||
|
||||
if (_Theme.ArrowColorName != String.Empty)
|
||||
ColorArrow = _Base.Theme.GetColor(_Theme.ArrowColorName);
|
||||
|
||||
if (_Theme.SArrowColorName != String.Empty)
|
||||
SColorArrow = _Base.Theme.GetColor(_Theme.SArrowColorName);
|
||||
|
||||
if (_Theme.TextColorName != String.Empty)
|
||||
TextColor = _Base.Theme.GetColor(_Theme.TextColorName);
|
||||
|
||||
if (_Theme.SColorName != String.Empty)
|
||||
STextColor = _Base.Theme.GetColor(_Theme.STextColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return base.MemberwiseClone();
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
if (!_ArrowLeftSelected && !_ArrowRightSelected)
|
||||
{
|
||||
Rect.X += stepX;
|
||||
Rect.Y += stepY;
|
||||
}
|
||||
|
||||
if (_ArrowLeftSelected)
|
||||
{
|
||||
RectArrowLeft.X += stepX;
|
||||
RectArrowLeft.Y += stepY;
|
||||
}
|
||||
|
||||
if (_ArrowRightSelected)
|
||||
{
|
||||
RectArrowRight.X += stepX;
|
||||
RectArrowRight.Y += stepY;
|
||||
}
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
if (!_ArrowLeftSelected && !_ArrowRightSelected)
|
||||
{
|
||||
Rect.W += stepW;
|
||||
if (Rect.W <= 0)
|
||||
Rect.W = 1;
|
||||
|
||||
Rect.H += stepH;
|
||||
if (Rect.H <= 0)
|
||||
Rect.H = 1;
|
||||
}
|
||||
|
||||
if (_ArrowLeftSelected)
|
||||
{
|
||||
RectArrowLeft.W += stepW;
|
||||
if (RectArrowLeft.W <= 0)
|
||||
RectArrowLeft.W = 1;
|
||||
|
||||
RectArrowLeft.H += stepH;
|
||||
if (RectArrowLeft.H <= 0)
|
||||
RectArrowLeft.H = 1;
|
||||
}
|
||||
|
||||
if (_ArrowRightSelected)
|
||||
{
|
||||
RectArrowRight.W += stepW;
|
||||
if (RectArrowRight.W <= 0)
|
||||
RectArrowRight.W = 1;
|
||||
|
||||
RectArrowRight.H += stepH;
|
||||
if (RectArrowRight.H <= 0)
|
||||
RectArrowRight.H = 1;
|
||||
}
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
struct SThemeStatic
|
||||
{
|
||||
public string Name;
|
||||
public string TextureName;
|
||||
public string ColorName;
|
||||
}
|
||||
|
||||
public class CStatic : IMenuElement
|
||||
{
|
||||
private Basic _Base;
|
||||
|
||||
private SThemeStatic _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
private STexture _Texture;
|
||||
public STexture Texture
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Texture.index != -1)
|
||||
return _Texture;
|
||||
else
|
||||
return _Base.Theme.GetSkinTexture(_Theme.TextureName);
|
||||
}
|
||||
|
||||
set { _Texture = value; }
|
||||
}
|
||||
|
||||
public SColorF Color;
|
||||
public SRectF Rect;
|
||||
|
||||
public bool Reflection;
|
||||
public float ReflectionSpace;
|
||||
public float ReflectionHeight;
|
||||
|
||||
public bool Selected;
|
||||
public bool Visible;
|
||||
|
||||
public float Alpha;
|
||||
|
||||
public EAspect Aspect = EAspect.Stretch;
|
||||
|
||||
public CStatic(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeStatic();
|
||||
_ThemeLoaded = false;
|
||||
|
||||
_Texture = new STexture(-1);
|
||||
Color = new SColorF();
|
||||
Rect = new SRectF();
|
||||
Reflection = false;
|
||||
ReflectionSpace = 0f;
|
||||
ReflectionHeight = 0f;
|
||||
|
||||
Selected = false;
|
||||
Alpha = 1f;
|
||||
Visible = true;
|
||||
}
|
||||
|
||||
public CStatic(CStatic s)
|
||||
{
|
||||
_Base = s._Base;
|
||||
_Theme = new SThemeStatic();
|
||||
_ThemeLoaded = false;
|
||||
|
||||
_Texture = s.Texture;
|
||||
Color = new SColorF(s.Color);
|
||||
Rect = new SRectF(s.Rect);
|
||||
Reflection = s.Reflection;
|
||||
ReflectionSpace = s.ReflectionHeight;
|
||||
ReflectionHeight = s.ReflectionSpace;
|
||||
|
||||
Selected = s.Selected;
|
||||
Alpha = s.Alpha;
|
||||
Visible = s.Visible;
|
||||
}
|
||||
|
||||
public CStatic(Basic Base, STexture texture, SColorF color, SRectF rect)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeStatic();
|
||||
_ThemeLoaded = false;
|
||||
|
||||
_Texture = texture;
|
||||
Color = color;
|
||||
Rect = rect;
|
||||
Reflection = false;
|
||||
ReflectionSpace = 0f;
|
||||
ReflectionHeight = 0f;
|
||||
|
||||
Selected = false;
|
||||
Alpha = 1f;
|
||||
Visible = true;
|
||||
}
|
||||
|
||||
public CStatic(Basic Base, string TextureSkinName, SColorF color, SRectF rect)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeStatic();
|
||||
_Theme.TextureName = TextureSkinName;
|
||||
_ThemeLoaded = false;
|
||||
|
||||
_Texture = new STexture(-1);
|
||||
Color = color;
|
||||
Rect = rect;
|
||||
Reflection = false;
|
||||
ReflectionSpace = 0f;
|
||||
ReflectionHeight = 0f;
|
||||
|
||||
Selected = false;
|
||||
Alpha = 1f;
|
||||
Visible = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref Rect.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref Rect.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref Rect.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref Rect.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
|
||||
}
|
||||
|
||||
if (CHelper.ItemExistsInXML(item + "/Reflection", navigator))
|
||||
{
|
||||
Reflection = true;
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Space", navigator, ref ReflectionSpace);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Height", navigator, ref ReflectionHeight);
|
||||
}
|
||||
else
|
||||
Reflection = false;
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
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>: 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 (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", Color.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
Draw(1f, Rect.Z, Aspect, false);
|
||||
}
|
||||
|
||||
public void Draw(EAspect aspect)
|
||||
{
|
||||
Draw(1f, Rect.Z, aspect, false);
|
||||
}
|
||||
|
||||
public void Draw(float scale, EAspect aspect)
|
||||
{
|
||||
Draw(scale, Rect.Z, aspect, false);
|
||||
}
|
||||
|
||||
public void ForceDraw()
|
||||
{
|
||||
Draw(1f, Rect.Z, Aspect, true);
|
||||
}
|
||||
|
||||
public void Draw(float scale, float z, EAspect aspect, bool ForceDraw)
|
||||
{
|
||||
STexture texture;
|
||||
if (_Texture.index != -1)
|
||||
texture = _Texture;
|
||||
else
|
||||
texture = _Base.Theme.GetSkinTexture(_Theme.TextureName);
|
||||
|
||||
SRectF bounds = new SRectF(
|
||||
Rect.X - Rect.W * (scale - 1f),
|
||||
Rect.Y - Rect.H * (scale - 1f),
|
||||
Rect.W + 2 * Rect.W * (scale - 1f),
|
||||
Rect.H + 2 * Rect.H * (scale - 1f),
|
||||
z);
|
||||
|
||||
SRectF rect = bounds;
|
||||
|
||||
if (aspect != EAspect.Stretch)
|
||||
{
|
||||
RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
|
||||
RectangleF rect2 = new RectangleF(0f, 0f, texture.width, texture.height);
|
||||
CHelper.SetRect(bounds2, ref rect2, texture.width / texture.height, aspect);
|
||||
|
||||
rect.X = rect2.X;
|
||||
rect.Y = rect2.Y;
|
||||
rect.W = rect2.Width;
|
||||
rect.H = rect2.Height;
|
||||
}
|
||||
|
||||
SColorF color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
|
||||
if (Visible || ForceDraw || (_Base.Settings.GetGameState() == EGameState.EditTheme))
|
||||
{
|
||||
_Base.Drawing.DrawTexture(texture, rect, color, bounds);
|
||||
if (Reflection)
|
||||
{
|
||||
_Base.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
|
||||
}
|
||||
}
|
||||
|
||||
if (Selected && (_Base.Settings.GetGameState() == EGameState.EditTheme))
|
||||
{
|
||||
_Base.Drawing.DrawColor(new SColorF(1f, 1f, 1f, 0.5f), rect);
|
||||
}
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
Rect.X += stepX;
|
||||
Rect.Y += stepY;
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
Rect.W += stepW;
|
||||
if (Rect.W <= 0)
|
||||
Rect.W = 1;
|
||||
|
||||
Rect.H += stepH;
|
||||
if (Rect.H <= 0)
|
||||
Rect.H = 1;
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,900 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
struct SThemeText
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string Text;
|
||||
public string ColorName;
|
||||
public string SColorName; //for Buttons
|
||||
}
|
||||
|
||||
struct STextPosition
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
public float tH;
|
||||
public float Width;
|
||||
public float Height;
|
||||
|
||||
public STextPosition(int dummy)
|
||||
{
|
||||
X = 0f;
|
||||
Y = 0f;
|
||||
tH = 0f;
|
||||
Width = 0f;
|
||||
Height = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public class CText : IMenuElement
|
||||
{
|
||||
private Basic _Base;
|
||||
private SThemeText _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
private bool _ButtonText;
|
||||
private bool _PositionNeedsUpdate = true;
|
||||
|
||||
private STextPosition _DrawPosition = new STextPosition(0);
|
||||
|
||||
private float _X = 0f;
|
||||
public float X //left
|
||||
{
|
||||
get { return _X; }
|
||||
set
|
||||
{
|
||||
if (_X != value)
|
||||
{
|
||||
_X = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float _Y = 0f;
|
||||
public float Y //higher
|
||||
{
|
||||
get { return _Y; }
|
||||
set
|
||||
{
|
||||
if (_Y != value)
|
||||
{
|
||||
_Y = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float _Z = 0f;
|
||||
public float Z
|
||||
{
|
||||
get { return _Z; }
|
||||
set
|
||||
{
|
||||
if (_Z != value)
|
||||
{
|
||||
_Z = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float _Height = 0f;
|
||||
public float Height
|
||||
{
|
||||
get { return _Height; }
|
||||
set
|
||||
{
|
||||
if (_Height != value)
|
||||
{
|
||||
_Height = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float _MaxWidth = 0f;
|
||||
public float MaxWidth
|
||||
{
|
||||
get { return _MaxWidth; }
|
||||
set
|
||||
{
|
||||
if (_MaxWidth != value)
|
||||
{
|
||||
_MaxWidth = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SRectF _Bounds = new SRectF();
|
||||
public SRectF Bounds
|
||||
{
|
||||
get { return _Bounds; }
|
||||
set
|
||||
{
|
||||
if (_Bounds.X != value.X || _Bounds.Y != value.Y || _Bounds.W != value.W || _Bounds.H != value.H || _Bounds.Z != value.Z)
|
||||
{
|
||||
_Bounds = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private EAlignment _Align = EAlignment.Left;
|
||||
public EAlignment Align
|
||||
{
|
||||
get { return _Align; }
|
||||
set
|
||||
{
|
||||
if (_Align != value)
|
||||
{
|
||||
_Align = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private EHAlignment _HAlign = EHAlignment.Center;
|
||||
public EHAlignment HAlign
|
||||
{
|
||||
get { return _HAlign; }
|
||||
set
|
||||
{
|
||||
if (_HAlign != value)
|
||||
{
|
||||
_HAlign = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private EStyle _Style = EStyle.Normal;
|
||||
public EStyle Style
|
||||
{
|
||||
get { return _Style; }
|
||||
set
|
||||
{
|
||||
if (_Style != value)
|
||||
{
|
||||
_Style = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string _Fon = String.Empty;
|
||||
public string Fon
|
||||
{
|
||||
get { return _Fon; }
|
||||
set
|
||||
{
|
||||
if (_Fon != value)
|
||||
{
|
||||
_Fon = value;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SColorF Color; //normal Color
|
||||
public SColorF SColor; //selected Color for Buttons
|
||||
|
||||
public bool Reflection;
|
||||
public float ReflectionSpace;
|
||||
public float ReflectionHeight;
|
||||
|
||||
private string _Text = String.Empty;
|
||||
public string Text
|
||||
{
|
||||
get { return _Theme.Text; }
|
||||
set
|
||||
{
|
||||
string translation = _Base.Language.Translate(value);
|
||||
if (_Theme.Text != value || translation != _Text)
|
||||
{
|
||||
_Theme.Text = value;
|
||||
_Text = translation;
|
||||
_PositionNeedsUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selected;
|
||||
public bool Visible = true;
|
||||
public bool EditMode = false;
|
||||
|
||||
public float Alpha = 1f;
|
||||
|
||||
public CText(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
|
||||
X = 0f;
|
||||
Y = 0f;
|
||||
Z = 0f;
|
||||
Height = 1f;
|
||||
MaxWidth = 0f;
|
||||
Bounds = new SRectF();
|
||||
Align = EAlignment.Left;
|
||||
HAlign = EHAlignment.Center;
|
||||
Style = EStyle.Normal;
|
||||
Fon = "Normal";
|
||||
|
||||
Color = new SColorF();
|
||||
SColor = new SColorF();
|
||||
Reflection = false;
|
||||
ReflectionSpace = 0f;
|
||||
ReflectionHeight = 0f;
|
||||
|
||||
Text = String.Empty;
|
||||
Selected = false;
|
||||
Visible = true;
|
||||
Alpha = 1f;
|
||||
}
|
||||
|
||||
public CText(CText text)
|
||||
{
|
||||
_Base = text._Base;
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
|
||||
X = text._X;
|
||||
Y = text._Y;
|
||||
Z = text._Z;
|
||||
Height = text._Height;
|
||||
MaxWidth = text._MaxWidth;
|
||||
Bounds = new SRectF(text._Bounds);
|
||||
Align = text._Align;
|
||||
HAlign = text._HAlign;
|
||||
Style = text._Style;
|
||||
Fon = text._Fon;
|
||||
|
||||
Color = new SColorF(text.Color);
|
||||
SColor = new SColorF(text.SColor);
|
||||
Reflection = text.Reflection;
|
||||
ReflectionSpace = text.ReflectionSpace;
|
||||
ReflectionHeight = text.ReflectionHeight;
|
||||
|
||||
Text = text._Text;
|
||||
Selected = text.Selected;
|
||||
Visible = text.Visible;
|
||||
Alpha = text.Alpha;
|
||||
|
||||
EditMode = text.EditMode;
|
||||
}
|
||||
|
||||
public CText(Basic Base, float x, float y, float z, EAlignment align, float h, float mw, float r, float g, float b, float a, EStyle style, string font, string text, float rspace, float rheight)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
Height = h;
|
||||
MaxWidth = mw;
|
||||
Align = align;
|
||||
HAlign = EHAlignment.Center;
|
||||
Style = style;
|
||||
Fon = font;
|
||||
|
||||
Color = new SColorF(r, g, b, a);
|
||||
SColor = new SColorF(r, g, b, a);
|
||||
|
||||
Text = text;
|
||||
|
||||
Selected = false;
|
||||
|
||||
if (MaxWidth > 0)
|
||||
{
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), MaxWidth, 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), 3f * _Base.Settings.GetRenderW(), 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
}
|
||||
|
||||
Reflection = true;
|
||||
ReflectionSpace = rspace;
|
||||
ReflectionHeight = rheight;
|
||||
}
|
||||
|
||||
public CText(Basic Base, float x, float y, float z, EAlignment align, float h, float mw, float r, float g, float b, float a, EStyle style, string font, string text)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
Height = h;
|
||||
MaxWidth = mw;
|
||||
Align = align;
|
||||
HAlign = EHAlignment.Center;
|
||||
Style = style;
|
||||
Fon = font;
|
||||
|
||||
Color = new SColorF(r, g, b, a);
|
||||
SColor = new SColorF(r, g, b, a);
|
||||
|
||||
Text = text;
|
||||
|
||||
Selected = false;
|
||||
|
||||
if (MaxWidth > 0)
|
||||
{
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), MaxWidth, 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), 3f * _Base.Settings.GetRenderW(), 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
}
|
||||
|
||||
Reflection = false;
|
||||
}
|
||||
|
||||
public CText(Basic Base, float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text, float rspace, float rheight)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
Height = h;
|
||||
MaxWidth = mw;
|
||||
Align = align;
|
||||
HAlign = EHAlignment.Center;
|
||||
Style = style;
|
||||
Fon = font;
|
||||
|
||||
Color = col;
|
||||
SColor = new SColorF(col);
|
||||
|
||||
Text = text;
|
||||
|
||||
Selected = false;
|
||||
|
||||
if (MaxWidth > 0)
|
||||
{
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), MaxWidth, 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), 3f * _Base.Settings.GetRenderW(), 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
}
|
||||
|
||||
Reflection = true;
|
||||
ReflectionSpace = rspace;
|
||||
ReflectionHeight = rheight;
|
||||
}
|
||||
|
||||
public CText(Basic Base, float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeText();
|
||||
_ThemeLoaded = false;
|
||||
_ButtonText = false;
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
Height = h;
|
||||
MaxWidth = mw;
|
||||
Align = align;
|
||||
HAlign = EHAlignment.Center;
|
||||
Style = style;
|
||||
Fon = font;
|
||||
|
||||
Color = col;
|
||||
SColor = new SColorF(col);
|
||||
|
||||
Text = text;
|
||||
|
||||
Selected = false;
|
||||
|
||||
if (MaxWidth > 0)
|
||||
{
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), MaxWidth, 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), 3f * _Base.Settings.GetRenderW(), 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
}
|
||||
|
||||
Reflection = false;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
return LoadTheme(XmlPath, ElementName, navigator, SkinIndex, false);
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex, bool ButtonText)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref _X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref _Y);
|
||||
|
||||
if (!ButtonText)
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref _Z);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref _Height);
|
||||
CHelper.TryGetFloatValueFromXML(item + "/MaxW", navigator, ref _MaxWidth);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
|
||||
}
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/SColor", navigator, ref _Theme.SColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.SColorName, SkinIndex, ref SColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CHelper.TryGetFloatValueFromXML(item + "/SR", navigator, ref SColor.R))
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SG", navigator, ref SColor.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SB", navigator, ref SColor.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SA", navigator, ref SColor.A);
|
||||
}
|
||||
}
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EAlignment>(item + "/Align", navigator, ref _Align);
|
||||
CHelper.TryGetEnumValueFromXML<EHAlignment>(item + "/HAlign", navigator, ref _HAlign);
|
||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EStyle>(item + "/Style", navigator, ref _Style);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/Font", navigator, ref _Fon, "Normal");
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/Text", navigator, ref _Theme.Text, String.Empty);
|
||||
|
||||
if (CHelper.ItemExistsInXML(item + "/Reflection", navigator) && !ButtonText)
|
||||
{
|
||||
Reflection = true;
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Space", navigator, ref ReflectionSpace);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Reflection/Height", navigator, ref ReflectionHeight);
|
||||
}
|
||||
else
|
||||
Reflection = false;
|
||||
|
||||
// Set values
|
||||
X = _X;
|
||||
Y = _Y;
|
||||
Z = _Z;
|
||||
Height = _Height;
|
||||
MaxWidth = _MaxWidth;
|
||||
Text = _Theme.Text;
|
||||
Fon = _Fon;
|
||||
Align = _Align;
|
||||
HAlign = _HAlign;
|
||||
Style = _Style;
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
LoadTextures();
|
||||
|
||||
if (MaxWidth > 0)
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), MaxWidth, 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
else
|
||||
Bounds = new SRectF(-_Base.Settings.GetRenderW(), -_Base.Settings.GetRenderH(), 3f * _Base.Settings.GetRenderW(), 3f * _Base.Settings.GetRenderH(), 0f);
|
||||
|
||||
_ButtonText = ButtonText;
|
||||
}
|
||||
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", Height.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 (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", Color.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<SColor>: Selected Text color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
|
||||
if (_Theme.SColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("SColor", _Theme.SColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("SR", SColor.R.ToString("#0.00"));
|
||||
writer.WriteElementString("SG", SColor.G.ToString("#0.00"));
|
||||
writer.WriteElementString("SB", SColor.B.ToString("#0.00"));
|
||||
writer.WriteElementString("SA", SColor.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("<HAlign>: Text align vertical (on downsizing): " + CHelper.ListStrings(Enum.GetNames(typeof(EHAlignment))));
|
||||
writer.WriteElementString("HAlign", Enum.GetName(typeof(EHAlignment), HAlign));
|
||||
|
||||
writer.WriteComment("<Style>: Text style: " + CHelper.ListStrings(Enum.GetNames(typeof(EStyle))));
|
||||
writer.WriteElementString("Style", Enum.GetName(typeof(EStyle), Style));
|
||||
|
||||
writer.WriteComment("<Font>: Text font name");
|
||||
writer.WriteElementString("Font", Fon);
|
||||
|
||||
writer.WriteComment("<Text>: Nothing or translation tag");
|
||||
if (_Base.Language.TranslationExists(_Theme.Text))
|
||||
writer.WriteElementString("Text", _Theme.Text);
|
||||
else
|
||||
writer.WriteElementString("Text", string.Empty);
|
||||
|
||||
if (!_ButtonText)
|
||||
{
|
||||
writer.WriteComment("<Reflection> If exists:");
|
||||
writer.WriteComment(" <Space>: Reflection Space");
|
||||
writer.WriteComment(" <Height>: Reflection Height");
|
||||
}
|
||||
|
||||
if (Reflection && !_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()
|
||||
{
|
||||
Draw(false);
|
||||
}
|
||||
|
||||
public void ForceDraw()
|
||||
{
|
||||
Draw(true);
|
||||
}
|
||||
|
||||
public void Draw(bool ForceDraw)
|
||||
{
|
||||
if (!ForceDraw && !Visible && _Base.Settings.GetGameState() != EGameState.EditTheme)
|
||||
return;
|
||||
|
||||
// Update Text
|
||||
Text = Text;
|
||||
|
||||
if (_PositionNeedsUpdate)
|
||||
UpdateTextPosition();
|
||||
|
||||
_Base.Fonts.SetFont(Fon);
|
||||
_Base.Fonts.SetStyle(Style);
|
||||
|
||||
SColorF CurrentColor = new SColorF(Color);
|
||||
if (Selected)
|
||||
CurrentColor = new SColorF(SColor);
|
||||
|
||||
SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha);
|
||||
|
||||
if (!EditMode)
|
||||
_Base.Fonts.DrawText(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color);
|
||||
else
|
||||
_Base.Fonts.DrawText(_Text + "|", _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color);
|
||||
|
||||
if (Reflection)
|
||||
{
|
||||
float sFactor = 0f;
|
||||
switch (HAlign)
|
||||
{
|
||||
case EHAlignment.Top:
|
||||
sFactor = (Height - _DrawPosition.tH) * 1.5f;
|
||||
break;
|
||||
case EHAlignment.Center:
|
||||
sFactor = (Height - _DrawPosition.tH) * 1.0f;
|
||||
break;
|
||||
case EHAlignment.Bottom:
|
||||
sFactor = (Height - _DrawPosition.tH) * 0.5f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!EditMode)
|
||||
_Base.Fonts.DrawTextReflection(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight);
|
||||
else
|
||||
_Base.Fonts.DrawTextReflection(_Text + "|", _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight);
|
||||
}
|
||||
|
||||
if (Selected && (_Base.Settings.GetGameState() == EGameState.EditTheme))
|
||||
{
|
||||
_Base.Drawing.DrawColor(
|
||||
new SColorF(0.5f, 1f, 0.5f, 0.5f * _Base.Graphics.GetGlobalAlpha()),
|
||||
new SRectF(_DrawPosition.X, _DrawPosition.Y, _DrawPosition.Width, _DrawPosition.Height, Z)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(float begin, float end)
|
||||
{
|
||||
RectangleF bounds = _Base.Drawing.GetTextBounds(this);
|
||||
|
||||
float x = X;
|
||||
switch (Align)
|
||||
{
|
||||
case EAlignment.Center:
|
||||
x = X - bounds.Width / 2;
|
||||
break;
|
||||
case EAlignment.Right:
|
||||
x = X - bounds.Width;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SColorF CurrentColor = new SColorF(Color);
|
||||
if (Selected)
|
||||
CurrentColor = new SColorF(SColor);
|
||||
|
||||
SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha);
|
||||
|
||||
_Base.Fonts.SetFont(Fon);
|
||||
_Base.Fonts.SetStyle(Style);
|
||||
|
||||
if (!EditMode)
|
||||
_Base.Fonts.DrawText(Text, Height, x, Y, Z, color, begin, end);
|
||||
else
|
||||
_Base.Fonts.DrawText(Text + "|", Height, x, Y, Z, color, begin, end);
|
||||
|
||||
if (Reflection)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
if (Selected && (_Base.Settings.GetGameState() == EGameState.EditTheme))
|
||||
{
|
||||
_Base.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(x, Y, bounds.Width, bounds.Height, Z));
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawRelative(float x, float y)
|
||||
{
|
||||
DrawRelative(x, y, false, 0f, 0f, 0f);
|
||||
}
|
||||
|
||||
public void DrawRelative(float x, float y, float reflectionSpace, float reflectionHeigth, float rectHeight)
|
||||
{
|
||||
DrawRelative(x, y, true, reflectionSpace, reflectionHeigth, rectHeight);
|
||||
}
|
||||
|
||||
public void DrawRelative(float rx, float ry, bool reflection, float reflectionSpace, float reflectionHeight, float rectHeight)
|
||||
{
|
||||
// Update Text
|
||||
Text = Text;
|
||||
|
||||
float h = Height;
|
||||
|
||||
float x = X + rx;
|
||||
float y = Y + ry;
|
||||
|
||||
RectangleF bounds = _Base.Drawing.GetTextBounds(this);
|
||||
|
||||
if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f)
|
||||
{
|
||||
float factor = Bounds.W / bounds.Width;
|
||||
float step = h * (1 - factor);
|
||||
h *= factor;
|
||||
switch (HAlign)
|
||||
{
|
||||
case EHAlignment.Top:
|
||||
y += step * 0.25f;
|
||||
break;
|
||||
case EHAlignment.Center:
|
||||
y += step * 0.50f;
|
||||
break;
|
||||
case EHAlignment.Bottom:
|
||||
y += step * 0.75f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bounds = _Base.Fonts.GetTextBounds(this, h);
|
||||
}
|
||||
|
||||
switch (Align)
|
||||
{
|
||||
case EAlignment.Center:
|
||||
x = x - bounds.Width / 2;
|
||||
break;
|
||||
case EAlignment.Right:
|
||||
x = x - bounds.Width;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
SColorF CurrentColor = new SColorF(Color);
|
||||
if (Selected)
|
||||
CurrentColor = new SColorF(SColor);
|
||||
|
||||
SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha);
|
||||
|
||||
_Base.Fonts.SetFont(Fon);
|
||||
_Base.Fonts.SetStyle(Style);
|
||||
|
||||
if (!EditMode)
|
||||
_Base.Fonts.DrawText(_Text, h, x, y, Z, color);
|
||||
else
|
||||
_Base.Fonts.DrawText(_Text + "|", h, x, y, Z, color);
|
||||
|
||||
if (reflection)
|
||||
{
|
||||
float space = (rectHeight - Y - bounds.Height) * 2f + reflectionSpace;
|
||||
float height = reflectionHeight - (rectHeight - Y) + bounds.Height;
|
||||
|
||||
if (!EditMode)
|
||||
_Base.Fonts.DrawTextReflection(_Text, h, x, y, Z, color, space, height);
|
||||
else
|
||||
_Base.Fonts.DrawTextReflection(_Text + "|", h, x, y, Z, color, space, height);
|
||||
}
|
||||
|
||||
if (Selected && (_Base.Settings.GetGameState() == EGameState.EditTheme))
|
||||
{
|
||||
_Base.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f * _Base.Graphics.GetGlobalAlpha()), new SRectF(x, y, bounds.Width, bounds.Height, Z));
|
||||
}
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
|
||||
if (_Theme.SColorName != String.Empty)
|
||||
SColor = _Base.Theme.GetColor(_Theme.SColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
X += stepX;
|
||||
Y += stepY;
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
Height += stepH;
|
||||
if (Height <= 0)
|
||||
Height = 1;
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
|
||||
private void UpdateTextPosition()
|
||||
{
|
||||
if (_Text == String.Empty)
|
||||
return;
|
||||
|
||||
_Base.Fonts.SetFont(Fon);
|
||||
_Base.Fonts.SetStyle(Style);
|
||||
|
||||
float h = Height;
|
||||
float y = Y;
|
||||
RectangleF bounds = _Base.Fonts.GetTextBounds(this, this.Height);
|
||||
|
||||
if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f)
|
||||
{
|
||||
float factor = Bounds.W / bounds.Width;
|
||||
float step = h * (1 - factor);
|
||||
h *= factor ;
|
||||
switch (HAlign)
|
||||
{
|
||||
case EHAlignment.Top:
|
||||
y += step * 0.25f;
|
||||
break;
|
||||
case EHAlignment.Center:
|
||||
y += step * 0.50f;
|
||||
break;
|
||||
case EHAlignment.Bottom:
|
||||
y += step * 0.75f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bounds = _Base.Fonts.GetTextBounds(this, h);
|
||||
}
|
||||
|
||||
float x = X;
|
||||
switch (Align)
|
||||
{
|
||||
case EAlignment.Center:
|
||||
x = X - bounds.Width / 2;
|
||||
break;
|
||||
case EAlignment.Right:
|
||||
x = X - bounds.Width;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_DrawPosition.X = x;
|
||||
_DrawPosition.Y = y;
|
||||
_DrawPosition.tH = h;
|
||||
_DrawPosition.Width = bounds.Width;
|
||||
_DrawPosition.Height = bounds.Height;
|
||||
|
||||
_PositionNeedsUpdate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,828 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Vocaluxe.Menu.SingNotes;
|
||||
using Vocaluxe.Menu.SongMenu;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
public interface IMenu
|
||||
{
|
||||
void Initialize(Basic Base);
|
||||
|
||||
void LoadTheme();
|
||||
void SaveTheme();
|
||||
void ReloadTextures();
|
||||
void UnloadTextures();
|
||||
void ReloadTheme();
|
||||
|
||||
bool HandleInput(KeyEvent KeyEvent);
|
||||
bool HandleMouse(MouseEvent MouseEvent);
|
||||
bool HandleInputThemeEditor(KeyEvent KeyEvent);
|
||||
bool HandleMouseThemeEditor(MouseEvent MouseEvent);
|
||||
|
||||
bool UpdateGame();
|
||||
void ApplyVolume();
|
||||
void OnShow();
|
||||
void OnShowFinish();
|
||||
void OnClose();
|
||||
|
||||
bool Draw();
|
||||
SRectF GetScreenArea();
|
||||
|
||||
void NextInteraction();
|
||||
void PrevInteraction();
|
||||
|
||||
bool NextElement();
|
||||
bool PrevElement();
|
||||
|
||||
void ProcessMouseClick(int x, int y);
|
||||
void ProcessMouseMove(int x, int y);
|
||||
}
|
||||
|
||||
public interface IConfig
|
||||
{
|
||||
void SetBackgroundMusicVolume(int NewVolume);
|
||||
int GetBackgroundMusicVolume();
|
||||
|
||||
int GetPreviewMusicVolume();
|
||||
|
||||
EOffOn GetVideosToBackground();
|
||||
EOffOn GetVideoBackgrounds();
|
||||
EOffOn GetVideoPreview();
|
||||
|
||||
ESongMenu GetSongMenuType();
|
||||
|
||||
EOffOn GetDrawNoteLines();
|
||||
EOffOn GetDrawToneHelper();
|
||||
|
||||
int GetCoverSize();
|
||||
|
||||
List<string> GetSongFolder();
|
||||
ESongSorting GetSongSorting();
|
||||
EOffOn GetTabs();
|
||||
EOffOn GetIgnoreArticles();
|
||||
}
|
||||
|
||||
public interface ISettings
|
||||
{
|
||||
int GetRenderW();
|
||||
int GetRenderH();
|
||||
bool IsTabNavigation();
|
||||
|
||||
float GetZFar();
|
||||
float GetZNear();
|
||||
|
||||
EGameState GetGameState();
|
||||
|
||||
int GetToneMin();
|
||||
int GetToneMax();
|
||||
|
||||
int GetNumNoteLines();
|
||||
int GetMaxNumPlayer();
|
||||
|
||||
float GetDefaultMedleyFadeInTime();
|
||||
float GetDefaultMedleyFadeOutTime();
|
||||
int GetMedleyMinSeriesLength();
|
||||
float GetMedleyMinDuration();
|
||||
}
|
||||
|
||||
public interface ITheme
|
||||
{
|
||||
string GetThemeScreensPath();
|
||||
int GetSkinIndex();
|
||||
STexture GetSkinTexture(string TextureName);
|
||||
STexture GetSkinVideoTexture(string VideoName);
|
||||
|
||||
void SkinVideoResume(string VideoName);
|
||||
void SkinVideoPause(string VideoName);
|
||||
|
||||
SColorF GetColor(string ColorName);
|
||||
bool GetColor(string ColorName, int SkinIndex, ref SColorF Color);
|
||||
SColorF GetPlayerColor(int PlayerNr);
|
||||
|
||||
void UnloadSkins();
|
||||
void ListSkins();
|
||||
void LoadSkins();
|
||||
void LoadTheme();
|
||||
}
|
||||
|
||||
public interface IHelper
|
||||
{
|
||||
}
|
||||
|
||||
public interface IBackgroundMusic
|
||||
{
|
||||
bool IsDisabled();
|
||||
bool IsPlaying();
|
||||
bool SongHasVideo();
|
||||
bool VideoEnabled();
|
||||
|
||||
void Next();
|
||||
void Previous();
|
||||
void Pause();
|
||||
void Play();
|
||||
|
||||
void ApplyVolume();
|
||||
|
||||
STexture GetVideoTexture();
|
||||
}
|
||||
|
||||
public interface IDrawing
|
||||
{
|
||||
RectangleF GetTextBounds(CText text);
|
||||
|
||||
void DrawTexture(STexture Texture, SRectF Rect);
|
||||
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color);
|
||||
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds);
|
||||
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, bool Mirrored);
|
||||
void DrawTextureReflection(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, float ReflectionSpace, float ReflectionHeight);
|
||||
|
||||
void RemoveTexture(ref STexture Texture);
|
||||
|
||||
void DrawColor(SColorF Color, SRectF Rect);
|
||||
void DrawColorReflection(SColorF Color, SRectF Rect, float Space, float Height);
|
||||
}
|
||||
|
||||
public interface IGraphics
|
||||
{
|
||||
void ReloadTheme();
|
||||
void SaveTheme();
|
||||
void FadeTo(EScreens NextScreen);
|
||||
|
||||
float GetGlobalAlpha();
|
||||
}
|
||||
|
||||
public interface ILog
|
||||
{
|
||||
void LogError(string ErrorText);
|
||||
}
|
||||
|
||||
public interface IFonts
|
||||
{
|
||||
void SetFont(string FontName);
|
||||
void SetStyle(EStyle FontStyle);
|
||||
|
||||
RectangleF GetTextBounds(CText Text, float TextHeight);
|
||||
|
||||
void DrawText(string Text, float TextHeight, float x, float y, float z, SColorF Color);
|
||||
void DrawTextReflection(string Text, float TextHeight, float x, float y, float z, SColorF Color, float ReflectionSpace, float ReflectionHeight);
|
||||
void DrawText(string Text, float TextHeight, float x, float y, float z, SColorF Color, float Begin, float End);
|
||||
}
|
||||
|
||||
public interface ILanguage
|
||||
{
|
||||
string Translate(string KeyWord);
|
||||
bool TranslationExists(string KeyWord);
|
||||
}
|
||||
|
||||
public interface IGame
|
||||
{
|
||||
int GetNumPlayer();
|
||||
SPlayer[] GetPlayer();
|
||||
float GetMidBeatD();
|
||||
int GetCurrentBeatD();
|
||||
|
||||
int GetRandom(int Max);
|
||||
double GetRandomDouble();
|
||||
|
||||
float GetTimeFromBeats(float Beat, float BPM);
|
||||
|
||||
void AddSong(int SongID, EGameMode GameMode);
|
||||
void Reset();
|
||||
void ClearSongs();
|
||||
int GetNumSongs();
|
||||
}
|
||||
|
||||
public interface IRecording
|
||||
{
|
||||
int GetToneAbs(int PlayerNr);
|
||||
}
|
||||
|
||||
public interface IProfiles
|
||||
{
|
||||
SProfile[] GetProfiles();
|
||||
}
|
||||
|
||||
public interface ISongs
|
||||
{
|
||||
int GetNumVisibleSongs();
|
||||
int GetNumCategories();
|
||||
int NumSongsInCategory(int CategoryIndex);
|
||||
|
||||
int GetCurrentCategoryIndex();
|
||||
EOffOn GetTabs();
|
||||
string GetSearchFilter();
|
||||
|
||||
void SetCategory(int CategoryIndex);
|
||||
void UpdateRandomSongList();
|
||||
|
||||
CSong GetVisibleSong(int VisibleIndex);
|
||||
CSong GetSongByID(int SongID);
|
||||
CCategory GetCategory(int Index);
|
||||
|
||||
void NextCategory();
|
||||
void PrevCategory();
|
||||
}
|
||||
|
||||
public interface IVideo
|
||||
{
|
||||
int Load(string VideoFileName);
|
||||
bool Skip(int VideoStream, float StartPosition, float VideoGap);
|
||||
bool GetFrame(int VideoStream, ref STexture VideoTexture, float Time, ref float VideoTime);
|
||||
bool IsFinished(int VideoStream);
|
||||
bool Close(int VideoStream);
|
||||
}
|
||||
|
||||
public interface ISound
|
||||
{
|
||||
int Load(string SoundFile, bool Prescan);
|
||||
void SetPosition(int SoundStream, float NewPosition);
|
||||
void Play(int SoundStream);
|
||||
void Fade(int SoundStream, float TargetVolume, float Duration);
|
||||
|
||||
bool IsFinished(int SoundStream);
|
||||
float GetPosition(int SoundStream);
|
||||
float GetLength(int SoundStream);
|
||||
void FadeAndStop(int SoundStream, float TargetVolume, float Duration);
|
||||
|
||||
void SetStreamVolume(int SoundStream, float Volume);
|
||||
void SetStreamVolumeMax(int SoundStream, float MaxVolume);
|
||||
}
|
||||
|
||||
public interface ICover
|
||||
{
|
||||
STexture GetNoCover();
|
||||
}
|
||||
|
||||
public interface IDataBase
|
||||
{
|
||||
bool GetCover(string FileName, ref STexture Texture, int CoverSize);
|
||||
}
|
||||
|
||||
public interface IInputs
|
||||
{
|
||||
void SetRumble(float Duration);
|
||||
}
|
||||
|
||||
public interface IPlaylist
|
||||
{
|
||||
string GetPlaylistName(int PlaylistID);
|
||||
void SetPlaylistName(int PlaylistID, string Name);
|
||||
void DeletePlaylist(int PlaylistID);
|
||||
void SavePlaylist(int PlaylistID);
|
||||
int GetNumPlaylists();
|
||||
|
||||
void AddPlaylistSong(int PlaylistID, int SongID);
|
||||
void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode);
|
||||
void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode);
|
||||
|
||||
void MovePlaylistSong(int PlaylistID, int SourceIndex, int DestIndex);
|
||||
void MovePlaylistSongDown(int PlaylistID, int SongIndex);
|
||||
void MovePlaylistSongUp(int PlaylistID, int SongIndex);
|
||||
void DeletePlaylistSong(int PlaylistID, int SongIndex);
|
||||
|
||||
int GetPlaylistSongCount(int PlaylistID);
|
||||
CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum EModifier
|
||||
{
|
||||
None,
|
||||
Shift,
|
||||
Alt,
|
||||
Ctrl
|
||||
}
|
||||
|
||||
public enum ESender
|
||||
{
|
||||
Mouse,
|
||||
Keyboard,
|
||||
WiiMote,
|
||||
Gamepad
|
||||
}
|
||||
|
||||
public struct KeyEvent
|
||||
{
|
||||
public ESender Sender;
|
||||
public bool ModALT;
|
||||
public bool ModSHIFT;
|
||||
public bool ModCTRL;
|
||||
public bool KeyPressed;
|
||||
public bool Handled;
|
||||
public Keys Key;
|
||||
public Char Unicode;
|
||||
public EModifier Mod;
|
||||
|
||||
public KeyEvent(ESender sender, bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key)
|
||||
{
|
||||
Sender = sender;
|
||||
ModALT = alt;
|
||||
ModSHIFT = shift;
|
||||
ModCTRL = ctrl;
|
||||
KeyPressed = pressed;
|
||||
Unicode = unicode;
|
||||
Key = key;
|
||||
Handled = false;
|
||||
|
||||
EModifier mALT = EModifier.None;
|
||||
EModifier mSHIFT = EModifier.None;
|
||||
EModifier mCTRL = EModifier.None;
|
||||
|
||||
if (alt)
|
||||
mALT = EModifier.Alt;
|
||||
|
||||
if (shift)
|
||||
mSHIFT = EModifier.Shift;
|
||||
|
||||
if (ctrl)
|
||||
mCTRL = EModifier.Ctrl;
|
||||
|
||||
if (!alt && !shift && !ctrl)
|
||||
Mod = EModifier.None;
|
||||
else
|
||||
Mod = mALT | mSHIFT | mCTRL;
|
||||
}
|
||||
}
|
||||
|
||||
public struct MouseEvent
|
||||
{
|
||||
public ESender Sender;
|
||||
public int X;
|
||||
public int Y;
|
||||
public bool LB; //left button click
|
||||
public bool LD; //left button double click
|
||||
public bool RB; //right button click
|
||||
public bool MB; //middle button click
|
||||
|
||||
public bool LBH; //left button hold (when moving)
|
||||
public bool RBH; //right button hold (when moving)
|
||||
public bool MBH; //middle button hold (when moving)
|
||||
|
||||
public bool ModALT;
|
||||
public bool ModSHIFT;
|
||||
public bool ModCTRL;
|
||||
|
||||
public EModifier Mod;
|
||||
public int Wheel;
|
||||
|
||||
public MouseEvent(ESender sender, bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
|
||||
{
|
||||
Sender = sender;
|
||||
X = x;
|
||||
Y = y;
|
||||
LB = lb;
|
||||
LD = ld;
|
||||
RB = rb;
|
||||
MB = mb;
|
||||
|
||||
LBH = lbh;
|
||||
RBH = rbh;
|
||||
MBH = mbh;
|
||||
|
||||
ModALT = alt;
|
||||
ModSHIFT = shift;
|
||||
ModCTRL = ctrl;
|
||||
|
||||
EModifier mALT = EModifier.None;
|
||||
EModifier mSHIFT = EModifier.None;
|
||||
EModifier mCTRL = EModifier.None;
|
||||
|
||||
if (alt)
|
||||
mALT = EModifier.Alt;
|
||||
|
||||
if (shift)
|
||||
mSHIFT = EModifier.Shift;
|
||||
|
||||
if (ctrl)
|
||||
mCTRL = EModifier.Ctrl;
|
||||
|
||||
if (!alt && !shift && !ctrl)
|
||||
Mod = EModifier.None;
|
||||
else
|
||||
Mod = mALT | mSHIFT | mCTRL;
|
||||
|
||||
Wheel = wheel;
|
||||
}
|
||||
}
|
||||
|
||||
public enum EGameState
|
||||
{
|
||||
Start,
|
||||
Normal,
|
||||
EditTheme
|
||||
}
|
||||
|
||||
public enum EAspect
|
||||
{
|
||||
Crop,
|
||||
LetterBox,
|
||||
Stretch
|
||||
}
|
||||
|
||||
#region Structs
|
||||
public struct SColorF
|
||||
{
|
||||
public float R;
|
||||
public float G;
|
||||
public float B;
|
||||
public float A;
|
||||
|
||||
public SColorF(float r, float g, float b, float a)
|
||||
{
|
||||
R = r;
|
||||
G = g;
|
||||
B = b;
|
||||
A = a;
|
||||
}
|
||||
|
||||
public SColorF(SColorF Color)
|
||||
{
|
||||
R = Color.R;
|
||||
G = Color.G;
|
||||
B = Color.B;
|
||||
A = Color.A;
|
||||
}
|
||||
}
|
||||
|
||||
public struct SRectF
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
public float W;
|
||||
public float H;
|
||||
public float Z;
|
||||
public float Rotation; //0..360°
|
||||
|
||||
public SRectF(float x, float y, float w, float h, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
W = w;
|
||||
H = h;
|
||||
Z = z;
|
||||
Rotation = 0f;
|
||||
}
|
||||
|
||||
public SRectF(SRectF rect)
|
||||
{
|
||||
X = rect.X;
|
||||
Y = rect.Y;
|
||||
W = rect.W;
|
||||
H = rect.H;
|
||||
Z = rect.Z;
|
||||
Rotation = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public struct SPoint3f
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
public float Z;
|
||||
}
|
||||
|
||||
public struct SPoint3
|
||||
{
|
||||
public int X;
|
||||
public int Y;
|
||||
public int Z;
|
||||
}
|
||||
|
||||
public struct STexture
|
||||
{
|
||||
public int index;
|
||||
public int PBO;
|
||||
public int ID;
|
||||
|
||||
public string TexturePath;
|
||||
|
||||
public float width;
|
||||
public float height;
|
||||
public SRectF rect;
|
||||
|
||||
public float w2; //power of 2 width
|
||||
public float h2; //power of 2 height
|
||||
public float width_ratio;
|
||||
public float height_ratio;
|
||||
|
||||
public SColorF color;
|
||||
|
||||
public STexture(int Index)
|
||||
{
|
||||
index = Index;
|
||||
PBO = 0;
|
||||
ID = -1;
|
||||
TexturePath = String.Empty;
|
||||
|
||||
width = 1f;
|
||||
height = 1f;
|
||||
rect = new SRectF(0f, 0f, 1f, 1f, 0f);
|
||||
|
||||
w2 = 2f;
|
||||
h2 = 2f;
|
||||
width_ratio = 0.5f;
|
||||
height_ratio = 0.5f;
|
||||
|
||||
color = new SColorF(1f, 1f, 1f, 1f);
|
||||
}
|
||||
}
|
||||
#endregion Structs
|
||||
|
||||
#region EnumsConfig
|
||||
public enum ERenderer
|
||||
{
|
||||
#if WIN
|
||||
TR_CONFIG_DIRECT3D,
|
||||
#endif
|
||||
TR_CONFIG_OPENGL,
|
||||
TR_CONFIG_SOFTWARE
|
||||
}
|
||||
|
||||
public enum EAntiAliasingModes
|
||||
{
|
||||
x0 = 0,
|
||||
x2 = 2,
|
||||
x4 = 4,
|
||||
x8 = 8,
|
||||
x16 = 16,
|
||||
x32 = 32
|
||||
}
|
||||
|
||||
public enum EColorDeep
|
||||
{
|
||||
Bit8 = 8,
|
||||
Bit16 = 16,
|
||||
Bit24 = 24,
|
||||
Bit32 = 32
|
||||
}
|
||||
|
||||
public enum ETextureQuality
|
||||
{
|
||||
TR_CONFIG_TEXTURE_LOWEST,
|
||||
TR_CONFIG_TEXTURE_LOW,
|
||||
TR_CONFIG_TEXTURE_MEDIUM,
|
||||
TR_CONFIG_TEXTURE_HIGH,
|
||||
TR_CONFIG_TEXTURE_HIGHEST
|
||||
}
|
||||
|
||||
public enum EOffOn
|
||||
{
|
||||
TR_CONFIG_OFF,
|
||||
TR_CONFIG_ON
|
||||
}
|
||||
|
||||
public enum EDebugLevel
|
||||
{
|
||||
// don't change the order!
|
||||
TR_CONFIG_OFF, //no debug infos
|
||||
TR_CONFIG_ONLY_FPS,
|
||||
TR_CONFIG_LEVEL1,
|
||||
TR_CONFIG_LEVEL2,
|
||||
TR_CONFIG_LEVEL3,
|
||||
TR_CONFIG_LEVEL_MAX //all debug infos
|
||||
}
|
||||
|
||||
public enum EBufferSize
|
||||
{
|
||||
b0 = 0,
|
||||
b512 = 512,
|
||||
b1024 = 1024,
|
||||
b1536 = 1536,
|
||||
b2048 = 2048,
|
||||
b2560 = 2560,
|
||||
b3072 = 3072,
|
||||
b3584 = 3584,
|
||||
b4096 = 4096
|
||||
}
|
||||
|
||||
public enum EPlaybackLib
|
||||
{
|
||||
PortAudio,
|
||||
OpenAL
|
||||
}
|
||||
|
||||
public enum EWebcamLib
|
||||
{
|
||||
OpenCV,
|
||||
AForgeNet
|
||||
}
|
||||
|
||||
public enum ERecordLib
|
||||
{
|
||||
#if WIN
|
||||
DirectSound,
|
||||
#endif
|
||||
PortAudio
|
||||
}
|
||||
|
||||
public enum EVideoDecoder
|
||||
{
|
||||
FFmpeg
|
||||
}
|
||||
|
||||
public enum ESongMenu
|
||||
{
|
||||
//TR_CONFIG_LIST, //a simple list
|
||||
//TR_CONFIG_DREIDEL, //as in ultrastar deluxe
|
||||
TR_CONFIG_TILE_BOARD, //chessboard like
|
||||
//TR_CONFIG_BOOK //for playlists
|
||||
}
|
||||
|
||||
public enum ESongSorting
|
||||
{
|
||||
TR_CONFIG_NONE,
|
||||
//TR_CONFIG_RANDOM,
|
||||
TR_CONFIG_FOLDER,
|
||||
TR_CONFIG_ARTIST,
|
||||
TR_CONFIG_ARTIST_LETTER,
|
||||
TR_CONFIG_TITLE_LETTER,
|
||||
TR_CONFIG_EDITION,
|
||||
TR_CONFIG_GENRE,
|
||||
TR_CONFIG_LANGUAGE,
|
||||
TR_CONFIG_YEAR,
|
||||
TR_CONFIG_DECADE
|
||||
}
|
||||
|
||||
public enum ECoverLoading
|
||||
{
|
||||
TR_CONFIG_COVERLOADING_ONDEMAND,
|
||||
TR_CONFIG_COVERLOADING_ATSTART,
|
||||
TR_CONFIG_COVERLOADING_DYNAMIC
|
||||
}
|
||||
|
||||
public enum EGameDifficulty
|
||||
{
|
||||
TR_CONFIG_EASY,
|
||||
TR_CONFIG_NORMAL,
|
||||
TR_CONFIG_HARD
|
||||
}
|
||||
|
||||
public enum ETimerMode
|
||||
{
|
||||
TR_CONFIG_TIMERMODE_CURRENT,
|
||||
TR_CONFIG_TIMERMODE_REMAINING,
|
||||
TR_CONFIG_TIMERMODE_TOTAL
|
||||
}
|
||||
|
||||
public enum ETimerLook
|
||||
{
|
||||
TR_CONFIG_TIMERLOOK_NORMAL,
|
||||
TR_CONFIG_TIMERLOOK_EXPANDED
|
||||
}
|
||||
|
||||
public enum EBackgroundMusicSource
|
||||
{
|
||||
TR_CONFIG_NO_OWN_MUSIC,
|
||||
TR_CONFIG_OWN_MUSIC,
|
||||
TR_CONFIG_ONLY_OWN_MUSIC
|
||||
}
|
||||
|
||||
public enum EPlayerInfo
|
||||
{
|
||||
TR_CONFIG_PLAYERINFO_BOTH,
|
||||
TR_CONFIG_PLAYERINFO_NAME,
|
||||
TR_CONFIG_PLAYERINFO_AVATAR,
|
||||
TR_CONFIG_PLAYERINFO_OFF
|
||||
}
|
||||
|
||||
public enum EFadePlayerInfo
|
||||
{
|
||||
TR_CONFIG_FADEPLAYERINFO_ALL,
|
||||
TR_CONFIG_FADEPLAYERINFO_INFO,
|
||||
TR_CONFIG_FADEPLAYERINFO_OFF
|
||||
}
|
||||
|
||||
public enum ELyricStyle
|
||||
{
|
||||
Fill,
|
||||
Jump,
|
||||
Slide,
|
||||
Zoom
|
||||
}
|
||||
|
||||
#endregion EnumsConfig
|
||||
|
||||
public enum EAlignment
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
Right
|
||||
}
|
||||
|
||||
public enum EHAlignment
|
||||
{
|
||||
Top,
|
||||
Center,
|
||||
Bottom
|
||||
}
|
||||
|
||||
public enum EStyle
|
||||
{
|
||||
Normal,
|
||||
Italic,
|
||||
Bold,
|
||||
BoldItalic
|
||||
}
|
||||
|
||||
public enum ENoteType
|
||||
{
|
||||
Normal,
|
||||
Golden,
|
||||
Freestyle
|
||||
}
|
||||
|
||||
public struct SProfile
|
||||
{
|
||||
public string PlayerName;
|
||||
public string ProfileFile;
|
||||
|
||||
public EGameDifficulty Difficulty;
|
||||
public SAvatar Avatar;
|
||||
public EOffOn GuestProfile;
|
||||
public EOffOn Active;
|
||||
}
|
||||
|
||||
public struct SAvatar
|
||||
{
|
||||
public string FileName;
|
||||
public STexture Texture;
|
||||
|
||||
public SAvatar(int dummy)
|
||||
{
|
||||
FileName = String.Empty;
|
||||
Texture = new STexture(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public struct SPlayer
|
||||
{
|
||||
public int ProfileID;
|
||||
public string Name;
|
||||
public EGameDifficulty Difficulty;
|
||||
public double Points;
|
||||
public double PointsLineBonus;
|
||||
public double PointsGoldenNotes;
|
||||
public int NoteDiff;
|
||||
public int LineNr;
|
||||
public List<CLine> SingLine;
|
||||
public int CurrentLine;
|
||||
public int CurrentNote;
|
||||
|
||||
public int SongID;
|
||||
public bool Medley;
|
||||
public bool Duet;
|
||||
public bool ShortSong;
|
||||
public long DateTicks;
|
||||
public bool SongFinished;
|
||||
}
|
||||
|
||||
public struct SScores
|
||||
{
|
||||
public string Name;
|
||||
public int Score;
|
||||
public string Date;
|
||||
public EGameDifficulty Difficulty;
|
||||
public int LineNr;
|
||||
public int ID;
|
||||
}
|
||||
|
||||
public enum EGameMode
|
||||
{
|
||||
TR_GAMEMODE_NORMAL,
|
||||
TR_GAMEMODE_MEDLEY,
|
||||
TR_GAMEMODE_DUET,
|
||||
TR_GAMEMODE_SHORTSONG
|
||||
}
|
||||
|
||||
public enum EScreens
|
||||
{
|
||||
ScreenTest = 0,
|
||||
ScreenLoad = 1,
|
||||
ScreenMain = 2,
|
||||
ScreenSong = 3,
|
||||
ScreenOptions = 4,
|
||||
ScreenSing = 5,
|
||||
ScreenProfiles = 6,
|
||||
ScreenScore = 7,
|
||||
ScreenHighscore = 8,
|
||||
|
||||
ScreenOptionsGame = 9,
|
||||
ScreenOptionsSound = 10,
|
||||
ScreenOptionsRecord = 11,
|
||||
ScreenOptionsVideo = 12,
|
||||
ScreenOptionsLyrics = 13,
|
||||
ScreenOptionsTheme = 14,
|
||||
|
||||
ScreenNames = 15,
|
||||
ScreenCredits = 16,
|
||||
ScreenParty = 17,
|
||||
ScreenPartyDummy = 18,
|
||||
|
||||
ScreenNull = -1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
interface IMenuElement
|
||||
{
|
||||
string GetThemeName();
|
||||
|
||||
bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex);
|
||||
bool SaveTheme(XmlWriter writer);
|
||||
|
||||
void UnloadTextures();
|
||||
void LoadTextures();
|
||||
void ReloadTextures();
|
||||
|
||||
void MoveElement(int stepX, int stepY);
|
||||
void ResizeElement(int stepW, int stepH);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,766 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Vocaluxe.Menu;
|
||||
|
||||
namespace Vocaluxe.Menu.SingNotes
|
||||
{
|
||||
public class CNotes
|
||||
{
|
||||
private List<CLines> _Lines = new List<CLines>();
|
||||
|
||||
public CLines[] Lines
|
||||
{
|
||||
get { return _Lines.ToArray(); }
|
||||
}
|
||||
|
||||
public CNotes()
|
||||
{
|
||||
}
|
||||
|
||||
public CNotes(CNotes notes)
|
||||
{
|
||||
foreach (CLines lines in notes._Lines)
|
||||
{
|
||||
_Lines.Add(new CLines(lines));
|
||||
}
|
||||
}
|
||||
|
||||
public CLines GetLines(int Index)
|
||||
{
|
||||
while (Index >= _Lines.Count)
|
||||
{
|
||||
_Lines.Add(new CLines());
|
||||
}
|
||||
|
||||
return _Lines[Index];
|
||||
}
|
||||
|
||||
public int GetPoints(int Index)
|
||||
{
|
||||
if (Index >= _Lines.Count)
|
||||
return 0;
|
||||
|
||||
return _Lines[Index].Points;
|
||||
}
|
||||
|
||||
public int GetNumLinesWithPoints(int Index)
|
||||
{
|
||||
if (Index >= _Lines.Count)
|
||||
return 0;
|
||||
|
||||
return _Lines[Index].NumLinesWithPoints;
|
||||
}
|
||||
|
||||
public void AddLines(CLines Lines)
|
||||
{
|
||||
_Lines.Add(Lines);
|
||||
}
|
||||
|
||||
public bool ReplaceLinesAt(int Index, CLines Lines)
|
||||
{
|
||||
if (Index >= _Lines.Count)
|
||||
return false;
|
||||
|
||||
_Lines[Index] = Lines;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_Lines.Clear();
|
||||
}
|
||||
|
||||
public void SetMedley(int StartBeat, int EndBeat)
|
||||
{
|
||||
foreach (CLines lines in _Lines)
|
||||
{
|
||||
lines.SetMedley(StartBeat, EndBeat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CNote
|
||||
{
|
||||
private Basic _Base;
|
||||
private int _StartBeat;
|
||||
private int _Duration;
|
||||
private int _Tone;
|
||||
private ENoteType _NoteType;
|
||||
private string _Text;
|
||||
private bool _Hit; // for drawing player notes
|
||||
private bool _Perfect; // for drawing perfect note effect
|
||||
|
||||
#region Contructors
|
||||
public CNote(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
StartBeat = 0;
|
||||
Duration = 1;
|
||||
Tone = 0;
|
||||
NoteType = ENoteType.Normal;
|
||||
Text = String.Empty;
|
||||
_Hit = false;
|
||||
_Perfect = false;
|
||||
}
|
||||
|
||||
public CNote(CNote note)
|
||||
{
|
||||
_Base = note._Base;
|
||||
_StartBeat = note._StartBeat;
|
||||
_Duration = note._Duration;
|
||||
_Tone = note._Tone;
|
||||
_NoteType = note._NoteType;
|
||||
_Text = note._Text;
|
||||
_Hit = note._Hit;
|
||||
_Perfect = note._Perfect;
|
||||
}
|
||||
|
||||
public CNote(Basic Base, int StartBeat, int Duration, int Tone, string Text)
|
||||
: this(Base)
|
||||
{
|
||||
this.StartBeat = StartBeat;
|
||||
this.Duration = Duration;
|
||||
this.Tone = Tone;
|
||||
this.NoteType = ENoteType.Normal;
|
||||
this.Text = Text;
|
||||
}
|
||||
|
||||
public CNote(Basic Base, int StartBeat, int Duration, int Tone, string Text, bool Hit)
|
||||
: this(Base)
|
||||
{
|
||||
this.StartBeat = StartBeat;
|
||||
this.Duration = Duration;
|
||||
this.Tone = Tone;
|
||||
this.NoteType = ENoteType.Normal;
|
||||
this.Text = Text;
|
||||
this.Hit = Hit;
|
||||
}
|
||||
|
||||
public CNote(Basic Base, int StartBeat, int Duration, int Tone, string Text, ENoteType NoteType)
|
||||
: this(Base, StartBeat, Duration, Tone, Text)
|
||||
{
|
||||
this.NoteType = NoteType;
|
||||
}
|
||||
|
||||
public CNote(Basic Base, int StartBeat, int Duration, int Tone, string Text, bool Hit, ENoteType NoteType)
|
||||
: this(Base, StartBeat, Duration, Tone, Text)
|
||||
{
|
||||
this.NoteType = NoteType;
|
||||
this.Hit = Hit;
|
||||
}
|
||||
#endregion Constructors
|
||||
|
||||
#region Properties
|
||||
public bool Hit
|
||||
{
|
||||
get { return _Hit; }
|
||||
set { _Hit = value; }
|
||||
}
|
||||
|
||||
public bool Perfect
|
||||
{
|
||||
get { return _Perfect; }
|
||||
set { _Perfect = value; }
|
||||
}
|
||||
|
||||
public int StartBeat
|
||||
{
|
||||
get { return _StartBeat; }
|
||||
set { _StartBeat = value; }
|
||||
}
|
||||
|
||||
public int EndBeat
|
||||
{
|
||||
get
|
||||
{
|
||||
return _StartBeat + _Duration - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int Duration
|
||||
{
|
||||
get { return _Duration; }
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
_Duration = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Tone
|
||||
{
|
||||
get { return _Tone; }
|
||||
set
|
||||
{
|
||||
if ((value >= _Base.Settings.GetToneMin()) && (value <= _Base.Settings.GetToneMax()))
|
||||
_Tone = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ENoteType NoteType
|
||||
{
|
||||
get { return _NoteType; }
|
||||
set { _NoteType = value; }
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return _Text; }
|
||||
set { _Text = value; }
|
||||
}
|
||||
|
||||
public int Points
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (_NoteType)
|
||||
{
|
||||
case ENoteType.Normal:
|
||||
return _Duration;
|
||||
case ENoteType.Golden:
|
||||
return _Duration * 2;
|
||||
case ENoteType.Freestyle:
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int PointsForBeat
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (_NoteType)
|
||||
{
|
||||
case ENoteType.Normal:
|
||||
return 1;
|
||||
case ENoteType.Golden:
|
||||
return 2;
|
||||
case ENoteType.Freestyle:
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Methods
|
||||
public bool IsPerfect(CNote CompareNote)
|
||||
{
|
||||
bool Result = true;
|
||||
|
||||
if (!Hit)
|
||||
Result = false;
|
||||
|
||||
if (StartBeat != CompareNote.StartBeat)
|
||||
Result = false;
|
||||
|
||||
if (EndBeat != CompareNote.EndBeat)
|
||||
Result = false;
|
||||
|
||||
if (Tone != CompareNote.Tone)
|
||||
Result = false;
|
||||
|
||||
Perfect = Result;
|
||||
return Result;
|
||||
}
|
||||
#endregion Methods
|
||||
}
|
||||
|
||||
public class CLine
|
||||
{
|
||||
private int _StartBeat;
|
||||
private int _EndBeat;
|
||||
private bool _PerfectLine; // for drawing perfect line effect
|
||||
private bool _VisibleInTimeLine;
|
||||
|
||||
private int _MinBeat = int.MaxValue;
|
||||
private int _MaxBeat = int.MinValue;
|
||||
private List<CNote> _Notes = new List<CNote>();
|
||||
|
||||
#region Constructors
|
||||
public CLine()
|
||||
{
|
||||
StartBeat = int.MinValue;
|
||||
EndBeat = int.MaxValue;
|
||||
_PerfectLine = false;
|
||||
_VisibleInTimeLine = true;
|
||||
}
|
||||
|
||||
public CLine(CLine line)
|
||||
{
|
||||
foreach (CNote note in line._Notes)
|
||||
{
|
||||
_Notes.Add(new CNote(note));
|
||||
}
|
||||
_StartBeat = line._StartBeat;
|
||||
_EndBeat = line._EndBeat;
|
||||
_PerfectLine = line._PerfectLine;
|
||||
_MinBeat = line._MinBeat;
|
||||
_MaxBeat = line._MaxBeat;
|
||||
_VisibleInTimeLine = line._VisibleInTimeLine;
|
||||
}
|
||||
#endregion Constructors
|
||||
|
||||
#region Properties
|
||||
public bool VisibleInTimeLine
|
||||
{
|
||||
get { return _VisibleInTimeLine; }
|
||||
set { _VisibleInTimeLine = value; }
|
||||
}
|
||||
|
||||
public int StartBeat
|
||||
{
|
||||
get { return _StartBeat; }
|
||||
set
|
||||
{
|
||||
if (value <= _MinBeat)
|
||||
_StartBeat = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int EndBeat
|
||||
{
|
||||
get { return _EndBeat; }
|
||||
set
|
||||
{
|
||||
if (value >= _MaxBeat)
|
||||
_EndBeat = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool PerfectLine
|
||||
{
|
||||
get { return _PerfectLine; }
|
||||
set { _PerfectLine = value; }
|
||||
}
|
||||
|
||||
public int FirstNoteBeat
|
||||
{
|
||||
get
|
||||
{
|
||||
return _MinBeat;
|
||||
}
|
||||
}
|
||||
|
||||
public int LastNoteBeat
|
||||
{
|
||||
get
|
||||
{
|
||||
return _MaxBeat;
|
||||
}
|
||||
}
|
||||
|
||||
public string Lyrics
|
||||
{
|
||||
get
|
||||
{
|
||||
string lyrics = String.Empty;
|
||||
foreach (CNote note in _Notes)
|
||||
{
|
||||
lyrics += note.Text;
|
||||
}
|
||||
return lyrics;
|
||||
}
|
||||
}
|
||||
|
||||
public int NoteCount
|
||||
{
|
||||
get { return _Notes.Count; }
|
||||
}
|
||||
|
||||
public int Points
|
||||
{
|
||||
get
|
||||
{
|
||||
int points = 0;
|
||||
foreach (CNote note in _Notes)
|
||||
{
|
||||
points += note.Points;
|
||||
}
|
||||
return points;
|
||||
}
|
||||
}
|
||||
|
||||
public CNote[] Notes
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Notes.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public CNote FirstNote
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Notes.Count > 0)
|
||||
return _Notes[0];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public CNote LastNote
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Notes.Count > 0)
|
||||
return _Notes[_Notes.Count - 1];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int BaseLine
|
||||
{
|
||||
get
|
||||
{
|
||||
int Min = int.MaxValue;
|
||||
foreach (CNote note in _Notes)
|
||||
{
|
||||
if (note.Tone < Min)
|
||||
Min = note.Tone;
|
||||
}
|
||||
|
||||
int Max = int.MinValue;
|
||||
foreach (CNote note in _Notes)
|
||||
{
|
||||
if (note.Tone > Max)
|
||||
Max = note.Tone;
|
||||
}
|
||||
|
||||
return Min - (Max-Min)/4;
|
||||
}
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
#region Methods
|
||||
public bool IsPerfect(CLine CompareLine)
|
||||
{
|
||||
if (_Notes.Count == 0)
|
||||
return false;
|
||||
|
||||
if (_Notes.Count != CompareLine.NoteCount)
|
||||
return false;
|
||||
|
||||
if (CompareLine.Points == 0)
|
||||
return false;
|
||||
|
||||
_PerfectLine = (this.Points == CompareLine.Points);
|
||||
return _PerfectLine;
|
||||
}
|
||||
|
||||
public void AddNote(CNote Note)
|
||||
{
|
||||
_Notes.Add(Note);
|
||||
updateMinMaxBeat(Note);
|
||||
}
|
||||
|
||||
public bool InsertNote(CNote Note, int Index)
|
||||
{
|
||||
if (_Notes.Count >= Index)
|
||||
{
|
||||
_Notes.Insert(Index, Note);
|
||||
updateMinMaxBeat(Note);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool DeleteNote(int Index)
|
||||
{
|
||||
if (_Notes.Count > Index)
|
||||
{
|
||||
_Notes.RemoveAt(Index);
|
||||
updateMinMaxBeat();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ReplaceNote(int Index, CNote Note)
|
||||
{
|
||||
if (_Notes.Count > Index)
|
||||
{
|
||||
_Notes.RemoveAt(Index);
|
||||
_Notes.Insert(Index, Note);
|
||||
updateMinMaxBeat();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IncLastNoteLength()
|
||||
{
|
||||
if (_Notes.Count > 0)
|
||||
{
|
||||
_Notes[_Notes.Count - 1].Duration++;
|
||||
updateMinMaxBeat();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void DeleteAllNotes()
|
||||
{
|
||||
_Notes.Clear();
|
||||
_MinBeat = int.MaxValue;
|
||||
_MaxBeat = int.MinValue;
|
||||
}
|
||||
|
||||
public void SetMedley(int StartBeat, int EndBeat)
|
||||
{
|
||||
foreach (CNote note in _Notes)
|
||||
{
|
||||
if (note.StartBeat < StartBeat || note.EndBeat > EndBeat)
|
||||
note.NoteType = ENoteType.Freestyle;
|
||||
}
|
||||
|
||||
_VisibleInTimeLine = _MinBeat >= StartBeat && _MaxBeat <= EndBeat;
|
||||
}
|
||||
|
||||
private void updateMinMaxBeat(CNote Note)
|
||||
{
|
||||
if (Note.StartBeat < _MinBeat)
|
||||
{
|
||||
_MinBeat = Note.StartBeat;
|
||||
}
|
||||
|
||||
if (Note.EndBeat > _MaxBeat)
|
||||
{
|
||||
_MaxBeat = Note.EndBeat;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMinMaxBeat()
|
||||
{
|
||||
_MinBeat = int.MaxValue;
|
||||
_MaxBeat = int.MinValue;
|
||||
foreach (CNote note in _Notes)
|
||||
{
|
||||
updateMinMaxBeat(note);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
|
||||
public class CLines
|
||||
{
|
||||
private List<CLine> _Lines = new List<CLine>();
|
||||
|
||||
public CLines()
|
||||
{
|
||||
}
|
||||
|
||||
public CLines(CLines lines)
|
||||
{
|
||||
foreach (CLine line in lines._Lines)
|
||||
{
|
||||
_Lines.Add(new CLine(line));
|
||||
}
|
||||
}
|
||||
|
||||
public CLine[] Line
|
||||
{
|
||||
get { return _Lines.ToArray(); }
|
||||
}
|
||||
public int LineCount
|
||||
{
|
||||
get { return _Lines.Count; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Total song length in beats
|
||||
/// </summary>
|
||||
public int Length
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Lines.Count == 0)
|
||||
return 0;
|
||||
|
||||
int startbeat = int.MaxValue;
|
||||
for (int i = 0; i < _Lines.Count; i++)
|
||||
{
|
||||
if (_Lines[i].FirstNoteBeat < startbeat)
|
||||
startbeat = _Lines[i].FirstNoteBeat;
|
||||
}
|
||||
|
||||
int endbeat = int.MinValue;
|
||||
for (int i = 0; i < _Lines.Count; i++)
|
||||
{
|
||||
if (_Lines[i].LastNoteBeat < endbeat)
|
||||
endbeat = _Lines[i].LastNoteBeat;
|
||||
}
|
||||
|
||||
int result = endbeat - startbeat;
|
||||
if (result > 0)
|
||||
return result;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int Points
|
||||
{
|
||||
get
|
||||
{
|
||||
int points = 0;
|
||||
foreach (CLine line in _Lines)
|
||||
{
|
||||
points += line.Points;
|
||||
}
|
||||
return points;
|
||||
}
|
||||
}
|
||||
|
||||
public int NumLinesWithPoints
|
||||
{
|
||||
get
|
||||
{
|
||||
int num = 0;
|
||||
foreach (CLine line in _Lines)
|
||||
{
|
||||
if (line.Points > 0f)
|
||||
num++;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
#region Methods
|
||||
public void AddLine(CLine Line)
|
||||
{
|
||||
AddLine(Line, true);
|
||||
}
|
||||
public void AddLine(CLine Line, bool updateTimings)
|
||||
{
|
||||
_Lines.Add(Line);
|
||||
if (updateTimings)
|
||||
{
|
||||
UpdateTimings();
|
||||
}
|
||||
}
|
||||
|
||||
public bool InsertLine(CLine Line, int Index)
|
||||
{
|
||||
if (_Lines.Count >= Index)
|
||||
{
|
||||
_Lines.Insert(Index, Line);
|
||||
UpdateTimings();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool DeleteLine(int Index)
|
||||
{
|
||||
if (_Lines.Count > Index)
|
||||
{
|
||||
_Lines.RemoveAt(Index);
|
||||
UpdateTimings();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void DeleteAllLines()
|
||||
{
|
||||
_Lines.Clear();
|
||||
}
|
||||
|
||||
public bool AddNote(CNote Note, int LineIndex, bool updateTimings)
|
||||
{
|
||||
if (_Lines.Count > LineIndex)
|
||||
{
|
||||
_Lines[LineIndex].AddNote(Note);
|
||||
if (updateTimings)
|
||||
{
|
||||
UpdateTimings();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool AddNote(CNote Note, int LineIndex)
|
||||
{
|
||||
return AddNote(Note, LineIndex, true);
|
||||
}
|
||||
|
||||
public bool InsertNote(CNote Note, int LineIndex, int NoteIndex)
|
||||
{
|
||||
if (_Lines.Count > LineIndex)
|
||||
{
|
||||
bool res = _Lines[LineIndex].InsertNote(Note, NoteIndex);
|
||||
UpdateTimings();
|
||||
return res;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void UpdateTimings()
|
||||
{
|
||||
CNote LastNote, FirstNote;
|
||||
int min, max, s;
|
||||
|
||||
if (_Lines.Count > 0)
|
||||
{
|
||||
_Lines[0].StartBeat = -10000;
|
||||
}
|
||||
|
||||
for (int i = 1; i < _Lines.Count; i++)
|
||||
{
|
||||
LastNote = _Lines[i - 1].LastNote;
|
||||
FirstNote = _Lines[i].FirstNote;
|
||||
|
||||
if ((LastNote != null) && (FirstNote != null))
|
||||
{
|
||||
min = LastNote.EndBeat;
|
||||
max = FirstNote.StartBeat;
|
||||
|
||||
s = 0;
|
||||
switch (max - min)
|
||||
{
|
||||
case 0:
|
||||
s = max;
|
||||
break;
|
||||
case 1:
|
||||
s = max;
|
||||
break;
|
||||
case 2:
|
||||
s = max - 1;
|
||||
break;
|
||||
case 3:
|
||||
s = max - 2;
|
||||
break;
|
||||
default:
|
||||
s = min + 2;
|
||||
break;
|
||||
}
|
||||
|
||||
_Lines[i].StartBeat = s;
|
||||
_Lines[i - 1].EndBeat = min;
|
||||
}
|
||||
}
|
||||
|
||||
LastNote = _Lines[_Lines.Count - 1].LastNote;
|
||||
if (LastNote != null)
|
||||
{
|
||||
_Lines[_Lines.Count - 1].EndBeat = LastNote.EndBeat;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMedley(int StartBeat, int EndBeat)
|
||||
{
|
||||
foreach (CLine line in _Lines)
|
||||
{
|
||||
line.SetMedley(StartBeat, EndBeat);
|
||||
}
|
||||
}
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,763 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu.SingNotes
|
||||
{
|
||||
struct SPlayerNotes
|
||||
{
|
||||
public int ID;
|
||||
public int PlayerNr;
|
||||
public SRectF Rect;
|
||||
public SColorF Color;
|
||||
public float Alpha;
|
||||
public CLine[] Lines;
|
||||
public int LineNr;
|
||||
public Stopwatch Timer;
|
||||
public List<CParticleEffect> GoldenStars;
|
||||
public List<CParticleEffect> Flares;
|
||||
public List<CParticleEffect> PerfectNoteEffect;
|
||||
public List<CParticleEffect> PerfectLineTwinkle;
|
||||
}
|
||||
|
||||
struct SThemeSingBar
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string SkinLeftName;
|
||||
public string SkinMiddleName;
|
||||
public string SkinRightName;
|
||||
|
||||
public string SkinBackgroundLeftName;
|
||||
public string SkinBackgroundMiddleName;
|
||||
public string SkinBackgroundRightName;
|
||||
|
||||
public string SkinGoldenStarName;
|
||||
public string SkinToneHelperName;
|
||||
public string SkinPerfectNoteStarName;
|
||||
}
|
||||
|
||||
public abstract class CSingNotes : ISingNotes, IMenuElement
|
||||
{
|
||||
private Basic _Base;
|
||||
private SThemeSingBar _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
private List<SPlayerNotes> _PlayerNotes;
|
||||
private int _ActID;
|
||||
|
||||
private SRectF[,] _BarPos;
|
||||
|
||||
/// <summary>
|
||||
/// Player bar positions
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// first index = player number; second index = num players seen on screen
|
||||
/// </remarks>
|
||||
public SRectF[,] BarPos
|
||||
{
|
||||
get { return _BarPos; }
|
||||
set { _BarPos = value; }
|
||||
}
|
||||
|
||||
public CSingNotes(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeSingBar();
|
||||
_ThemeLoaded = false;
|
||||
|
||||
_PlayerNotes = new List<SPlayerNotes>();
|
||||
_ActID = 0;
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinLeft", navigator, ref _Theme.SkinLeftName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinMiddle", navigator, ref _Theme.SkinMiddleName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinRight", navigator, ref _Theme.SkinRightName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinBackgroundLeft", navigator, ref _Theme.SkinBackgroundLeftName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinBackgroundMiddle", navigator, ref _Theme.SkinBackgroundMiddleName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinBackgroundRight", navigator, ref _Theme.SkinBackgroundRightName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinGoldenStar", navigator, ref _Theme.SkinGoldenStarName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinToneHelper", navigator, ref _Theme.SkinToneHelperName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinPerfectNoteStar", navigator, ref _Theme.SkinPerfectNoteStarName, String.Empty);
|
||||
|
||||
_BarPos = new SRectF[_Base.Settings.GetMaxNumPlayer(), _Base.Settings.GetMaxNumPlayer()];
|
||||
for (int numplayer = 0; numplayer < _Base.Settings.GetMaxNumPlayer(); numplayer++)
|
||||
{
|
||||
for (int player = 0; player < _Base.Settings.GetMaxNumPlayer(); player++)
|
||||
{
|
||||
if (player <= numplayer)
|
||||
{
|
||||
_BarPos[player, numplayer] = new SRectF();
|
||||
string target = "/BarPositions/P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString();
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + target + "X", navigator, ref _BarPos[player, numplayer].X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + target + "Y", navigator, ref _BarPos[player, numplayer].Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + target + "Z", navigator, ref _BarPos[player, numplayer].Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + target + "W", navigator, ref _BarPos[player, numplayer].W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + target + "H", navigator, ref _BarPos[player, numplayer].H);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
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 < _Base.Settings.GetMaxNumPlayer(); numplayer++)
|
||||
{
|
||||
for (int player = 0; player < _Base.Settings.GetMaxNumPlayer(); player++)
|
||||
{
|
||||
if (player <= numplayer)
|
||||
{
|
||||
string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString();
|
||||
|
||||
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 virtual void Reset()
|
||||
{
|
||||
_PlayerNotes.Clear();
|
||||
_ActID = 0;
|
||||
}
|
||||
|
||||
public virtual int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr)
|
||||
{
|
||||
SPlayerNotes notes = new SPlayerNotes();
|
||||
|
||||
notes.Rect = Rect;
|
||||
notes.Color = Color;
|
||||
notes.Alpha = 1f;
|
||||
notes.ID = ++_ActID;
|
||||
notes.Lines = null;
|
||||
notes.LineNr = -1;
|
||||
notes.PlayerNr = PlayerNr;
|
||||
notes.Timer = new Stopwatch();
|
||||
notes.GoldenStars = new List<CParticleEffect>();
|
||||
notes.Flares = new List<CParticleEffect>();
|
||||
notes.PerfectNoteEffect = new List<CParticleEffect>();
|
||||
notes.PerfectLineTwinkle = new List<CParticleEffect>();
|
||||
_PlayerNotes.Add(notes);
|
||||
|
||||
return notes.ID;
|
||||
}
|
||||
|
||||
public virtual void RemovePlayer(int ID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void AddLine(int ID, CLine[] Line, int LineNr, int Player)
|
||||
{
|
||||
if (Line == null)
|
||||
return;
|
||||
|
||||
int n = FindPlayerLine(ID);
|
||||
if (n == -1)
|
||||
return;
|
||||
|
||||
if (LineNr == _PlayerNotes[n].LineNr)
|
||||
return;
|
||||
|
||||
SPlayerNotes notes = _PlayerNotes[n];
|
||||
|
||||
if (Line.Length == 0 || Line.Length <= LineNr)
|
||||
return;
|
||||
|
||||
notes.Lines = Line;
|
||||
notes.LineNr = LineNr;
|
||||
notes.GoldenStars.Clear();
|
||||
notes.Flares.Clear();
|
||||
notes.PerfectNoteEffect.Clear();
|
||||
|
||||
_PlayerNotes.RemoveAt(n);
|
||||
_PlayerNotes.Add(notes);
|
||||
}
|
||||
|
||||
public virtual void RemoveLine(int ID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void AddNote(int ID, CNote Note)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void SetAlpha(int ID, float Alpha)
|
||||
{
|
||||
int n = FindPlayerLine(ID);
|
||||
if (n == -1)
|
||||
return;
|
||||
|
||||
SPlayerNotes pn = _PlayerNotes[n];
|
||||
pn.Alpha = Alpha;
|
||||
_PlayerNotes[n] = pn;
|
||||
}
|
||||
|
||||
public virtual float GetAlpha(int ID)
|
||||
{
|
||||
int n = FindPlayerLine(ID);
|
||||
if (n == -1)
|
||||
return 0f;
|
||||
|
||||
return _PlayerNotes[n].Alpha;
|
||||
}
|
||||
|
||||
public virtual void Draw(int ID, int Player)
|
||||
{
|
||||
Draw(ID, null, Player);
|
||||
}
|
||||
|
||||
public virtual void Draw(int ID, List<CLine> SingLine, int Player)
|
||||
{
|
||||
int n = FindPlayerLine(ID);
|
||||
if (n == -1)
|
||||
return;
|
||||
|
||||
if (_PlayerNotes[n].LineNr == -1)
|
||||
return;
|
||||
|
||||
if (_PlayerNotes[n].Lines == null)
|
||||
return;
|
||||
|
||||
if (_PlayerNotes[n].Lines.Length <= _PlayerNotes[n].LineNr)
|
||||
return;
|
||||
|
||||
CLine Line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr];
|
||||
|
||||
if (_Base.Config.GetDrawNoteLines() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
DrawNoteLines(_PlayerNotes[n].Rect, new SColorF(0.5f, 0.5f, 0.5f, 0.5f * _PlayerNotes[n].Alpha));
|
||||
}
|
||||
|
||||
if (Line.NoteCount == 0)
|
||||
return;
|
||||
|
||||
float w = _PlayerNotes[n].Rect.W;
|
||||
float h = _PlayerNotes[n].Rect.H;
|
||||
float dh = h / _Base.Settings.GetNumNoteLines() * (2f - (int)_Base.Game.GetPlayer()[_PlayerNotes[n].PlayerNr].Difficulty) / 4f;
|
||||
|
||||
float beats = Line.LastNoteBeat - Line.FirstNoteBeat + 1;
|
||||
|
||||
if (beats == 0)
|
||||
return;
|
||||
|
||||
SColorF color = new SColorF(
|
||||
_PlayerNotes[n].Color.R,
|
||||
_PlayerNotes[n].Color.G,
|
||||
_PlayerNotes[n].Color.B,
|
||||
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
|
||||
|
||||
float BaseLine = Line.BaseLine;
|
||||
int Nr = 1;
|
||||
foreach (CNote note in Line.Notes)
|
||||
{
|
||||
if (note.NoteType != ENoteType.Freestyle)
|
||||
{
|
||||
float width = note.Duration / beats * w;
|
||||
|
||||
SRectF rect = new SRectF(
|
||||
_PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w,
|
||||
_PlayerNotes[n].Rect.Y + (_Base.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine)/2) / _Base.Settings.GetNumNoteLines() * h - dh,
|
||||
width,
|
||||
h / _Base.Settings.GetNumNoteLines() + 2 * dh,
|
||||
_PlayerNotes[n].Rect.Z
|
||||
);
|
||||
|
||||
DrawNoteBG(rect, color, 1f, _PlayerNotes[n].Timer);
|
||||
DrawNote(rect, new SColorF(5f, 5f, 5f, 0.7f * _PlayerNotes[n].Alpha), 0.7f);
|
||||
|
||||
if (note.NoteType == ENoteType.Golden)
|
||||
{
|
||||
AddGoldenNote(rect, n, Nr);
|
||||
Nr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_Base.Config.GetDrawToneHelper() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
DrawToneHelper(n, (int)BaseLine, (_Base.Game.GetMidBeatD() - Line.FirstNoteBeat) / beats * w);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
while (i < _PlayerNotes[n].PerfectLineTwinkle.Count)
|
||||
{
|
||||
_PlayerNotes[n].PerfectLineTwinkle[i].Update();
|
||||
if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive)
|
||||
{
|
||||
_PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
|
||||
foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
|
||||
{
|
||||
perfline.Draw();
|
||||
}
|
||||
|
||||
if (SingLine == null || SingLine.Count == 0 || _Base.Game.GetPlayer()[Player].CurrentLine == -1 || SingLine.Count <= _Base.Game.GetPlayer()[Player].CurrentLine)
|
||||
{
|
||||
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
|
||||
{
|
||||
stars.Update();
|
||||
stars.Alpha = _PlayerNotes[n].Alpha;
|
||||
stars.Draw();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (CNote note in SingLine[_Base.Game.GetPlayer()[Player].CurrentLine].Notes)
|
||||
{
|
||||
if (note.StartBeat >= Line.FirstNoteBeat && note.EndBeat <= Line.LastNoteBeat)
|
||||
{
|
||||
float width = note.Duration / beats * w;
|
||||
|
||||
if (note.EndBeat == _Base.Game.GetCurrentBeatD())
|
||||
width -= (1 - (_Base.Game.GetMidBeatD() - _Base.Game.GetCurrentBeatD())) / beats * w;
|
||||
|
||||
SRectF rect = new SRectF(
|
||||
_PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w,
|
||||
_PlayerNotes[n].Rect.Y + (_Base.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine)/2) / _Base.Settings.GetNumNoteLines() * h - dh,
|
||||
width,
|
||||
h / _Base.Settings.GetNumNoteLines() + 2 * dh,
|
||||
_PlayerNotes[n].Rect.Z
|
||||
);
|
||||
|
||||
float f = 0.7f;
|
||||
if (!note.Hit)
|
||||
f = 0.4f;
|
||||
|
||||
DrawNote(rect, color, f);
|
||||
|
||||
if (note.EndBeat >= _Base.Game.GetCurrentBeatD() && note.Hit && note.NoteType == ENoteType.Golden)
|
||||
{
|
||||
SRectF re = new SRectF(rect);
|
||||
re.W = (_Base.Game.GetMidBeatD() - note.StartBeat) / beats * w;
|
||||
AddFlare(re, n);
|
||||
}
|
||||
|
||||
if (note.Perfect && note.EndBeat < _Base.Game.GetCurrentBeatD())
|
||||
{
|
||||
AddPerfectNote(rect, n);
|
||||
note.Perfect = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int currentLine = _Base.Game.GetPlayer()[Player].SingLine.Count - 1;
|
||||
if (currentLine > 0)
|
||||
{
|
||||
if (_Base.Game.GetPlayer()[Player].SingLine[currentLine - 1].PerfectLine)
|
||||
{
|
||||
AddPerfectLine(n);
|
||||
_Base.Game.GetPlayer()[Player].SingLine[currentLine - 1].PerfectLine = false;
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < _PlayerNotes[n].Flares.Count)
|
||||
{
|
||||
_PlayerNotes[n].Flares[i].Update();
|
||||
if (!_PlayerNotes[n].Flares[i].IsAlive)
|
||||
{
|
||||
_PlayerNotes[n].Flares.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < _PlayerNotes[n].PerfectNoteEffect.Count)
|
||||
{
|
||||
_PlayerNotes[n].PerfectNoteEffect[i].Update();
|
||||
if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive)
|
||||
{
|
||||
_PlayerNotes[n].PerfectNoteEffect.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
|
||||
{
|
||||
stars.Update();
|
||||
stars.Alpha = _PlayerNotes[n].Alpha;
|
||||
stars.Draw();
|
||||
}
|
||||
|
||||
foreach (CParticleEffect flare in _PlayerNotes[n].Flares)
|
||||
{
|
||||
flare.Draw();
|
||||
}
|
||||
|
||||
foreach (CParticleEffect perfnote in _PlayerNotes[n].PerfectNoteEffect)
|
||||
{
|
||||
perfnote.Draw();
|
||||
}
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
private int FindPlayerLine(int ID)
|
||||
{
|
||||
if (ID < 0 || ID > _PlayerNotes.Count)
|
||||
return -1;
|
||||
|
||||
int n = -1;
|
||||
for (int i = 0; i < _PlayerNotes.Count; i++)
|
||||
{
|
||||
if (_PlayerNotes[i].ID == ID)
|
||||
{
|
||||
n = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
private void DrawNote(SRectF Rect, SColorF Color)
|
||||
{
|
||||
DrawNote(Rect, Color, 1f);
|
||||
}
|
||||
|
||||
private void DrawNote(SRectF Rect, SColorF Color, float factor)
|
||||
{
|
||||
const int spacing = 0;
|
||||
|
||||
float d = (1f - factor) / 2 * Rect.H;
|
||||
float dw = d;
|
||||
|
||||
if (2 * dw > Rect.W)
|
||||
dw = Rect.W / 2;
|
||||
|
||||
SRectF r = new SRectF(
|
||||
Rect.X + dw + spacing,
|
||||
Rect.Y + d + spacing,
|
||||
Rect.W - 2 * dw - 2 * spacing,
|
||||
Rect.H - 2 * d - 2 * spacing,
|
||||
Rect.Z
|
||||
);
|
||||
|
||||
STexture NoteBegin = _Base.Theme.GetSkinTexture(_Theme.SkinLeftName);
|
||||
STexture NoteMiddle = _Base.Theme.GetSkinTexture(_Theme.SkinMiddleName);
|
||||
STexture NoteEnd = _Base.Theme.GetSkinTexture(_Theme.SkinRightName);
|
||||
|
||||
float dx = NoteBegin.width * r.H / NoteBegin.height;
|
||||
if (2 * dx > r.W)
|
||||
dx = r.W / 2;
|
||||
|
||||
|
||||
_Base.Drawing.DrawTexture(NoteBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), Color);
|
||||
_Base.Drawing.DrawTexture(NoteMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), Color);
|
||||
_Base.Drawing.DrawTexture(NoteEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), Color);
|
||||
}
|
||||
|
||||
private void DrawNoteBG(SRectF Rect, SColorF Color, float factor, Stopwatch Timer)
|
||||
{
|
||||
const int spacing = 0;
|
||||
const float period = 1.5f; //[s]
|
||||
|
||||
if (!Timer.IsRunning)
|
||||
Timer.Start();
|
||||
|
||||
if (Timer.ElapsedMilliseconds / 1000f > period)
|
||||
{
|
||||
Timer.Reset();
|
||||
Timer.Start();
|
||||
}
|
||||
|
||||
float alpha = (float)((Math.Cos((Timer.ElapsedMilliseconds / 1000f) / period * Math.PI * 2) + 1) / 2.0) / 2f + 0.5f;
|
||||
float d = (1f - factor) / 2 * Rect.H;
|
||||
float dw = d;
|
||||
if (2 * dw > Rect.W)
|
||||
dw = Rect.W / 2;
|
||||
|
||||
SRectF r = new SRectF(
|
||||
Rect.X + dw + spacing,
|
||||
Rect.Y + d + spacing,
|
||||
Rect.W - 2 * dw - 2 * spacing,
|
||||
Rect.H - 2 * d - 2 * spacing,
|
||||
Rect.Z
|
||||
);
|
||||
|
||||
STexture NoteBackgroundBegin = _Base.Theme.GetSkinTexture(_Theme.SkinBackgroundLeftName);
|
||||
STexture NoteBackgroundMiddle = _Base.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName);
|
||||
STexture NoteBackgroundEnd = _Base.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName);
|
||||
|
||||
float dx = NoteBackgroundBegin.width * r.H / NoteBackgroundBegin.height;
|
||||
if (2 * dx > r.W)
|
||||
dx = r.W / 2;
|
||||
|
||||
SColorF col = new SColorF(Color.R, Color.G, Color.B, Color.A * alpha);
|
||||
|
||||
_Base.Drawing.DrawTexture(NoteBackgroundBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), col);
|
||||
_Base.Drawing.DrawTexture(NoteBackgroundMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), col);
|
||||
_Base.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)
|
||||
{
|
||||
for (int i = 0; i < _Base.Settings.GetNumNoteLines() - 1; i++)
|
||||
{
|
||||
float y = Rect.Y + Rect.H / _Base.Settings.GetNumNoteLines() * (i + 1);
|
||||
_Base.Drawing.DrawColor(Color, new SRectF(Rect.X, y, Rect.W, 1, -1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddGoldenNote(SRectF Rect, int n, int Nr)
|
||||
{
|
||||
AddGoldenNote(Rect, n, Nr, 1f);
|
||||
}
|
||||
|
||||
private void AddGoldenNote(SRectF Rect, int n, int Nr, float factor)
|
||||
{
|
||||
const int spacing = 0;
|
||||
|
||||
if ( Nr > _PlayerNotes[n].GoldenStars.Count)
|
||||
{
|
||||
float d = (1f - factor) / 2 * Rect.H;
|
||||
float dw = d;
|
||||
|
||||
if (2 * dw > Rect.W)
|
||||
dw = Rect.W / 2;
|
||||
|
||||
SRectF r = new SRectF(
|
||||
Rect.X + dw + spacing,
|
||||
Rect.Y + d + spacing,
|
||||
Rect.W - 2 * dw - 2 * spacing,
|
||||
Rect.H - 2 * d - 2 * spacing,
|
||||
Rect.Z
|
||||
);
|
||||
|
||||
int numstars = (int)(r.W * 0.25f);
|
||||
CParticleEffect stars = new CParticleEffect(_Base, numstars, new SColorF(1f, 1f, 0f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticeType.Star);
|
||||
_PlayerNotes[n].GoldenStars.Add(stars);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddFlare(SRectF Rect, int n)
|
||||
{
|
||||
AddFlare(Rect, n, 1f);
|
||||
}
|
||||
|
||||
private void AddFlare(SRectF Rect, int n, float factor)
|
||||
{
|
||||
const int spacing = 0;
|
||||
|
||||
float d = (1f - factor) / 2 * Rect.H;
|
||||
float dw = d;
|
||||
|
||||
if (2 * dw > Rect.W)
|
||||
dw = Rect.W / 2;
|
||||
|
||||
SRectF r = new SRectF(
|
||||
Rect.X + dw + spacing + Rect.W - 2 * dw - 2 * spacing,
|
||||
Rect.Y + d + spacing,
|
||||
0f,
|
||||
Rect.H - 2 * d - 2 * spacing,
|
||||
Rect.Z
|
||||
);
|
||||
|
||||
CParticleEffect flares = new CParticleEffect(_Base, 15, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticeType.Flare);
|
||||
_PlayerNotes[n].Flares.Add(flares);
|
||||
}
|
||||
|
||||
private void AddPerfectNote(SRectF Rect, int n)
|
||||
{
|
||||
AddPerfectNote(Rect, n, 1f);
|
||||
}
|
||||
|
||||
private void AddPerfectNote(SRectF Rect, int n, float factor)
|
||||
{
|
||||
const int spacing = 0;
|
||||
|
||||
float d = (1f - factor) / 2 * Rect.H;
|
||||
float dw = d;
|
||||
|
||||
if (2 * dw > Rect.W)
|
||||
dw = Rect.W / 2;
|
||||
|
||||
SRectF r = new SRectF(
|
||||
Rect.X + dw + spacing,
|
||||
Rect.Y + d + spacing,
|
||||
Rect.W - 2 * dw - 2 * spacing,
|
||||
Rect.H - 2 * d - 2 * spacing,
|
||||
Rect.Z
|
||||
);
|
||||
|
||||
STexture NoteBegin = _Base.Theme.GetSkinTexture(_Theme.SkinLeftName);
|
||||
float dx = NoteBegin.width * r.H / NoteBegin.height;
|
||||
if (2 * dx > r.W)
|
||||
dx = r.W / 2;
|
||||
|
||||
r = new SRectF(
|
||||
r.X + r.W - dx,
|
||||
r.Y,
|
||||
dx * 0.5f,
|
||||
dx * 0.2f,
|
||||
Rect.Z
|
||||
);
|
||||
|
||||
CParticleEffect stars = new CParticleEffect(_Base, _Base.Game.GetRandom(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35, EParticeType.PerfNoteStar);
|
||||
_PlayerNotes[n].PerfectNoteEffect.Add(stars);
|
||||
}
|
||||
|
||||
private void AddPerfectLine(int n)
|
||||
{
|
||||
CParticleEffect twinkle = new CParticleEffect(_Base, 200, _PlayerNotes[n].Color, _PlayerNotes[n].Rect, _Theme.SkinGoldenStarName, 25, EParticeType.Twinkle);
|
||||
_PlayerNotes[n].PerfectLineTwinkle.Add(twinkle);
|
||||
}
|
||||
|
||||
private void DrawToneHelper(int n, int BaseLine, float XOffset)
|
||||
{
|
||||
int TonePlayer = _Base.Record.GetToneAbs(_PlayerNotes[n].PlayerNr);
|
||||
|
||||
SRectF Rect = _PlayerNotes[n].Rect;
|
||||
|
||||
while (TonePlayer - BaseLine < 0)
|
||||
TonePlayer += 12;
|
||||
|
||||
while (TonePlayer - BaseLine > 12)
|
||||
TonePlayer -= 12;
|
||||
|
||||
if (XOffset < 0f)
|
||||
XOffset = 0f;
|
||||
|
||||
if (XOffset > Rect.W)
|
||||
XOffset = Rect.W;
|
||||
|
||||
float dy = Rect.H / (_Base.Settings.GetNumNoteLines());
|
||||
SRectF rect = new SRectF(
|
||||
Rect.X - dy + XOffset,
|
||||
Rect.Y + dy * (_Base.Settings.GetNumNoteLines() - 1 - (TonePlayer - BaseLine) / 2f),
|
||||
dy,
|
||||
dy,
|
||||
Rect.Z
|
||||
);
|
||||
|
||||
SColorF color = new SColorF(
|
||||
_PlayerNotes[n].Color.R,
|
||||
_PlayerNotes[n].Color.G,
|
||||
_PlayerNotes[n].Color.B,
|
||||
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
|
||||
|
||||
STexture ToneHelper = _Base.Theme.GetSkinTexture(_Theme.SkinToneHelperName);
|
||||
_Base.Drawing.DrawTexture(ToneHelper, rect, color);
|
||||
|
||||
|
||||
while (TonePlayer - BaseLine < 12)
|
||||
TonePlayer += 12;
|
||||
|
||||
while (TonePlayer - BaseLine > 24)
|
||||
TonePlayer -= 12;
|
||||
|
||||
rect = new SRectF(
|
||||
Rect.X - dy + XOffset,
|
||||
Rect.Y + dy * (_Base.Settings.GetNumNoteLines() - 1 - (TonePlayer - BaseLine) / 2f),
|
||||
dy,
|
||||
dy,
|
||||
Rect.Z
|
||||
);
|
||||
|
||||
_Base.Drawing.DrawTexture(ToneHelper, rect, color);
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu.SingNotes
|
||||
{
|
||||
class CSingNotesClassic : CSingNotes
|
||||
{
|
||||
private Basic _Base;
|
||||
|
||||
public CSingNotesClassic(Basic Base)
|
||||
: base(Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu.SingNotes
|
||||
{
|
||||
interface ISingNotes
|
||||
{
|
||||
void Reset();
|
||||
int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr);
|
||||
void RemovePlayer(int ID);
|
||||
|
||||
|
||||
void AddLine(int ID, CLine[] Line, int LineNr, int Player);
|
||||
void RemoveLine(int ID);
|
||||
|
||||
void AddNote(int ID, CNote Note);
|
||||
|
||||
void SetAlpha(int ID, float Alpha);
|
||||
float GetAlpha(int ID);
|
||||
|
||||
void Draw(int ID, int Player);
|
||||
void Draw(int ID, List<CLine> SingLine, int Player);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,232 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
using Vocaluxe.Menu;
|
||||
using Vocaluxe.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
public class CSongMenu : ISongMenu
|
||||
{
|
||||
private Basic _Base;
|
||||
|
||||
private ISongMenu _SongMenu;
|
||||
private ESongMenu _Type;
|
||||
|
||||
public CSongMenu(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
CreateSongMenu();
|
||||
}
|
||||
|
||||
public void UpdateSongMenuType()
|
||||
{
|
||||
if (_Type != _Base.Config.GetSongMenuType())
|
||||
CreateSongMenu();
|
||||
}
|
||||
|
||||
public bool Selected
|
||||
{
|
||||
get { return _SongMenu.IsSelected(); }
|
||||
set { _SongMenu.SetSelected(value); }
|
||||
}
|
||||
|
||||
public bool Visible
|
||||
{
|
||||
get { return _SongMenu.IsVisible(); }
|
||||
set { _SongMenu.SetVisible(value); }
|
||||
}
|
||||
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return _SongMenu.GetRect(); }
|
||||
}
|
||||
|
||||
#region ISongMenu
|
||||
public void Update()
|
||||
{
|
||||
_SongMenu.Update();
|
||||
}
|
||||
|
||||
public void OnShow()
|
||||
{
|
||||
_SongMenu.OnShow();
|
||||
}
|
||||
|
||||
public void OnHide()
|
||||
{
|
||||
_SongMenu.OnHide();
|
||||
}
|
||||
|
||||
public void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
_SongMenu.HandleInput(ref KeyEvent, SongOptions);
|
||||
}
|
||||
|
||||
public void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
_SongMenu.HandleMouse(ref MouseEvent, SongOptions);
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
_SongMenu.Draw();
|
||||
}
|
||||
|
||||
public void ApplyVolume(float VolumeMax)
|
||||
{
|
||||
_SongMenu.ApplyVolume(VolumeMax);
|
||||
}
|
||||
|
||||
public bool IsActive()
|
||||
{
|
||||
return _SongMenu.IsActive();
|
||||
}
|
||||
|
||||
public void SetActive(bool Active)
|
||||
{
|
||||
_SongMenu.SetActive(Active);
|
||||
}
|
||||
|
||||
public int GetSelectedSong()
|
||||
{
|
||||
return _SongMenu.GetSelectedSong();
|
||||
}
|
||||
|
||||
public CStatic GetSelectedSongCover()
|
||||
{
|
||||
return _SongMenu.GetSelectedSongCover();
|
||||
}
|
||||
|
||||
public void SetSelectedSong(int VisibleSongNr)
|
||||
{
|
||||
_SongMenu.SetSelectedSong(VisibleSongNr);
|
||||
}
|
||||
|
||||
public int GetSelectedCategory()
|
||||
{
|
||||
return _SongMenu.GetSelectedCategory();
|
||||
}
|
||||
|
||||
public void SetSelectedCategory(int CategoryNr)
|
||||
{
|
||||
_SongMenu.SetSelectedCategory(CategoryNr);
|
||||
}
|
||||
|
||||
public int GetActualSelection()
|
||||
{
|
||||
return _SongMenu.GetActualSelection();
|
||||
}
|
||||
|
||||
public bool IsSelected()
|
||||
{
|
||||
return _SongMenu.IsSelected();
|
||||
}
|
||||
|
||||
public void SetSelected(bool Selected)
|
||||
{
|
||||
_SongMenu.SetSelected(Selected);
|
||||
}
|
||||
|
||||
public bool IsVisible()
|
||||
{
|
||||
return _SongMenu.IsVisible();
|
||||
}
|
||||
|
||||
public void SetVisible(bool Visible)
|
||||
{
|
||||
_SongMenu.SetVisible(Visible);
|
||||
}
|
||||
|
||||
public SRectF GetRect()
|
||||
{
|
||||
return _SongMenu.GetRect();
|
||||
}
|
||||
|
||||
public bool IsSmallView()
|
||||
{
|
||||
return _SongMenu.IsSmallView();
|
||||
}
|
||||
|
||||
public void SetSmallView(bool SmallView)
|
||||
{
|
||||
_SongMenu.SetSmallView(SmallView);
|
||||
}
|
||||
|
||||
#endregion ISongMenu
|
||||
|
||||
#region IMenuElement
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _SongMenu.GetThemeName();
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
return _SongMenu.LoadTheme(XmlPath, ElementName, navigator, SkinIndex);
|
||||
}
|
||||
|
||||
public bool SaveTheme(XmlWriter writer)
|
||||
{
|
||||
return _SongMenu.SaveTheme(writer);
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
_SongMenu.UnloadTextures();
|
||||
}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
_SongMenu.LoadTextures();
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
_SongMenu.ReloadTextures();
|
||||
}
|
||||
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
_SongMenu.MoveElement(stepX, stepY);
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
_SongMenu.ResizeElement(stepW, stepH);
|
||||
}
|
||||
#endregion IMenuElement
|
||||
|
||||
private void CreateSongMenu()
|
||||
{
|
||||
if (_SongMenu != null)
|
||||
{
|
||||
_SongMenu.OnHide();
|
||||
}
|
||||
|
||||
switch (_Base.Config.GetSongMenuType())
|
||||
{
|
||||
//case ESongMenu.TR_CONFIG_LIST:
|
||||
// _SongMenu = new CSongMenuList();
|
||||
// break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_DREIDEL:
|
||||
// _SongMenu = new CSongMenuDreidel();
|
||||
// break;
|
||||
|
||||
case ESongMenu.TR_CONFIG_TILE_BOARD:
|
||||
_SongMenu = new CSongMenuTileBoard(_Base);
|
||||
break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_BOOK:
|
||||
// _SongMenu = new CSongMenuBook();
|
||||
// break;
|
||||
}
|
||||
|
||||
_Type = _Base.Config.GetSongMenuType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuBook : CSongMenuFramework
|
||||
{
|
||||
new private Basic _Base;
|
||||
|
||||
public CSongMenuBook(Basic Base)
|
||||
: base(Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuDreidel : CSongMenuFramework
|
||||
{
|
||||
new private Basic _Base;
|
||||
/*
|
||||
private SRectF _ScrollRect;
|
||||
private CStatic _CoverBig;
|
||||
private CStatic _TextBG;
|
||||
|
||||
private CStatic _DuetIcon;
|
||||
private CStatic _VideoIcon;
|
||||
|
||||
private CText _Artist;
|
||||
private CText _Title;
|
||||
private CText _SongLength;
|
||||
|
||||
private int _actualSelection = -1;
|
||||
|
||||
public override int GetActualSelection()
|
||||
{
|
||||
return _actualSelection;
|
||||
}
|
||||
*/
|
||||
|
||||
public CSongMenuDreidel(Basic Base)
|
||||
: base(Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
/**
|
||||
_CoverBig = _Theme.songMenuDreidel.StaticCoverBig;
|
||||
_TextBG = _Theme.songMenuDreidel.StaticTextBG;
|
||||
_DuetIcon = _Theme.songMenuDreidel.StaticDuetIcon;
|
||||
_VideoIcon = _Theme.songMenuDreidel.StaticVideoIcon;
|
||||
|
||||
_Artist = _Theme.songMenuDreidel.TextArtist;
|
||||
_Title = _Theme.songMenuDreidel.TextTitle;
|
||||
_SongLength = _Theme.songMenuDreidel.TextSongLength;
|
||||
**/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,710 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
using Vocaluxe.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
struct SThemeSongMenu
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string CoverBackgroundName;
|
||||
public string CoverBigBackgroundName;
|
||||
public string DuetIconName;
|
||||
public string VideoIconName;
|
||||
|
||||
public string MedleyCalcIcon;
|
||||
public string MedleyTagIcon;
|
||||
|
||||
public string ColorName;
|
||||
|
||||
//public SThemeSongMenuBook songMenuBook;
|
||||
//public SThemeSongMenuDreidel songMenuDreidel;
|
||||
//public SThemeSongMenuList songMenuList;
|
||||
public SThemeSongMenuTileBoard songMenuTileBoard;
|
||||
}
|
||||
|
||||
struct SThemeSongMenuBook
|
||||
{
|
||||
}
|
||||
|
||||
struct SThemeSongMenuDreidel
|
||||
{
|
||||
}
|
||||
|
||||
struct SThemeSongMenuList
|
||||
{
|
||||
}
|
||||
|
||||
struct SThemeSongMenuTileBoard
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of tiles horizontal
|
||||
/// </summary>
|
||||
public int numW;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles vertical
|
||||
/// </summary>
|
||||
public int numH;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles horizontal in small-modus
|
||||
/// </summary>
|
||||
public int numWsmall;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles vertical in small-modus
|
||||
/// </summary>
|
||||
public int numHsmall;
|
||||
|
||||
/// <summary>
|
||||
/// Space between tiles horizontal
|
||||
/// </summary>
|
||||
public float spaceW;
|
||||
|
||||
/// <summary>
|
||||
/// Space between tiles vertical
|
||||
/// </summary>
|
||||
public float spaceH;
|
||||
|
||||
public SRectF TileRect;
|
||||
public SRectF TileRectSmall;
|
||||
|
||||
public CText TextArtist;
|
||||
public CText TextTitle;
|
||||
public CText TextSongLength;
|
||||
|
||||
public CStatic StaticCoverBig;
|
||||
public CStatic StaticTextBG;
|
||||
public CStatic StaticDuetIcon;
|
||||
public CStatic StaticVideoIcon;
|
||||
public CStatic StaticMedleyCalcIcon;
|
||||
public CStatic StaticMedleyTagIcon;
|
||||
}
|
||||
|
||||
abstract class CSongMenuFramework : ISongMenu
|
||||
{
|
||||
protected Basic _Base;
|
||||
protected SThemeSongMenu _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
private Stopwatch _timer = new Stopwatch();
|
||||
private Stopwatch _VideoFadeTimer = new Stopwatch();
|
||||
private List<int> _streams = new List<int>();
|
||||
private int _video = -1;
|
||||
private int _actsong = -1;
|
||||
private int _actsongstream = -1;
|
||||
protected STexture _vidtex = new STexture(-1);
|
||||
|
||||
protected bool _Initialized = false;
|
||||
protected int _LastKnownNumSongs = 0;
|
||||
protected int _LastKnownCategory = -1;
|
||||
|
||||
protected SRectF _Rect = new SRectF();
|
||||
protected SColorF _Color = new SColorF();
|
||||
|
||||
private int _SelectedInternal = -1;
|
||||
private int _SelectedPending = -1;
|
||||
protected long _PendingTime = 500L;
|
||||
|
||||
private int _LockedInternal = -1;
|
||||
protected bool _Active = false;
|
||||
|
||||
protected float _MaxVolume = 100f;
|
||||
|
||||
protected int _PreviewSelected //for preview only
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((_SelectedInternal != _SelectedPending) && (_timer.ElapsedMilliseconds >= _PendingTime))
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
return _SelectedInternal;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == -1)
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
|
||||
_SelectedInternal = -1;
|
||||
_SelectedPending = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((value != _SelectedInternal) && (value != _SelectedPending))
|
||||
{
|
||||
_timer.Reset();
|
||||
_timer.Start();
|
||||
|
||||
_SelectedPending = value;
|
||||
}
|
||||
|
||||
if ((value == _SelectedPending) && ((_timer.ElapsedMilliseconds >= _PendingTime) || (_SelectedInternal == -1)))
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected virtual void SetSelectedNow()
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
|
||||
protected int _Locked //the real selected song for singing
|
||||
{
|
||||
get { return _LockedInternal; }
|
||||
set { _LockedInternal = value; }
|
||||
}
|
||||
|
||||
protected int _SongStream
|
||||
{
|
||||
get { return _actsongstream; }
|
||||
}
|
||||
|
||||
protected int _Video
|
||||
{
|
||||
get { return _video; }
|
||||
}
|
||||
|
||||
protected int _ActSong
|
||||
{
|
||||
get { return _actsong; }
|
||||
}
|
||||
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return _Rect; }
|
||||
}
|
||||
|
||||
public SRectF GetRect()
|
||||
{
|
||||
return _Rect;
|
||||
}
|
||||
|
||||
public SColorF Color
|
||||
{
|
||||
get { return _Color; }
|
||||
}
|
||||
|
||||
public virtual int GetActualSelection()
|
||||
{
|
||||
return _actsong;
|
||||
}
|
||||
|
||||
private bool _Selected = false;
|
||||
private bool _Visible = true;
|
||||
|
||||
public bool IsSelected()
|
||||
{
|
||||
return _Selected;
|
||||
}
|
||||
|
||||
public void SetSelected(bool Selected)
|
||||
{
|
||||
_Selected = Selected;
|
||||
SetActive(Selected);
|
||||
}
|
||||
|
||||
public bool IsVisible()
|
||||
{
|
||||
return _Visible;
|
||||
}
|
||||
|
||||
public void SetVisible(bool Visible)
|
||||
{
|
||||
_Visible = Visible;
|
||||
}
|
||||
|
||||
public CSongMenuFramework(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
_Theme = new SThemeSongMenu();
|
||||
|
||||
_Theme.songMenuTileBoard.TextArtist = new CText(_Base);
|
||||
_Theme.songMenuTileBoard.TextTitle = new CText(_Base);
|
||||
_Theme.songMenuTileBoard.TextSongLength = new CText(_Base);
|
||||
|
||||
_Theme.songMenuTileBoard.StaticCoverBig = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticTextBG = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticDuetIcon = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticVideoIcon = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticMedleyCalcIcon = new CStatic(_Base);
|
||||
_Theme.songMenuTileBoard.StaticMedleyTagIcon = new CStatic(_Base);
|
||||
|
||||
_ThemeLoaded = false;
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/CoverBackground", navigator, ref _Theme.CoverBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/CoverBigBackground", navigator, ref _Theme.CoverBigBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/DuetIcon", navigator, ref _Theme.DuetIconName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/VideoIcon", navigator, ref _Theme.VideoIconName, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/MedleyCalcIcon", navigator, ref _Theme.MedleyCalcIcon, String.Empty);
|
||||
_ThemeLoaded &= CHelper.GetValueFromXML(item + "/MedleyTagIcon", navigator, ref _Theme.MedleyTagIcon, String.Empty);
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref _Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref _Color.R);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref _Color.G);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref _Color.B);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref _Color.A);
|
||||
}
|
||||
|
||||
#region SongMenuTileBoard
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumW", navigator, ref _Theme.songMenuTileBoard.numW);
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumH", navigator, ref _Theme.songMenuTileBoard.numH);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/SpaceW", navigator, ref _Theme.songMenuTileBoard.spaceW);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/SpaceH", navigator, ref _Theme.songMenuTileBoard.spaceH);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumWsmall", navigator, ref _Theme.songMenuTileBoard.numWsmall);
|
||||
_ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumHsmall", navigator, ref _Theme.songMenuTileBoard.numHsmall);
|
||||
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.TextArtist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.TextTitle.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.TextSongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", navigator, SkinIndex);
|
||||
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticCoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticTextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticDuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticVideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticMedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", navigator, SkinIndex);
|
||||
_ThemeLoaded &= _Theme.songMenuTileBoard.StaticMedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", navigator, SkinIndex);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectX", navigator, ref _Theme.songMenuTileBoard.TileRect.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectY", navigator, ref _Theme.songMenuTileBoard.TileRect.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectZ", navigator, ref _Theme.songMenuTileBoard.TileRect.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectW", navigator, ref _Theme.songMenuTileBoard.TileRect.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectH", navigator, ref _Theme.songMenuTileBoard.TileRect.H);
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallX", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.X);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallY", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.Y);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallZ", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.Z);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallW", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.W);
|
||||
_ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallH", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.H);
|
||||
|
||||
#endregion SongMenuTileBoard
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
LoadTextures();
|
||||
Init();
|
||||
}
|
||||
|
||||
return _ThemeLoaded;
|
||||
}
|
||||
|
||||
public bool SaveTheme(XmlWriter writer)
|
||||
{
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
writer.WriteStartElement(_Theme.Name);
|
||||
|
||||
writer.WriteComment("<CoverBackground>: Texture name of cover background/tiles");
|
||||
writer.WriteElementString("CoverBackground", _Theme.CoverBackgroundName);
|
||||
|
||||
writer.WriteComment("<CoverBigBackground>: Texture name of big cover background and info texts");
|
||||
writer.WriteElementString("CoverBigBackground", _Theme.CoverBigBackgroundName);
|
||||
|
||||
writer.WriteComment("<DuetIcon>: Texture name of duet icon");
|
||||
writer.WriteElementString("DuetIcon", _Theme.DuetIconName);
|
||||
|
||||
writer.WriteComment("<VideoIcon>: Texture name of video icon");
|
||||
writer.WriteElementString("VideoIcon", _Theme.VideoIconName);
|
||||
|
||||
writer.WriteComment("<MedleyCalcIcon>: Texture name of medley calc (calculated) icon");
|
||||
writer.WriteElementString("MedleyCalcIcon", _Theme.MedleyCalcIcon);
|
||||
|
||||
writer.WriteComment("<MedleyTagIcon>: Texture name of medley tag (manuelly set) icon");
|
||||
writer.WriteElementString("MedleyTagIcon", _Theme.MedleyTagIcon);
|
||||
|
||||
writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", _Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", _Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", _Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", _Color.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
#region SongMenuTileBoard
|
||||
writer.WriteComment("<SongMenuTileBoard>: Config for TileBoard view");
|
||||
writer.WriteStartElement("SongMenuTileBoard");
|
||||
|
||||
writer.WriteComment("<NumW>: Number of tiles horizontal");
|
||||
writer.WriteElementString("NumW", _Theme.songMenuTileBoard.numW.ToString());
|
||||
|
||||
writer.WriteComment("<NumH>: Number of tiles vertical");
|
||||
writer.WriteElementString("NumH", _Theme.songMenuTileBoard.numH.ToString());
|
||||
|
||||
writer.WriteComment("<SpaceW>: Space between tiles horizontal");
|
||||
writer.WriteElementString("SpaceW", _Theme.songMenuTileBoard.spaceW.ToString("#0.00"));
|
||||
|
||||
writer.WriteComment("<SpaceH>: Space between tiles vertical");
|
||||
writer.WriteElementString("SpaceH", _Theme.songMenuTileBoard.spaceH.ToString("#0.00"));
|
||||
|
||||
writer.WriteComment("<NumWsmall>: Number of tiles horizontal in small-mode");
|
||||
writer.WriteElementString("NumWsmall", _Theme.songMenuTileBoard.numWsmall.ToString());
|
||||
|
||||
writer.WriteComment("<NumHsmall>: Number of tiles vertical in small-mode");
|
||||
writer.WriteElementString("NumHsmall", _Theme.songMenuTileBoard.numHsmall.ToString());
|
||||
|
||||
writer.WriteComment("<TileRectX>, <TileRectY>, <TileRectZ>, <TileRectW>, <TileRectH>: SongMenu position, width and height");
|
||||
writer.WriteElementString("TileRectX", _Theme.songMenuTileBoard.TileRect.X.ToString("#0"));
|
||||
writer.WriteElementString("TileRectY", _Theme.songMenuTileBoard.TileRect.Y.ToString("#0"));
|
||||
writer.WriteElementString("TileRectZ", _Theme.songMenuTileBoard.TileRect.Z.ToString("#0.00"));
|
||||
writer.WriteElementString("TileRectW", _Theme.songMenuTileBoard.TileRect.W.ToString("#0"));
|
||||
writer.WriteElementString("TileRectH", _Theme.songMenuTileBoard.TileRect.H.ToString("#0"));
|
||||
|
||||
writer.WriteComment("<TileRectSmallX>, <TileRectSmallY>, <TileRectSmallZ>, <TileRectSmallW>, <TileRectSmallH>: SongMenu position, width and height in small-mode");
|
||||
writer.WriteElementString("TileRectSmallX", _Theme.songMenuTileBoard.TileRectSmall.X.ToString("#0"));
|
||||
writer.WriteElementString("TileRectSmallY", _Theme.songMenuTileBoard.TileRectSmall.Y.ToString("#0"));
|
||||
writer.WriteElementString("TileRectSmallZ", _Theme.songMenuTileBoard.TileRectSmall.Z.ToString("#0.00"));
|
||||
writer.WriteElementString("TileRectSmallW", _Theme.songMenuTileBoard.TileRectSmall.W.ToString("#0"));
|
||||
writer.WriteElementString("TileRectSmallH", _Theme.songMenuTileBoard.TileRectSmall.H.ToString("#0"));
|
||||
|
||||
_Theme.songMenuTileBoard.TextArtist.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.TextTitle.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.TextSongLength.SaveTheme(writer);
|
||||
|
||||
_Theme.songMenuTileBoard.StaticCoverBig.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticTextBG.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticDuetIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticVideoIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer);
|
||||
|
||||
writer.WriteEndElement();
|
||||
#endregion SongMenuTileBoard
|
||||
|
||||
writer.WriteEndElement();
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
{
|
||||
Reset();
|
||||
_Initialized = true;
|
||||
}
|
||||
|
||||
public virtual void UpdateRect(SRectF rect)
|
||||
{
|
||||
_Rect = rect;
|
||||
Init();
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
if (_actsong != _PreviewSelected)
|
||||
SelectSong(_PreviewSelected);
|
||||
|
||||
if (_streams.Count > 0 && _video != -1)
|
||||
{
|
||||
if (_Base.Video.IsFinished(_video) || _Base.Sound.IsFinished(_actsongstream))
|
||||
{
|
||||
_Base.Video.Close(_video);
|
||||
_video = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
float time = _Base.Sound.GetPosition(_actsongstream);
|
||||
|
||||
float vtime = 0f;
|
||||
_Base.Video.GetFrame(_video, ref _vidtex, time, ref vtime);
|
||||
if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L)
|
||||
{
|
||||
_vidtex.color.A = (_VideoFadeTimer.ElapsedMilliseconds / 3000f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_vidtex.color.A = 1f;
|
||||
_VideoFadeTimer.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnShow()
|
||||
{
|
||||
_actsongstream = -1;
|
||||
_vidtex = new STexture(-1);
|
||||
}
|
||||
|
||||
public virtual void OnHide()
|
||||
{
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
_Base.Sound.FadeAndStop(stream, 0f, 0.75f);
|
||||
}
|
||||
_streams.Clear();
|
||||
|
||||
_Base.Video.Close(_video);
|
||||
_video = -1;
|
||||
|
||||
_Base.Drawing.RemoveTexture(ref _vidtex);
|
||||
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
|
||||
public virtual void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void Draw()
|
||||
{
|
||||
if (!_Initialized || !_Visible)
|
||||
return;
|
||||
|
||||
if (_video != -1)
|
||||
{
|
||||
_Base.Drawing.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual void ApplyVolume(float VolumeMax)
|
||||
{
|
||||
_MaxVolume = VolumeMax;
|
||||
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
_Base.Sound.SetStreamVolumeMax(stream, _MaxVolume);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsActive()
|
||||
{
|
||||
return _Active;
|
||||
}
|
||||
|
||||
public virtual void SetActive(bool Active)
|
||||
{
|
||||
_Active = Active;
|
||||
}
|
||||
|
||||
public virtual int GetSelectedSong()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public virtual CStatic GetSelectedSongCover()
|
||||
{
|
||||
return new CStatic(_Base);
|
||||
}
|
||||
|
||||
public virtual int GetSelectedCategory()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public virtual void SetSelectedSong(int VisibleSongNr)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void SetSelectedCategory(int CategoryNr)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void SetSmallView(bool SmallView)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual bool IsSmallView()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void LoadTextures()
|
||||
{
|
||||
Init();
|
||||
|
||||
if (_Theme.ColorName != String.Empty)
|
||||
_Color = _Base.Theme.GetColor(_Theme.ColorName);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
protected virtual void EnterCategory(int Category)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
if (Category >= _Base.Songs.GetNumCategories())
|
||||
return;
|
||||
|
||||
_Base.Songs.SetCategory(Category);
|
||||
}
|
||||
|
||||
protected virtual void ShowCategories()
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() != -1)
|
||||
Reset();
|
||||
|
||||
_Base.Songs.SetCategory(-1);
|
||||
}
|
||||
|
||||
public void ApplyVolume()
|
||||
{
|
||||
_Base.Sound.SetStreamVolume(_actsongstream, _Base.Config.GetPreviewMusicVolume());
|
||||
}
|
||||
|
||||
protected void SelectSong(int nr)
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() >= 0 && (_Base.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0)))
|
||||
{
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
_Base.Sound.FadeAndStop(stream, 0f, 1f);
|
||||
}
|
||||
_streams.Clear();
|
||||
|
||||
_Base.Video.Close(_video);
|
||||
_video = -1;
|
||||
|
||||
_Base.Drawing.RemoveTexture(ref _vidtex);
|
||||
|
||||
_actsong = nr;
|
||||
if (_actsong >= _Base.Songs.GetNumVisibleSongs())
|
||||
_actsong = 0;
|
||||
|
||||
|
||||
int _stream = _Base.Sound.Load(Path.Combine(_Base.Songs.GetVisibleSong(_actsong).Folder, _Base.Songs.GetVisibleSong(_actsong).MP3FileName), true);
|
||||
_Base.Sound.SetStreamVolumeMax(_stream, _MaxVolume);
|
||||
_Base.Sound.SetStreamVolume(_stream, 0f);
|
||||
|
||||
float startposition = _Base.Songs.GetVisibleSong(_actsong).PreviewStart;
|
||||
|
||||
if (startposition == 0f)
|
||||
startposition = _Base.Sound.GetLength(_stream) / 4f;
|
||||
|
||||
_Base.Sound.SetPosition(_stream, startposition);
|
||||
_Base.Sound.Play(_stream);
|
||||
_Base.Sound.Fade(_stream, 100f, 3f);
|
||||
_streams.Add(_stream);
|
||||
_actsongstream = _stream;
|
||||
|
||||
if (_Base.Songs.GetVisibleSong(_actsong).VideoFileName != String.Empty && _Base.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
_video = _Base.Video.Load(Path.Combine(_Base.Songs.GetVisibleSong(_actsong).Folder, _Base.Songs.GetVisibleSong(_actsong).VideoFileName));
|
||||
if (_video == -1)
|
||||
return;
|
||||
_Base.Video.Skip(_video, startposition, _Base.Songs.GetVisibleSong(_actsong).VideoGap);
|
||||
_VideoFadeTimer.Stop();
|
||||
_VideoFadeTimer.Reset();
|
||||
_VideoFadeTimer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void Reset()
|
||||
{
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
_Base.Sound.FadeAndStop(stream, 0f, 0.75f);
|
||||
}
|
||||
_streams.Clear();
|
||||
|
||||
_Base.Video.Close(_video);
|
||||
_video = -1;
|
||||
|
||||
_Base.Drawing.RemoveTexture(ref _vidtex);
|
||||
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
SRectF rect = Rect;
|
||||
rect.X += stepX;
|
||||
rect.Y += stepY;
|
||||
UpdateRect(rect);
|
||||
}
|
||||
|
||||
public void ResizeElement(int stepW, int stepH)
|
||||
{
|
||||
SRectF rect = Rect;
|
||||
|
||||
rect.W += stepW;
|
||||
if (rect.W < 100)
|
||||
rect.W = 100;
|
||||
|
||||
rect.H += stepH;
|
||||
if (rect.H < 100)
|
||||
rect.H = 100;
|
||||
|
||||
UpdateRect(rect);
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuList : CSongMenuFramework
|
||||
{
|
||||
new private Basic _Base;
|
||||
|
||||
public CSongMenuList(Basic Base)
|
||||
: base(Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,839 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Vocaluxe.Menu.SongMenu;
|
||||
using Vocaluxe.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuTileBoard : CSongMenuFramework
|
||||
{
|
||||
new private Basic _Base;
|
||||
private SRectF _ScrollRect;
|
||||
private List<CStatic> _Tiles;
|
||||
private CStatic _CoverBig;
|
||||
private CStatic _TextBG;
|
||||
private CStatic _DuetIcon;
|
||||
private CStatic _VideoIcon;
|
||||
private CStatic _MedleyCalcIcon;
|
||||
private CStatic _MedleyTagIcon;
|
||||
|
||||
private STexture _CoverBigTexture;
|
||||
private STexture _CoverTexture;
|
||||
|
||||
private CText _Artist;
|
||||
private CText _Title;
|
||||
private CText _SongLength;
|
||||
|
||||
private int _NumW;
|
||||
private int _NumH;
|
||||
|
||||
private float _SpaceW;
|
||||
private float _SpaceH;
|
||||
|
||||
private int _TileW;
|
||||
private int _TileH;
|
||||
|
||||
private int _Offset = 0;
|
||||
private int _actualSelection = -1;
|
||||
|
||||
private bool _SmallView = false;
|
||||
|
||||
public CSongMenuTileBoard(Basic Base)
|
||||
: base(Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
|
||||
public override int GetActualSelection()
|
||||
{
|
||||
return _actualSelection;
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_Rect = _Theme.songMenuTileBoard.TileRect;
|
||||
|
||||
_NumW = _Theme.songMenuTileBoard.numW;
|
||||
_NumH = _Theme.songMenuTileBoard.numH;
|
||||
_SpaceW = _Theme.songMenuTileBoard.spaceW;
|
||||
_SpaceH = _Theme.songMenuTileBoard.spaceH;
|
||||
|
||||
_PendingTime = 100L;
|
||||
|
||||
_TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||
_TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||
|
||||
_CoverTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBackgroundName);
|
||||
_CoverBigTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName);
|
||||
|
||||
_Tiles = new List<CStatic>();
|
||||
for (int i = 0; i < _NumH; i++)
|
||||
{
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
|
||||
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
CStatic tile = new CStatic(_Base, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
_ScrollRect = new SRectF(0, 0, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRect.Z);
|
||||
|
||||
_PreviewSelected = -1;
|
||||
_Offset = 0;
|
||||
|
||||
_CoverBig = _Theme.songMenuTileBoard.StaticCoverBig;
|
||||
_TextBG = _Theme.songMenuTileBoard.StaticTextBG;
|
||||
_DuetIcon = _Theme.songMenuTileBoard.StaticDuetIcon;
|
||||
_VideoIcon = _Theme.songMenuTileBoard.StaticVideoIcon;
|
||||
_MedleyCalcIcon = _Theme.songMenuTileBoard.StaticMedleyCalcIcon;
|
||||
_MedleyTagIcon = _Theme.songMenuTileBoard.StaticMedleyTagIcon;
|
||||
|
||||
_Artist = _Theme.songMenuTileBoard.TextArtist;
|
||||
_Title = _Theme.songMenuTileBoard.TextTitle;
|
||||
_SongLength = _Theme.songMenuTileBoard.TextSongLength;
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && _Base.Songs.GetNumCategories() > 0 && _Base.Songs.GetCurrentCategoryIndex() == -1)
|
||||
{
|
||||
EnterCategory(0);
|
||||
}
|
||||
_actualSelection = -1;
|
||||
_Locked = -1;
|
||||
_PreviewSelected = -1;
|
||||
UpdateList(0);
|
||||
//AfterCategoryChange();
|
||||
SetSelectedSong(_ActSong);
|
||||
AfterCategoryChange();
|
||||
_Base.Songs.UpdateRandomSongList();
|
||||
|
||||
int actcat = _PreviewSelected;
|
||||
if ((_Base.Songs.GetNumCategories() > 0) && (actcat < 0))
|
||||
{
|
||||
_CoverBig.Texture = _Base.Songs.GetCategory(0).CoverTextureSmall;
|
||||
_Artist.Text = _Base.Songs.GetCategory(0).Name;
|
||||
_Title.Text = String.Empty;
|
||||
_SongLength.Text = String.Empty;
|
||||
_PreviewSelected = 0;
|
||||
_Locked = 0;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
|
||||
if (_Base.Songs.GetNumVisibleSongs() == 0 && _Base.Songs.GetSearchFilter() != String.Empty)
|
||||
{
|
||||
_CoverBig.Texture = _CoverBigTexture;
|
||||
_Artist.Text = String.Empty;
|
||||
_Title.Text = String.Empty;
|
||||
_SongLength.Text = String.Empty;
|
||||
_PreviewSelected = -1;
|
||||
_Locked = -1;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
base.HandleInput(ref KeyEvent, SongOptions);
|
||||
|
||||
if (KeyEvent.KeyPressed)
|
||||
{
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down ||
|
||||
KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter ||
|
||||
KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp))
|
||||
return;
|
||||
|
||||
bool sel = false;
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
{
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((_Locked == -1 || !sel) &&
|
||||
KeyEvent.Key != Keys.Escape && KeyEvent.Key != Keys.Back && KeyEvent.Key != Keys.PageUp && KeyEvent.Key != Keys.PageDown)
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
_actualSelection = 0;
|
||||
_PreviewSelected = 0;
|
||||
SetSelectedNow();
|
||||
UpdateList(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
case Keys.Enter:
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() < 0)
|
||||
{
|
||||
EnterCategory(_PreviewSelected);
|
||||
KeyEvent.Handled = true;
|
||||
}
|
||||
else if (_actualSelection > -1 && _PreviewSelected >= 0)
|
||||
{
|
||||
_Locked = _actualSelection;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() > -1 && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
ShowCategories();
|
||||
KeyEvent.Handled = true;
|
||||
}
|
||||
//else if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF)
|
||||
//{
|
||||
// CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
//}
|
||||
break;
|
||||
|
||||
case Keys.PageUp:
|
||||
if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
PrevCategory();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.PageDown:
|
||||
if (_Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
NextCategory();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
if (_Locked > 0 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && _Base.Songs.GetCurrentCategoryIndex() < 0))
|
||||
{
|
||||
_Locked--;
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() < 0 && _Locked < _Base.Songs.GetNumCategories() - _NumW ||
|
||||
_Base.Songs.GetCurrentCategoryIndex() >= 0 && _Locked < _Base.Songs.GetNumVisibleSongs() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Right:
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
if (_Locked < _Base.Songs.GetNumCategories() - 1)
|
||||
{
|
||||
_Locked++;
|
||||
if (_Locked < _Base.Songs.GetNumCategories() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() != -1 && _Locked < _Base.Songs.GetNumVisibleSongs() - 1 && !SongOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked++;
|
||||
if (_Locked < _Base.Songs.GetNumVisibleSongs() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Up:
|
||||
if (KeyEvent.ModSHIFT && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
PrevCategory();
|
||||
break;
|
||||
}
|
||||
|
||||
if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && _Base.Songs.GetCurrentCategoryIndex() < 0))
|
||||
{
|
||||
_Locked -= _NumW;
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Down:
|
||||
if (KeyEvent.ModSHIFT && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
NextCategory();
|
||||
break;
|
||||
}
|
||||
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
if (_Locked < _Base.Songs.GetNumCategories() - _NumW)
|
||||
{
|
||||
_Locked += _NumW;
|
||||
if (_Locked < _Base.Songs.GetNumCategories() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_Locked < _Base.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly)
|
||||
{
|
||||
_Locked += _NumW;
|
||||
if (_Locked < _Base.Songs.GetNumVisibleSongs() - _NumW)
|
||||
UpdateList((_Locked / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!KeyEvent.Handled)
|
||||
{
|
||||
_PreviewSelected = _Locked;
|
||||
_actualSelection = _Locked;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
|
||||
{
|
||||
base.HandleMouse(ref MouseEvent, SongOptions);
|
||||
|
||||
int i = 0;
|
||||
bool sel = false;
|
||||
int lastselection = _actualSelection;
|
||||
|
||||
if (!SongOptions.Selection.RandomOnly || _Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent) && !sel)
|
||||
{
|
||||
if (MouseEvent.LB || _Base.Songs.GetCurrentCategoryIndex() == -1)
|
||||
{
|
||||
if (_PreviewSelected == i + _Offset)
|
||||
_Locked = _PreviewSelected;
|
||||
else
|
||||
{
|
||||
_PreviewSelected = i + _Offset;
|
||||
_Locked = -1;
|
||||
}
|
||||
}
|
||||
tile.Selected = true;
|
||||
_actualSelection = i + _Offset;
|
||||
sel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
sel = true;
|
||||
|
||||
if (MouseEvent.Sender == ESender.WiiMote && _actualSelection != lastselection && _actualSelection != -1)
|
||||
_Base.Input.SetRumble(0.050f);
|
||||
|
||||
if (!sel)
|
||||
_actualSelection = -1;
|
||||
|
||||
if ((MouseEvent.RB) && (_Base.Songs.GetNumCategories() > 0) && _Base.Songs.GetCurrentCategoryIndex() >= 0 && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
ShowCategories();
|
||||
return;
|
||||
}
|
||||
else if (MouseEvent.RB && _Base.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode)
|
||||
{
|
||||
_Base.Graphics.FadeTo(EScreens.ScreenMain);
|
||||
}
|
||||
else if (_PreviewSelected != -1 && MouseEvent.LB && _Base.Songs.GetCurrentCategoryIndex() != -1 && !SongOptions.Selection.PartyMode)
|
||||
{
|
||||
if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent))
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
}
|
||||
else if ((MouseEvent.LB) && (_Base.Songs.GetCurrentCategoryIndex() == -1))
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if ((tile.Texture.index != _CoverTexture.index) && CHelper.IsInBounds(tile.Rect, MouseEvent))
|
||||
{
|
||||
EnterCategory(_PreviewSelected);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MouseEvent.Wheel > 0)
|
||||
{
|
||||
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || _Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() >= 0 && _Base.Songs.GetNumVisibleSongs() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1) ||
|
||||
_Base.Songs.GetCurrentCategoryIndex() < 0 && _Base.Songs.GetNumCategories() > _Offset + _NumW * MouseEvent.Wheel + _NumW * (_NumH - 1))
|
||||
{
|
||||
_Offset += _NumW * MouseEvent.Wheel;
|
||||
UpdateList(_Offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MouseEvent.Wheel < 0)
|
||||
{
|
||||
if (CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || _Base.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
{
|
||||
_Offset += _NumW * MouseEvent.Wheel;
|
||||
if (_Offset < 0)
|
||||
{
|
||||
_Offset = 0;
|
||||
}
|
||||
UpdateList(_Offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected && _Active)
|
||||
tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop, false);
|
||||
else
|
||||
{
|
||||
if (tile.Texture.index != _CoverTexture.index)
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Crop, false);
|
||||
else
|
||||
tile.Draw(1f, tile.Rect.Z, EAspect.Stretch, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() >= 0)
|
||||
{
|
||||
int actsong = _PreviewSelected;
|
||||
if ((_Base.Songs.GetNumVisibleSongs() > actsong) && (actsong >= 0))
|
||||
{
|
||||
CSong song = _Base.Songs.GetVisibleSong(actsong);
|
||||
|
||||
_CoverBig.Texture = song.CoverTextureSmall;
|
||||
_Artist.Text = song.Artist;
|
||||
_Title.Text = song.Title;
|
||||
_DuetIcon.Visible = song.IsDuet;
|
||||
_VideoIcon.Visible = song.VideoFileName.Length > 0;
|
||||
_MedleyCalcIcon.Visible = song.Medley.Source == EMedleySource.Calculated;
|
||||
_MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag;
|
||||
|
||||
float Time = _Base.Sound.GetLength(_SongStream);
|
||||
if (song.Finish != 0)
|
||||
Time = song.Finish;
|
||||
|
||||
Time -= song.Start;
|
||||
int min = (int)Math.Floor(Time / 60f);
|
||||
int sec = (int)(Time - min * 60f);
|
||||
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int actcat = _PreviewSelected;
|
||||
if ((_Base.Songs.GetNumCategories() > actcat) && (actcat >= 0))
|
||||
{
|
||||
_CoverBig.Texture = _Base.Songs.GetCategory(actcat).CoverTextureSmall;
|
||||
_Artist.Text = _Base.Songs.GetCategory(actcat).Name;
|
||||
|
||||
int num = _Base.Songs.NumSongsInCategory(actcat);
|
||||
if (num != 1)
|
||||
_Title.Text = _Base.Language.Translate("TR_SCREENSONG_NUMSONGS").Replace("%v", num.ToString());
|
||||
else
|
||||
_Title.Text = _Base.Language.Translate("TR_SCREENSONG_NUMSONG").Replace("%v", num.ToString());
|
||||
|
||||
_SongLength.Text = String.Empty;
|
||||
_DuetIcon.Visible = false;
|
||||
_VideoIcon.Visible = false;
|
||||
_MedleyCalcIcon.Visible = false;
|
||||
_MedleyTagIcon.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
_TextBG.Draw();
|
||||
|
||||
_CoverBig.Draw(1f, EAspect.Crop);
|
||||
if (_vidtex.color.A < 1)
|
||||
_CoverBig.Draw(1f, EAspect.Crop);
|
||||
|
||||
if (_vidtex.index != -1 && _Video != -1)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
|
||||
RectangleF rect = new RectangleF(0f, 0f, _vidtex.width, _vidtex.height);
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
|
||||
_Base.Drawing.DrawTexture(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z),
|
||||
_vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
|
||||
_Base.Drawing.DrawTextureReflection(_vidtex, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z),
|
||||
_vidtex.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
|
||||
}
|
||||
|
||||
|
||||
|
||||
_Artist.Draw();
|
||||
_Title.Draw();
|
||||
_SongLength.Draw();
|
||||
_DuetIcon.Draw();
|
||||
_VideoIcon.Draw();
|
||||
_MedleyCalcIcon.Draw();
|
||||
_MedleyTagIcon.Draw();
|
||||
|
||||
}
|
||||
|
||||
public override int GetSelectedSong()
|
||||
{
|
||||
return _Locked;
|
||||
}
|
||||
|
||||
public override CStatic GetSelectedSongCover()
|
||||
{
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
return new CStatic(tile);
|
||||
}
|
||||
return new CStatic(_Base);
|
||||
}
|
||||
|
||||
public override void SetSelectedSong(int VisibleSongNr)
|
||||
{
|
||||
base.SetSelectedSong(VisibleSongNr);
|
||||
|
||||
if (VisibleSongNr < 0)
|
||||
return;
|
||||
|
||||
if (_Base.Songs.GetNumVisibleSongs() > VisibleSongNr)
|
||||
{
|
||||
bool sel = false;
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
{
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_Locked == -1 || !sel)
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
_actualSelection = 0;
|
||||
_PreviewSelected = 0;
|
||||
SetSelectedNow();
|
||||
UpdateList(0);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
|
||||
_PreviewSelected = VisibleSongNr;
|
||||
SetSelectedNow();
|
||||
_Locked = VisibleSongNr;
|
||||
|
||||
UpdateList((VisibleSongNr / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
|
||||
_PreviewSelected = _Locked;
|
||||
_actualSelection = _Locked;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void SetSelectedCategory(int CategoryNr)
|
||||
{
|
||||
base.SetSelectedCategory(CategoryNr);
|
||||
|
||||
if (CategoryNr < 0)
|
||||
return;
|
||||
|
||||
if (_Base.Songs.GetNumCategories() > CategoryNr)
|
||||
{
|
||||
bool sel = false;
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
if (tile.Selected)
|
||||
{
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_Locked == -1 || !sel)
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
_actualSelection = 0;
|
||||
_PreviewSelected = 0;
|
||||
SetSelectedNow();
|
||||
UpdateList(0);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
|
||||
_PreviewSelected = CategoryNr;
|
||||
SetSelectedNow();
|
||||
_Locked = CategoryNr;
|
||||
|
||||
UpdateList((CategoryNr / _NumW) * _NumW - (_NumW * (_NumH - 2)));
|
||||
|
||||
_PreviewSelected = _Locked;
|
||||
_actualSelection = _Locked;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void EnterCategory(int cat)
|
||||
{
|
||||
base.EnterCategory(cat);
|
||||
|
||||
_PreviewSelected = 0;
|
||||
_Locked = -1;
|
||||
_actualSelection = 0;
|
||||
AfterCategoryChange();
|
||||
}
|
||||
|
||||
protected override void ShowCategories()
|
||||
{
|
||||
base.ShowCategories();
|
||||
|
||||
_PreviewSelected = 0;
|
||||
_Locked = -1;
|
||||
_actualSelection = 0;
|
||||
AfterCategoryChange();
|
||||
}
|
||||
|
||||
private void NextCategory()
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() > -1)
|
||||
{
|
||||
Reset();
|
||||
_Base.Songs.NextCategory();
|
||||
EnterCategory(_Base.Songs.GetCurrentCategoryIndex());
|
||||
_Locked = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void PrevCategory()
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() > -1)
|
||||
{
|
||||
Reset();
|
||||
_Base.Songs.PrevCategory();
|
||||
EnterCategory(_Base.Songs.GetCurrentCategoryIndex());
|
||||
_Locked = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void AfterCategoryChange()
|
||||
{
|
||||
SetSelectedNow();
|
||||
SelectSong(_PreviewSelected);
|
||||
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
|
||||
if (_actualSelection >= 0 && _actualSelection < _Tiles.Count)
|
||||
_Tiles[_actualSelection].Selected = true;
|
||||
|
||||
if ((_LastKnownNumSongs == _Base.Songs.GetNumVisibleSongs()) && (_LastKnownCategory == _Base.Songs.GetCurrentCategoryIndex()))
|
||||
return;
|
||||
|
||||
_LastKnownCategory = _Base.Songs.GetCurrentCategoryIndex();
|
||||
_LastKnownNumSongs = _Base.Songs.GetNumVisibleSongs();
|
||||
UpdateList(0);
|
||||
_Base.Songs.UpdateRandomSongList();
|
||||
}
|
||||
|
||||
private void UpdateList(int offset)
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() > -1)
|
||||
{
|
||||
if (offset >= (_Base.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1)))
|
||||
offset = (_Base.Songs.GetNumVisibleSongs() / _NumW) * _NumW - (_NumW * (_NumH - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (offset >= (_Base.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1)))
|
||||
offset = (_Base.Songs.GetNumCategories() / _NumW) * _NumW - (_NumW * (_NumH - 1));
|
||||
}
|
||||
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() >= 0)
|
||||
{
|
||||
if (_Base.Songs.GetNumVisibleSongs() > i + offset)
|
||||
{
|
||||
_Tiles[i].Texture = _Base.Songs.GetVisibleSong(i + offset).CoverTextureSmall;
|
||||
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_Tiles[i].Texture = _CoverTexture;
|
||||
_Tiles[i].Color = _Color;
|
||||
}
|
||||
}
|
||||
|
||||
if (_Base.Songs.GetCurrentCategoryIndex() == -1)
|
||||
{
|
||||
if (_Base.Songs.GetNumCategories() > i + offset)
|
||||
{
|
||||
_Tiles[i].Texture = _Base.Songs.GetCategory(i + offset).CoverTextureSmall;
|
||||
_Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_Tiles[i].Texture = _CoverTexture;
|
||||
_Tiles[i].Color = _Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
_Offset = offset;
|
||||
}
|
||||
|
||||
public override void SetSmallView(bool SmallView)
|
||||
{
|
||||
base.SetSmallView(SmallView);
|
||||
|
||||
_SmallView = SmallView;
|
||||
|
||||
if (_SmallView)
|
||||
{
|
||||
_NumH = _Theme.songMenuTileBoard.numHsmall;
|
||||
_NumW = _Theme.songMenuTileBoard.numWsmall;
|
||||
|
||||
_TileW = (int)((_Theme.songMenuTileBoard.TileRectSmall.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||
_TileH = (int)((_Theme.songMenuTileBoard.TileRectSmall.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||
|
||||
_CoverTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBackgroundName);
|
||||
_CoverBigTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName);
|
||||
|
||||
_Tiles = new List<CStatic>();
|
||||
for (int i = 0; i < _NumH; i++)
|
||||
{
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRectSmall.X + j * (_TileW + _SpaceW),
|
||||
_Theme.songMenuTileBoard.TileRectSmall.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
CStatic tile = new CStatic(_Base, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
_Rect = _Theme.songMenuTileBoard.TileRectSmall;
|
||||
_ScrollRect = new SRectF(0, 0, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRectSmall.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
_NumH = _Theme.songMenuTileBoard.numH;
|
||||
_NumW = _Theme.songMenuTileBoard.numW;
|
||||
|
||||
_TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW);
|
||||
_TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH);
|
||||
|
||||
_CoverTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBackgroundName);
|
||||
_CoverBigTexture = _Base.Theme.GetSkinTexture(_Theme.CoverBigBackgroundName);
|
||||
|
||||
_Tiles = new List<CStatic>();
|
||||
for (int i = 0; i < _NumH; i++)
|
||||
{
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
|
||||
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
CStatic tile = new CStatic(_Base, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
_Rect = _Theme.songMenuTileBoard.TileRect;
|
||||
_ScrollRect = new SRectF(0, 0, _Base.Settings.GetRenderW(), _Base.Settings.GetRenderH(), _Theme.songMenuTileBoard.TileRect.Z);
|
||||
}
|
||||
|
||||
UpdateList(_Offset);
|
||||
|
||||
}
|
||||
|
||||
public override bool IsSmallView()
|
||||
{
|
||||
return _SmallView;
|
||||
}
|
||||
|
||||
public override void LoadTextures()
|
||||
{
|
||||
base.LoadTextures();
|
||||
|
||||
_Theme.songMenuTileBoard.StaticCoverBig.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticTextBG.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticDuetIcon.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticVideoIcon.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticMedleyCalcIcon.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.StaticMedleyTagIcon.ReloadTextures();
|
||||
|
||||
_Theme.songMenuTileBoard.TextArtist.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.TextTitle.ReloadTextures();
|
||||
_Theme.songMenuTileBoard.TextSongLength.ReloadTextures();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Vocaluxe.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Menu.SongMenu
|
||||
{
|
||||
interface ISongMenu : IMenuElement
|
||||
{
|
||||
void Update();
|
||||
void OnShow();
|
||||
void OnHide();
|
||||
|
||||
void HandleInput(ref KeyEvent KeyEvent, ScreenSongOptions SongOptions);
|
||||
void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions);
|
||||
void Draw();
|
||||
|
||||
void ApplyVolume(float VolumeMax);
|
||||
|
||||
int GetSelectedSong();
|
||||
CStatic GetSelectedSongCover();
|
||||
void SetSelectedSong(int VisibleSongNr);
|
||||
|
||||
bool IsActive();
|
||||
void SetActive(bool Active);
|
||||
|
||||
int GetSelectedCategory();
|
||||
void SetSelectedCategory(int CategoryNr);
|
||||
int GetActualSelection();
|
||||
|
||||
bool IsSelected();
|
||||
void SetSelected(bool Selected);
|
||||
|
||||
bool IsVisible();
|
||||
void SetVisible(bool Visible);
|
||||
|
||||
bool IsSmallView();
|
||||
void SetSmallView(bool SmallView);
|
||||
|
||||
SRectF GetRect();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Vocaluxe.Menu;
|
||||
|
||||
namespace Vocaluxe.PartyModes
|
||||
{
|
||||
public abstract class CPartyMode : IPartyMode
|
||||
{
|
||||
protected Basic _Base;
|
||||
protected ScreenSongOptions _ScreenSongOptions;
|
||||
protected List<CMenu> _Screens;
|
||||
protected string _Folder;
|
||||
|
||||
public CPartyMode()
|
||||
{
|
||||
_Screens = new List<CMenu>();
|
||||
_Folder = String.Empty;
|
||||
_ScreenSongOptions = new ScreenSongOptions();
|
||||
_ScreenSongOptions.Selection = new SelectionOptions();
|
||||
_ScreenSongOptions.Sorting = new SortingOptions();
|
||||
}
|
||||
|
||||
public void Initialize(Basic Base)
|
||||
{
|
||||
_Base = Base;
|
||||
}
|
||||
|
||||
#region Implementation
|
||||
public virtual bool Init(string Folder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual CMenu GetNextPartyScreen()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual EScreens GetStartScreen()
|
||||
{
|
||||
return EScreens.ScreenSong;
|
||||
}
|
||||
|
||||
public virtual EScreens GetMainScreen()
|
||||
{
|
||||
return EScreens.ScreenSong;
|
||||
}
|
||||
|
||||
public virtual ScreenSongOptions GetScreenSongOptions()
|
||||
{
|
||||
return new ScreenSongOptions();
|
||||
}
|
||||
|
||||
public virtual void SetSearchString(string SearchString, bool Visible)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void JokerUsed(int TeamNr)
|
||||
{
|
||||
if (_ScreenSongOptions.Selection.NumJokers == null)
|
||||
return;
|
||||
|
||||
if (_ScreenSongOptions.Selection.NumJokers.Length < TeamNr)
|
||||
return;
|
||||
|
||||
if (_ScreenSongOptions.Selection.NumJokers[TeamNr] > 0)
|
||||
_ScreenSongOptions.Selection.NumJokers[TeamNr]--;
|
||||
}
|
||||
#endregion Implementation
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Vocaluxe.PartyModes
|
||||
{
|
||||
public class CPartyModeNone : CPartyMode
|
||||
{
|
||||
//just a dummy for normal game mode
|
||||
public CPartyModeNone()
|
||||
{
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||
_ScreenSongOptions.Selection.PartyMode = false;
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = true;
|
||||
_ScreenSongOptions.Selection.NumJokers = null;
|
||||
|
||||
_ScreenSongOptions.Sorting.SearchString = String.Empty;
|
||||
_ScreenSongOptions.Sorting.SearchStringVisible = false;
|
||||
}
|
||||
|
||||
public override ScreenSongOptions GetScreenSongOptions()
|
||||
{
|
||||
_ScreenSongOptions.Sorting.SongSorting = _Base.Config.GetSongSorting();
|
||||
_ScreenSongOptions.Sorting.Tabs = _Base.Config.GetTabs();
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = _Base.Config.GetIgnoreArticles();
|
||||
|
||||
return _ScreenSongOptions;
|
||||
}
|
||||
|
||||
public override void SetSearchString(string SearchString, bool Visible)
|
||||
{
|
||||
_ScreenSongOptions.Sorting.SearchString = SearchString;
|
||||
_ScreenSongOptions.Sorting.SearchStringVisible = Visible;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Vocaluxe.Menu;
|
||||
|
||||
namespace Vocaluxe.PartyModes
|
||||
{
|
||||
public class CScreenPartyDummy : CMenu
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
const int ScreenVersion = 1;
|
||||
private CText Warning;
|
||||
|
||||
public CScreenPartyDummy()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeName = "ScreenPartyDummy";
|
||||
_ScreenVersion = ScreenVersion;
|
||||
}
|
||||
|
||||
public override void LoadTheme()
|
||||
{
|
||||
Warning = GetNewText();
|
||||
Warning.Height = 100f;
|
||||
Warning.X = 150;
|
||||
Warning.Y = 300;
|
||||
Warning.Fon = "Normal";
|
||||
Warning.Style = EStyle.Normal;
|
||||
Warning.Color = new SColorF(1f, 0f, 0f, 1f);
|
||||
Warning.SColor = new SColorF(1f, 0f, 0f, 1f);
|
||||
Warning.Text = "SOMETHING WENT WRONG!";
|
||||
AddText(Warning);
|
||||
}
|
||||
|
||||
public override void ReloadTheme()
|
||||
{
|
||||
}
|
||||
|
||||
public override void ReloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public override void SaveTheme()
|
||||
{
|
||||
}
|
||||
|
||||
public override void UnloadTextures()
|
||||
{
|
||||
}
|
||||
|
||||
public override bool HandleInput(KeyEvent KeyEvent)
|
||||
{
|
||||
base.HandleInput(KeyEvent);
|
||||
|
||||
if (KeyEvent.KeyPressed)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
FadeTo(EScreens.ScreenParty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool HandleMouse(MouseEvent MouseEvent)
|
||||
{
|
||||
base.HandleMouse(MouseEvent);
|
||||
|
||||
if (MouseEvent.LB && IsMouseOver(MouseEvent))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (MouseEvent.RB)
|
||||
{
|
||||
FadeTo(EScreens.ScreenParty);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
}
|
||||
|
||||
public override bool UpdateGame()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Draw()
|
||||
{
|
||||
base.Draw();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
base.OnClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Vocaluxe.Menu;
|
||||
|
||||
namespace Vocaluxe.PartyModes
|
||||
{
|
||||
#region Structs
|
||||
public struct ScreenSongOptions
|
||||
{
|
||||
public SortingOptions Sorting;
|
||||
public SelectionOptions Selection;
|
||||
}
|
||||
|
||||
public struct SortingOptions
|
||||
{
|
||||
public ESongSorting SongSorting;
|
||||
public EOffOn Tabs;
|
||||
public EOffOn IgnoreArticles;
|
||||
public string SearchString;
|
||||
public bool SearchStringVisible;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration of song selection options
|
||||
/// </summary>
|
||||
public struct SelectionOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Choosing song only by random
|
||||
/// </summary>
|
||||
public bool RandomOnly;
|
||||
|
||||
/// <summary>
|
||||
/// If true, it is not allowed to go to MainScreen nor open the playlist nor open the song menu
|
||||
/// </summary>
|
||||
public bool PartyMode;
|
||||
|
||||
/// <summary>
|
||||
/// If true, it is not alled to change or leave the category. It's only valid if Tabs=On.
|
||||
/// </summary>
|
||||
public bool CategoryChangeAllowed;
|
||||
|
||||
/// <summary>
|
||||
/// The number of jokers left for each team
|
||||
/// </summary>
|
||||
public int[] NumJokers;
|
||||
}
|
||||
#endregion Structs
|
||||
|
||||
public interface IPartyMode
|
||||
{
|
||||
bool Init(string Folder);
|
||||
void Initialize(Basic Base);
|
||||
|
||||
CMenu GetNextPartyScreen();
|
||||
EScreens GetStartScreen();
|
||||
EScreens GetMainScreen();
|
||||
ScreenSongOptions GetScreenSongOptions();
|
||||
|
||||
void SetSearchString(string SearchString, bool Visible);
|
||||
|
||||
void JokerUsed(int TeamNr);
|
||||
}
|
||||
}
|
||||
@@ -15,91 +15,91 @@
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWin|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WIN;ARCH_X86</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWin|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>WIN;ARCH_X86</DefineConstants>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWin|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WIN;ARCH_X64</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>WIN;ARCH_X64</DefineConstants>
|
||||
<DefineConstants>WIN</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugLinux|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX;ARCH_X86</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLinux|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>LINUX;ARCH_X86</DefineConstants>
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX;ARCH_X64</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseLinux|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Output\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<DefineConstants>LINUX;ARCH_X64</DefineConstants>
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@@ -110,6 +110,39 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Menu\CBackground.cs" />
|
||||
<Compile Include="Menu\CButton.cs" />
|
||||
<Compile Include="Menu\CEqualizer.cs" />
|
||||
<Compile Include="Menu\CHelper.cs" />
|
||||
<Compile Include="Menu\CInteraction.cs" />
|
||||
<Compile Include="Menu\CLyric.cs" />
|
||||
<Compile Include="Menu\CMenu.cs" />
|
||||
<Compile Include="Menu\CMenuParty.cs" />
|
||||
<Compile Include="Menu\CNameSelection.cs" />
|
||||
<Compile Include="Menu\CObjectInteractions.cs" />
|
||||
<Compile Include="Menu\CParticle.cs" />
|
||||
<Compile Include="Menu\CPlaylist.cs" />
|
||||
<Compile Include="Menu\CSelectSlide.cs" />
|
||||
<Compile Include="Menu\CStatic.cs" />
|
||||
<Compile Include="Menu\CText.cs" />
|
||||
<Compile Include="Menu\IMenu.cs" />
|
||||
<Compile Include="Menu\IMenuElement.cs" />
|
||||
<Compile Include="Menu\SingNotes\CNotes.cs" />
|
||||
<Compile Include="Menu\SingNotes\CSingNotes.cs" />
|
||||
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
|
||||
<Compile Include="Menu\SingNotes\ISingNotes.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSong.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenu.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenuBook.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenuDreidel.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenuFramework.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenuList.cs" />
|
||||
<Compile Include="Menu\SongMenu\CSongMenuTileBoard.cs" />
|
||||
<Compile Include="Menu\SongMenu\ISongMenu.cs" />
|
||||
<Compile Include="PartyModes\CPartyMode.cs" />
|
||||
<Compile Include="PartyModes\CPartyModeNone.cs" />
|
||||
<Compile Include="PartyModes\CScreenPartyDummy.cs" />
|
||||
<Compile Include="PartyModes\IPartyMode.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
Reference in new issue
Block a user