Auto cleanup of VocaluxeLib

This commit is contained in:
Flamefire committed 2013-03-22 21:12:45 +01:00
1 parent b497b58740
commit efab579188
37 files changed
+642 -1155

No files matched your search

+29 -23
View File
@@ -8,26 +8,32 @@
// "Meldung(en) unterdrücken", und klicken Sie auf "In Projektunterdrückungsdatei". // "Meldung(en) unterdrücken", und klicken Sie auf "In Projektunterdrückungsdatei".
// Sie müssen dieser Datei nicht manuell Unterdrückungen hinzufügen. // Sie müssen dieser Datei nicht manuell Unterdrückungen hinzufügen.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Vocaluxe.Menu.CHelper.TryParse(System.String,System.Single@)", Scope = "member", Target = "Vocaluxe.Menu.SongMenu.CSong.#ReadHeader(System.String)")] using System.Diagnostics.CodeAnalysis;
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "System.Int32.TryParse(System.String,System.Int32@)", Scope = "member", Target = "Vocaluxe.Menu.SongMenu.CSong.#ReadNotes(System.String,System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Config")] [assembly:
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Settings")] SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Vocaluxe.Menu.CHelper.TryParse(System.String,System.Single@)", Scope = "member",
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Theme")] Target = "Vocaluxe.Menu.SongMenu.CSong.#ReadHeader(System.String)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Helper")] [assembly:
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Log")] SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "System.Int32.TryParse(System.String,System.Int32@)", Scope = "member",
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#BackgroundMusic")] Target = "Vocaluxe.Menu.SongMenu.CSong.#ReadNotes(System.String,System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Drawing")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Config")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Graphics")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Settings")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Fonts")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Theme")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Language")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Helper")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Game")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Log")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Profiles")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#BackgroundMusic")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Record")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Drawing")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Songs")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Graphics")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Video")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Fonts")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Sound")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Language")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Cover")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Game")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#DataBase")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Profiles")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Input")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Record")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Playlist")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Songs")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "Vocaluxe.Menu.EColorDeep")] [assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Video")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Sound")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Cover")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#DataBase")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Input")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Playlist")]
[assembly: SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "Vocaluxe.Menu.EColorDeep")]
+16 -26
View File
@@ -26,10 +26,10 @@ namespace VocaluxeLib.Menu
public class CBackground : IMenuElement public class CBackground : IMenuElement
{ {
private int _PartyModeID; private readonly int _PartyModeID;
private SThemeBackground _Theme; private SThemeBackground _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
public SColorF Color; public SColorF Color;
public string GetThemeName() public string GetThemeName()
@@ -43,7 +43,7 @@ namespace VocaluxeLib.Menu
_PartyModeID = PartyModeID; _PartyModeID = PartyModeID;
_ThemeLoaded = false; _ThemeLoaded = false;
_Theme = new SThemeBackground(); _Theme = new SThemeBackground();
Color = new SColorF(0f, 0f, 0f, 1f); Color = new SColorF(0f, 0f, 0f, 1f);
} }
#endregion Constructors #endregion Constructors
@@ -54,16 +54,14 @@ namespace VocaluxeLib.Menu
string item = XmlPath + "/" + ElementName; string item = XmlPath + "/" + ElementName;
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.TryGetEnumValue<EBackgroundTypes>(item + "/Type", ref _Theme.Type); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
bool vid = xmlReader.GetValue(item + "/Video", ref _Theme.VideoName, String.Empty); bool vid = xmlReader.GetValue(item + "/Video", ref _Theme.VideoName, String.Empty);
bool tex = xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); bool tex = xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
_ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None; _ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else else
{ {
bool success = true; bool success = true;
@@ -80,7 +78,7 @@ namespace VocaluxeLib.Menu
{ {
_Theme.Name = ElementName; _Theme.Name = ElementName;
LoadTextures(); LoadTextures();
} }
return _ThemeLoaded; return _ThemeLoaded;
} }
@@ -102,9 +100,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Background color for type \"Color\" from ColorScheme (high priority)"); writer.WriteComment("<Color>: Background color for type \"Color\" from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)"); writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0) if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName); writer.WriteElementString("Color", _Theme.ColorName);
}
else else
{ {
if (_Theme.Type != EBackgroundTypes.None) if (_Theme.Type != EBackgroundTypes.None)
@@ -152,19 +148,17 @@ namespace VocaluxeLib.Menu
if (_Theme.TextureName.Length > 0 && if (_Theme.TextureName.Length > 0 &&
(_Theme.Type == EBackgroundTypes.Texture || (_Theme.Type == EBackgroundTypes.Texture ||
(_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok)))) (_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok))))
ok = DrawTexture(); ok = DrawTexture();
if (_Theme.Type == EBackgroundTypes.Color || _Theme.Type == EBackgroundTypes.Texture && !ok || if (_Theme.Type == EBackgroundTypes.Color || _Theme.Type == EBackgroundTypes.Texture && !ok ||
(_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF && !ok)) (_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF && !ok))
DrawColor(); DrawColor();
return true; return true;
} }
public void UnloadTextures() public void UnloadTextures() {}
{
}
public void LoadTextures() public void LoadTextures()
{ {
@@ -175,14 +169,14 @@ namespace VocaluxeLib.Menu
public void ReloadTextures() public void ReloadTextures()
{ {
UnloadTextures(); UnloadTextures();
LoadTextures(); LoadTextures();
} }
#endregion public #endregion public
#region internal #region internal
private void DrawColor() private void DrawColor()
{ {
SRectF bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar()/4); SRectF bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4);
CBase.Drawing.DrawColor(Color, bounds); CBase.Drawing.DrawColor(Color, bounds);
} }
@@ -234,13 +228,9 @@ namespace VocaluxeLib.Menu
#endregion internal #endregion internal
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY) {}
{
}
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH) {}
{
}
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+4 -5
View File
@@ -1,5 +1,4 @@
namespace VocaluxeLib.Menu
namespace VocaluxeLib.Menu
{ {
public static class CBase public static class CBase
{ {
@@ -25,8 +24,8 @@ namespace VocaluxeLib.Menu
public static IPlaylist Playlist; public static IPlaylist Playlist;
public static void Assign(IConfig config, ISettings settings, ITheme theme, IHelper helper, ILog log, IBackgroundMusic backgroundMusic, public static void Assign(IConfig config, ISettings settings, ITheme theme, IHelper helper, ILog log, IBackgroundMusic backgroundMusic,
IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record, IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record,
ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IInputs input, IPlaylist playlist) ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IInputs input, IPlaylist playlist)
{ {
Config = config; Config = config;
Settings = settings; Settings = settings;
@@ -50,4 +49,4 @@ namespace VocaluxeLib.Menu
Playlist = playlist; Playlist = playlist;
} }
} }
} }
+10 -18
View File
@@ -18,7 +18,7 @@ namespace VocaluxeLib.Menu
{ {
private SThemeButton _Theme; private SThemeButton _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
private int _PartyModeID; private readonly int _PartyModeID;
public STexture Texture; public STexture Texture;
public STexture STexture; public STexture STexture;
@@ -29,7 +29,7 @@ namespace VocaluxeLib.Menu
public bool SelText; public bool SelText;
public CText Text; public CText Text;
public CText SText; public CText SText;
public bool Reflection; public bool Reflection;
public float ReflectionSpace; public float ReflectionSpace;
public float ReflectionHeight; public float ReflectionHeight;
@@ -135,7 +135,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", ref _Theme.STextureName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", ref _Theme.STextureName, String.Empty);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref Rect.Z); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref Rect.Z);
@@ -143,9 +143,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -155,9 +153,7 @@ namespace VocaluxeLib.Menu
} }
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty)) if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SColor.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SColor.R);
@@ -174,8 +170,8 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= SText.LoadTheme(item, "SText", xmlReader, SkinIndex, true); _ThemeLoaded &= SText.LoadTheme(item, "SText", xmlReader, SkinIndex, true);
SText.Z = Rect.Z; SText.Z = Rect.Z;
} }
//Reflections //Reflections
if (xmlReader.ItemExists(item + "/Reflection")) if (xmlReader.ItemExists(item + "/Reflection"))
{ {
@@ -225,9 +221,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Button color from ColorScheme (high priority)"); writer.WriteComment("<Color>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)"); writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0) if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName); writer.WriteElementString("Color", _Theme.ColorName);
}
else else
{ {
writer.WriteElementString("R", Color.R.ToString("#0.00")); writer.WriteElementString("R", Color.R.ToString("#0.00"));
@@ -239,9 +233,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<SColor>: Selected button color from ColorScheme (high priority)"); writer.WriteComment("<SColor>: Selected button color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)"); writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName.Length > 0) if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName); writer.WriteElementString("SColor", _Theme.SColorName);
}
else else
{ {
writer.WriteElementString("SR", SColor.R.ToString("#0.00")); writer.WriteElementString("SR", SColor.R.ToString("#0.00"));
@@ -308,7 +300,7 @@ namespace VocaluxeLib.Menu
texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
CBase.Drawing.DrawTexture(texture, Rect, Color); CBase.Drawing.DrawTexture(texture, Rect, Color);
if (Reflection) if (Reflection)
{ {
CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, ReflectionSpace, ReflectionHeight); CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, ReflectionSpace, ReflectionHeight);
@@ -317,7 +309,7 @@ namespace VocaluxeLib.Menu
else else
Text.DrawRelative(Rect.X, Rect.Y); Text.DrawRelative(Rect.X, Rect.Y);
} }
else if(!SelText) else if (!SelText)
{ {
if (Texture.index != -1) if (Texture.index != -1)
texture = Texture; texture = Texture;
@@ -334,7 +326,7 @@ namespace VocaluxeLib.Menu
else else
Text.DrawRelative(Rect.X, Rect.Y); Text.DrawRelative(Rect.X, Rect.Y);
} }
else if(SelText) else if (SelText)
{ {
if (STexture.index != -1) if (STexture.index != -1)
texture = STexture; texture = STexture;
@@ -377,7 +369,7 @@ namespace VocaluxeLib.Menu
public void ReloadTextures() public void ReloadTextures()
{ {
UnloadTextures(); UnloadTextures();
LoadTextures(); LoadTextures();
} }
#region ThemeEdit #region ThemeEdit
@@ -399,4 +391,4 @@ namespace VocaluxeLib.Menu
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+7 -18
View File
@@ -9,7 +9,6 @@ namespace VocaluxeLib.Menu
{ {
public static class CHelper public static class CHelper
{ {
public static int nCk(int n, int k) public static int nCk(int n, int k)
{ {
if (k > n) if (k > n)
@@ -29,14 +28,12 @@ namespace VocaluxeLib.Menu
long nk = k; long nk = k;
for (long i = 1; i <= k - 1; i++) for (long i = 1; i <= k - 1; i++)
{
result = result * (n - i) / (i + 1); result = result * (n - i) / (i + 1);
}
return (int)result; return (int)result;
} }
/// <summary> /// <summary>
/// Concat strings into one string with ", " as separator. /// Concat strings into one string with ", " as separator.
/// </summary> /// </summary>
public static string ListStrings(string[] str) public static string ListStrings(string[] str)
{ {
@@ -73,7 +70,7 @@ namespace VocaluxeLib.Menu
return 0; return 0;
} }
int result = 0; int result = 0;
if(int.TryParse(value, out result)) if (int.TryParse(value, out result))
return result; return result;
return 0; return 0;
} }
@@ -128,8 +125,6 @@ namespace VocaluxeLib.Menu
Rect = new RectangleF(Left, Upper, Rigth - Left, Lower - Upper); Rect = new RectangleF(Left, Upper, Rigth - Left, Lower - Upper);
} }
public static List<string> ListFiles(string path, string cast) public static List<string> ListFiles(string path, string cast)
{ {
return ListFiles(path, cast, false, false); return ListFiles(path, cast, false, false);
@@ -147,7 +142,6 @@ namespace VocaluxeLib.Menu
try try
{ {
foreach (FileInfo file in dir.GetFiles(cast)) foreach (FileInfo file in dir.GetFiles(cast))
{ {
if (!fullpath) if (!fullpath)
@@ -159,15 +153,10 @@ namespace VocaluxeLib.Menu
if (recursive) if (recursive)
{ {
foreach (DirectoryInfo di in dir.GetDirectories()) foreach (DirectoryInfo di in dir.GetDirectories())
{
files.AddRange(ListFiles(di.FullName, cast, recursive, fullpath)); files.AddRange(ListFiles(di.FullName, cast, recursive, fullpath));
}
} }
} }
catch (Exception) catch (Exception) {}
{
}
return files; return files;
} }
@@ -175,11 +164,11 @@ namespace VocaluxeLib.Menu
public static bool TryParse<T>(string value, out T result) public static bool TryParse<T>(string value, out T result)
where T : struct where T : struct
{ {
return TryParse<T>(value, out result, false); return TryParse(value, out result, false);
} }
public static bool TryParse<T>(string value, out T result, bool ignoreCase) public static bool TryParse<T>(string value, out T result, bool ignoreCase)
where T : struct where T : struct
{ {
result = default(T); result = default(T);
try try
@@ -187,7 +176,7 @@ namespace VocaluxeLib.Menu
result = (T)Enum.Parse(typeof(T), value, ignoreCase); result = (T)Enum.Parse(typeof(T), value, ignoreCase);
return true; return true;
} }
catch { } catch {}
return false; return false;
} }
@@ -243,4 +232,4 @@ namespace VocaluxeLib.Menu
return Result; return Result;
} }
} }
} }
+12 -13
View File
@@ -1,5 +1,4 @@
namespace VocaluxeLib.Menu
namespace VocaluxeLib.Menu
{ {
public enum EType public enum EType
{ {
@@ -19,8 +18,8 @@ namespace VocaluxeLib.Menu
class CInteraction class CInteraction
{ {
private int _Num; private readonly int _Num;
private EType _Type; private readonly EType _Type;
public int Num public int Num
{ {
@@ -37,14 +36,14 @@ namespace VocaluxeLib.Menu
get get
{ {
return (_Type == EType.TBackground || return (_Type == EType.TBackground ||
_Type == EType.TNameSelection || _Type == EType.TNameSelection ||
_Type == EType.TText || _Type == EType.TText ||
_Type == EType.TStatic || _Type == EType.TStatic ||
_Type == EType.TSongMenu || _Type == EType.TSongMenu ||
_Type == EType.TLyric || _Type == EType.TLyric ||
_Type == EType.TSingNote || _Type == EType.TSingNote ||
_Type == EType.TEqualizer || _Type == EType.TEqualizer ||
_Type == EType.TPlaylist); _Type == EType.TPlaylist);
} }
} }
@@ -54,4 +53,4 @@ namespace VocaluxeLib.Menu
_Type = type; _Type = type;
} }
} }
} }
+20 -33
View File
@@ -25,11 +25,11 @@ namespace VocaluxeLib.Menu
public class CLyric : IMenuElement public class CLyric : IMenuElement
{ {
private int _PartyModeID; private readonly int _PartyModeID;
private SThemeLyrics _Theme; private SThemeLyrics _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
private List<SNote> _Notes; private readonly List<SNote> _Notes;
private CText _Text; private CText _Text;
private float _X; private float _X;
@@ -115,9 +115,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -127,9 +125,7 @@ namespace VocaluxeLib.Menu
} }
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty)) if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out ColorProcessed); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out ColorProcessed);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref ColorProcessed.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref ColorProcessed.R);
@@ -163,9 +159,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Lyric text color from ColorScheme (high priority)"); writer.WriteComment("<Color>: Lyric text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)"); writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0) if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName); writer.WriteElementString("Color", _Theme.ColorName);
}
else else
{ {
writer.WriteElementString("R", Color.R.ToString("#0.00")); writer.WriteElementString("R", Color.R.ToString("#0.00"));
@@ -177,9 +171,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)"); writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)"); writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName.Length > 0) if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName); writer.WriteElementString("SColor", _Theme.SColorName);
}
else else
{ {
writer.WriteElementString("SR", ColorProcessed.R.ToString("#0.00")); writer.WriteElementString("SR", ColorProcessed.R.ToString("#0.00"));
@@ -215,7 +207,7 @@ namespace VocaluxeLib.Menu
if (n.Type == ENoteType.Freestyle) if (n.Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic; _Text.Style = EStyle.BoldItalic;
RectangleF rect = CBase.Drawing.GetTextBounds(_Text); RectangleF rect = CBase.Drawing.GetTextBounds(_Text);
_width += rect.Width; _width += rect.Width;
_Notes.Add(n); _Notes.Add(n);
@@ -229,7 +221,7 @@ namespace VocaluxeLib.Menu
public float GetCurrentLyricPosX() public float GetCurrentLyricPosX()
{ {
return _X - _width / 2; return _X - _width / 2;
} }
#region draw #region draw
@@ -254,14 +246,14 @@ namespace VocaluxeLib.Menu
default: default:
DrawSlide(ActualBeat); DrawSlide(ActualBeat);
break; break;
} }
} }
} }
private void DrawSlide(float CurrentBeat) private void DrawSlide(float CurrentBeat)
{ {
float x = _X - _width / 2; float x = _X - _width / 2;
foreach (SNote note in _Notes) foreach (SNote note in _Notes)
{ {
_Text.X = x; _Text.X = x;
@@ -277,7 +269,7 @@ namespace VocaluxeLib.Menu
if (CurrentBeat <= note.EndBeat) if (CurrentBeat <= note.EndBeat)
{ {
_Text.Color = ColorProcessed; _Text.Color = ColorProcessed;
float diff = note.EndBeat - note.StartBeat; float diff = note.EndBeat - note.StartBeat;
if (diff == 0) if (diff == 0)
@@ -291,17 +283,16 @@ namespace VocaluxeLib.Menu
} }
else else
{ {
_Text.Color = ColorProcessed; _Text.Color = ColorProcessed;
_Text.Draw(); _Text.Draw();
} }
} }
else else
{ {
_Text.Color = Color; _Text.Color = Color;
_Text.Draw(); _Text.Draw();
} }
x += rect.Width; x += rect.Width;
} }
} }
@@ -334,9 +325,9 @@ namespace VocaluxeLib.Menu
if (CurrentBeat >= _Notes[note].StartBeat) if (CurrentBeat >= _Notes[note].StartBeat)
{ {
bool last = note == _Notes.Count -1; bool last = note == _Notes.Count - 1;
int endbeat = _Notes[note].EndBeat; int endbeat = _Notes[note].EndBeat;
if (note < _Notes.Count -1) if (note < _Notes.Count - 1)
endbeat = _Notes[note + 1].StartBeat - 1; endbeat = _Notes[note + 1].StartBeat - 1;
if (CurrentBeat <= endbeat) if (CurrentBeat <= endbeat)
@@ -355,7 +346,6 @@ namespace VocaluxeLib.Menu
_Text.Draw(); _Text.Draw();
} }
} }
else else
{ {
@@ -363,7 +353,7 @@ namespace VocaluxeLib.Menu
_Text.Color = Color; _Text.Color = Color;
_Text.Draw(); _Text.Draw();
} }
x += rect.Width; x += rect.Width;
} }
@@ -428,16 +418,16 @@ namespace VocaluxeLib.Menu
if (CurrentBeat >= note.StartBeat) if (CurrentBeat >= note.StartBeat)
{ {
_Text.Color = ColorProcessed; _Text.Color = ColorProcessed;
_Text.Draw(); _Text.Draw();
} }
else else
{ {
// not passed // not passed
_Text.Color = Color; _Text.Color = Color;
_Text.Draw(); _Text.Draw();
} }
x += rect.Width; x += rect.Width;
} }
} }
@@ -491,15 +481,14 @@ namespace VocaluxeLib.Menu
_Text.Draw(); _Text.Draw();
} }
} }
else else
{ {
// not passed // not passed
_Text.Color = Color; _Text.Color = Color;
_Text.Draw(); _Text.Draw();
} }
x += rect.Width; x += rect.Width;
} }
@@ -539,9 +528,7 @@ namespace VocaluxeLib.Menu
} }
#endregion draw #endregion draw
public void UnloadTextures() public void UnloadTextures() {}
{
}
public void LoadTextures() public void LoadTextures()
{ {
@@ -582,4 +569,4 @@ namespace VocaluxeLib.Menu
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+26 -116
View File
@@ -19,7 +19,7 @@ namespace VocaluxeLib.Menu
public abstract class CMenu : IMenu public abstract class CMenu : IMenu
{ {
private List<CInteraction> _Interactions; private List<CInteraction> _Interactions;
private int _Selection = 0; private int _Selection;
private string _ThemePath = String.Empty; private string _ThemePath = String.Empty;
protected int _PartyModeID = -1; protected int _PartyModeID = -1;
@@ -37,7 +37,6 @@ namespace VocaluxeLib.Menu
private COrderedDictionaryLite<CParticleEffect> _ParticleEffects; private COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
private COrderedDictionaryLite<CScreenSetting> _ScreenSettings; private COrderedDictionaryLite<CScreenSetting> _ScreenSettings;
private int _PrevMouseX; private int _PrevMouseX;
private int _PrevMouseY; private int _PrevMouseY;
@@ -78,14 +77,10 @@ namespace VocaluxeLib.Menu
get { return _ScreenVersion; } get { return _ScreenVersion; }
} }
public CMenu()
{
}
public virtual void Init() public virtual void Init()
{ {
_ThemeName = this.GetType().Name; _ThemeName = GetType().Name;
if(_ThemeName[0]=='C' && Char.IsUpper(_ThemeName[1])) if (_ThemeName[0] == 'C' && Char.IsUpper(_ThemeName[1]))
_ThemeName = _ThemeName.Remove(0, 1); _ThemeName = _ThemeName.Remove(0, 1);
_Interactions = new List<CInteraction>(); _Interactions = new List<CInteraction>();
@@ -135,7 +130,6 @@ namespace VocaluxeLib.Menu
} }
#region ThemeHandler #region ThemeHandler
protected delegate void DAddElement<T>(T Element, String key); protected delegate void DAddElement<T>(T Element, String key);
private void LoadThemeElement<T>(string[] Elements, DAddElement<T> MAddElement, CXMLReader xmlReader, int SkinIndex) where T : IMenuElement private void LoadThemeElement<T>(string[] Elements, DAddElement<T> MAddElement, CXMLReader xmlReader, int SkinIndex) where T : IMenuElement
@@ -146,13 +140,9 @@ namespace VocaluxeLib.Menu
{ {
T Element = (T)Activator.CreateInstance(typeof(T), _PartyModeID); T Element = (T)Activator.CreateInstance(typeof(T), _PartyModeID);
if (Element.LoadTheme("//root/" + ThemeName, elName, xmlReader, SkinIndex)) if (Element.LoadTheme("//root/" + ThemeName, elName, xmlReader, SkinIndex))
{
MAddElement(Element, elName); MAddElement(Element, elName);
}
else else
{
CBase.Log.LogError("Can't load " + typeof(T).Name.Substring(1) + " \"" + elName + "\" in screen " + ThemeName); CBase.Log.LogError("Can't load " + typeof(T).Name.Substring(1) + " \"" + elName + "\" in screen " + ThemeName);
}
} }
} }
} }
@@ -204,7 +194,6 @@ namespace VocaluxeLib.Menu
string file = Path.Combine(_ThemePath, ThemeName + ".xml"); string file = Path.Combine(_ThemePath, ThemeName + ".xml");
using (XmlWriter writer = XmlWriter.Create(file, settings)) using (XmlWriter writer = XmlWriter.Create(file, settings))
{ {
writer.WriteStartDocument(); writer.WriteStartDocument();
writer.WriteStartElement("root"); writer.WriteStartElement("root");
@@ -278,136 +267,84 @@ namespace VocaluxeLib.Menu
public virtual void ReloadTextures() public virtual void ReloadTextures()
{ {
foreach (CBackground background in _Backgrounds) foreach (CBackground background in _Backgrounds)
{
background.ReloadTextures(); background.ReloadTextures();
}
foreach (CButton button in _Buttons) foreach (CButton button in _Buttons)
{
button.ReloadTextures(); button.ReloadTextures();
}
foreach (CText text in _Texts) foreach (CText text in _Texts)
{
text.ReloadTextures(); text.ReloadTextures();
}
foreach (CStatic stat in _Statics) foreach (CStatic stat in _Statics)
{
stat.ReloadTextures(); stat.ReloadTextures();
}
foreach (CSelectSlide slide in _SelectSlides) foreach (CSelectSlide slide in _SelectSlides)
{
slide.ReloadTextures(); slide.ReloadTextures();
}
foreach (CSongMenu sm in _SongMenus) foreach (CSongMenu sm in _SongMenus)
{
sm.ReloadTextures(); sm.ReloadTextures();
}
foreach (CLyric lyric in _Lyrics) foreach (CLyric lyric in _Lyrics)
{
lyric.ReloadTextures(); lyric.ReloadTextures();
}
foreach (CSingNotes sn in _SingNotes) foreach (CSingNotes sn in _SingNotes)
{
sn.ReloadTextures(); sn.ReloadTextures();
}
foreach (CNameSelection ns in _NameSelections) foreach (CNameSelection ns in _NameSelections)
{
ns.ReloadTextures(); ns.ReloadTextures();
}
foreach (CEqualizer eq in _Equalizers) foreach (CEqualizer eq in _Equalizers)
{
eq.ReloadTextures(); eq.ReloadTextures();
}
foreach (CPlaylist pls in _Playlists) foreach (CPlaylist pls in _Playlists)
{
pls.ReloadTextures(); pls.ReloadTextures();
}
foreach (CParticleEffect pe in _ParticleEffects) foreach (CParticleEffect pe in _ParticleEffects)
{
pe.ReloadTextures(); pe.ReloadTextures();
}
foreach (CScreenSetting se in _ScreenSettings) foreach (CScreenSetting se in _ScreenSettings)
{
se.ReloadTextures(); se.ReloadTextures();
}
} }
public virtual void UnloadTextures() public virtual void UnloadTextures()
{ {
foreach (CBackground background in _Backgrounds) foreach (CBackground background in _Backgrounds)
{
background.UnloadTextures(); background.UnloadTextures();
}
foreach (CButton button in _Buttons) foreach (CButton button in _Buttons)
{
button.UnloadTextures(); button.UnloadTextures();
}
foreach (CText text in _Texts) foreach (CText text in _Texts)
{
text.UnloadTextures(); text.UnloadTextures();
}
foreach (CStatic stat in _Statics) foreach (CStatic stat in _Statics)
{
stat.UnloadTextures(); stat.UnloadTextures();
}
foreach (CSelectSlide slide in _SelectSlides) foreach (CSelectSlide slide in _SelectSlides)
{
slide.UnloadTextures(); slide.UnloadTextures();
}
foreach (CSongMenu sm in _SongMenus) foreach (CSongMenu sm in _SongMenus)
{
sm.UnloadTextures(); sm.UnloadTextures();
}
foreach (CLyric lyric in _Lyrics) foreach (CLyric lyric in _Lyrics)
{
lyric.UnloadTextures(); lyric.UnloadTextures();
}
foreach (CSingNotes sn in _SingNotes) foreach (CSingNotes sn in _SingNotes)
{
sn.UnloadTextures(); sn.UnloadTextures();
}
foreach (CNameSelection ns in _NameSelections) foreach (CNameSelection ns in _NameSelections)
{
ns.UnloadTextures(); ns.UnloadTextures();
}
foreach (CPlaylist pls in _Playlists) foreach (CPlaylist pls in _Playlists)
{
pls.UnloadTextures(); pls.UnloadTextures();
}
foreach (CEqualizer eq in _Equalizers) foreach (CEqualizer eq in _Equalizers)
{
eq.UnloadTextures(); eq.UnloadTextures();
}
foreach (CParticleEffect pe in _ParticleEffects) foreach (CParticleEffect pe in _ParticleEffects)
{
pe.UnloadTextures(); pe.UnloadTextures();
}
foreach (CScreenSetting se in _ScreenSettings) foreach (CScreenSetting se in _ScreenSettings)
{
se.UnloadTextures(); se.UnloadTextures();
}
} }
public virtual void ReloadTheme(string XmlPath) public virtual void ReloadTheme(string XmlPath)
@@ -489,6 +426,7 @@ namespace VocaluxeLib.Menu
#endregion GetLists #endregion GetLists
#region ElementHandler #region ElementHandler
#region Create Elements #region Create Elements
public CButton GetNewButton() public CButton GetNewButton()
{ {
@@ -515,7 +453,6 @@ namespace VocaluxeLib.Menu
return new CText(x, y, z, h, mw, align, style, font, col, text); return new CText(x, y, z, h, mw, align, style, font, col, text);
} }
public CBackground GetNewBackground() public CBackground GetNewBackground()
{ {
return new CBackground(_PartyModeID); return new CBackground(_PartyModeID);
@@ -633,7 +570,6 @@ namespace VocaluxeLib.Menu
get { return _Equalizers; } get { return _Equalizers; }
} }
public COrderedDictionaryLite<CPlaylist> Playlists public COrderedDictionaryLite<CPlaylist> Playlists
{ {
get { return _Playlists; } get { return _Playlists; }
@@ -649,6 +585,7 @@ namespace VocaluxeLib.Menu
get { return _ScreenSettings; } get { return _ScreenSettings; }
} }
#endregion Get Arrays #endregion Get Arrays
#endregion ElementHandler #endregion ElementHandler
#region MenuHandler #region MenuHandler
@@ -673,9 +610,7 @@ namespace VocaluxeLib.Menu
} }
if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down) if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
{
KeyEvent.Handled = _NextInteraction(KeyEvent); KeyEvent.Handled = _NextInteraction(KeyEvent);
}
} }
else else
{ {
@@ -837,9 +772,7 @@ namespace VocaluxeLib.Menu
public abstract bool UpdateGame(); public abstract bool UpdateGame();
public virtual void ApplyVolume() public virtual void ApplyVolume() {}
{
}
public virtual void OnShow() public virtual void OnShow()
{ {
@@ -862,17 +795,13 @@ namespace VocaluxeLib.Menu
protected void ResumeBG() protected void ResumeBG()
{ {
foreach (CBackground bg in _Backgrounds) foreach (CBackground bg in _Backgrounds)
{
bg.Resume(); bg.Resume();
}
} }
protected void PauseBG() protected void PauseBG()
{ {
foreach (CBackground bg in _Backgrounds) foreach (CBackground bg in _Backgrounds)
{
bg.Pause(); bg.Pause();
}
} }
#region Drawing #region Drawing
@@ -886,9 +815,7 @@ namespace VocaluxeLib.Menu
public void DrawBG() public void DrawBG()
{ {
foreach (CBackground bg in _Backgrounds) foreach (CBackground bg in _Backgrounds)
{
bg.Draw(); bg.Draw();
}
} }
public void DrawFG() public void DrawFG()
@@ -901,15 +828,15 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
if (_IsVisible(i) && ( if (_IsVisible(i) && (
_Interactions[i].Type == EType.TButton || _Interactions[i].Type == EType.TButton ||
_Interactions[i].Type == EType.TSelectSlide || _Interactions[i].Type == EType.TSelectSlide ||
_Interactions[i].Type == EType.TStatic || _Interactions[i].Type == EType.TStatic ||
_Interactions[i].Type == EType.TNameSelection || _Interactions[i].Type == EType.TNameSelection ||
_Interactions[i].Type == EType.TText || _Interactions[i].Type == EType.TText ||
_Interactions[i].Type == EType.TSongMenu || _Interactions[i].Type == EType.TSongMenu ||
_Interactions[i].Type == EType.TEqualizer || _Interactions[i].Type == EType.TEqualizer ||
_Interactions[i].Type == EType.TPlaylist || _Interactions[i].Type == EType.TPlaylist ||
_Interactions[i].Type == EType.TParticleEffect)) _Interactions[i].Type == EType.TParticleEffect))
{ {
ZSort zs = new ZSort(); ZSort zs = new ZSort();
zs.ID = i; zs.ID = i;
@@ -925,15 +852,11 @@ namespace VocaluxeLib.Menu
items.Sort(delegate(ZSort s1, ZSort s2) { return (s2.z.CompareTo(s1.z)); }); items.Sort(delegate(ZSort s1, ZSort s2) { return (s2.z.CompareTo(s1.z)); });
for (int i = 0; i < items.Count; i++) for (int i = 0; i < items.Count; i++)
{
_DrawInteraction(items[i].ID); _DrawInteraction(items[i].ID);
}
} }
#endregion Drawing #endregion Drawing
#region Elements #region Elements
public void AddBackground(CBackground bg) public void AddBackground(CBackground bg)
{ {
AddBackground(bg, null); AddBackground(bg, null);
@@ -998,7 +921,7 @@ namespace VocaluxeLib.Menu
{ {
AddScreenSetting(se, null); AddScreenSetting(se, null);
} }
public void AddBackground(CBackground bg, String key) public void AddBackground(CBackground bg, String key)
{ {
_AddInteraction(_Backgrounds.Add(bg, key), EType.TBackground); _AddInteraction(_Backgrounds.Add(bg, key), EType.TBackground);
@@ -1085,7 +1008,7 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the next element in a menu Interaction. /// Selects the next element in a menu Interaction.
/// </summary> /// </summary>
/// <returns>True if the next element is selected. False if either there is no next element or the Interaction does not provide such a method.</returns> /// <returns>True if the next element is selected. False if either there is no next element or the Interaction does not provide such a method.</returns>
public bool NextElement() public bool NextElement()
@@ -1097,7 +1020,7 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the previous element in a menu Interaction. /// Selects the previous element in a menu Interaction.
/// </summary> /// </summary>
/// <returns>True if the previous element is selected. False if either there is no next element or the Interaction does not provide such a method.</returns> /// <returns>True if the previous element is selected. False if either there is no next element or the Interaction does not provide such a method.</returns>
public bool PrevElement() public bool PrevElement()
@@ -1154,9 +1077,7 @@ namespace VocaluxeLib.Menu
if (_Interactions[_Selection].Type == EType.TSelectSlide) if (_Interactions[_Selection].Type == EType.TSelectSlide)
{ {
if (_SelectSlides[_Interactions[_Selection].Num].Visible) if (_SelectSlides[_Interactions[_Selection].Num].Visible)
{
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y); _SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y);
}
} }
} }
@@ -1170,9 +1091,7 @@ namespace VocaluxeLib.Menu
if (_Interactions[_Selection].Type == EType.TSelectSlide) if (_Interactions[_Selection].Type == EType.TSelectSlide)
{ {
if (_SelectSlides[_Interactions[_Selection].Num].Visible) if (_SelectSlides[_Interactions[_Selection].Num].Visible)
{
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y); _SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y);
}
} }
} }
@@ -1352,7 +1271,7 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the next best interaction in a menu. /// Selects the next best interaction in a menu.
/// </summary> /// </summary>
/// <param name="Key"></param> /// <param name="Key"></param>
/// <returns></returns> /// <returns></returns>
@@ -1364,9 +1283,7 @@ namespace VocaluxeLib.Menu
int[] elements = new int[4]; int[] elements = new int[4];
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{
Directions[i] = new KeyEvent(); Directions[i] = new KeyEvent();
}
Directions[0].Key = Keys.Up; Directions[0].Key = Keys.Up;
Directions[1].Key = Keys.Right; Directions[1].Key = Keys.Right;
@@ -1374,9 +1291,7 @@ namespace VocaluxeLib.Menu
Directions[3].Key = Keys.Left; Directions[3].Key = Keys.Left;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{
elements[i] = _GetNextElement(Directions[i], out Distances[i], out stages[i]); elements[i] = _GetNextElement(Directions[i], out Distances[i], out stages[i]);
}
int element = _Selection; int element = _Selection;
int stage = int.MaxValue; int stage = int.MaxValue;
@@ -1534,7 +1449,6 @@ namespace VocaluxeLib.Menu
if (vector.X > 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y)) if (vector.X > 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y))
inDirection = true; inDirection = true;
break; break;
} }
if (!inDirection) if (!inDirection)
return float.MaxValue; return float.MaxValue;
@@ -1571,7 +1485,6 @@ namespace VocaluxeLib.Menu
if (vector.X > 0f) if (vector.X > 0f)
inDirection = true; inDirection = true;
break; break;
} }
if (!inDirection) if (!inDirection)
return float.MaxValue; return float.MaxValue;
@@ -1580,7 +1493,7 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the next element in a menu interaction. /// Selects the next element in a menu interaction.
/// </summary> /// </summary>
/// <returns>True if the next element is selected. False if either there is no next element or the interaction does not provide such a method.</returns> /// <returns>True if the next element is selected. False if either there is no next element or the interaction does not provide such a method.</returns>
private bool _NextElement() private bool _NextElement()
@@ -1592,10 +1505,10 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the previous element in a menu interaction. /// Selects the previous element in a menu interaction.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method. /// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method.
/// </returns> /// </returns>
private bool _PrevElement() private bool _PrevElement()
{ {
@@ -1753,9 +1666,7 @@ namespace VocaluxeLib.Menu
return; return;
if (_Interactions[_Selection].Type == EType.TSelectSlide) if (_Interactions[_Selection].Type == EType.TSelectSlide)
{
_SelectSlides[_Interactions[_Selection].Num].Highlighted = !_SelectSlides[_Interactions[_Selection].Num].Highlighted; _SelectSlides[_Interactions[_Selection].Num].Highlighted = !_SelectSlides[_Interactions[_Selection].Num].Highlighted;
}
} }
private bool _IsHighlighted() private bool _IsHighlighted()
@@ -1944,13 +1855,12 @@ namespace VocaluxeLib.Menu
_ParticleEffects[_Interactions[interaction].Num].Draw(); _ParticleEffects[_Interactions[interaction].Num].Draw();
break; break;
//TODO: //TODO:
//case EType.TLyric: //case EType.TLyric:
// _Lyrics[_Interactions[interaction].Num].Draw(0); // _Lyrics[_Interactions[interaction].Num].Draw(0);
// break; // break;
} }
} }
#endregion InteractionHandling #endregion InteractionHandling
#region Theme Handling #region Theme Handling
+2 -5
View File
@@ -27,9 +27,7 @@ namespace VocaluxeLib.Menu
_PartyMode = PartyMode; _PartyMode = PartyMode;
} }
public virtual void DataToScreen(Object Data) public virtual void DataToScreen(Object Data) {}
{
}
/* /*
public sealed override void LoadTheme() public sealed override void LoadTheme()
@@ -48,6 +46,5 @@ namespace VocaluxeLib.Menu
{ {
} }
*/ */
} }
} }
+17 -57
View File
@@ -21,15 +21,13 @@ namespace VocaluxeLib.Menu
public class CNameSelection : IMenuElement public class CNameSelection : IMenuElement
{ {
class CTile private class CTile
{ {
public int PlayerNr; public int PlayerNr;
public CStatic Avatar; public readonly CStatic Avatar;
public CText Name; public readonly CText Name;
public CTile() public CTile() {}
{
}
public CTile(CStatic av, CText tex, int pl) public CTile(CStatic av, CText tex, int pl)
{ {
@@ -39,7 +37,7 @@ namespace VocaluxeLib.Menu
} }
} }
private int _PartyModeID; private readonly int _PartyModeID;
private SThemeNameSelection _Theme; private SThemeNameSelection _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
@@ -52,7 +50,7 @@ namespace VocaluxeLib.Menu
public bool Visible = true; public bool Visible = true;
public SRectF Rect; public SRectF Rect;
private List<CTile> _Tiles; private readonly List<CTile> _Tiles;
private STexture _TextureEmptyTile; private STexture _TextureEmptyTile;
private STexture _TextureTileSelected; private STexture _TextureTileSelected;
@@ -72,13 +70,12 @@ namespace VocaluxeLib.Menu
private int _actualSelection = -1; private int _actualSelection = -1;
public int Selection = -1; public int Selection = -1;
int _player = -1; private int _player = -1;
private List<int> VisibleProfiles; private readonly List<int> VisibleProfiles;
private CStatic PlayerSelector; private CStatic PlayerSelector;
public CNameSelection(int PartyModeID) public CNameSelection(int PartyModeID)
{ {
_PartyModeID = PartyModeID; _PartyModeID = PartyModeID;
@@ -116,9 +113,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", ref _Theme.TextureEmptyTileName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", ref _Theme.TextureEmptyTileName, String.Empty);
if (xmlReader.GetValue(item + "/ColorEmptyTile", ref _Theme.ColorEmptyTileName, String.Empty)) if (xmlReader.GetValue(item + "/ColorEmptyTile", ref _Theme.ColorEmptyTileName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, SkinIndex, out ColorEmptyTile); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, SkinIndex, out ColorEmptyTile);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref ColorEmptyTile.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref ColorEmptyTile.R);
@@ -138,11 +133,9 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/Space", ref _Theme.NameSpace); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/Space", ref _Theme.NameSpace);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/H", ref _Theme.NameHeight); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/H", ref _Theme.NameHeight);
_ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", ref _Theme.NameFont, "Normal"); _ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", ref _Theme.NameFont, "Normal");
_ThemeLoaded &= xmlReader.TryGetEnumValue<EStyle>(item + "/Tiles/Name/Style", ref _Theme.NameStyle); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Tiles/Name/Style", ref _Theme.NameStyle);
if (xmlReader.GetValue(item + "/Tiles/Name/Color", ref _Theme.NameColorName, String.Empty)) if (xmlReader.GetValue(item + "/Tiles/Name/Color", ref _Theme.NameColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, SkinIndex, out _Theme.NameColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, SkinIndex, out _Theme.NameColor);
}
else else
{ {
if (xmlReader.TryGetFloatValue(item + "/Tiles/Name/R", ref _Theme.NameColor.R)) if (xmlReader.TryGetFloatValue(item + "/Tiles/Name/R", ref _Theme.NameColor.R))
@@ -181,9 +174,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<ColorEmptyTile>: Static color from ColorScheme (high priority)"); writer.WriteComment("<ColorEmptyTile>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)"); writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorEmptyTileName.Length > 0) if (_Theme.ColorEmptyTileName.Length > 0)
{
writer.WriteElementString("ColorEmptyTile", _Theme.ColorEmptyTileName); writer.WriteElementString("ColorEmptyTile", _Theme.ColorEmptyTileName);
}
else else
{ {
writer.WriteElementString("R", ColorEmptyTile.R.ToString("#0.00")); writer.WriteElementString("R", ColorEmptyTile.R.ToString("#0.00"));
@@ -214,9 +205,7 @@ namespace VocaluxeLib.Menu
writer.WriteElementString("Font", _Theme.NameFont); writer.WriteElementString("Font", _Theme.NameFont);
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)"); writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
if (_Theme.NameColorName.Length > 0) if (_Theme.NameColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.NameColorName); writer.WriteElementString("Color", _Theme.NameColorName);
}
else else
{ {
writer.WriteElementString("R", _Theme.NameColor.R.ToString("#0.00")); writer.WriteElementString("R", _Theme.NameColor.R.ToString("#0.00"));
@@ -282,43 +271,34 @@ namespace VocaluxeLib.Menu
if (_actualSelection + 1 < _Tiles.Count) if (_actualSelection + 1 < _Tiles.Count)
{ {
if (_Tiles[_actualSelection + 1].PlayerNr != -1) if (_Tiles[_actualSelection + 1].PlayerNr != -1)
{
_actualSelection++; _actualSelection++;
}
} }
else else
{ {
int offset = _Offset; int offset = _Offset;
UpdateList(_Offset + 1); UpdateList(_Offset + 1);
if (offset != _Offset) if (offset != _Offset)
{
_actualSelection = 0; _actualSelection = 0;
}
} }
break; break;
case Keys.Left: case Keys.Left:
if (_actualSelection - 1 > -1) if (_actualSelection - 1 > -1)
{
_actualSelection--; _actualSelection--;
}
else if (_Offset > 0) else if (_Offset > 0)
{ {
UpdateList(_Offset - 1); UpdateList(_Offset - 1);
_actualSelection = _Tiles.Count-1; _actualSelection = _Tiles.Count - 1;
} }
break; break;
case Keys.Up: case Keys.Up:
if (_actualSelection - _NumW > -1) if (_actualSelection - _NumW > -1)
{
_actualSelection -= _NumW; _actualSelection -= _NumW;
}
else if (_Offset > 0) else if (_Offset > 0)
{ {
UpdateList(_Offset - 1); UpdateList(_Offset - 1);
_actualSelection += _Tiles.Count- _NumW; _actualSelection += _Tiles.Count - _NumW;
} }
break; break;
@@ -326,9 +306,7 @@ namespace VocaluxeLib.Menu
if (_actualSelection + _NumW < _Tiles.Count) if (_actualSelection + _NumW < _Tiles.Count)
{ {
if (_Tiles[_actualSelection + _NumW].PlayerNr != -1) if (_Tiles[_actualSelection + _NumW].PlayerNr != -1)
{
_actualSelection += _NumW; _actualSelection += _NumW;
}
} }
else else
{ {
@@ -367,7 +345,7 @@ namespace VocaluxeLib.Menu
_player = player; _player = player;
PlayerSelector.Color = CBase.Theme.GetPlayerColor(player); PlayerSelector.Color = CBase.Theme.GetPlayerColor(player);
} }
//Normal activation //Normal activation
else if (active) else if (active)
{ {
Selection = 0; Selection = 0;
@@ -376,7 +354,7 @@ namespace VocaluxeLib.Menu
PlayerSelector.Color = CBase.Theme.GetPlayerColor(player); PlayerSelector.Color = CBase.Theme.GetPlayerColor(player);
PlayerSelector.Visible = true; PlayerSelector.Visible = true;
} }
//Deactivate //Deactivate
else else
{ {
Selection = -1; Selection = -1;
@@ -390,13 +368,9 @@ namespace VocaluxeLib.Menu
{ {
UpdateVisibleProfiles(); UpdateVisibleProfiles();
if (_Tiles.Count * (_Offset + 1) - VisibleProfiles.Count >= _Tiles.Count * _Offset) if (_Tiles.Count * (_Offset + 1) - VisibleProfiles.Count >= _Tiles.Count * _Offset)
{
UpdateList(_Offset - 1); UpdateList(_Offset - 1);
}
else else
{
UpdateList(_Offset); UpdateList(_Offset);
}
} }
public void UpdateList(int offset) public void UpdateList(int offset)
@@ -430,9 +404,7 @@ namespace VocaluxeLib.Menu
foreach (CTile tile in _Tiles) foreach (CTile tile in _Tiles)
{ {
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent)) if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
{
isOver = true; isOver = true;
}
} }
return isOver; return isOver;
} }
@@ -442,9 +414,7 @@ namespace VocaluxeLib.Menu
foreach (CTile tile in _Tiles) foreach (CTile tile in _Tiles)
{ {
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent)) if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
{
return tile.PlayerNr; return tile.PlayerNr;
}
} }
return -1; return -1;
@@ -455,17 +425,13 @@ namespace VocaluxeLib.Menu
foreach (CTile tile in _Tiles) foreach (CTile tile in _Tiles)
{ {
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent)) if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
{
return tile.Avatar; return tile.Avatar;
}
} }
return new CStatic(_PartyModeID); return new CStatic(_PartyModeID);
} }
public void UnloadTextures() public void UnloadTextures() {}
{
}
public void LoadTextures() public void LoadTextures()
{ {
@@ -496,7 +462,8 @@ namespace VocaluxeLib.Menu
{ {
SRectF rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z); SRectF rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z);
CStatic tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect); CStatic tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect);
CText tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.NameSpace, rect.Z, _Theme.NameHeight, rect.W, EAlignment.Center, _Theme.NameStyle, _Theme.NameFont, _Theme.NameColor, ""); CText tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.NameSpace, rect.Z, _Theme.NameHeight, rect.W, EAlignment.Center, _Theme.NameStyle,
_Theme.NameFont, _Theme.NameColor, "");
_Tiles.Add(new CTile(tileStatic, tileText, -1)); _Tiles.Add(new CTile(tileStatic, tileText, -1));
} }
} }
@@ -510,21 +477,15 @@ namespace VocaluxeLib.Menu
bool visible = false; bool visible = false;
//Show profile only if active //Show profile only if active
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
{
visible = true; visible = true;
}
for (int p = 0; p < CBase.Game.GetNumPlayer(); p++) for (int p = 0; p < CBase.Game.GetNumPlayer(); p++)
{ {
//Don't show profile if is selected, but if selected and guest //Don't show profile if is selected, but if selected and guest
if (CBase.Game.GetPlayer()[p].ProfileID == i && CBase.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF) if (CBase.Game.GetPlayer()[p].ProfileID == i && CBase.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
{
visible = false; visible = false;
}
} }
if (visible) if (visible)
{
VisibleProfiles.Add(i); VisibleProfiles.Add(i);
}
} }
} }
@@ -546,6 +507,5 @@ namespace VocaluxeLib.Menu
Rect.H = 1; Rect.H = 1;
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+21 -45
View File
@@ -8,7 +8,7 @@ namespace VocaluxeLib.Menu
class CObjectInteractions class CObjectInteractions
{ {
private List<CInteraction> _Interactions; private List<CInteraction> _Interactions;
private int _Selection = 0; private int _Selection;
private List<CStatic> _Statics; private List<CStatic> _Statics;
private List<CText> _Texts; private List<CText> _Texts;
@@ -73,6 +73,7 @@ namespace VocaluxeLib.Menu
Active = false; Active = false;
} }
#region GetLists #region GetLists
public List<CButton> GetButtons() public List<CButton> GetButtons()
{ {
@@ -86,23 +87,19 @@ namespace VocaluxeLib.Menu
#endregion GetLists #endregion GetLists
#region ElementHandler #region ElementHandler
#region Get Arrays #region Get Arrays
public CButton[] Buttons public CButton[] Buttons
{ {
get get { return _Buttons.ToArray(); }
{
return _Buttons.ToArray();
}
} }
public CSelectSlide[] SelectSlides public CSelectSlide[] SelectSlides
{ {
get get { return _SelectSlides.ToArray(); }
{
return _SelectSlides.ToArray();
}
} }
#endregion Get Arrays #endregion Get Arrays
#endregion ElementHandler #endregion ElementHandler
#region MenuHandler #region MenuHandler
@@ -127,9 +124,7 @@ namespace VocaluxeLib.Menu
} }
if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down) if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
{
KeyEvent.Handled = _NextInteraction(KeyEvent); KeyEvent.Handled = _NextInteraction(KeyEvent);
}
} }
else else
{ {
@@ -173,10 +168,7 @@ namespace VocaluxeLib.Menu
public bool HandleInputThemeEditor(KeyEvent KeyEvent) public bool HandleInputThemeEditor(KeyEvent KeyEvent)
{ {
_UnsetHighlighted(_Selection); _UnsetHighlighted(_Selection);
if (KeyEvent.KeyPressed) if (KeyEvent.KeyPressed) {}
{
}
else else
{ {
switch (KeyEvent.Key) switch (KeyEvent.Key)
@@ -301,13 +293,13 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
if (_IsVisible(i) && ( if (_IsVisible(i) && (
_Interactions[i].Type == EType.TButton || _Interactions[i].Type == EType.TButton ||
_Interactions[i].Type == EType.TSelectSlide || _Interactions[i].Type == EType.TSelectSlide ||
_Interactions[i].Type == EType.TStatic || _Interactions[i].Type == EType.TStatic ||
_Interactions[i].Type == EType.TNameSelection || _Interactions[i].Type == EType.TNameSelection ||
_Interactions[i].Type == EType.TText || _Interactions[i].Type == EType.TText ||
_Interactions[i].Type == EType.TSongMenu || _Interactions[i].Type == EType.TSongMenu ||
_Interactions[i].Type == EType.TEqualizer)) _Interactions[i].Type == EType.TEqualizer))
{ {
ZSort zs = new ZSort(); ZSort zs = new ZSort();
zs.ID = i; zs.ID = i;
@@ -323,10 +315,7 @@ namespace VocaluxeLib.Menu
items.Sort(delegate(ZSort s1, ZSort s2) { return (s2.z.CompareTo(s1.z)); }); items.Sort(delegate(ZSort s1, ZSort s2) { return (s2.z.CompareTo(s1.z)); });
for (int i = 0; i < items.Count; i++) for (int i = 0; i < items.Count; i++)
{
_DrawInteraction(items[i].ID); _DrawInteraction(items[i].ID);
}
} }
#endregion Drawing #endregion Drawing
@@ -374,7 +363,7 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the next element in a menu interaction. /// Selects the next element in a menu interaction.
/// </summary> /// </summary>
/// <returns>True if the next element is selected. False if either there is no next element or the interaction does not provide such a method.</returns> /// <returns>True if the next element is selected. False if either there is no next element or the interaction does not provide such a method.</returns>
public bool NextElement() public bool NextElement()
@@ -386,7 +375,7 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the previous element in a menu interaction. /// Selects the previous element in a menu interaction.
/// </summary> /// </summary>
/// <returns>True if the previous element is selected. False if either there is no next element or the interaction does not provide such a method.</returns> /// <returns>True if the previous element is selected. False if either there is no next element or the interaction does not provide such a method.</returns>
public bool PrevElement() public bool PrevElement()
@@ -443,9 +432,7 @@ namespace VocaluxeLib.Menu
if (_Interactions[_Selection].Type == EType.TSelectSlide) if (_Interactions[_Selection].Type == EType.TSelectSlide)
{ {
if (_SelectSlides[_Interactions[_Selection].Num].Visible) if (_SelectSlides[_Interactions[_Selection].Num].Visible)
{
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y); _SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y);
}
} }
} }
@@ -459,9 +446,7 @@ namespace VocaluxeLib.Menu
if (_Interactions[_Selection].Type == EType.TSelectSlide) if (_Interactions[_Selection].Type == EType.TSelectSlide)
{ {
if (_SelectSlides[_Interactions[_Selection].Num].Visible) if (_SelectSlides[_Interactions[_Selection].Num].Visible)
{
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y); _SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y);
}
} }
} }
@@ -608,7 +593,7 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the next best interaction in a menu. /// Selects the next best interaction in a menu.
/// </summary> /// </summary>
/// <param name="Key"></param> /// <param name="Key"></param>
/// <returns></returns> /// <returns></returns>
@@ -620,9 +605,7 @@ namespace VocaluxeLib.Menu
int[] elements = new int[4]; int[] elements = new int[4];
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{
Directions[i] = new KeyEvent(); Directions[i] = new KeyEvent();
}
Directions[0].Key = Keys.Up; Directions[0].Key = Keys.Up;
Directions[1].Key = Keys.Right; Directions[1].Key = Keys.Right;
@@ -630,9 +613,7 @@ namespace VocaluxeLib.Menu
Directions[3].Key = Keys.Left; Directions[3].Key = Keys.Left;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{
elements[i] = _GetNextElement(Directions[i], out Distances[i], out stages[i]); elements[i] = _GetNextElement(Directions[i], out Distances[i], out stages[i]);
}
int element = _Selection; int element = _Selection;
int stage = int.MaxValue; int stage = int.MaxValue;
@@ -790,7 +771,6 @@ namespace VocaluxeLib.Menu
if (vector.X > 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y)) if (vector.X > 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y))
inDirection = true; inDirection = true;
break; break;
} }
if (!inDirection) if (!inDirection)
return float.MaxValue; return float.MaxValue;
@@ -827,7 +807,6 @@ namespace VocaluxeLib.Menu
if (vector.X > 0f) if (vector.X > 0f)
inDirection = true; inDirection = true;
break; break;
} }
if (!inDirection) if (!inDirection)
return float.MaxValue; return float.MaxValue;
@@ -836,7 +815,7 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the next element in a menu interaction. /// Selects the next element in a menu interaction.
/// </summary> /// </summary>
/// <returns>True if the next element is selected. False if either there is no next element or the interaction does not provide such a method.</returns> /// <returns>True if the next element is selected. False if either there is no next element or the interaction does not provide such a method.</returns>
private bool _NextElement() private bool _NextElement()
@@ -848,10 +827,10 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Selects the previous element in a menu interaction. /// Selects the previous element in a menu interaction.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method. /// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method.
/// </returns> /// </returns>
private bool _PrevElement() private bool _PrevElement()
{ {
@@ -961,9 +940,7 @@ namespace VocaluxeLib.Menu
return; return;
if (_Interactions[_Selection].Type == EType.TSelectSlide) if (_Interactions[_Selection].Type == EType.TSelectSlide)
{
_SelectSlides[_Interactions[_Selection].Num].Highlighted = !_SelectSlides[_Interactions[_Selection].Num].Highlighted; _SelectSlides[_Interactions[_Selection].Num].Highlighted = !_SelectSlides[_Interactions[_Selection].Num].Highlighted;
}
} }
private bool _IsHighlighted() private bool _IsHighlighted()
@@ -1071,7 +1048,6 @@ namespace VocaluxeLib.Menu
break; break;
} }
} }
#endregion InteractionHandling #endregion InteractionHandling
#region Theme Handling #region Theme Handling
@@ -1110,4 +1086,4 @@ namespace VocaluxeLib.Menu
} }
#endregion Theme Handling #endregion Theme Handling
} }
} }
+4 -4
View File
@@ -6,9 +6,9 @@ namespace VocaluxeLib.Menu
{ {
public class COrderedDictionaryLite<T> : IEnumerable<T> public class COrderedDictionaryLite<T> : IEnumerable<T>
{ {
private List<T> _Items; private readonly List<T> _Items;
private Dictionary<String, int> _htIndex; private readonly Dictionary<String, int> _htIndex;
private CMenu _Parent; private readonly CMenu _Parent;
public COrderedDictionaryLite(CMenu Parent) public COrderedDictionaryLite(CMenu Parent)
{ {
@@ -74,4 +74,4 @@ namespace VocaluxeLib.Menu
return GetEnumerator(); return GetEnumerator();
} }
} }
} }
+31 -47
View File
@@ -24,25 +24,25 @@ namespace VocaluxeLib.Menu
class CParticle class CParticle
{ {
#region private vars #region private vars
private int _PartyModeID; private readonly int _PartyModeID;
private string _TextureName; private readonly string _TextureName;
private STexture _Texture; private readonly STexture _Texture;
private SRectF _Rect; private SRectF _Rect;
private float _Size; private float _Size;
private SColorF _Color; private SColorF _Color;
private float _Alpha; private float _Alpha;
private float _Angle; //0..360° private float _Angle; //0..360°
private float _MaxAge; //[s] private readonly float _MaxAge; //[s]
private float _Age; //[s] private float _Age; //[s]
private float _Vx; //movement speed in x-axis [pix/s] private readonly float _Vx; //movement speed in x-axis [pix/s]
private float _Vy; //movement speed in y-axis [pix/s] private readonly float _Vy; //movement speed in y-axis [pix/s]
private float _Vr; //rotation speed [rpm] private readonly float _Vr; //rotation speed [rpm]
private float _Rotation; //start rotation 0..360° private readonly float _Rotation; //start rotation 0..360°
private float _Vsize; //size changing speed: period [s] private readonly float _Vsize; //size changing speed: period [s]
private float _LastTime; private float _LastTime;
private EParticleType _Type; private readonly EParticleType _Type;
private Stopwatch _Timer; private readonly Stopwatch _Timer;
#endregion private vars #endregion private vars
#region public vars #region public vars
@@ -91,7 +91,8 @@ namespace VocaluxeLib.Menu
#endregion public vars #endregion public vars
#region Constructors #region Constructors
public CParticle(int PartyModeID, string textureName, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, EParticleType type) public CParticle(int PartyModeID, string textureName, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize,
EParticleType type)
{ {
_PartyModeID = PartyModeID; _PartyModeID = PartyModeID;
_TextureName = textureName; _TextureName = textureName;
@@ -114,7 +115,8 @@ namespace VocaluxeLib.Menu
_Rotation = (float)(CBase.Game.GetRandomDouble() * 360.0); _Rotation = (float)(CBase.Game.GetRandomDouble() * 360.0);
} }
public CParticle(int PartyModeID, STexture texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize, EParticleType type) public CParticle(int PartyModeID, STexture texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize,
EParticleType type)
{ {
_PartyModeID = PartyModeID; _PartyModeID = PartyModeID;
_TextureName = String.Empty; _TextureName = String.Empty;
@@ -175,9 +177,7 @@ namespace VocaluxeLib.Menu
case EParticleType.PerfNoteStar: case EParticleType.PerfNoteStar:
_Alpha = 1f - _Age / _MaxAge; _Alpha = 1f - _Age / _MaxAge;
break; break;
} }
} }
// update position // update position
@@ -219,7 +219,6 @@ namespace VocaluxeLib.Menu
X += _Vx * timediff; X += _Vx * timediff;
Y += _Vy * timediff; Y += _Vy * timediff;
break; break;
} }
@@ -248,7 +247,6 @@ namespace VocaluxeLib.Menu
case EParticleType.PerfNoteStar: case EParticleType.PerfNoteStar:
size = _Size * (1f - CurrentTime / _Vsize); size = _Size * (1f - CurrentTime / _Vsize);
break; break;
} }
_Rect.X += (_Rect.W - size) / 2f; _Rect.X += (_Rect.W - size) / 2f;
@@ -289,7 +287,7 @@ namespace VocaluxeLib.Menu
public class CParticleEffect : IMenuElement public class CParticleEffect : IMenuElement
{ {
private int _PartyModeID; private readonly int _PartyModeID;
private SThemeParticleEffect _Theme; private SThemeParticleEffect _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
@@ -300,11 +298,11 @@ namespace VocaluxeLib.Menu
public bool Selected; public bool Selected;
public bool Visible; public bool Visible;
private List<CParticle> _Stars; private readonly List<CParticle> _Stars;
private int _MaxNumber; private int _MaxNumber;
private float _Size; private float _Size;
private EParticleType _Type; private EParticleType _Type;
private Stopwatch _SpawnTimer; private readonly Stopwatch _SpawnTimer;
private float _NextSpawnTime; private float _NextSpawnTime;
public float Alpha = 1f; public float Alpha = 1f;
@@ -316,13 +314,10 @@ namespace VocaluxeLib.Menu
public bool IsAlive public bool IsAlive
{ {
get get { return (_Stars.Count > 0 || !_SpawnTimer.IsRunning); }
{
return (_Stars.Count > 0 || !_SpawnTimer.IsRunning);
}
} }
public CParticleEffect(int PartyModeID) public CParticleEffect(int PartyModeID)
{ {
_PartyModeID = PartyModeID; _PartyModeID = PartyModeID;
_Theme = new SThemeParticleEffect(); _Theme = new SThemeParticleEffect();
@@ -380,9 +375,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -391,7 +384,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
} }
_ThemeLoaded &= xmlReader.TryGetEnumValue<EParticleType>(item + "/Type", ref _Type); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Type);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Size", ref _Size); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Size", ref _Size);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/MaxNumber", ref _MaxNumber); _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/MaxNumber", ref _MaxNumber);
@@ -422,9 +415,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: ParticleEffect color from ColorScheme (high priority)"); writer.WriteComment("<Color>: ParticleEffect color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)"); writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0) if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName); writer.WriteElementString("Color", _Theme.ColorName);
}
else else
{ {
writer.WriteElementString("R", Color.R.ToString("#0.00")); writer.WriteElementString("R", Color.R.ToString("#0.00"));
@@ -522,7 +513,6 @@ namespace VocaluxeLib.Menu
vr = CBase.Game.GetRandom(500) / 50f + 10f; vr = CBase.Game.GetRandom(500) / 50f + 10f;
vsize = lifetime * 2f; vsize = lifetime * 2f;
break; break;
} }
int w = (int)(Rect.W - size / 4f); int w = (int)(Rect.W - size / 4f);
@@ -538,16 +528,16 @@ namespace VocaluxeLib.Menu
if (_Theme.TextureName.Length > 0) if (_Theme.TextureName.Length > 0)
{ {
star = new CParticle(_PartyModeID, _Theme.TextureName, Color, star = new CParticle(_PartyModeID, _Theme.TextureName, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f, CBase.Game.GetRandom(w) + Rect.X - size / 4f,
CBase.Game.GetRandom(h) + Rect.Y - size / 4f, CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type); size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
} }
else else
{ {
star = new CParticle(_PartyModeID, Texture, Color, star = new CParticle(_PartyModeID, Texture, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f, CBase.Game.GetRandom(w) + Rect.X - size / 4f,
CBase.Game.GetRandom(h) + Rect.Y - size / 4f, CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type); size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
} }
_Stars.Add(star); _Stars.Add(star);
@@ -561,9 +551,7 @@ namespace VocaluxeLib.Menu
{ {
_Stars[i].Update(); _Stars[i].Update();
if (!_Stars[i].IsAlive) if (!_Stars[i].IsAlive)
{
_Stars.RemoveAt(i); _Stars.RemoveAt(i);
}
else else
i++; i++;
} }
@@ -572,17 +560,13 @@ namespace VocaluxeLib.Menu
public void Pause() public void Pause()
{ {
foreach (CParticle star in _Stars) foreach (CParticle star in _Stars)
{
star.Pause(); star.Pause();
}
} }
public void Resume() public void Resume()
{ {
foreach (CParticle star in _Stars) foreach (CParticle star in _Stars)
{
star.Resume(); star.Resume();
}
} }
public void Draw() public void Draw()
@@ -604,7 +588,7 @@ namespace VocaluxeLib.Menu
{ {
if (_Theme.ColorName.Length > 0) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if(_Theme.TextureName.Length > 0) if (_Theme.TextureName.Length > 0)
Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
} }
@@ -633,4 +617,4 @@ namespace VocaluxeLib.Menu
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+39 -69
View File
@@ -21,7 +21,7 @@ namespace VocaluxeLib.Menu
public CPlaylistSong(int SongID, EGameMode gm) public CPlaylistSong(int SongID, EGameMode gm)
{ {
this.SongID = SongID; this.SongID = SongID;
this.GameMode = gm; GameMode = gm;
} }
public CPlaylistSong() public CPlaylistSong()
@@ -65,14 +65,14 @@ namespace VocaluxeLib.Menu
public class CPlaylist : IMenuElement public class CPlaylist : IMenuElement
{ {
class PlaylistElementContent private class PlaylistElementContent
{ {
public EGameMode[] Modes; public EGameMode[] Modes;
public int SongID; public int SongID;
public EGameMode Mode; public EGameMode Mode;
} }
class PlaylistElement private class PlaylistElement
{ {
public CStatic Cover; public CStatic Cover;
public CStatic Background; public CStatic Background;
@@ -80,9 +80,7 @@ namespace VocaluxeLib.Menu
public CSelectSlide SelectSlide; public CSelectSlide SelectSlide;
public int Content; public int Content;
public PlaylistElement() public PlaylistElement() {}
{
}
public PlaylistElement(PlaylistElement pe) public PlaylistElement(PlaylistElement pe)
{ {
@@ -125,7 +123,8 @@ namespace VocaluxeLib.Menu
Text1.Y += diffY; Text1.Y += diffY;
} }
} }
private int _PartyModeID;
private readonly int _PartyModeID;
private SThemePlaylist _Theme; private SThemePlaylist _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
@@ -134,10 +133,10 @@ namespace VocaluxeLib.Menu
return _Theme.Name; return _Theme.Name;
} }
private CObjectInteractions _Interactions; private readonly CObjectInteractions _Interactions;
private List<PlaylistElement> PlaylistElements; private readonly List<PlaylistElement> PlaylistElements;
private List<PlaylistElementContent> PlaylistElementContents; private readonly List<PlaylistElementContent> PlaylistElementContents;
public SRectF CompleteRect; public SRectF CompleteRect;
public SRectF Rect; public SRectF Rect;
@@ -161,7 +160,7 @@ namespace VocaluxeLib.Menu
if (_EditMode == EEditMode.ChangeOrder && ChangeOrderSource != -1 && PlaylistElements.Count > ChangeOrderSource) if (_EditMode == EEditMode.ChangeOrder && ChangeOrderSource != -1 && PlaylistElements.Count > ChangeOrderSource)
{ {
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, PlaylistElements[ChangeOrderSource].Content); CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, PlaylistElements[ChangeOrderSource].Content);
UpdatePlaylist(); UpdatePlaylist();
} }
ChangeOrderSource = -1; ChangeOrderSource = -1;
_EditMode = EEditMode.None; _EditMode = EEditMode.None;
@@ -176,8 +175,8 @@ namespace VocaluxeLib.Menu
private PlaylistElement ChangeOrderElement; private PlaylistElement ChangeOrderElement;
private int ChangeOrderSource = -1; private int ChangeOrderSource = -1;
private int OldMousePosX = 0; private int OldMousePosX;
private int OldMousePosY = 0; private int OldMousePosY;
public int DragAndDropSongID = -1; public int DragAndDropSongID = -1;
@@ -210,7 +209,7 @@ namespace VocaluxeLib.Menu
ChangeOrderElement = new PlaylistElement(); ChangeOrderElement = new PlaylistElement();
Visible = false; Visible = false;
Selected = false; Selected = false;
} }
public void Init() public void Init()
@@ -241,9 +240,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/ColorBackground", ref _Theme.ColorBackgroundName, String.Empty)) if (xmlReader.GetValue(item + "/ColorBackground", ref _Theme.ColorBackgroundName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, SkinIndex, out BackgroundColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, SkinIndex, out BackgroundColor);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundR", ref BackgroundColor.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundR", ref BackgroundColor.R);
@@ -252,9 +249,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A);
} }
if (xmlReader.GetValue(item + "/SColorBackground", ref _Theme.SColorBackgroundName, String.Empty)) if (xmlReader.GetValue(item + "/SColorBackground", ref _Theme.SColorBackgroundName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorBackgroundName, SkinIndex, out BackgroundSColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorBackgroundName, SkinIndex, out BackgroundSColor);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundR", ref BackgroundSColor.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundR", ref BackgroundSColor.R);
@@ -358,9 +353,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<ColorBackground>: Button color from ColorScheme (high priority)"); writer.WriteComment("<ColorBackground>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <BackgroundR>, <BackgroundG>, <BackgroundB>, <BackgroundA> (lower priority)"); writer.WriteComment("or <BackgroundR>, <BackgroundG>, <BackgroundB>, <BackgroundA> (lower priority)");
if (_Theme.ColorBackgroundName.Length > 0) if (_Theme.ColorBackgroundName.Length > 0)
{
writer.WriteElementString("ColorBackground", _Theme.ColorBackgroundName); writer.WriteElementString("ColorBackground", _Theme.ColorBackgroundName);
}
else else
{ {
writer.WriteElementString("BackgroundR", BackgroundColor.R.ToString("#0.00")); writer.WriteElementString("BackgroundR", BackgroundColor.R.ToString("#0.00"));
@@ -372,9 +365,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<SColorBackground>: Selected paylist-entry color from ColorScheme (high priority)"); writer.WriteComment("<SColorBackground>: Selected paylist-entry color from ColorScheme (high priority)");
writer.WriteComment("or <SBackgroundR>, <SBackgroundG>, <SBackgroundB>, <SBackgroundA> (lower priority)"); writer.WriteComment("or <SBackgroundR>, <SBackgroundG>, <SBackgroundB>, <SBackgroundA> (lower priority)");
if (_Theme.SColorBackgroundName.Length > 0) if (_Theme.SColorBackgroundName.Length > 0)
{
writer.WriteElementString("SColorBackground", _Theme.SColorBackgroundName); writer.WriteElementString("SColorBackground", _Theme.SColorBackgroundName);
}
else else
{ {
writer.WriteElementString("SBackgroundR", BackgroundSColor.R.ToString("#0.00")); writer.WriteElementString("SBackgroundR", BackgroundSColor.R.ToString("#0.00"));
@@ -394,7 +385,7 @@ namespace VocaluxeLib.Menu
_Theme.ButtonPlaylistClose.SaveTheme(writer); _Theme.ButtonPlaylistClose.SaveTheme(writer);
_Theme.ButtonPlaylistDelete.SaveTheme(writer); _Theme.ButtonPlaylistDelete.SaveTheme(writer);
_Theme.ButtonPlaylistSave.SaveTheme(writer); _Theme.ButtonPlaylistSave.SaveTheme(writer);
_Theme.ButtonPlaylistSing.SaveTheme(writer); _Theme.ButtonPlaylistSing.SaveTheme(writer);
writer.WriteEndElement(); writer.WriteEndElement();
@@ -416,13 +407,11 @@ namespace VocaluxeLib.Menu
public void Draw(bool ForceDraw) public void Draw(bool ForceDraw)
{ {
if (PlaylistElements.Count <= 0) if (PlaylistElements.Count <= 0)
{
LoadPlaylist(0); LoadPlaylist(0);
}
if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !ForceDraw) if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !ForceDraw)
return; return;
for (int i = 0; i < PlaylistElements.Count; i++ ) for (int i = 0; i < PlaylistElements.Count; i++)
{ {
if (i == CurrentPlaylistElement && _Selected) if (i == CurrentPlaylistElement && _Selected)
{ {
@@ -500,9 +489,7 @@ namespace VocaluxeLib.Menu
if (_EditMode == EEditMode.PlaylistName) if (_EditMode == EEditMode.PlaylistName)
{ {
if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
{
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + KeyEvent.Unicode; _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + KeyEvent.Unicode;
}
else if (KeyEvent.Key == Keys.Enter) else if (KeyEvent.Key == Keys.Enter)
{ {
CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text); CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
@@ -524,7 +511,7 @@ namespace VocaluxeLib.Menu
} }
else else
{ {
if (CurrentPlaylistElement == -1 || PlaylistElementContents.Count == 0) //no song is selected if (CurrentPlaylistElement == -1 || PlaylistElementContents.Count == 0) //no song is selected
{ {
_Interactions.HandleInput(KeyEvent); _Interactions.HandleInput(KeyEvent);
CurrentPlaylistElement = GetSelectedSelectionNr(); CurrentPlaylistElement = GetSelectedSelectionNr();
@@ -532,7 +519,7 @@ namespace VocaluxeLib.Menu
if (CurrentPlaylistElement != -1) if (CurrentPlaylistElement != -1)
return true; return true;
} }
else if (CurrentPlaylistElement != -1) //a song is selected else if (CurrentPlaylistElement != -1) //a song is selected
{ {
int ScrollLimit = PlaylistElements.Count / 2; int ScrollLimit = PlaylistElements.Count / 2;
@@ -609,9 +596,7 @@ namespace VocaluxeLib.Menu
Update(); Update();
if (PlaylistElementContents.Count - 1 < CurrentPlaylistElement) if (PlaylistElementContents.Count - 1 < CurrentPlaylistElement)
{
CurrentPlaylistElement = PlaylistElementContents.Count - 1; CurrentPlaylistElement = PlaylistElementContents.Count - 1;
}
if (CurrentPlaylistElement != -1) if (CurrentPlaylistElement != -1)
_Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide); _Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide);
@@ -625,7 +610,7 @@ namespace VocaluxeLib.Menu
StartPlaylistSong(CurrentPlaylistElement); StartPlaylistSong(CurrentPlaylistElement);
break; break;
case Keys.Add: //move the selected song up case Keys.Add: //move the selected song up
if (PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0)) if (PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0))
{ {
CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset); CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
@@ -685,7 +670,7 @@ namespace VocaluxeLib.Menu
} }
break; break;
case Keys.PageUp: //scroll up case Keys.PageUp: //scroll up
if (PlaylistElementContents.Count > 0) if (PlaylistElementContents.Count > 0)
{ {
Offset -= PlaylistElements.Count; Offset -= PlaylistElements.Count;
@@ -697,7 +682,7 @@ namespace VocaluxeLib.Menu
CurrentPlaylistElement = 0; CurrentPlaylistElement = 0;
} }
break; break;
case Keys.PageDown: //scroll down case Keys.PageDown: //scroll down
if (PlaylistElementContents.Count > 0) if (PlaylistElementContents.Count > 0)
{ {
@@ -728,7 +713,8 @@ namespace VocaluxeLib.Menu
if (CurrentPlaylistElement != -1) if (CurrentPlaylistElement != -1)
{ {
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
UpdatePlaylist(); UpdatePlaylist();
} }
break; break;
@@ -739,14 +725,15 @@ namespace VocaluxeLib.Menu
if (CurrentPlaylistElement != -1) if (CurrentPlaylistElement != -1)
{ {
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
UpdatePlaylist(); UpdatePlaylist();
} }
break; break;
} }
return true; return true;
} }
//default actions //default actions
switch (KeyEvent.Key) switch (KeyEvent.Key)
{ {
@@ -762,17 +749,11 @@ namespace VocaluxeLib.Menu
case Keys.Enter: case Keys.Enter:
if (_Theme.ButtonPlaylistClose.Selected) if (_Theme.ButtonPlaylistClose.Selected)
{
ClosePlaylist(); ClosePlaylist();
}
else if (_Theme.ButtonPlaylistSing.Selected) else if (_Theme.ButtonPlaylistSing.Selected)
{
StartPlaylistSongs(); StartPlaylistSongs();
}
else if (_Theme.ButtonPlaylistSave.Selected) else if (_Theme.ButtonPlaylistSave.Selected)
{
CBase.Playlist.SavePlaylist(ActivePlaylistID); CBase.Playlist.SavePlaylist(ActivePlaylistID);
}
else if (_Theme.ButtonPlaylistDelete.Selected) else if (_Theme.ButtonPlaylistDelete.Selected)
{ {
CBase.Playlist.DeletePlaylist(ActivePlaylistID); CBase.Playlist.DeletePlaylist(ActivePlaylistID);
@@ -903,13 +884,11 @@ namespace VocaluxeLib.Menu
} }
} }
if (!hover_set) if (!hover_set)
{
CurrentPlaylistElement = -1; CurrentPlaylistElement = -1;
}
switch (_EditMode) switch (_EditMode)
{ {
//Normal mode //Normal mode
case EEditMode.None: case EEditMode.None:
//LB actions //LB actions
@@ -917,7 +896,8 @@ namespace VocaluxeLib.Menu
{ {
if (CurrentPlaylistElement != -1) if (CurrentPlaylistElement != -1)
{ {
CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode =
PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection];
UpdatePlaylist(); UpdatePlaylist();
} }
if (_Theme.ButtonPlaylistClose.Selected) if (_Theme.ButtonPlaylistClose.Selected)
@@ -951,14 +931,11 @@ namespace VocaluxeLib.Menu
//Start selected song with double click //Start selected song with double click
if (MouseEvent.LD && CurrentPlaylistElement != -1) if (MouseEvent.LD && CurrentPlaylistElement != -1)
{
StartPlaylistSong(CurrentPlaylistElement); StartPlaylistSong(CurrentPlaylistElement);
}
//Change order with holding LB //Change order with holding LB
if (MouseEvent.LBH && CurrentPlaylistElement != -1 && PlaylistElementContents.Count > 0 && DragAndDropSongID == -1) if (MouseEvent.LBH && CurrentPlaylistElement != -1 && PlaylistElementContents.Count > 0 && DragAndDropSongID == -1)
{ {
ChangeOrderSource = CurrentPlaylistElement + Offset; ChangeOrderSource = CurrentPlaylistElement + Offset;
//Update of Drag/Drop-Texture //Update of Drag/Drop-Texture
@@ -1077,9 +1054,7 @@ namespace VocaluxeLib.Menu
else if (CurrentPlaylistElement == -1) else if (CurrentPlaylistElement == -1)
{ {
if (MouseEvent.Y < PlaylistElements[0].Background.Rect.Y && Offset == 0) if (MouseEvent.Y < PlaylistElements[0].Background.Rect.Y && Offset == 0)
{
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, 0); CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, 0);
}
else else
{ {
if (PlaylistElements.Count + Offset >= PlaylistElementContents.Count) if (PlaylistElements.Count + Offset >= PlaylistElementContents.Count)
@@ -1095,9 +1070,7 @@ namespace VocaluxeLib.Menu
} }
if (MouseEvent.Y > min) if (MouseEvent.Y > min)
{
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, PlaylistElementContents.Count - 1); CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, PlaylistElementContents.Count - 1);
}
} }
} }
@@ -1114,12 +1087,13 @@ namespace VocaluxeLib.Menu
private void PrepareList() private void PrepareList()
{ {
PlaylistElements.Clear(); PlaylistElements.Clear();
for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++) for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++)
{ {
PlaylistElement en = new PlaylistElement(); PlaylistElement en = new PlaylistElement();
en.Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor, new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)); en.Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor,
new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z));
en.Cover = new CStatic(_Theme.StaticCover); en.Cover = new CStatic(_Theme.StaticCover);
en.Cover.Rect.Y += Rect.Y + (i * _Theme.EntryHeight); en.Cover.Rect.Y += Rect.Y + (i * _Theme.EntryHeight);
@@ -1147,7 +1121,7 @@ namespace VocaluxeLib.Menu
} }
} }
public bool LoadPlaylist(int PlaylistID) public bool LoadPlaylist(int PlaylistID)
{ {
if (PlaylistID > -1 && PlaylistID < CBase.Playlist.GetNumPlaylists()) if (PlaylistID > -1 && PlaylistID < CBase.Playlist.GetNumPlaylists())
{ {
@@ -1180,11 +1154,10 @@ namespace VocaluxeLib.Menu
pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode; pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode;
PlaylistElementContents.Add(pec); PlaylistElementContents.Add(pec);
} }
Update(); Update();
} }
public void ClosePlaylist() public void ClosePlaylist()
{ {
Visible = false; Visible = false;
@@ -1192,7 +1165,6 @@ namespace VocaluxeLib.Menu
ActivePlaylistID = -1; ActivePlaylistID = -1;
} }
private void StartPlaylistSongs() private void StartPlaylistSongs()
{ {
CBase.Game.Reset(); CBase.Game.Reset();
@@ -1201,11 +1173,9 @@ namespace VocaluxeLib.Menu
if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists()) if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists())
{ {
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
{
CBase.Game.AddSong(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID, CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode); CBase.Game.AddSong(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID, CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode);
}
if (CBase.Game.GetNumSongs() > 0) if (CBase.Game.GetNumSongs() > 0)
CBase.Graphics.FadeTo(EScreens.ScreenNames); //TODO: What is if someone uses that in PartyMode? CBase.Graphics.FadeTo(EScreens.ScreenNames); //TODO: What is if someone uses that in PartyMode?
} }
} }
@@ -1217,14 +1187,14 @@ namespace VocaluxeLib.Menu
CBase.Game.AddSong(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).SongID, CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).GameMode); CBase.Game.AddSong(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).SongID, CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).GameMode);
if (CBase.Game.GetNumSongs() > 0) if (CBase.Game.GetNumSongs() > 0)
CBase.Graphics.FadeTo(EScreens.ScreenNames); CBase.Graphics.FadeTo(EScreens.ScreenNames);
} }
public void Update() public void Update()
{ {
if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists()) if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists())
{ {
for (int i = 0; i < PlaylistElements.Count; i++ ) for (int i = 0; i < PlaylistElements.Count; i++)
{ {
if (Offset + i < PlaylistElementContents.Count) if (Offset + i < PlaylistElementContents.Count)
{ {
@@ -1237,14 +1207,14 @@ namespace VocaluxeLib.Menu
CSong song = CBase.Songs.GetSongByID(pec.SongID); CSong song = CBase.Songs.GetSongByID(pec.SongID);
PlaylistElements[i].Cover.Texture = song.CoverTextureSmall; PlaylistElements[i].Cover.Texture = song.CoverTextureSmall;
string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title); string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title);
PlaylistElements[i].Text1.Text = /*(Offset + i + 1).ToString() + ") " + */song.Artist + " - " + song.Title; //TODO: Add text field for the number PlaylistElements[i].Text1.Text = /*(Offset + i + 1).ToString() + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number
PlaylistElements[i].SelectSlide.Clear(); PlaylistElements[i].SelectSlide.Clear();
for (int g = 0; g < pec.Modes.Length; g++) for (int g = 0; g < pec.Modes.Length; g++)
{ {
PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(EGameMode), pec.Modes[g])); PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(EGameMode), pec.Modes[g]));
if (pec.Modes[g] == pec.Mode) if (pec.Modes[g] == pec.Mode)
PlaylistElements[i].SelectSlide.SetSelectionByValueIndex(g); PlaylistElements[i].SelectSlide.SetSelectionByValueIndex(g);
} }
} }
else else
{ {
@@ -1277,4 +1247,4 @@ namespace VocaluxeLib.Menu
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+9 -21
View File
@@ -20,7 +20,7 @@ namespace VocaluxeLib.Menu
public class CScreenSetting : IMenuElement public class CScreenSetting : IMenuElement
{ {
private int _PartyModeID; private readonly int _PartyModeID;
private SScreenSetting _Theme; private SScreenSetting _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
@@ -50,12 +50,10 @@ namespace VocaluxeLib.Menu
_ThemeLoaded = true; _ThemeLoaded = true;
_ThemeLoaded &= xmlReader.GetValue(item + "/Value", ref _Theme.Value, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/Value", ref _Theme.Value, String.Empty);
_ThemeLoaded &= xmlReader.TryGetEnumValue<ESettingType>(item + "/Type", ref _Theme.Type); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
if (_ThemeLoaded) if (_ThemeLoaded)
{
_Theme.Name = ElementName; _Theme.Name = ElementName;
}
return _ThemeLoaded; return _ThemeLoaded;
} }
@@ -65,7 +63,7 @@ namespace VocaluxeLib.Menu
{ {
writer.WriteStartElement(_Theme.Name); writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<Type>: Type of theme-setting-value: "+ CHelper.ListStrings(Enum.GetNames(typeof(ESettingType)))); writer.WriteComment("<Type>: Type of theme-setting-value: " + CHelper.ListStrings(Enum.GetNames(typeof(ESettingType))));
writer.WriteElementString("Type", Enum.GetName(typeof(ESettingType), _Theme.Type)); writer.WriteElementString("Type", Enum.GetName(typeof(ESettingType), _Theme.Type));
writer.WriteComment("<Value>: Value of theme-setting"); writer.WriteComment("<Value>: Value of theme-setting");
writer.WriteElementString("Value", _Theme.Value); writer.WriteElementString("Value", _Theme.Value);
@@ -95,17 +93,11 @@ namespace VocaluxeLib.Menu
return null; return null;
} }
public void UnloadTextures() public void UnloadTextures() {}
{
}
public void LoadTextures() public void LoadTextures() {}
{
}
public void ReloadTextures() public void ReloadTextures() {}
{
}
#region Private #region Private
private int GetIntValue(string _string) private int GetIntValue(string _string)
@@ -132,13 +124,9 @@ namespace VocaluxeLib.Menu
#endregion Private #endregion Private
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY) {}
{
}
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH) {}
{
}
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+26 -65
View File
@@ -35,7 +35,7 @@ namespace VocaluxeLib.Menu
public class CSelectSlide : IMenuElement, ICloneable public class CSelectSlide : IMenuElement, ICloneable
{ {
private int _PartyModeID; private readonly int _PartyModeID;
private SThemeSelectSlide _Theme; private SThemeSelectSlide _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
@@ -85,16 +85,16 @@ namespace VocaluxeLib.Menu
public bool Visible = true; public bool Visible = true;
public bool Highlighted = false; public bool Highlighted = false;
private bool _ArrowLeftSelected; private bool _ArrowLeftSelected;
private bool _ArrowRightSelected; private bool _ArrowRightSelected;
private List<string> _ValueNames; private readonly List<string> _ValueNames;
private List<int> _ValuePartyModeIDs; private readonly List<int> _ValuePartyModeIDs;
private List<STexture> _Textures; private readonly List<STexture> _Textures;
private List<int> _ValueIndexes; private readonly List<int> _ValueIndexes;
private List<SRectF> _ValueBounds = new List<SRectF>(); private readonly List<SRectF> _ValueBounds = new List<SRectF>();
public bool WithTextures = false; public bool WithTextures = false;
@@ -105,9 +105,7 @@ namespace VocaluxeLib.Menu
set set
{ {
if (value >= 0 && value < _ValueNames.Count) if (value >= 0 && value < _ValueNames.Count)
{
_Selection = value; _Selection = value;
}
} }
} }
@@ -118,16 +116,14 @@ namespace VocaluxeLib.Menu
if (_Selection >= 0 && _ValueIndexes.Count > _Selection) if (_Selection >= 0 && _ValueIndexes.Count > _Selection)
return _ValueIndexes[_Selection]; return _ValueIndexes[_Selection];
else return -1; else
return -1;
} }
} }
public int NumValues public int NumValues
{ {
get get { return _ValueNames.Count; }
{
return _ValueNames.Count;
}
} }
private int _NumVisible = -1; private int _NumVisible = -1;
@@ -175,7 +171,7 @@ namespace VocaluxeLib.Menu
{ {
_PartyModeID = slide._PartyModeID; _PartyModeID = slide._PartyModeID;
_Theme = new SThemeSelectSlide(); _Theme = new SThemeSelectSlide();
_Theme.TextureArrowLeftName = slide._Theme.TextureArrowLeftName; _Theme.TextureArrowLeftName = slide._Theme.TextureArrowLeftName;
_Theme.TextureArrowRightName = slide._Theme.TextureArrowRightName; _Theme.TextureArrowRightName = slide._Theme.TextureArrowRightName;
@@ -252,9 +248,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -264,9 +258,7 @@ namespace VocaluxeLib.Menu
} }
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty)) if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SColor.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref SColor.R);
@@ -276,9 +268,7 @@ namespace VocaluxeLib.Menu
} }
if (xmlReader.GetValue(item + "/HColor", ref _Theme.HColorName, String.Empty)) if (xmlReader.GetValue(item + "/HColor", ref _Theme.HColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.HColorName, SkinIndex, out HColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.HColorName, SkinIndex, out HColor);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HR", ref HColor.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HR", ref HColor.R);
@@ -300,9 +290,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H);
if (xmlReader.GetValue(item + "/ArrowColor", ref _Theme.ArrowColorName, String.Empty)) if (xmlReader.GetValue(item + "/ArrowColor", ref _Theme.ArrowColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, SkinIndex, out ColorArrow); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, SkinIndex, out ColorArrow);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowR", ref ColorArrow.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowR", ref ColorArrow.R);
@@ -312,9 +300,7 @@ namespace VocaluxeLib.Menu
} }
if (xmlReader.GetValue(item + "/ArrowSColor", ref _Theme.SArrowColorName, String.Empty)) if (xmlReader.GetValue(item + "/ArrowSColor", ref _Theme.SArrowColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SArrowColorName, SkinIndex, out SColorArrow); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SArrowColorName, SkinIndex, out SColorArrow);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSR", ref SColorArrow.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSR", ref SColorArrow.R);
@@ -324,9 +310,7 @@ namespace VocaluxeLib.Menu
} }
if (xmlReader.GetValue(item + "/TextColor", ref _Theme.TextColorName, String.Empty)) if (xmlReader.GetValue(item + "/TextColor", ref _Theme.TextColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, SkinIndex, out TextColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, SkinIndex, out TextColor);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextR", ref TextColor.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextR", ref TextColor.R);
@@ -336,9 +320,7 @@ namespace VocaluxeLib.Menu
} }
if (xmlReader.GetValue(item + "/TextSColor", ref _Theme.STextColorName, String.Empty)) if (xmlReader.GetValue(item + "/TextSColor", ref _Theme.STextColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.STextColorName, SkinIndex, out STextColor); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.STextColorName, SkinIndex, out STextColor);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSR", ref STextColor.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSR", ref STextColor.R);
@@ -348,13 +330,13 @@ namespace VocaluxeLib.Menu
} }
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextH", ref TextH); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextH", ref TextH);
if(xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref TextRelativeX)) if (xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref TextRelativeX))
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref TextRelativeX); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref TextRelativeX);
if(xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY)) if (xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY))
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextMaxW", ref MaxW); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextMaxW", ref MaxW);
_ThemeLoaded &= xmlReader.GetValue(item + "/TextFont", ref _Theme.TextFont, "Normal"); _ThemeLoaded &= xmlReader.GetValue(item + "/TextFont", ref _Theme.TextFont, "Normal");
_ThemeLoaded &= xmlReader.TryGetEnumValue<EStyle>(item + "/TextStyle", ref _Theme.TextStyle); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/TextStyle", ref _Theme.TextStyle);
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/NumVisible", ref _NumVisible); _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/NumVisible", ref _NumVisible);
@@ -418,9 +400,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("<Color>: SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)"); writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0) if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName); writer.WriteElementString("Color", _Theme.ColorName);
}
else else
{ {
writer.WriteElementString("R", Color.R.ToString("#0.00")); writer.WriteElementString("R", Color.R.ToString("#0.00"));
@@ -432,9 +412,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<SColor>: Selected SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("<SColor>: Selected SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)"); writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName.Length > 0) if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName); writer.WriteElementString("SColor", _Theme.SColorName);
}
else else
{ {
writer.WriteElementString("SR", SColor.R.ToString("#0.00")); writer.WriteElementString("SR", SColor.R.ToString("#0.00"));
@@ -446,9 +424,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <HR>, <HG>, <HB>, <HA> (lower priority)"); writer.WriteComment("or <HR>, <HG>, <HB>, <HA> (lower priority)");
if (_Theme.HColorName.Length > 0) if (_Theme.HColorName.Length > 0)
{
writer.WriteElementString("HColor", _Theme.HColorName); writer.WriteElementString("HColor", _Theme.HColorName);
}
else else
{ {
writer.WriteElementString("HR", HColor.R.ToString("#0.00")); writer.WriteElementString("HR", HColor.R.ToString("#0.00"));
@@ -460,9 +436,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<ArrowColor>: Arrow color from ColorScheme (high priority)"); writer.WriteComment("<ArrowColor>: Arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)"); writer.WriteComment("or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)");
if (_Theme.ArrowColorName.Length > 0) if (_Theme.ArrowColorName.Length > 0)
{
writer.WriteElementString("ArrowColor", _Theme.ArrowColorName); writer.WriteElementString("ArrowColor", _Theme.ArrowColorName);
}
else else
{ {
writer.WriteElementString("ArrowR", ColorArrow.R.ToString("#0.00")); writer.WriteElementString("ArrowR", ColorArrow.R.ToString("#0.00"));
@@ -474,9 +448,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<ArrowSColor>: Selected arrow color from ColorScheme (high priority)"); writer.WriteComment("<ArrowSColor>: Selected arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower priority)"); writer.WriteComment("or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower priority)");
if (_Theme.SArrowColorName.Length > 0) if (_Theme.SArrowColorName.Length > 0)
{
writer.WriteElementString("ArrowSColor", _Theme.SArrowColorName); writer.WriteElementString("ArrowSColor", _Theme.SArrowColorName);
}
else else
{ {
writer.WriteElementString("ArrowSR", SColorArrow.R.ToString("#0.00")); writer.WriteElementString("ArrowSR", SColorArrow.R.ToString("#0.00"));
@@ -488,9 +460,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<TextColor>: Text color from ColorScheme (high priority)"); writer.WriteComment("<TextColor>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)"); writer.WriteComment("or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)");
if (_Theme.TextColorName.Length > 0) if (_Theme.TextColorName.Length > 0)
{
writer.WriteElementString("TextColor", _Theme.TextColorName); writer.WriteElementString("TextColor", _Theme.TextColorName);
}
else else
{ {
writer.WriteElementString("TextR", TextColor.R.ToString("#0.00")); writer.WriteElementString("TextR", TextColor.R.ToString("#0.00"));
@@ -502,9 +472,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<TextSColor>: Selected text color from ColorScheme (high priority)"); writer.WriteComment("<TextSColor>: Selected text color from ColorScheme (high priority)");
writer.WriteComment("or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)"); writer.WriteComment("or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)");
if (_Theme.STextColorName.Length > 0) if (_Theme.STextColorName.Length > 0)
{
writer.WriteElementString("TextSColor", _Theme.STextColorName); writer.WriteElementString("TextSColor", _Theme.STextColorName);
}
else else
{ {
writer.WriteElementString("TextSR", STextColor.R.ToString("#0.00")); writer.WriteElementString("TextSR", STextColor.R.ToString("#0.00"));
@@ -579,9 +547,7 @@ namespace VocaluxeLib.Menu
public void AddValues(string[] values) public void AddValues(string[] values)
{ {
foreach (string value in values) foreach (string value in values)
{
AddValue(value, new STexture(-1), _PartyModeID); AddValue(value, new STexture(-1), _PartyModeID);
}
_ValueBounds.Clear(); _ValueBounds.Clear();
} }
@@ -592,9 +558,7 @@ namespace VocaluxeLib.Menu
return; return;
for (int i = 0; i < values.Length; i++) for (int i = 0; i < values.Length; i++)
{
AddValue(values[i], textures[i]); AddValue(values[i], textures[i]);
}
if (Selection == -1) if (Selection == -1)
Selection = 0; Selection = 0;
@@ -682,7 +646,7 @@ namespace VocaluxeLib.Menu
public void ProcessMouseMove(int x, int y) public void ProcessMouseMove(int x, int y)
{ {
_ArrowLeftSelected = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0; _ArrowLeftSelected = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0;
_ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _ValueNames.Count - 1; _ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _ValueNames.Count - 1;
} }
@@ -700,7 +664,7 @@ namespace VocaluxeLib.Menu
{ {
if (CHelper.IsInBounds(_ValueBounds[i], x, y)) if (CHelper.IsInBounds(_ValueBounds[i], x, y))
{ {
int offset = _Selection - (int)_NumVisible / 2; int offset = _Selection - _NumVisible / 2;
if (_ValueNames.Count - _NumVisible - offset < 0) if (_ValueNames.Count - _NumVisible - offset < 0)
offset = _ValueNames.Count - _NumVisible; offset = _ValueNames.Count - _NumVisible;
@@ -755,15 +719,15 @@ namespace VocaluxeLib.Menu
else else
CBase.Drawing.DrawTexture(TextureArrowRight, RectArrowRight, ColorArrow); CBase.Drawing.DrawTexture(TextureArrowRight, RectArrowRight, ColorArrow);
} }
if (_NumVisible < 1 || _ValueNames.Count == 0) if (_NumVisible < 1 || _ValueNames.Count == 0)
return; return;
float x = Rect.X + (Rect.W - TextRelativeX) * 0.1f; float x = Rect.X + (Rect.W - TextRelativeX) * 0.1f;
float dx = (Rect.W - TextRelativeX) * 0.8f / _NumVisible; float dx = (Rect.W - TextRelativeX) * 0.8f / _NumVisible;
//float y = Rect.Y + (Rect.H - TextH); //float y = Rect.Y + (Rect.H - TextH);
int offset = _Selection - (int)_NumVisible/2; int offset = _Selection - _NumVisible / 2;
if (_ValueNames.Count - _NumVisible - offset < 0) if (_ValueNames.Count - _NumVisible - offset < 0)
offset = _ValueNames.Count - _NumVisible; offset = _ValueNames.Count - _NumVisible;
@@ -779,7 +743,8 @@ namespace VocaluxeLib.Menu
_ValueBounds.Clear(); _ValueBounds.Clear();
for (int i = 0; i < numvis; i++) for (int i = 0; i < numvis; i++)
{ {
CText Text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset], _ValuePartyModeIDs[i + offset]); CText Text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset],
_ValuePartyModeIDs[i + offset]);
SColorF Alpha = new SColorF(1f, 1f, 1f, 0.35f); SColorF Alpha = new SColorF(1f, 1f, 1f, 0.35f);
if (i + offset == _Selection) if (i + offset == _Selection)
@@ -789,7 +754,7 @@ namespace VocaluxeLib.Menu
} }
RectangleF bounds = CBase.Drawing.GetTextBounds(Text); RectangleF bounds = CBase.Drawing.GetTextBounds(Text);
Text.X = (x + dx/2f + dx * i)+TextRelativeX; Text.X = (x + dx / 2f + dx * i) + TextRelativeX;
if (!WithTextures) if (!WithTextures)
Text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + TextRelativeY); Text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + TextRelativeY);
@@ -807,15 +772,11 @@ namespace VocaluxeLib.Menu
_ValueBounds.Add(rect); _ValueBounds.Add(rect);
} }
else else
{ _ValueBounds.Add(new SRectF(Text.X - bounds.Width / 2f, Text.Y, bounds.Width, bounds.Height, Rect.Z));
_ValueBounds.Add(new SRectF(Text.X - bounds.Width/2f, Text.Y, bounds.Width, bounds.Height, Rect.Z));
}
} }
} }
public void UnloadTextures() public void UnloadTextures() {}
{
}
public void LoadTextures() public void LoadTextures()
{ {
@@ -911,4 +872,4 @@ namespace VocaluxeLib.Menu
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+4 -14
View File
@@ -13,7 +13,7 @@ namespace VocaluxeLib.Menu
public class CStatic : IMenuElement public class CStatic : IMenuElement
{ {
private int _PartyModeID; private readonly int _PartyModeID;
private SThemeStatic _Theme; private SThemeStatic _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
@@ -138,9 +138,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -185,9 +183,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Static color from ColorScheme (high priority)"); writer.WriteComment("<Color>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)"); writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0) if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName); writer.WriteElementString("Color", _Theme.ColorName);
}
else else
{ {
writer.WriteElementString("R", Color.R.ToString("#0.00")); writer.WriteElementString("R", Color.R.ToString("#0.00"));
@@ -261,26 +257,20 @@ namespace VocaluxeLib.Menu
rect.W = rect2.Width; rect.W = rect2.Width;
rect.H = rect2.Height; rect.H = rect2.Height;
} }
SColorF color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha); SColorF color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
if (Visible || ForceDraw || (CBase.Settings.GetGameState() == EGameState.EditTheme)) if (Visible || ForceDraw || (CBase.Settings.GetGameState() == EGameState.EditTheme))
{ {
CBase.Drawing.DrawTexture(texture, rect, color, bounds); CBase.Drawing.DrawTexture(texture, rect, color, bounds);
if (Reflection) if (Reflection)
{
CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight); CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
}
} }
if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme)) if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme))
{
CBase.Drawing.DrawColor(new SColorF(1f, 1f, 1f, 0.5f), rect); CBase.Drawing.DrawColor(new SColorF(1f, 1f, 1f, 0.5f), rect);
}
} }
public void UnloadTextures() public void UnloadTextures() {}
{
}
public void LoadTextures() public void LoadTextures()
{ {
@@ -313,4 +303,4 @@ namespace VocaluxeLib.Menu
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+7 -12
View File
@@ -6,14 +6,14 @@ namespace VocaluxeLib.Menu
{ {
public class CXMLReader public class CXMLReader
{ {
private XPathNavigator _Navigator; private readonly XPathNavigator _Navigator;
private String _FileName; private readonly String _FileName;
public string FileName public string FileName
{ {
get { return _FileName; } get { return _FileName; }
} }
//Private method. Use OpenFile factory method to get an instance //Private method. Use OpenFile factory method to get an instance
private CXMLReader(string uri) private CXMLReader(string uri)
{ {
@@ -39,14 +39,14 @@ namespace VocaluxeLib.Menu
return null; return null;
} }
} }
public bool TryGetEnumValue<T>(string Cast, ref T value) public bool TryGetEnumValue<T>(string Cast, ref T value)
where T : struct where T : struct
{ {
string val = String.Empty; string val = String.Empty;
if (GetValue(Cast, ref val, Enum.GetName(typeof(T), value))) if (GetValue(Cast, ref val, Enum.GetName(typeof(T), value)))
{ {
CHelper.TryParse<T>(val, out value, true); CHelper.TryParse(val, out value, true);
return true; return true;
} }
return false; return false;
@@ -56,13 +56,11 @@ namespace VocaluxeLib.Menu
{ {
string val = String.Empty; string val = String.Empty;
if (GetValue(Cast, ref val, value.ToString())) if (GetValue(Cast, ref val, value.ToString()))
{
return int.TryParse(val, out value); return int.TryParse(val, out value);
}
return false; return false;
} }
public bool TryGetIntValueRange(string Cast,ref int value, int min = 0, int max = 100) public bool TryGetIntValueRange(string Cast, ref int value, int min = 0, int max = 100)
{ {
bool result = TryGetIntValue(Cast, ref value); bool result = TryGetIntValue(Cast, ref value);
if (result) if (result)
@@ -79,9 +77,7 @@ namespace VocaluxeLib.Menu
{ {
string val = String.Empty; string val = String.Empty;
if (GetValue(Cast, ref val, value.ToString())) if (GetValue(Cast, ref val, value.ToString()))
{
return CHelper.TryParse(val, out value); return CHelper.TryParse(val, out value);
}
return false; return false;
} }
@@ -110,7 +106,6 @@ namespace VocaluxeLib.Menu
Value = val; Value = val;
return true; return true;
} }
} }
public List<string> GetValues(string Cast) public List<string> GetValues(string Cast)
@@ -187,4 +182,4 @@ namespace VocaluxeLib.Menu
return true; return true;
} }
} }
} }
+18 -22
View File
@@ -121,9 +121,7 @@ namespace VocaluxeLib.Menu
void LoadTheme(); void LoadTheme();
} }
public interface IHelper public interface IHelper {}
{
}
public interface IBackgroundMusic public interface IBackgroundMusic
{ {
@@ -146,7 +144,7 @@ namespace VocaluxeLib.Menu
public interface IDrawing public interface IDrawing
{ {
RectangleF GetTextBounds(CText text); RectangleF GetTextBounds(CText text);
void DrawTexture(STexture Texture, SRectF Rect); void DrawTexture(STexture Texture, SRectF Rect);
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color); 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);
@@ -301,7 +299,7 @@ namespace VocaluxeLib.Menu
void DeletePlaylist(int PlaylistID); void DeletePlaylist(int PlaylistID);
void SavePlaylist(int PlaylistID); void SavePlaylist(int PlaylistID);
int GetNumPlaylists(); int GetNumPlaylists();
void AddPlaylistSong(int PlaylistID, int SongID); void AddPlaylistSong(int PlaylistID, int SongID);
void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode); void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode);
void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode); void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode);
@@ -315,7 +313,6 @@ namespace VocaluxeLib.Menu
CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex); CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex);
} }
[Flags] [Flags]
public enum EModifier public enum EModifier
{ {
@@ -373,14 +370,14 @@ namespace VocaluxeLib.Menu
public bool Handled; public bool Handled;
public int X; public int X;
public int Y; public int Y;
public bool LB; //left button click public bool LB; //left button click
public bool LD; //left button double click public bool LD; //left button double click
public bool RB; //right button click public bool RB; //right button click
public bool MB; //middle button click public bool MB; //middle button click
public bool LBH; //left button hold (when moving) public bool LBH; //left button hold (when moving)
public bool RBH; //right button hold (when moving) public bool RBH; //right button hold (when moving)
public bool MBH; //middle button hold (when moving) public bool MBH; //middle button hold (when moving)
public bool ModALT; public bool ModALT;
public bool ModSHIFT; public bool ModSHIFT;
@@ -525,8 +522,8 @@ namespace VocaluxeLib.Menu
public float height; public float height;
public SRectF rect; public SRectF rect;
public float w2; //power of 2 width public float w2; //power of 2 width
public float h2; //power of 2 height public float h2; //power of 2 height
public float width_ratio; public float width_ratio;
public float height_ratio; public float height_ratio;
@@ -599,12 +596,12 @@ namespace VocaluxeLib.Menu
public enum EDebugLevel public enum EDebugLevel
{ {
// don't change the order! // don't change the order!
TR_CONFIG_OFF, //no debug infos TR_CONFIG_OFF, //no debug infos
TR_CONFIG_ONLY_FPS, TR_CONFIG_ONLY_FPS,
TR_CONFIG_LEVEL1, TR_CONFIG_LEVEL1,
TR_CONFIG_LEVEL2, TR_CONFIG_LEVEL2,
TR_CONFIG_LEVEL3, TR_CONFIG_LEVEL3,
TR_CONFIG_LEVEL_MAX //all debug infos TR_CONFIG_LEVEL_MAX //all debug infos
} }
public enum EBufferSize public enum EBufferSize
@@ -651,7 +648,7 @@ namespace VocaluxeLib.Menu
{ {
//TR_CONFIG_LIST, //a simple list //TR_CONFIG_LIST, //a simple list
//TR_CONFIG_DREIDEL, //as in ultrastar deluxe //TR_CONFIG_DREIDEL, //as in ultrastar deluxe
TR_CONFIG_TILE_BOARD, //chessboard like TR_CONFIG_TILE_BOARD, //chessboard like
//TR_CONFIG_BOOK //for playlists //TR_CONFIG_BOOK //for playlists
} }
@@ -733,7 +730,6 @@ namespace VocaluxeLib.Menu
Slide, Slide,
Zoom Zoom
} }
#endregion EnumsConfig #endregion EnumsConfig
public enum EAlignment public enum EAlignment
@@ -812,11 +808,11 @@ namespace VocaluxeLib.Menu
public class CPoints public class CPoints
{ {
private SPlayer[,] _Rounds; private readonly SPlayer[,] _Rounds;
public CPoints(int NumRounds, SPlayer[] Player) public CPoints(int NumRounds, SPlayer[] Player)
{ {
_Rounds = new SPlayer[NumRounds, Player.Length]; _Rounds = new SPlayer[NumRounds,Player.Length];
for (int round = 0; round < NumRounds; round++) for (int round = 0; round < NumRounds; round++)
{ {
@@ -954,4 +950,4 @@ namespace VocaluxeLib.Menu
ScreenNull = -1 ScreenNull = -1
} }
} }
+2 -2
View File
@@ -12,8 +12,8 @@ namespace VocaluxeLib.Menu
void UnloadTextures(); void UnloadTextures();
void LoadTextures(); void LoadTextures();
void ReloadTextures(); void ReloadTextures();
void MoveElement(int stepX, int stepY); void MoveElement(int stepX, int stepY);
void ResizeElement(int stepW, int stepH); void ResizeElement(int stepW, int stepH);
} }
} }
+22 -57
View File
@@ -3,18 +3,16 @@ using System.Collections.Generic;
namespace VocaluxeLib.Menu.SingNotes namespace VocaluxeLib.Menu.SingNotes
{ {
public class CNotes public class CNotes
{ {
private List<CLines> _Lines = new List<CLines>(); private readonly List<CLines> _Lines = new List<CLines>();
public CLines[] Lines public CLines[] Lines
{ {
get { return _Lines.ToArray(); } get { return _Lines.ToArray(); }
} }
public CNotes() public CNotes() {}
{
}
public int LinesCount public int LinesCount
{ {
@@ -24,17 +22,13 @@ namespace VocaluxeLib.Menu.SingNotes
public CNotes(CNotes notes) public CNotes(CNotes notes)
{ {
foreach (CLines lines in notes._Lines) foreach (CLines lines in notes._Lines)
{
_Lines.Add(new CLines(lines)); _Lines.Add(new CLines(lines));
}
} }
public CLines GetLines(int Index) public CLines GetLines(int Index)
{ {
while (Index >= _Lines.Count) while (Index >= _Lines.Count)
{
_Lines.Add(new CLines()); _Lines.Add(new CLines());
}
return _Lines[Index]; return _Lines[Index];
} }
@@ -77,9 +71,7 @@ namespace VocaluxeLib.Menu.SingNotes
public void SetMedley(int StartBeat, int EndBeat) public void SetMedley(int StartBeat, int EndBeat)
{ {
foreach (CLines lines in _Lines) foreach (CLines lines in _Lines)
{
lines.SetMedley(StartBeat, EndBeat); lines.SetMedley(StartBeat, EndBeat);
}
} }
} }
@@ -90,8 +82,8 @@ namespace VocaluxeLib.Menu.SingNotes
private int _Tone; private int _Tone;
private ENoteType _NoteType; private ENoteType _NoteType;
private string _Text; private string _Text;
private bool _Hit; // for drawing player notes private bool _Hit; // for drawing player notes
private bool _Perfect; // for drawing perfect note effect private bool _Perfect; // for drawing perfect note effect
#region Contructors #region Contructors
public CNote() public CNote()
@@ -122,7 +114,7 @@ namespace VocaluxeLib.Menu.SingNotes
this.StartBeat = StartBeat; this.StartBeat = StartBeat;
this.Duration = Duration; this.Duration = Duration;
this.Tone = Tone; this.Tone = Tone;
this.NoteType = ENoteType.Normal; NoteType = ENoteType.Normal;
this.Text = Text; this.Text = Text;
} }
@@ -132,7 +124,7 @@ namespace VocaluxeLib.Menu.SingNotes
this.StartBeat = StartBeat; this.StartBeat = StartBeat;
this.Duration = Duration; this.Duration = Duration;
this.Tone = Tone; this.Tone = Tone;
this.NoteType = ENoteType.Normal; NoteType = ENoteType.Normal;
this.Text = Text; this.Text = Text;
this.Hit = Hit; this.Hit = Hit;
} }
@@ -172,10 +164,7 @@ namespace VocaluxeLib.Menu.SingNotes
public int EndBeat public int EndBeat
{ {
get get { return _StartBeat + _Duration - 1; }
{
return _StartBeat + _Duration - 1;
}
} }
public int Duration public int Duration
@@ -274,24 +263,20 @@ namespace VocaluxeLib.Menu.SingNotes
{ {
private int _StartBeat = int.MinValue; private int _StartBeat = int.MinValue;
private int _EndBeat = int.MinValue; private int _EndBeat = int.MinValue;
private bool _PerfectLine = false; // for drawing perfect line effect private bool _PerfectLine; // for drawing perfect line effect
private bool _VisibleInTimeLine = true; private bool _VisibleInTimeLine = true;
private int _MinBeat = int.MaxValue; private int _MinBeat = int.MaxValue;
private int _MaxBeat = int.MinValue; private int _MaxBeat = int.MinValue;
private List<CNote> _Notes = new List<CNote>(); private readonly List<CNote> _Notes = new List<CNote>();
#region Constructors #region Constructors
public CLine() public CLine() {}
{
}
public CLine(CLine line) public CLine(CLine line)
{ {
foreach (CNote note in line._Notes) foreach (CNote note in line._Notes)
{
_Notes.Add(new CNote(note)); _Notes.Add(new CNote(note));
}
_StartBeat = line._StartBeat; _StartBeat = line._StartBeat;
_EndBeat = line._EndBeat; _EndBeat = line._EndBeat;
_PerfectLine = line._PerfectLine; _PerfectLine = line._PerfectLine;
@@ -350,9 +335,7 @@ namespace VocaluxeLib.Menu.SingNotes
{ {
string lyrics = String.Empty; string lyrics = String.Empty;
foreach (CNote note in _Notes) foreach (CNote note in _Notes)
{
lyrics += note.Text; lyrics += note.Text;
}
return lyrics; return lyrics;
} }
} }
@@ -368,13 +351,11 @@ namespace VocaluxeLib.Menu.SingNotes
{ {
int points = 0; int points = 0;
foreach (CNote note in _Notes) foreach (CNote note in _Notes)
{
points += note.Points; points += note.Points;
}
return points; return points;
} }
} }
public CNote[] Notes public CNote[] Notes
{ {
get { return _Notes.ToArray(); } get { return _Notes.ToArray(); }
@@ -416,7 +397,7 @@ namespace VocaluxeLib.Menu.SingNotes
Max = note.Tone; Max = note.Tone;
} }
return Min - (Max-Min)/4; return Min - (Max - Min) / 4;
} }
} }
#endregion Properties #endregion Properties
@@ -433,7 +414,7 @@ namespace VocaluxeLib.Menu.SingNotes
if (CompareLine.Points == 0) if (CompareLine.Points == 0)
return false; return false;
_PerfectLine = (this.Points == CompareLine.Points); _PerfectLine = (Points == CompareLine.Points);
return _PerfectLine; return _PerfectLine;
} }
@@ -460,7 +441,7 @@ namespace VocaluxeLib.Menu.SingNotes
} }
return start; return start;
} }
public bool AddNote(CNote Note) public bool AddNote(CNote Note)
{ {
if (_Notes.Count == 0) if (_Notes.Count == 0)
@@ -534,14 +515,10 @@ namespace VocaluxeLib.Menu.SingNotes
private void updateMinMaxBeat(CNote Note) private void updateMinMaxBeat(CNote Note)
{ {
if (Note.StartBeat < _MinBeat) if (Note.StartBeat < _MinBeat)
{
_MinBeat = Note.StartBeat; _MinBeat = Note.StartBeat;
}
if (Note.EndBeat > _MaxBeat) if (Note.EndBeat > _MaxBeat)
{
_MaxBeat = Note.EndBeat; _MaxBeat = Note.EndBeat;
}
} }
private void updateMinMaxBeat() private void updateMinMaxBeat()
@@ -557,24 +534,19 @@ namespace VocaluxeLib.Menu.SingNotes
_MaxBeat = int.MinValue; _MaxBeat = int.MinValue;
} }
} }
#endregion Methods #endregion Methods
} }
public class CLines public class CLines
{ {
private List<CLine> _Lines = new List<CLine>(); private readonly List<CLine> _Lines = new List<CLine>();
public CLines() public CLines() {}
{
}
public CLines(CLines lines) public CLines(CLines lines)
{ {
foreach (CLine line in lines._Lines) foreach (CLine line in lines._Lines)
{
_Lines.Add(new CLine(line)); _Lines.Add(new CLine(line));
}
} }
public CLine[] Line public CLine[] Line
@@ -587,7 +559,7 @@ namespace VocaluxeLib.Menu.SingNotes
} }
/// <summary> /// <summary>
/// Total song length in beats /// Total song length in beats
/// </summary> /// </summary>
public int Length public int Length
{ {
@@ -624,9 +596,7 @@ namespace VocaluxeLib.Menu.SingNotes
{ {
int points = 0; int points = 0;
foreach (CLine line in _Lines) foreach (CLine line in _Lines)
{
points += line.Points; points += line.Points;
}
return points; return points;
} }
} }
@@ -730,15 +700,14 @@ namespace VocaluxeLib.Menu.SingNotes
} }
return false; return false;
} }
public void UpdateTimings() public void UpdateTimings()
{ {
CNote LastNote, FirstNote; CNote LastNote, FirstNote;
int min, max, s; int min, max, s;
if (_Lines.Count > 0) if (_Lines.Count > 0)
{
_Lines[0].StartBeat = -10000; _Lines[0].StartBeat = -10000;
}
for (int i = 1; i < _Lines.Count; i++) for (int i = 1; i < _Lines.Count; i++)
{ {
@@ -776,18 +745,14 @@ namespace VocaluxeLib.Menu.SingNotes
LastNote = _Lines[_Lines.Count - 1].LastNote; LastNote = _Lines[_Lines.Count - 1].LastNote;
if (LastNote != null) if (LastNote != null)
{
_Lines[_Lines.Count - 1].EndBeat = LastNote.EndBeat; _Lines[_Lines.Count - 1].EndBeat = LastNote.EndBeat;
}
} }
public void SetMedley(int StartBeat, int EndBeat) public void SetMedley(int StartBeat, int EndBeat)
{ {
foreach (CLine line in _Lines) foreach (CLine line in _Lines)
{
line.SetMedley(StartBeat, EndBeat); line.SetMedley(StartBeat, EndBeat);
}
} }
#endregion Methods #endregion Methods
} }
} }
+37 -70
View File
@@ -44,16 +44,16 @@ namespace VocaluxeLib.Menu.SingNotes
private SThemeSingBar _Theme; private SThemeSingBar _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
private List<SPlayerNotes> _PlayerNotes; private readonly List<SPlayerNotes> _PlayerNotes;
private int _ActID; private int _ActID;
private SRectF[,] _BarPos; private SRectF[,] _BarPos;
/// <summary> /// <summary>
/// Player bar positions /// Player bar positions
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// first index = player number; second index = num players seen on screen /// first index = player number; second index = num players seen on screen
/// </remarks> /// </remarks>
public SRectF[,] BarPos public SRectF[,] BarPos
{ {
@@ -93,7 +93,7 @@ namespace VocaluxeLib.Menu.SingNotes
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", ref _Theme.SkinToneHelperName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", ref _Theme.SkinToneHelperName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", ref _Theme.SkinPerfectNoteStarName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", ref _Theme.SkinPerfectNoteStarName, String.Empty);
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(), CBase.Settings.GetMaxNumPlayer()]; _BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++) for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
{ {
for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++) for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++)
@@ -182,6 +182,7 @@ namespace VocaluxeLib.Menu.SingNotes
return false; return false;
} }
public virtual void Reset() public virtual void Reset()
{ {
_PlayerNotes.Clear(); _PlayerNotes.Clear();
@@ -209,10 +210,7 @@ namespace VocaluxeLib.Menu.SingNotes
return notes.ID; return notes.ID;
} }
public virtual void RemovePlayer(int ID) public virtual void RemovePlayer(int ID) {}
{
}
public virtual void AddLine(int ID, CLine[] Line, int LineNr, int Player) public virtual void AddLine(int ID, CLine[] Line, int LineNr, int Player)
{ {
@@ -241,15 +239,9 @@ namespace VocaluxeLib.Menu.SingNotes
_PlayerNotes.Add(notes); _PlayerNotes.Add(notes);
} }
public virtual void RemoveLine(int ID) public virtual void RemoveLine(int ID) {}
{
} public virtual void AddNote(int ID, CNote Note) {}
public virtual void AddNote(int ID, CNote Note)
{
}
public virtual void SetAlpha(int ID, float Alpha) public virtual void SetAlpha(int ID, float Alpha)
{ {
@@ -270,10 +262,10 @@ namespace VocaluxeLib.Menu.SingNotes
return _PlayerNotes[n].Alpha; return _PlayerNotes[n].Alpha;
} }
public virtual void Draw(int ID, int Player) public virtual void Draw(int ID, int Player)
{ {
Draw(ID, null, Player); Draw(ID, null, Player);
} }
public virtual void Draw(int ID, List<CLine> SingLine, int Player) public virtual void Draw(int ID, List<CLine> SingLine, int Player)
@@ -294,9 +286,7 @@ namespace VocaluxeLib.Menu.SingNotes
CLine Line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr]; CLine Line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr];
if (CBase.Config.GetDrawNoteLines() == EOffOn.TR_CONFIG_ON) if (CBase.Config.GetDrawNoteLines() == EOffOn.TR_CONFIG_ON)
{
DrawNoteLines(_PlayerNotes[n].Rect, new SColorF(0.5f, 0.5f, 0.5f, 0.5f * _PlayerNotes[n].Alpha)); DrawNoteLines(_PlayerNotes[n].Rect, new SColorF(0.5f, 0.5f, 0.5f, 0.5f * _PlayerNotes[n].Alpha));
}
if (Line.NoteCount == 0) if (Line.NoteCount == 0)
return; return;
@@ -311,10 +301,10 @@ namespace VocaluxeLib.Menu.SingNotes
return; return;
SColorF color = new SColorF( SColorF color = new SColorF(
_PlayerNotes[n].Color.R, _PlayerNotes[n].Color.R,
_PlayerNotes[n].Color.G, _PlayerNotes[n].Color.G,
_PlayerNotes[n].Color.B, _PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha); _PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
float BaseLine = Line.BaseLine; float BaseLine = Line.BaseLine;
int Nr = 1; int Nr = 1;
@@ -326,7 +316,7 @@ namespace VocaluxeLib.Menu.SingNotes
SRectF rect = new SRectF( SRectF rect = new SRectF(
_PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w, _PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w,
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine)/2) / CBase.Settings.GetNumNoteLines() * h - dh, _PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
width, width,
h / CBase.Settings.GetNumNoteLines() + 2 * dh, h / CBase.Settings.GetNumNoteLines() + 2 * dh,
_PlayerNotes[n].Rect.Z _PlayerNotes[n].Rect.Z
@@ -340,29 +330,23 @@ namespace VocaluxeLib.Menu.SingNotes
AddGoldenNote(rect, n, Nr); AddGoldenNote(rect, n, Nr);
Nr++; Nr++;
} }
} }
} }
if (CBase.Config.GetDrawToneHelper() == EOffOn.TR_CONFIG_ON) if (CBase.Config.GetDrawToneHelper() == EOffOn.TR_CONFIG_ON)
{
DrawToneHelper(n, (int)BaseLine, (CBase.Game.GetMidBeatD() - Line.FirstNoteBeat) / beats * w); DrawToneHelper(n, (int)BaseLine, (CBase.Game.GetMidBeatD() - Line.FirstNoteBeat) / beats * w);
}
int i = 0; int i = 0;
while (i < _PlayerNotes[n].PerfectLineTwinkle.Count) while (i < _PlayerNotes[n].PerfectLineTwinkle.Count)
{ {
if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive) if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive)
{
_PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i); _PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i);
}
else else
i++; i++;
} }
foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle) foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
{
perfline.Draw(); perfline.Draw();
}
if (SingLine == null || SingLine.Count == 0 || CBase.Game.GetPlayer()[Player].CurrentLine == -1 || SingLine.Count <= CBase.Game.GetPlayer()[Player].CurrentLine) if (SingLine == null || SingLine.Count == 0 || CBase.Game.GetPlayer()[Player].CurrentLine == -1 || SingLine.Count <= CBase.Game.GetPlayer()[Player].CurrentLine)
{ {
@@ -385,7 +369,7 @@ namespace VocaluxeLib.Menu.SingNotes
SRectF rect = new SRectF( SRectF rect = new SRectF(
_PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w, _PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w,
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine)/2) / CBase.Settings.GetNumNoteLines() * h - dh, _PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
width, width,
h / CBase.Settings.GetNumNoteLines() + 2 * dh, h / CBase.Settings.GetNumNoteLines() + 2 * dh,
_PlayerNotes[n].Rect.Z _PlayerNotes[n].Rect.Z
@@ -426,9 +410,7 @@ namespace VocaluxeLib.Menu.SingNotes
while (i < _PlayerNotes[n].Flares.Count) while (i < _PlayerNotes[n].Flares.Count)
{ {
if (!_PlayerNotes[n].Flares[i].IsAlive) if (!_PlayerNotes[n].Flares[i].IsAlive)
{
_PlayerNotes[n].Flares.RemoveAt(i); _PlayerNotes[n].Flares.RemoveAt(i);
}
else else
i++; i++;
} }
@@ -437,15 +419,11 @@ namespace VocaluxeLib.Menu.SingNotes
while (i < _PlayerNotes[n].PerfectNoteEffect.Count) while (i < _PlayerNotes[n].PerfectNoteEffect.Count)
{ {
if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive) if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive)
{
_PlayerNotes[n].PerfectNoteEffect.RemoveAt(i); _PlayerNotes[n].PerfectNoteEffect.RemoveAt(i);
}
else else
i++; i++;
} }
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars) foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
{ {
@@ -454,28 +432,20 @@ namespace VocaluxeLib.Menu.SingNotes
} }
foreach (CParticleEffect flare in _PlayerNotes[n].Flares) foreach (CParticleEffect flare in _PlayerNotes[n].Flares)
{
flare.Draw(); flare.Draw();
}
foreach (CParticleEffect perfnote in _PlayerNotes[n].PerfectNoteEffect) foreach (CParticleEffect perfnote in _PlayerNotes[n].PerfectNoteEffect)
{
perfnote.Draw(); perfnote.Draw();
}
} }
public void UnloadTextures() public void UnloadTextures() {}
{
}
public void LoadTextures() public void LoadTextures() {}
{
}
public void ReloadTextures() public void ReloadTextures()
{ {
UnloadTextures(); UnloadTextures();
LoadTextures(); LoadTextures();
} }
private int FindPlayerLine(int ID) private int FindPlayerLine(int ID)
@@ -604,7 +574,7 @@ namespace VocaluxeLib.Menu.SingNotes
{ {
const int spacing = 0; const int spacing = 0;
if ( Nr > _PlayerNotes[n].GoldenStars.Count) if (Nr > _PlayerNotes[n].GoldenStars.Count)
{ {
float d = (1f - factor) / 2 * Rect.H; float d = (1f - factor) / 2 * Rect.H;
float dw = d; float dw = d;
@@ -689,7 +659,8 @@ namespace VocaluxeLib.Menu.SingNotes
Rect.Z Rect.Z
); );
CParticleEffect stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35, EParticleType.PerfNoteStar); CParticleEffect stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35,
EParticleType.PerfNoteStar);
_PlayerNotes[n].PerfectNoteEffect.Add(stars); _PlayerNotes[n].PerfectNoteEffect.Add(stars);
} }
@@ -704,7 +675,7 @@ namespace VocaluxeLib.Menu.SingNotes
int TonePlayer = CBase.Record.GetToneAbs(_PlayerNotes[n].PlayerNr); int TonePlayer = CBase.Record.GetToneAbs(_PlayerNotes[n].PlayerNr);
SRectF Rect = _PlayerNotes[n].Rect; SRectF Rect = _PlayerNotes[n].Rect;
while (TonePlayer - BaseLine < 0) while (TonePlayer - BaseLine < 0)
TonePlayer += 12; TonePlayer += 12;
@@ -719,18 +690,18 @@ namespace VocaluxeLib.Menu.SingNotes
float dy = Rect.H / (CBase.Settings.GetNumNoteLines()); float dy = Rect.H / (CBase.Settings.GetNumNoteLines());
SRectF rect = new SRectF( SRectF rect = new SRectF(
Rect.X - dy + XOffset, Rect.X - dy + XOffset,
Rect.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (TonePlayer - BaseLine) / 2f), Rect.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (TonePlayer - BaseLine) / 2f),
dy, dy,
dy, dy,
Rect.Z Rect.Z
); );
SColorF color = new SColorF( SColorF color = new SColorF(
_PlayerNotes[n].Color.R, _PlayerNotes[n].Color.R,
_PlayerNotes[n].Color.G, _PlayerNotes[n].Color.G,
_PlayerNotes[n].Color.B, _PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha); _PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
STexture ToneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID); STexture ToneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID);
CBase.Drawing.DrawTexture(ToneHelper, rect, color); CBase.Drawing.DrawTexture(ToneHelper, rect, color);
@@ -754,13 +725,9 @@ namespace VocaluxeLib.Menu.SingNotes
} }
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY) {}
{
}
public void ResizeElement(int stepW, int stepH) public void ResizeElement(int stepW, int stepH) {}
{
}
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
@@ -1,12 +1,8 @@
namespace VocaluxeLib.Menu.SingNotes
namespace VocaluxeLib.Menu.SingNotes
{ {
class CSingNotesClassic : CSingNotes class CSingNotesClassic : CSingNotes
{ {
public CSingNotesClassic(int PartyModeID) public CSingNotesClassic(int PartyModeID)
: base(PartyModeID) : base(PartyModeID) {}
{
}
} }
} }
+1 -2
View File
@@ -8,7 +8,6 @@ namespace VocaluxeLib.Menu.SingNotes
int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr); int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr);
void RemovePlayer(int ID); void RemovePlayer(int ID);
void AddLine(int ID, CLine[] Line, int LineNr, int Player); void AddLine(int ID, CLine[] Line, int LineNr, int Player);
void RemoveLine(int ID); void RemoveLine(int ID);
@@ -20,4 +19,4 @@ namespace VocaluxeLib.Menu.SingNotes
void Draw(int ID, int Player); void Draw(int ID, int Player);
void Draw(int ID, List<CLine> SingLine, int Player); void Draw(int ID, List<CLine> SingLine, int Player);
} }
} }
+186 -216
View File
@@ -31,7 +31,7 @@ namespace VocaluxeLib.Menu.SongMenu
public string Name = String.Empty; public string Name = String.Empty;
private STexture _CoverTextureSmall = new STexture(-1); private STexture _CoverTextureSmall = new STexture(-1);
private STexture _CoverTextureBig = new STexture(-1); private STexture _CoverTextureBig = new STexture(-1);
private bool _CoverBigLoaded = false; private bool _CoverBigLoaded;
public CCategory(string name) public CCategory(string name)
{ {
@@ -42,10 +42,7 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
get { return _CoverTextureSmall; } get { return _CoverTextureSmall; }
set set { _CoverTextureSmall = value; }
{
_CoverTextureSmall = value;
}
} }
public STexture CoverTextureBig public STexture CoverTextureBig
@@ -102,9 +99,9 @@ namespace VocaluxeLib.Menu.SongMenu
public class CSong public class CSong
{ {
private bool _CoverSmallLoaded = false; private bool _CoverSmallLoaded;
private bool _CoverBigLoaded = false; private bool _CoverBigLoaded;
private bool _NotesLoaded = false; private bool _NotesLoaded;
private STexture _CoverTextureSmall = new STexture(-1); private STexture _CoverTextureSmall = new STexture(-1);
private STexture _CoverTextureBig = new STexture(-1); private STexture _CoverTextureBig = new STexture(-1);
@@ -146,9 +143,7 @@ namespace VocaluxeLib.Menu.SongMenu
get get
{ {
if (!_CoverSmallLoaded) if (!_CoverSmallLoaded)
{
LoadSmallCover(); LoadSmallCover();
}
return _CoverTextureSmall; return _CoverTextureSmall;
} }
@@ -165,10 +160,11 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
if (_CoverBigLoaded) if (_CoverBigLoaded)
return _CoverTextureBig; return _CoverTextureBig;
else else
return _CoverTextureSmall; return _CoverTextureSmall;
} }
set { set
{
_CoverTextureBig = value; _CoverTextureBig = value;
_CoverBigLoaded = true; _CoverBigLoaded = true;
} }
@@ -182,7 +178,7 @@ namespace VocaluxeLib.Menu.SongMenu
public float Start = 0f; public float Start = 0f;
public float Finish = 0f; public float Finish = 0f;
public float BPM = 1f; public float BPM = 1f;
public float Gap = 0f; public float Gap = 0f;
public float VideoGap = 0f; public float VideoGap = 0f;
@@ -213,7 +209,7 @@ namespace VocaluxeLib.Menu.SongMenu
public EGameMode[] AvailableGameModes public EGameMode[] AvailableGameModes
{ {
get get
{ {
List<EGameMode> gms = new List<EGameMode>(); List<EGameMode> gms = new List<EGameMode>();
if (IsDuet) if (IsDuet)
@@ -229,9 +225,7 @@ namespace VocaluxeLib.Menu.SongMenu
} }
//No point creating a song without a text file --> Use factory method LoadSong //No point creating a song without a text file --> Use factory method LoadSong
private CSong() private CSong() {}
{
}
public static CSong LoadSong(string FilePath) public static CSong LoadSong(string FilePath)
{ {
@@ -243,81 +237,73 @@ namespace VocaluxeLib.Menu.SongMenu
public CSong(CSong song) public CSong(CSong song)
{ {
this._CoverTextureSmall = song._CoverTextureSmall; _CoverTextureSmall = song._CoverTextureSmall;
this._CoverTextureBig = song._CoverTextureBig; _CoverTextureBig = song._CoverTextureBig;
this.Medley = new SMedley(); Medley = new SMedley();
this.Medley.Source = song.Medley.Source; Medley.Source = song.Medley.Source;
this.Medley.StartBeat = song.Medley.StartBeat; Medley.StartBeat = song.Medley.StartBeat;
this.Medley.EndBeat = song.Medley.EndBeat; Medley.EndBeat = song.Medley.EndBeat;
this.Medley.FadeInTime = song.Medley.FadeInTime; Medley.FadeInTime = song.Medley.FadeInTime;
this.Medley.FadeOutTime = song.Medley.FadeOutTime; Medley.FadeOutTime = song.Medley.FadeOutTime;
this.CalculateMedley = song.CalculateMedley; CalculateMedley = song.CalculateMedley;
this.PreviewStart = song.PreviewStart; PreviewStart = song.PreviewStart;
this.ShortEnd = song.ShortEnd; ShortEnd = song.ShortEnd;
this.DuetPart1 = song.DuetPart1; DuetPart1 = song.DuetPart1;
this.DuetPart2 = song.DuetPart2; DuetPart2 = song.DuetPart2;
this.Encoding = song.Encoding; Encoding = song.Encoding;
this.Folder = song.Folder; Folder = song.Folder;
this.FolderName = song.FolderName; FolderName = song.FolderName;
this.FileName = song.FileName; FileName = song.FileName;
this.Relative = song.Relative; Relative = song.Relative;
this.MP3FileName = song.MP3FileName; MP3FileName = song.MP3FileName;
this.CoverFileName = song.CoverFileName; CoverFileName = song.CoverFileName;
this.BackgroundFileName = song.BackgroundFileName; BackgroundFileName = song.BackgroundFileName;
this.VideoFileName = song.VideoFileName; VideoFileName = song.VideoFileName;
this.VideoAspect = song.VideoAspect; VideoAspect = song.VideoAspect;
this._CoverSmallLoaded = song._CoverSmallLoaded; _CoverSmallLoaded = song._CoverSmallLoaded;
this._CoverBigLoaded = song._CoverBigLoaded; _CoverBigLoaded = song._CoverBigLoaded;
this._NotesLoaded = song._NotesLoaded; _NotesLoaded = song._NotesLoaded;
this.Artist = song.Artist; Artist = song.Artist;
this.Title = song.Title; Title = song.Title;
this.Start = song.Start;
this.Finish = song.Finish;
this.BPM = song.BPM; Start = song.Start;
this.Gap = song.Gap; Finish = song.Finish;
this.VideoGap = song.VideoGap;
this.Comment = new List<string>(); BPM = song.BPM;
Gap = song.Gap;
VideoGap = song.VideoGap;
Comment = new List<string>();
foreach (string value in song.Comment) foreach (string value in song.Comment)
{ Comment.Add(value);
this.Comment.Add(value);
}
this.ID = song.ID; ID = song.ID;
this.Visible = song.Visible; Visible = song.Visible;
this.CatIndex = song.CatIndex; CatIndex = song.CatIndex;
this.Selected = song.Selected; Selected = song.Selected;
this.Edition = new List<string>(); Edition = new List<string>();
foreach (string value in song.Edition) foreach (string value in song.Edition)
{ Edition.Add(value);
this.Edition.Add(value);
}
this.Genre = new List<string>(); Genre = new List<string>();
foreach (string value in song.Genre) foreach (string value in song.Genre)
{ Genre.Add(value);
this.Genre.Add(value);
}
this.Year = song.Year; Year = song.Year;
this.Language = new List<string>(); Language = new List<string>();
foreach (string value in song.Language) foreach (string value in song.Language)
{ Language.Add(value);
this.Language.Add(value);
}
this.Notes = new CNotes(song.Notes); Notes = new CNotes(song.Notes);
} }
public string GetMP3() public string GetMP3()
@@ -335,33 +321,32 @@ namespace VocaluxeLib.Menu.SongMenu
if (!File.Exists(FilePath)) if (!File.Exists(FilePath))
return false; return false;
this.Folder = Path.GetDirectoryName(FilePath); Folder = Path.GetDirectoryName(FilePath);
foreach (string folder in CBase.Config.GetSongFolder()) foreach (string folder in CBase.Config.GetSongFolder())
{ {
if (this.Folder.Contains(folder)) if (Folder.Contains(folder))
{ {
if (this.Folder.Length == folder.Length) if (Folder.Length == folder.Length)
this.FolderName = "Songs"; FolderName = "Songs";
else else
{ {
this.FolderName = this.Folder.Substring(folder.Length + 1, this.Folder.Length - folder.Length - 1); FolderName = Folder.Substring(folder.Length + 1, Folder.Length - folder.Length - 1);
int pos = this.FolderName.IndexOf("\\"); int pos = FolderName.IndexOf("\\");
if (pos >= 0) if (pos >= 0)
this.FolderName = this.FolderName.Substring(0, pos); FolderName = FolderName.Substring(0, pos);
} }
break; break;
} }
} }
this.FileName = Path.GetFileName(FilePath); FileName = Path.GetFileName(FilePath);
EHeaderFlags HeaderFlags = new EHeaderFlags(); EHeaderFlags HeaderFlags = new EHeaderFlags();
StreamReader sr = null; StreamReader sr = null;
try try
{ {
sr = new StreamReader(FilePath, Encoding.Default, true); sr = new StreamReader(FilePath, Encoding.Default, true);
string line; string line;
@@ -375,7 +360,8 @@ namespace VocaluxeLib.Menu.SongMenu
line = sr.ReadLine(); line = sr.ReadLine();
if (line.Length == 0) if (line.Length == 0)
continue; continue;
if (!line[0].ToString().Equals("#")) break; if (!line[0].ToString().Equals("#"))
break;
pos = line.IndexOf(":"); pos = line.IndexOf(":");
@@ -389,10 +375,10 @@ namespace VocaluxeLib.Menu.SongMenu
switch (Identifier) switch (Identifier)
{ {
case "ENCODING": case "ENCODING":
this.Encoding = CEncoding.GetEncoding(Value); Encoding = CEncoding.GetEncoding(Value);
sr.Dispose(); sr.Dispose();
sr = null; sr = null;
sr = new StreamReader(FilePath, this.Encoding); sr = new StreamReader(FilePath, Encoding);
Identifier = String.Empty; Identifier = String.Empty;
//Scip everything till encoding //Scip everything till encoding
@@ -401,7 +387,8 @@ namespace VocaluxeLib.Menu.SongMenu
line = sr.ReadLine(); line = sr.ReadLine();
if (line.Length == 0) if (line.Length == 0)
continue; continue;
if (!line[0].ToString().Equals("#")) break; if (!line[0].ToString().Equals("#"))
break;
pos = line.IndexOf(":"); pos = line.IndexOf(":");
@@ -416,136 +403,128 @@ namespace VocaluxeLib.Menu.SongMenu
case "TITLE": case "TITLE":
if (Value.Length > 0) if (Value.Length > 0)
{ {
this.Title = Value; Title = Value;
HeaderFlags |= EHeaderFlags.Title; HeaderFlags |= EHeaderFlags.Title;
} }
break; break;
case "ARTIST": case "ARTIST":
if (Value.Length > 0) if (Value.Length > 0)
{ {
this.Artist = Value; Artist = Value;
HeaderFlags |= EHeaderFlags.Artist; HeaderFlags |= EHeaderFlags.Artist;
} }
break; break;
case "TITLE-ON-SORTING": case "TITLE-ON-SORTING":
if (Value.Length > 0) if (Value.Length > 0)
{ TitleSorting = Value;
this.TitleSorting = Value;
}
break; break;
case "ARTIST-ON-SORTING": case "ARTIST-ON-SORTING":
if (Value.Length > 0) if (Value.Length > 0)
{ ArtistSorting = Value;
this.ArtistSorting = Value;
}
break; break;
case "P1": case "P1":
if (Value.Length > 0) if (Value.Length > 0)
{ DuetPart1 = Value;
this.DuetPart1 = Value;
}
break; break;
case "P2": case "P2":
if (Value.Length > 0) if (Value.Length > 0)
{ DuetPart2 = Value;
this.DuetPart2 = Value;
}
break; break;
case "MP3": case "MP3":
if (File.Exists(Path.Combine(this.Folder, Value))) if (File.Exists(Path.Combine(Folder, Value)))
{ {
this.MP3FileName = Value; MP3FileName = Value;
HeaderFlags |= EHeaderFlags.MP3; HeaderFlags |= EHeaderFlags.MP3;
} }
else else
{ {
CBase.Log.LogError("Can't find audio file: " + Path.Combine(this.Folder, Value)); CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, Value));
return false; return false;
} }
break; break;
case "BPM": case "BPM":
if (CHelper.TryParse(Value, out this.BPM)) if (CHelper.TryParse(Value, out BPM))
{ {
this.BPM *= 4; BPM *= 4;
HeaderFlags |= EHeaderFlags.BPM; HeaderFlags |= EHeaderFlags.BPM;
} }
break; break;
case "EDITION": case "EDITION":
if (Value.Length > 1) if (Value.Length > 1)
this.Edition.Add(Value); Edition.Add(Value);
break; break;
case "GENRE": case "GENRE":
if (Value.Length > 1) if (Value.Length > 1)
this.Genre.Add(Value); Genre.Add(Value);
break; break;
case "YEAR": case "YEAR":
int num = 0; int num = 0;
if (Value.Length == 4 && int.TryParse(Value, out num) && num != 0) if (Value.Length == 4 && int.TryParse(Value, out num) && num != 0)
{ Year = Value;
this.Year = Value;
}
break; break;
case "LANGUAGE": case "LANGUAGE":
if (Value.Length > 1) if (Value.Length > 1)
this.Language.Add(Value); Language.Add(Value);
break; break;
case "COMMENT": case "COMMENT":
if (Value.Length > 1) if (Value.Length > 1)
this.Comment.Add(Value); Comment.Add(Value);
break; break;
case "GAP": case "GAP":
if (CHelper.TryParse(Value, out this.Gap)) if (CHelper.TryParse(Value, out Gap))
this.Gap /= 1000f; Gap /= 1000f;
break; break;
case "COVER": case "COVER":
if (File.Exists(Path.Combine(this.Folder, Value))) if (File.Exists(Path.Combine(Folder, Value)))
this.CoverFileName = Value; CoverFileName = Value;
break; break;
case "BACKGROUND": case "BACKGROUND":
if (File.Exists(Path.Combine(this.Folder, Value))) if (File.Exists(Path.Combine(Folder, Value)))
this.BackgroundFileName = Value; BackgroundFileName = Value;
break; break;
case "VIDEO": case "VIDEO":
if (File.Exists(Path.Combine(this.Folder, Value))) if (File.Exists(Path.Combine(Folder, Value)))
this.VideoFileName = Value; VideoFileName = Value;
else else
CBase.Log.LogError("Can't find video file: " + Path.Combine(this.Folder, Value)); CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, Value));
break; break;
case "VIDEOGAP": case "VIDEOGAP":
CHelper.TryParse(Value, out this.VideoGap); CHelper.TryParse(Value, out VideoGap);
break; break;
case "VIDEOASPECT": case "VIDEOASPECT":
CHelper.TryParse<EAspect>(Value, out this.VideoAspect, true); CHelper.TryParse(Value, out VideoAspect, true);
break; break;
case "START": case "START":
CHelper.TryParse(Value, out this.Start); CHelper.TryParse(Value, out Start);
break; break;
case "END": case "END":
if (CHelper.TryParse(Value, out this.Finish)) if (CHelper.TryParse(Value, out Finish))
this.Finish /= 1000f; Finish /= 1000f;
break; break;
case "PREVIEWSTART": case "PREVIEWSTART":
if (CHelper.TryParse(Value, out this.PreviewStart)) if (CHelper.TryParse(Value, out PreviewStart))
if (this.PreviewStart < 0f) {
this.PreviewStart = 0f; if (PreviewStart < 0f)
PreviewStart = 0f;
else else
HeaderFlags |= EHeaderFlags.PreviewStart; HeaderFlags |= EHeaderFlags.PreviewStart;
}
break; break;
case "MEDLEYSTARTBEAT": case "MEDLEYSTARTBEAT":
if (int.TryParse(Value, out this.Medley.StartBeat)) if (int.TryParse(Value, out Medley.StartBeat))
HeaderFlags |= EHeaderFlags.MedleyStartBeat; HeaderFlags |= EHeaderFlags.MedleyStartBeat;
break; break;
case "MEDLEYENDBEAT": case "MEDLEYENDBEAT":
if (int.TryParse(Value, out this.Medley.EndBeat)) if (int.TryParse(Value, out Medley.EndBeat))
HeaderFlags |= EHeaderFlags.MedleyEndBeat; HeaderFlags |= EHeaderFlags.MedleyEndBeat;
break; break;
case "CALCMEDLEY": case "CALCMEDLEY":
if (Value.ToUpper() == "OFF") if (Value.ToUpper() == "OFF")
this.CalculateMedley = false; CalculateMedley = false;
break; break;
case "RELATIVE": case "RELATIVE":
if (Value.ToUpper() == "YES" && Value.ToUpper() != "NO") if (Value.ToUpper() == "YES" && Value.ToUpper() != "NO")
this.Relative = EOffOn.TR_CONFIG_ON; Relative = EOffOn.TR_CONFIG_ON;
break; break;
} }
} }
@@ -586,33 +565,33 @@ namespace VocaluxeLib.Menu.SongMenu
#region check medley tags #region check medley tags
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0)
{ {
if (this.Medley.StartBeat > this.Medley.EndBeat) if (Medley.StartBeat > Medley.EndBeat)
{ {
CBase.Log.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath); CBase.Log.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath);
HeaderFlags = HeaderFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat; HeaderFlags = HeaderFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat;
} }
} }
if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || this.PreviewStart == 0f) if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || PreviewStart == 0f)
{ {
//PreviewStart is not set or <=0 //PreviewStart is not set or <=0
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0) if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0)
//fallback to MedleyStart //fallback to MedleyStart
this.PreviewStart = CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM); PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM);
else else
//else set to 0, it will be set in FindRefrainStart //else set to 0, it will be set in FindRefrainStart
this.PreviewStart = 0f; PreviewStart = 0f;
} }
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0)
{ {
this.Medley.Source = EMedleySource.Tag; Medley.Source = EMedleySource.Tag;
this.Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime(); Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
this.Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime(); Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
} }
#endregion check medley tags #endregion check medley tags
this.Encoding = sr.CurrentEncoding; Encoding = sr.CurrentEncoding;
} }
catch (Exception e) catch (Exception e)
{ {
@@ -625,24 +604,21 @@ namespace VocaluxeLib.Menu.SongMenu
CheckFiles(); CheckFiles();
//Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag. //Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag.
if (this.ArtistSorting.Length == 0) if (ArtistSorting.Length == 0)
{ ArtistSorting = Artist;
this.ArtistSorting = this.Artist;
}
if (this.TitleSorting.Length == 0) if (TitleSorting.Length == 0)
{ TitleSorting = Title;
this.TitleSorting = this.Title;
}
return true; return true;
} }
public bool ReadNotes() public bool ReadNotes()
{ {
return ReadNotes(Path.Combine(this.Folder, this.FileName)); return ReadNotes(Path.Combine(Folder, FileName));
} }
public bool ReadNotes(string FilePath, bool forceReload=false)
public bool ReadNotes(string FilePath, bool forceReload = false)
{ {
//Skip loading if already done and no reload is forced //Skip loading if already done and no reload is forced
if (_NotesLoaded && !forceReload) if (_NotesLoaded && !forceReload)
@@ -669,19 +645,18 @@ namespace VocaluxeLib.Menu.SongMenu
StreamReader sr = null; StreamReader sr = null;
try try
{ {
sr = new StreamReader(FilePath, Encoding, true);
sr = new StreamReader(FilePath, this.Encoding, true); Notes.Reset();
this.Notes.Reset();
//Search for Note Beginning //Search for Note Beginning
while(!sr.EndOfStream) while (!sr.EndOfStream)
{ {
line = sr.ReadLine(); line = sr.ReadLine();
FileLineNo++; FileLineNo++;
TempC = (char)sr.Peek(); TempC = (char)sr.Peek();
if ((TempC == '#') || (TempC == '\r') || (TempC == '\n')) if ((TempC == '#') || (TempC == '\r') || (TempC == '\n'))
continue; continue;
if ((TempC == ':') || (TempC == 'F') || (TempC == '*') || (TempC == 'P')) if ((TempC == ':') || (TempC == 'F') || (TempC == '*') || (TempC == 'P'))
{ {
@@ -698,12 +673,11 @@ namespace VocaluxeLib.Menu.SongMenu
do do
{ {
char chr; char chr;
switch (TempC) switch (TempC)
{ {
case 'P': case 'P':
while ((chr = (char)sr.Read()) == ' ') { } while ((chr = (char)sr.Read()) == ' ') {}
int.TryParse(chr.ToString(), out Param1); int.TryParse(chr.ToString(), out Param1);
if (Param1 == 1) if (Param1 == 1)
@@ -743,7 +717,7 @@ namespace VocaluxeLib.Menu.SongMenu
else else
NoteType = ENoteType.Normal; NoteType = ENoteType.Normal;
if (this.Relative == EOffOn.TR_CONFIG_ON) if (Relative == EOffOn.TR_CONFIG_ON)
Param1 += currentPos; Param1 += currentPos;
if (Player != 2) if (Player != 2)
@@ -766,7 +740,7 @@ namespace VocaluxeLib.Menu.SongMenu
sr.Read(); sr.Read();
Param1 = CHelper.TryReadInt(sr); Param1 = CHelper.TryReadInt(sr);
if (this.Relative == EOffOn.TR_CONFIG_ON) if (Relative == EOffOn.TR_CONFIG_ON)
{ {
Param1 += currentPos; Param1 += currentPos;
sr.Read(); sr.Read();
@@ -798,17 +772,15 @@ namespace VocaluxeLib.Menu.SongMenu
} while (!sr.EndOfStream && (c == 19 || c == 16 || c == 13 || c == 10)); } while (!sr.EndOfStream && (c == 19 || c == 16 || c == 13 || c == 10));
TempC = (char)c; TempC = (char)c;
FileLineNo++; FileLineNo++;
}while(!sr.EndOfStream && (TempC != 'E')); } while (!sr.EndOfStream && (TempC != 'E'));
foreach(CLines lines in this.Notes.Lines) foreach (CLines lines in Notes.Lines)
{
lines.UpdateTimings(); lines.UpdateTimings();
}
} }
catch (Exception e) catch (Exception e)
{ {
CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath); CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath);
if(sr != null) if (sr != null)
sr.Dispose(); sr.Dispose();
return false; return false;
} }
@@ -816,7 +788,7 @@ namespace VocaluxeLib.Menu.SongMenu
FindRefrain(); FindRefrain();
FindShortEnd(); FindShortEnd();
_NotesLoaded = true; _NotesLoaded = true;
if(IsDuet) if (IsDuet)
CheckDuet(); CheckDuet();
return true; return true;
} }
@@ -824,7 +796,7 @@ namespace VocaluxeLib.Menu.SongMenu
private bool ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text) private bool ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text)
{ {
CNote note = new CNote(Start, Length, Tone, Text, NoteType); CNote note = new CNote(Start, Length, Tone, Text, NoteType);
CLines lines = this.Notes.GetLines(Player); CLines lines = Notes.GetLines(Player);
return lines.AddNote(note); return lines.AddNote(note);
} }
@@ -833,16 +805,16 @@ namespace VocaluxeLib.Menu.SongMenu
CLines lines = Notes.GetLines(Player); CLines lines = Notes.GetLines(Player);
CLine line = new CLine(); CLine line = new CLine();
line.StartBeat = Start; line.StartBeat = Start;
lines.AddLine(line); lines.AddLine(line);
} }
public void LoadSmallCover() public void LoadSmallCover()
{ {
if (_CoverSmallLoaded) if (_CoverSmallLoaded)
return; return;
if (this.CoverFileName.Length > 0) if (CoverFileName.Length > 0)
{ {
if (!CBase.DataBase.GetCover(Path.Combine(this.Folder, this.CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize())) if (!CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
_CoverTextureSmall = CBase.Cover.GetNoCover(); _CoverTextureSmall = CBase.Cover.GetNoCover();
} }
else else
@@ -853,29 +825,27 @@ namespace VocaluxeLib.Menu.SongMenu
private void CheckFiles() private void CheckFiles()
{ {
if(this.CoverFileName.Length == 0){ if (CoverFileName.Length == 0)
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false); {
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false)); List<string> files = CHelper.ListFiles(Folder, "*.jpg", false);
foreach(String file in files) files.AddRange(CHelper.ListFiles(Folder, "*.png", false));
foreach (String file in files)
{ {
if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase))) if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) &&
{ (Regex.IsMatch(file, @"" + Regex.Escape(Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(Artist), RegexOptions.IgnoreCase)))
this.CoverFileName = file; CoverFileName = file;
}
} }
} }
if (this.BackgroundFileName.Length == 0) if (BackgroundFileName.Length == 0)
{ {
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false); List<string> files = CHelper.ListFiles(Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false)); files.AddRange(CHelper.ListFiles(Folder, "*.png", false));
foreach (String file in files) foreach (String file in files)
{ {
if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) &&
if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase))) (Regex.IsMatch(file, @"" + Regex.Escape(Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(Artist), RegexOptions.IgnoreCase)))
{ BackgroundFileName = file;
this.BackgroundFileName = file;
}
} }
} }
} }
@@ -885,12 +855,12 @@ namespace VocaluxeLib.Menu.SongMenu
if (DuetPart1.Length == 0) if (DuetPart1.Length == 0)
{ {
DuetPart1 = "Part 1"; DuetPart1 = "Part 1";
CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + this.Artist + " - " + this.Title + "\"."); CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + Artist + " - " + Title + "\".");
} }
if (DuetPart2.Length == 0) if (DuetPart2.Length == 0)
{ {
DuetPart2 = "Part 2"; DuetPart2 = "Part 2";
CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + this.Artist + " - " + this.Title + "\"."); CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + Artist + " - " + Title + "\".");
} }
} }
@@ -903,7 +873,7 @@ namespace VocaluxeLib.Menu.SongMenu
private List<Series> GetSeries() private List<Series> GetSeries()
{ {
CLines lines = this.Notes.GetLines(0); CLines lines = Notes.GetLines(0);
if (lines.LineCount == 0) if (lines.LineCount == 0)
return null; return null;
@@ -954,16 +924,16 @@ namespace VocaluxeLib.Menu.SongMenu
private void FindRefrain() private void FindRefrain()
{ {
if (this.IsDuet) if (IsDuet)
{ {
this.Medley.Source = EMedleySource.None; Medley.Source = EMedleySource.None;
return; return;
} }
if (this.Medley.Source == EMedleySource.Tag) if (Medley.Source == EMedleySource.Tag)
return; return;
if (!this.CalculateMedley) if (!CalculateMedley)
return; return;
List<Series> series = GetSeries(); List<Series> series = GetSeries();
@@ -978,55 +948,56 @@ namespace VocaluxeLib.Menu.SongMenu
longest = i; longest = i;
} }
CLines lines = this.Notes.GetLines(0); CLines lines = Notes.GetLines(0);
// set medley vars // set medley vars
if (series.Count > 0 && series[longest].length > CBase.Settings.GetMedleyMinSeriesLength()) if (series.Count > 0 && series[longest].length > CBase.Settings.GetMedleyMinSeriesLength())
{ {
this.Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat; Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat;
this.Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat; Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat;
bool foundEnd = false; bool foundEnd = false;
// set end if duration > MedleyMinDuration // set end if duration > MedleyMinDuration
if (CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CBase.Settings.GetMedleyMinDuration() > if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(this.Medley.EndBeat, this.BPM)) CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM))
foundEnd = true; foundEnd = true;
if (!foundEnd) if (!foundEnd)
{ {
for (int i = series[longest].start + 1; i < lines.LineCount - 1; i++) for (int i = series[longest].start + 1; i < lines.LineCount - 1; i++)
{ {
if (CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CBase.Settings.GetMedleyMinDuration() > if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, this.BPM)) CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, BPM))
{ {
foundEnd = true; foundEnd = true;
this.Medley.EndBeat = lines.Line[i].LastNoteBeat; Medley.EndBeat = lines.Line[i].LastNoteBeat;
} }
} }
} }
if (foundEnd) if (foundEnd)
{ {
this.Medley.Source = EMedleySource.Calculated; Medley.Source = EMedleySource.Calculated;
this.Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime(); Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
this.Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime(); Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
} }
} }
if (this.PreviewStart == 0f) if (PreviewStart == 0f)
{ {
if (this.Medley.Source == EMedleySource.Calculated) if (Medley.Source == EMedleySource.Calculated)
this.PreviewStart = CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM); PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM);
} }
} }
private void FindShortEnd(){ private void FindShortEnd()
{
List<Series> series = GetSeries(); List<Series> series = GetSeries();
if (series == null) if (series == null)
return; return;
CLines lines = this.Notes.GetLines(0); CLines lines = Notes.GetLines(0);
//Calculate length of singing //Calculate length of singing
int stop = (lines.Line[lines.Line.Length - 1].LastNoteBeat - lines.Line[0].FirstNoteBeat) / 2 + lines.Line[0].StartBeat; int stop = (lines.Line[lines.Line.Length - 1].LastNoteBeat - lines.Line[0].FirstNoteBeat) / 2 + lines.Line[0].StartBeat;
@@ -1038,12 +1009,12 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
if (stop < (lines.Line[series[i].start].FirstNoteBeat + ((lines.Line[series[i].end].LastNoteBeat - lines.Line[series[i].start].FirstNoteBeat) / 2))) if (stop < (lines.Line[series[i].start].FirstNoteBeat + ((lines.Line[series[i].end].LastNoteBeat - lines.Line[series[i].start].FirstNoteBeat) / 2)))
{ {
this.ShortEnd = lines.Line[series[i].start-1].LastNote.EndBeat; ShortEnd = lines.Line[series[i].start - 1].LastNote.EndBeat;
return; return;
} }
else else
{ {
this.ShortEnd = lines.Line[series[i].end].LastNote.EndBeat; ShortEnd = lines.Line[series[i].end].LastNote.EndBeat;
return; return;
} }
} }
@@ -1054,13 +1025,12 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
if (lines.Line[i].FirstNoteBeat < stop && lines.Line[i].LastNoteBeat > stop) if (lines.Line[i].FirstNoteBeat < stop && lines.Line[i].LastNoteBeat > stop)
{ {
this.ShortEnd = lines.Line[i].LastNoteBeat; ShortEnd = lines.Line[i].LastNoteBeat;
return; return;
} }
} }
ShortEnd = stop; ShortEnd = stop;
} }
public object Clone() public object Clone()
@@ -1068,4 +1038,4 @@ namespace VocaluxeLib.Menu.SongMenu
return base.MemberwiseClone(); return base.MemberwiseClone();
} }
} }
} }
+11 -14
View File
@@ -5,7 +5,7 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
public class CSongMenu : ISongMenu public class CSongMenu : ISongMenu
{ {
private int _PartyModeID; private readonly int _PartyModeID;
private ISongMenu _SongMenu; private ISongMenu _SongMenu;
private ESongMenu _Type; private ESongMenu _Type;
@@ -154,7 +154,6 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
_SongMenu.SetSmallView(SmallView); _SongMenu.SetSmallView(SmallView);
} }
#endregion ISongMenu #endregion ISongMenu
#region IMenuElement #region IMenuElement
@@ -202,30 +201,28 @@ namespace VocaluxeLib.Menu.SongMenu
private void CreateSongMenu() private void CreateSongMenu()
{ {
if (_SongMenu != null) if (_SongMenu != null)
{
_SongMenu.OnHide(); _SongMenu.OnHide();
}
switch (CBase.Config.GetSongMenuType()) switch (CBase.Config.GetSongMenuType())
{ {
//case ESongMenu.TR_CONFIG_LIST: //case ESongMenu.TR_CONFIG_LIST:
// _SongMenu = new CSongMenuList(); // _SongMenu = new CSongMenuList();
// break; // break;
//case ESongMenu.TR_CONFIG_DREIDEL: //case ESongMenu.TR_CONFIG_DREIDEL:
// _SongMenu = new CSongMenuDreidel(); // _SongMenu = new CSongMenuDreidel();
// break; // break;
case ESongMenu.TR_CONFIG_TILE_BOARD: case ESongMenu.TR_CONFIG_TILE_BOARD:
_SongMenu = new CSongMenuTileBoard(_PartyModeID); _SongMenu = new CSongMenuTileBoard(_PartyModeID);
break; break;
//case ESongMenu.TR_CONFIG_BOOK: //case ESongMenu.TR_CONFIG_BOOK:
// _SongMenu = new CSongMenuBook(); // _SongMenu = new CSongMenuBook();
// break; // break;
} }
_Type = CBase.Config.GetSongMenuType(); _Type = CBase.Config.GetSongMenuType();
} }
} }
} }
+3 -6
View File
@@ -1,11 +1,8 @@
namespace VocaluxeLib.Menu.SongMenu
namespace VocaluxeLib.Menu.SongMenu
{ {
class CSongMenuBook : CSongMenuFramework class CSongMenuBook : CSongMenuFramework
{ {
public CSongMenuBook(int PartyModeID) public CSongMenuBook(int PartyModeID)
: base(PartyModeID) : base(PartyModeID) {}
{
}
} }
} }
@@ -1,5 +1,4 @@
namespace VocaluxeLib.Menu.SongMenu
namespace VocaluxeLib.Menu.SongMenu
{ {
class CSongMenuDreidel : CSongMenuFramework class CSongMenuDreidel : CSongMenuFramework
{ {
@@ -24,9 +23,7 @@ namespace VocaluxeLib.Menu.SongMenu
*/ */
public CSongMenuDreidel(int PartyModeID) public CSongMenuDreidel(int PartyModeID)
: base(PartyModeID) : base(PartyModeID) {}
{
}
public override void Init() public override void Init()
{ {
@@ -43,4 +40,4 @@ namespace VocaluxeLib.Menu.SongMenu
**/ **/
} }
} }
} }
+21 -48
View File
@@ -10,7 +10,7 @@ namespace VocaluxeLib.Menu.SongMenu
struct SThemeSongMenu struct SThemeSongMenu
{ {
public string Name; public string Name;
public string CoverBackgroundName; public string CoverBackgroundName;
public string CoverBigBackgroundName; public string CoverBigBackgroundName;
public string DuetIconName; public string DuetIconName;
@@ -27,47 +27,41 @@ namespace VocaluxeLib.Menu.SongMenu
public SThemeSongMenuTileBoard songMenuTileBoard; public SThemeSongMenuTileBoard songMenuTileBoard;
} }
struct SThemeSongMenuBook struct SThemeSongMenuBook {}
{
}
struct SThemeSongMenuDreidel struct SThemeSongMenuDreidel {}
{
}
struct SThemeSongMenuList struct SThemeSongMenuList {}
{
}
struct SThemeSongMenuTileBoard struct SThemeSongMenuTileBoard
{ {
/// <summary> /// <summary>
/// Number of tiles horizontal /// Number of tiles horizontal
/// </summary> /// </summary>
public int numW; public int numW;
/// <summary> /// <summary>
/// Number of tiles vertical /// Number of tiles vertical
/// </summary> /// </summary>
public int numH; public int numH;
/// <summary> /// <summary>
/// Number of tiles horizontal in small-modus /// Number of tiles horizontal in small-modus
/// </summary> /// </summary>
public int numWsmall; public int numWsmall;
/// <summary> /// <summary>
/// Number of tiles vertical in small-modus /// Number of tiles vertical in small-modus
/// </summary> /// </summary>
public int numHsmall; public int numHsmall;
/// <summary> /// <summary>
/// Space between tiles horizontal /// Space between tiles horizontal
/// </summary> /// </summary>
public float spaceW; public float spaceW;
/// <summary> /// <summary>
/// Space between tiles vertical /// Space between tiles vertical
/// </summary> /// </summary>
public float spaceH; public float spaceH;
@@ -92,9 +86,9 @@ namespace VocaluxeLib.Menu.SongMenu
protected SThemeSongMenu _Theme; protected SThemeSongMenu _Theme;
private bool _ThemeLoaded; private bool _ThemeLoaded;
private Stopwatch _timer = new Stopwatch(); private readonly Stopwatch _timer = new Stopwatch();
private Stopwatch _VideoFadeTimer = new Stopwatch(); private readonly Stopwatch _VideoFadeTimer = new Stopwatch();
private List<int> _streams = new List<int>(); private readonly List<int> _streams = new List<int>();
private int _video = -1; private int _video = -1;
private int _actsong = -1; private int _actsong = -1;
private int _actsongstream = -1; private int _actsongstream = -1;
@@ -155,7 +149,6 @@ namespace VocaluxeLib.Menu.SongMenu
_SelectedInternal = _SelectedPending; _SelectedInternal = _SelectedPending;
} }
} }
} }
protected virtual void SetSelectedNow() protected virtual void SetSelectedNow()
@@ -165,7 +158,7 @@ namespace VocaluxeLib.Menu.SongMenu
_SelectedInternal = _SelectedPending; _SelectedInternal = _SelectedPending;
} }
protected int _Locked //the real selected song for singing protected int _Locked //the real selected song for singing
{ {
get { return _LockedInternal; } get { return _LockedInternal; }
set { _LockedInternal = value; } set { _LockedInternal = value; }
@@ -206,7 +199,7 @@ namespace VocaluxeLib.Menu.SongMenu
return _actsong; return _actsong;
} }
private bool _Selected = false; private bool _Selected;
private bool _Visible = true; private bool _Visible = true;
public bool IsSelected() public bool IsSelected()
@@ -267,9 +260,7 @@ namespace VocaluxeLib.Menu.SongMenu
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", ref _Theme.MedleyTagIcon, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", ref _Theme.MedleyTagIcon, String.Empty);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out _Color); _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out _Color);
}
else else
{ {
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R);
@@ -309,7 +300,6 @@ namespace VocaluxeLib.Menu.SongMenu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallZ", ref _Theme.songMenuTileBoard.TileRectSmall.Z); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallZ", ref _Theme.songMenuTileBoard.TileRectSmall.Z);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallW", ref _Theme.songMenuTileBoard.TileRectSmall.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallW", ref _Theme.songMenuTileBoard.TileRectSmall.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallH", ref _Theme.songMenuTileBoard.TileRectSmall.H); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallH", ref _Theme.songMenuTileBoard.TileRectSmall.H);
#endregion SongMenuTileBoard #endregion SongMenuTileBoard
if (_ThemeLoaded) if (_ThemeLoaded)
@@ -349,9 +339,7 @@ namespace VocaluxeLib.Menu.SongMenu
writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)"); writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)"); writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0) if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName); writer.WriteElementString("Color", _Theme.ColorName);
}
else else
{ {
writer.WriteElementString("R", _Color.R.ToString("#0.00")); writer.WriteElementString("R", _Color.R.ToString("#0.00"));
@@ -406,7 +394,7 @@ namespace VocaluxeLib.Menu.SongMenu
_Theme.songMenuTileBoard.StaticVideoIcon.SaveTheme(writer); _Theme.songMenuTileBoard.StaticVideoIcon.SaveTheme(writer);
_Theme.songMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer); _Theme.songMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer);
_Theme.songMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer); _Theme.songMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer);
writer.WriteEndElement(); writer.WriteEndElement();
#endregion SongMenuTileBoard #endregion SongMenuTileBoard
@@ -447,13 +435,11 @@ namespace VocaluxeLib.Menu.SongMenu
} }
float time = CBase.Sound.GetPosition(_actsongstream); float time = CBase.Sound.GetPosition(_actsongstream);
float vtime = 0f; float vtime = 0f;
CBase.Video.GetFrame(_video, ref _vidtex, time, ref vtime); CBase.Video.GetFrame(_video, ref _vidtex, time, ref vtime);
if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L) if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L)
{
_vidtex.color.A = (_VideoFadeTimer.ElapsedMilliseconds / 3000f); _vidtex.color.A = (_VideoFadeTimer.ElapsedMilliseconds / 3000f);
}
else else
{ {
_vidtex.color.A = 1f; _vidtex.color.A = 1f;
@@ -471,15 +457,13 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual void OnHide() public virtual void OnHide()
{ {
foreach (int stream in _streams) foreach (int stream in _streams)
{
CBase.Sound.FadeAndStop(stream, 0f, 0.75f); CBase.Sound.FadeAndStop(stream, 0f, 0.75f);
}
_streams.Clear(); _streams.Clear();
CBase.Video.Close(_video); CBase.Video.Close(_video);
_video = -1; _video = -1;
CBase.Drawing.RemoveTexture(ref _vidtex); CBase.Drawing.RemoveTexture(ref _vidtex);
_timer.Stop(); _timer.Stop();
_timer.Reset(); _timer.Reset();
@@ -504,10 +488,7 @@ namespace VocaluxeLib.Menu.SongMenu
return; return;
if (_video != -1) if (_video != -1)
{
CBase.Drawing.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0)); CBase.Drawing.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0));
}
} }
public virtual void ApplyVolume(float VolumeMax) public virtual void ApplyVolume(float VolumeMax)
@@ -515,9 +496,7 @@ namespace VocaluxeLib.Menu.SongMenu
_MaxVolume = VolumeMax; _MaxVolume = VolumeMax;
foreach (int stream in _streams) foreach (int stream in _streams)
{
CBase.Sound.SetStreamVolumeMax(stream, _MaxVolume); CBase.Sound.SetStreamVolumeMax(stream, _MaxVolume);
}
} }
public virtual bool IsActive() public virtual bool IsActive()
@@ -568,9 +547,7 @@ namespace VocaluxeLib.Menu.SongMenu
return false; return false;
} }
public virtual void UnloadTextures() public virtual void UnloadTextures() {}
{
}
public virtual void LoadTextures() public virtual void LoadTextures()
{ {
@@ -630,9 +607,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && (CBase.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0))) if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && (CBase.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0)))
{ {
foreach (int stream in _streams) foreach (int stream in _streams)
{
CBase.Sound.FadeAndStop(stream, 0f, 1f); CBase.Sound.FadeAndStop(stream, 0f, 1f);
}
_streams.Clear(); _streams.Clear();
CBase.Video.Close(_video); CBase.Video.Close(_video);
@@ -659,7 +634,7 @@ namespace VocaluxeLib.Menu.SongMenu
CBase.Sound.Fade(_stream, 100f, 3f); CBase.Sound.Fade(_stream, 100f, 3f);
_streams.Add(_stream); _streams.Add(_stream);
_actsongstream = _stream; _actsongstream = _stream;
if (CBase.Songs.GetVisibleSong(_actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) if (CBase.Songs.GetVisibleSong(_actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
{ {
_video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_actsong).Folder, CBase.Songs.GetVisibleSong(_actsong).VideoFileName)); _video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_actsong).Folder, CBase.Songs.GetVisibleSong(_actsong).VideoFileName));
@@ -676,9 +651,7 @@ namespace VocaluxeLib.Menu.SongMenu
protected void Reset() protected void Reset()
{ {
foreach (int stream in _streams) foreach (int stream in _streams)
{
CBase.Sound.FadeAndStop(stream, 0f, 0.75f); CBase.Sound.FadeAndStop(stream, 0f, 0.75f);
}
_streams.Clear(); _streams.Clear();
CBase.Video.Close(_video); CBase.Video.Close(_video);
@@ -716,4 +689,4 @@ namespace VocaluxeLib.Menu.SongMenu
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+3 -6
View File
@@ -1,11 +1,8 @@
namespace VocaluxeLib.Menu.SongMenu
namespace VocaluxeLib.Menu.SongMenu
{ {
class CSongMenuList : CSongMenuFramework class CSongMenuList : CSongMenuFramework
{ {
public CSongMenuList(int PartyModeID) public CSongMenuList(int PartyModeID)
: base(PartyModeID) : base(PartyModeID) {}
{
}
} }
} }
+12 -44
View File
@@ -36,12 +36,10 @@ namespace VocaluxeLib.Menu.SongMenu
private int _Offset = -1; private int _Offset = -1;
private int _actualSelection = -1; private int _actualSelection = -1;
private bool _SmallView = false; private bool _SmallView;
public CSongMenuTileBoard(int PartyModeID) public CSongMenuTileBoard(int PartyModeID)
: base(PartyModeID) : base(PartyModeID) {}
{
}
public override int GetActualSelection() public override int GetActualSelection()
{ {
@@ -73,7 +71,7 @@ namespace VocaluxeLib.Menu.SongMenu
for (int j = 0; j < _NumW; j++) for (int j = 0; j < _NumW; j++)
{ {
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW), SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
_Tiles.Add(tile); _Tiles.Add(tile);
} }
@@ -105,18 +103,14 @@ namespace VocaluxeLib.Menu.SongMenu
_Locked = _PreviewSelected; _Locked = _PreviewSelected;
_actualSelection = _PreviewSelected; _actualSelection = _PreviewSelected;
for (int i = 0; i < _Tiles.Count; i++) for (int i = 0; i < _Tiles.Count; i++)
{
_Tiles[i].Selected = _Locked == i + _Offset; _Tiles[i].Selected = _Locked == i + _Offset;
}
} }
} }
public override void OnShow() public override void OnShow()
{ {
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetCurrentCategoryIndex() == -1) if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetCurrentCategoryIndex() == -1)
{
EnterCategory(0); EnterCategory(0);
}
_actualSelection = -1; _actualSelection = -1;
_Locked = -1; _Locked = -1;
_PreviewSelected = -1; _PreviewSelected = -1;
@@ -163,8 +157,8 @@ namespace VocaluxeLib.Menu.SongMenu
if (!KeyEvent.KeyPressed) if (!KeyEvent.KeyPressed)
{ {
if (!(KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down || 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.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter ||
KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp)) KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp))
return; return;
bool sel = false; bool sel = false;
@@ -181,9 +175,7 @@ namespace VocaluxeLib.Menu.SongMenu
(KeyEvent.Key != Keys.Escape && KeyEvent.Key != Keys.Back && KeyEvent.Key != Keys.PageUp && KeyEvent.Key != Keys.PageDown)) (KeyEvent.Key != Keys.Escape && KeyEvent.Key != Keys.Back && KeyEvent.Key != Keys.PageUp && KeyEvent.Key != Keys.PageDown))
{ {
if (_PreviewSelected > -1) if (_PreviewSelected > -1)
{
_Locked = _PreviewSelected; _Locked = _PreviewSelected;
}
else else
{ {
_Locked = 0; _Locked = 0;
@@ -204,9 +196,7 @@ namespace VocaluxeLib.Menu.SongMenu
KeyEvent.Handled = true; KeyEvent.Handled = true;
} }
else if (_actualSelection > -1 && _PreviewSelected >= 0) else if (_actualSelection > -1 && _PreviewSelected >= 0)
{
_Locked = _actualSelection; _Locked = _actualSelection;
}
break; break;
case Keys.Escape: case Keys.Escape:
@@ -224,16 +214,12 @@ namespace VocaluxeLib.Menu.SongMenu
case Keys.PageUp: case Keys.PageUp:
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{
PrevCategory(); PrevCategory();
}
break; break;
case Keys.PageDown: case Keys.PageDown:
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{
NextCategory(); NextCategory();
}
break; break;
case Keys.Left: case Keys.Left:
@@ -252,7 +238,6 @@ namespace VocaluxeLib.Menu.SongMenu
_Locked++; _Locked++;
UpdateList(); UpdateList();
} }
} }
else else
{ {
@@ -271,7 +256,8 @@ namespace VocaluxeLib.Menu.SongMenu
break; break;
} }
if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0)) if (_Locked > _NumW - 1 &&
(!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0))
{ {
_Locked -= _NumW; _Locked -= _NumW;
UpdateList(); UpdateList();
@@ -292,7 +278,6 @@ namespace VocaluxeLib.Menu.SongMenu
_Locked += _NumW; _Locked += _NumW;
UpdateList(); UpdateList();
} }
} }
else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly) else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly)
{ {
@@ -300,7 +285,6 @@ namespace VocaluxeLib.Menu.SongMenu
UpdateList(); UpdateList();
} }
break; break;
} }
} }
@@ -310,9 +294,7 @@ namespace VocaluxeLib.Menu.SongMenu
_actualSelection = _Locked; _actualSelection = _Locked;
for (int i = 0; i < _Tiles.Count; i++) for (int i = 0; i < _Tiles.Count; i++)
{
_Tiles[i].Selected = _Locked == i + _Offset; _Tiles[i].Selected = _Locked == i + _Offset;
}
} }
} }
} }
@@ -346,9 +328,7 @@ namespace VocaluxeLib.Menu.SongMenu
sel = true; sel = true;
} }
else else
{
tile.Selected = false; tile.Selected = false;
}
i++; i++;
} }
} }
@@ -361,22 +341,19 @@ namespace VocaluxeLib.Menu.SongMenu
if (!sel) if (!sel)
_actualSelection = -1; _actualSelection = -1;
if ((MouseEvent.RB) && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed) if ((MouseEvent.RB) && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON &&
SongOptions.Selection.CategoryChangeAllowed)
{ {
ShowCategories(); ShowCategories();
MouseEvent.Handled = true; MouseEvent.Handled = true;
return; return;
} }
else if (MouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode) else if (MouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode)
{
CBase.Graphics.FadeTo(EScreens.ScreenMain); CBase.Graphics.FadeTo(EScreens.ScreenMain);
}
else if (_PreviewSelected != -1 && MouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !SongOptions.Selection.PartyMode) else if (_PreviewSelected != -1 && MouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !SongOptions.Selection.PartyMode)
{ {
if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent)) if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent))
{
_Locked = _PreviewSelected; _Locked = _PreviewSelected;
}
} }
else if ((MouseEvent.LB) && (CBase.Songs.GetCurrentCategoryIndex() == -1)) else if ((MouseEvent.LB) && (CBase.Songs.GetCurrentCategoryIndex() == -1))
{ {
@@ -391,10 +368,9 @@ namespace VocaluxeLib.Menu.SongMenu
} }
} }
if (MouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed)) if (MouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, MouseEvent) &&
{ (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
UpdateList(_Offset + _NumW * MouseEvent.Wheel); UpdateList(_Offset + _NumW * MouseEvent.Wheel);
}
} }
public override void Draw() public override void Draw()
@@ -479,7 +455,6 @@ namespace VocaluxeLib.Menu.SongMenu
_CoverBig.Draw(1f, EAspect.Crop); _CoverBig.Draw(1f, EAspect.Crop);
_Artist.Draw(); _Artist.Draw();
_Title.Draw(); _Title.Draw();
_SongLength.Draw(); _SongLength.Draw();
@@ -487,7 +462,6 @@ namespace VocaluxeLib.Menu.SongMenu
_VideoIcon.Draw(); _VideoIcon.Draw();
_MedleyCalcIcon.Draw(); _MedleyCalcIcon.Draw();
_MedleyTagIcon.Draw(); _MedleyTagIcon.Draw();
} }
public override int GetSelectedSong() public override int GetSelectedSong()
@@ -520,9 +494,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (_Locked == -1 || !sel) if (_Locked == -1 || !sel)
{ {
if (_PreviewSelected > -1) if (_PreviewSelected > -1)
{
_Locked = _PreviewSelected; _Locked = _PreviewSelected;
}
else else
{ {
_Locked = 0; _Locked = 0;
@@ -534,9 +506,7 @@ namespace VocaluxeLib.Menu.SongMenu
} }
foreach (CStatic tile in _Tiles) foreach (CStatic tile in _Tiles)
{
tile.Selected = false; tile.Selected = false;
}
_PreviewSelected = itemNr; _PreviewSelected = itemNr;
SetSelectedNow(); SetSelectedNow();
@@ -613,9 +583,7 @@ namespace VocaluxeLib.Menu.SongMenu
SelectSong(_PreviewSelected); SelectSong(_PreviewSelected);
foreach (CStatic tile in _Tiles) foreach (CStatic tile in _Tiles)
{
tile.Selected = false; tile.Selected = false;
}
if (_actualSelection >= 0 && _actualSelection < _Tiles.Count) if (_actualSelection >= 0 && _actualSelection < _Tiles.Count)
_Tiles[_actualSelection].Selected = true; _Tiles[_actualSelection].Selected = true;
@@ -728,4 +696,4 @@ namespace VocaluxeLib.Menu.SongMenu
_Theme.songMenuTileBoard.TextSongLength.ReloadTextures(); _Theme.songMenuTileBoard.TextSongLength.ReloadTextures();
} }
} }
} }
+2 -3
View File
@@ -1,5 +1,4 @@
using VocaluxeLib.PartyModes;
using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu.SongMenu namespace VocaluxeLib.Menu.SongMenu
{ {
@@ -39,4 +38,4 @@ namespace VocaluxeLib.Menu.SongMenu
SRectF GetRect(); SRectF GetRect();
} }
} }
+8 -22
View File
@@ -25,22 +25,16 @@ namespace VocaluxeLib.PartyModes
return false; return false;
} }
public void Initialize() public void Initialize() {}
{
}
public void AddScreen(CMenuParty Screen, string ScreenName) public void AddScreen(CMenuParty Screen, string ScreenName)
{ {
_Screens.Add(ScreenName, Screen); _Screens.Add(ScreenName, Screen);
} }
public virtual void DataFromScreen(string ScreenName, Object Data) public virtual void DataFromScreen(string ScreenName, Object Data) {}
{
}
public virtual void UpdateGame() public virtual void UpdateGame() {}
{
}
public virtual CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen) public virtual CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen)
{ {
@@ -63,13 +57,9 @@ namespace VocaluxeLib.PartyModes
return new ScreenSongOptions(); return new ScreenSongOptions();
} }
public virtual void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions) public virtual void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions) {}
{
}
public virtual void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions) public virtual void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions) {}
{
}
public virtual int GetMaxPlayer() public virtual int GetMaxPlayer()
{ {
@@ -96,9 +86,7 @@ namespace VocaluxeLib.PartyModes
return 1; return 1;
} }
public virtual void SetSearchString(string SearchString, bool Visible) public virtual void SetSearchString(string SearchString, bool Visible) {}
{
}
public virtual void JokerUsed(int TeamNr) public virtual void JokerUsed(int TeamNr)
{ {
@@ -112,9 +100,7 @@ namespace VocaluxeLib.PartyModes
_ScreenSongOptions.Selection.NumJokers[TeamNr]--; _ScreenSongOptions.Selection.NumJokers[TeamNr]--;
} }
public virtual void SongSelected(int SongID) public virtual void SongSelected(int SongID) {}
{
}
public virtual void FinishedSinging() public virtual void FinishedSinging()
{ {
@@ -132,4 +118,4 @@ namespace VocaluxeLib.PartyModes
} }
#endregion Implementation #endregion Implementation
} }
} }
+1 -1
View File
@@ -39,4 +39,4 @@ namespace VocaluxeLib.PartyModes
_ScreenSongOptions.Sorting.SearchActive = Visible; _ScreenSongOptions.Sorting.SearchActive = Visible;
} }
} }
} }
+10 -28
View File
@@ -6,12 +6,11 @@ namespace VocaluxeLib.PartyModes
public class CScreenPartyDummy : CMenuParty public class CScreenPartyDummy : CMenuParty
{ {
// Version number for theme files. Increment it, if you've changed something on the theme files! // Version number for theme files. Increment it, if you've changed something on the theme files!
protected override int _ScreenVersion { get { return 1; } } protected override int _ScreenVersion
private CText Warning;
public CScreenPartyDummy()
{ {
get { return 1; }
} }
private CText Warning;
public override void LoadTheme(string XmlPath) public override void LoadTheme(string XmlPath)
{ {
@@ -27,30 +26,19 @@ namespace VocaluxeLib.PartyModes
AddText(Warning); AddText(Warning);
} }
public override void ReloadTheme(string XmlPath) public override void ReloadTheme(string XmlPath) {}
{
}
public override void ReloadTextures() public override void ReloadTextures() {}
{
}
public override void SaveTheme() public override void SaveTheme() {}
{
}
public override void UnloadTextures() public override void UnloadTextures() {}
{
}
public override bool HandleInput(KeyEvent KeyEvent) public override bool HandleInput(KeyEvent KeyEvent)
{ {
base.HandleInput(KeyEvent); base.HandleInput(KeyEvent);
if (KeyEvent.KeyPressed) if (KeyEvent.KeyPressed) {}
{
}
else else
{ {
switch (KeyEvent.Key) switch (KeyEvent.Key)
@@ -68,15 +56,10 @@ namespace VocaluxeLib.PartyModes
{ {
base.HandleMouse(MouseEvent); base.HandleMouse(MouseEvent);
if (MouseEvent.LB && IsMouseOver(MouseEvent)) if (MouseEvent.LB && IsMouseOver(MouseEvent)) {}
{
}
if (MouseEvent.RB) if (MouseEvent.RB)
{
FadeTo(EScreens.ScreenParty); FadeTo(EScreens.ScreenParty);
}
return true; return true;
} }
@@ -91,6 +74,5 @@ namespace VocaluxeLib.PartyModes
base.Draw(); base.Draw();
return true; return true;
} }
} }
} }
+10 -9
View File
@@ -3,6 +3,7 @@ using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes namespace VocaluxeLib.PartyModes
{ {
#region Structs #region Structs
public struct ScreenSongOptions public struct ScreenSongOptions
{ {
@@ -21,42 +22,42 @@ namespace VocaluxeLib.PartyModes
} }
/// <summary> /// <summary>
/// Configuration of song selection options /// Configuration of song selection options
/// </summary> /// </summary>
public struct SelectionOptions public struct SelectionOptions
{ {
/// <summary> /// <summary>
/// If != -1, the SongMenu should set the song selection on the provided song index (visible index) if possible /// If != -1, the SongMenu should set the song selection on the provided song index (visible index) if possible
/// </summary> /// </summary>
public int SongIndex; public int SongIndex;
/// <summary> /// <summary>
/// If true, the SongMenu should perform the select random song method /// If true, the SongMenu should perform the select random song method
/// </summary> /// </summary>
public bool SelectNextRandomSong; public bool SelectNextRandomSong;
/// <summary> /// <summary>
/// Choosing song only by random /// Choosing song only by random
/// </summary> /// </summary>
public bool RandomOnly; public bool RandomOnly;
/// <summary> /// <summary>
/// If true, it is not allowed to go to MainScreen nor open the playlist nor open the song menu /// If true, it is not allowed to go to MainScreen nor open the playlist nor open the song menu
/// </summary> /// </summary>
public bool PartyMode; public bool PartyMode;
/// <summary> /// <summary>
/// If true, it is not alled to change or leave the category. It's only valid if Tabs=On. /// If true, it is not alled to change or leave the category. It's only valid if Tabs=On.
/// </summary> /// </summary>
public bool CategoryChangeAllowed; public bool CategoryChangeAllowed;
/// <summary> /// <summary>
/// The number of jokers left for each team /// The number of jokers left for each team
/// </summary> /// </summary>
public int[] NumJokers; public int[] NumJokers;
/// <summary> /// <summary>
/// The Team Name of the teams (:>) /// The Team Name of the teams (:>)
/// </summary> /// </summary>
public string[] TeamNames; public string[] TeamNames;
} }
@@ -93,4 +94,4 @@ namespace VocaluxeLib.PartyModes
void LeavingScore(); void LeavingScore();
void LeavingHighscore(); void LeavingHighscore();
} }
} }
+5 -1
View File
@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden // Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind. // die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("VocaluxeLib")] [assembly: AssemblyTitle("VocaluxeLib")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
@@ -16,9 +17,11 @@ using System.Runtime.InteropServices;
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("3fb7cd34-186d-4f89-beb5-8830b8e5593b")] [assembly: Guid("3fb7cd34-186d-4f89-beb5-8830b8e5593b")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
@@ -31,5 +34,6 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]