Auto cleanup of VocaluxeLib

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

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")]
+6 -16
View File
@@ -26,7 +26,7 @@ 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;
@@ -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;
@@ -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)
@@ -162,9 +158,7 @@ namespace VocaluxeLib.Menu
return true; return true;
} }
public void UnloadTextures() public void UnloadTextures() {}
{
}
public void LoadTextures() public void LoadTextures()
{ {
@@ -182,7 +176,7 @@ namespace VocaluxeLib.Menu
#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
} }
} }
+1 -2
View File
@@ -1,5 +1,4 @@
namespace VocaluxeLib.Menu
namespace VocaluxeLib.Menu
{ {
public static class CBase public static class CBase
{ {
+3 -11
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;
@@ -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);
@@ -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"));
@@ -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;
+4 -15
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,9 +28,7 @@ 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;
} }
@@ -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,7 +164,7 @@ 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)
@@ -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;
} }
+3 -4
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
{ {
+5 -18
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"));
@@ -294,7 +286,6 @@ namespace VocaluxeLib.Menu
_Text.Color = ColorProcessed; _Text.Color = ColorProcessed;
_Text.Draw(); _Text.Draw();
} }
} }
else else
{ {
@@ -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
{ {
@@ -491,7 +481,6 @@ namespace VocaluxeLib.Menu
_Text.Draw(); _Text.Draw();
} }
} }
else else
{ {
@@ -539,9 +528,7 @@ namespace VocaluxeLib.Menu
} }
#endregion draw #endregion draw
public void UnloadTextures() public void UnloadTextures() {}
{
}
public void LoadTextures() public void LoadTextures()
{ {
+6 -96
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,16 +140,12 @@ 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);
} }
} }
} }
}
public virtual void LoadTheme(string XmlPath) public virtual void LoadTheme(string XmlPath)
{ {
@@ -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,137 +267,85 @@ 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,10 +610,8 @@ 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
{ {
if (KeyEvent.Key == Keys.Tab) if (KeyEvent.Key == Keys.Tab)
@@ -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,18 +795,14 @@ 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
public virtual bool Draw() public virtual bool Draw()
@@ -886,10 +815,8 @@ 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()
{ {
@@ -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);
@@ -1154,11 +1077,9 @@ 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);
} }
} }
}
public void ProcessMouseMove(int x, int y) public void ProcessMouseMove(int x, int y)
{ {
@@ -1170,11 +1091,9 @@ 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);
} }
} }
}
public void SelectByMouse(int x, int y) public void SelectByMouse(int x, int y)
{ {
@@ -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;
@@ -1753,10 +1666,8 @@ 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()
{ {
@@ -1950,7 +1861,6 @@ namespace VocaluxeLib.Menu
// break; // break;
} }
} }
#endregion InteractionHandling #endregion InteractionHandling
#region Theme Handling #region Theme Handling
+1 -4
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
{ {
} }
*/ */
} }
} }
+14 -54
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,10 +306,8 @@ 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
{ {
int offset = _Offset; int offset = _Offset;
@@ -390,14 +368,10 @@ 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,10 +404,8 @@ 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,10 +414,8 @@ 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,23 +477,17 @@ 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);
} }
} }
}
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
@@ -546,6 +507,5 @@ namespace VocaluxeLib.Menu
Rect.H = 1; Rect.H = 1;
} }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }
+7 -31
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,10 +124,8 @@ 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
{ {
if (KeyEvent.Key == Keys.Tab) if (KeyEvent.Key == Keys.Tab)
@@ -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)
@@ -323,11 +315,8 @@ 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
@@ -443,11 +432,9 @@ 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);
} }
} }
}
public void ProcessMouseMove(int x, int y) public void ProcessMouseMove(int x, int y)
{ {
@@ -459,11 +446,9 @@ 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);
} }
} }
}
public void SelectByMouse(int x, int y) public void SelectByMouse(int x, int y)
{ {
@@ -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;
@@ -961,10 +940,8 @@ 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
+3 -3
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)
{ {
+21 -37
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,10 +314,7 @@ 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)
@@ -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);
@@ -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,18 +560,14 @@ 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);
} }
+22 -52
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;
@@ -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;
@@ -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"));
@@ -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);
@@ -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);
@@ -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,7 +725,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;
@@ -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,9 +884,7 @@ namespace VocaluxeLib.Menu
} }
} }
if (!hover_set) if (!hover_set)
{
CurrentPlaylistElement = -1; CurrentPlaylistElement = -1;
}
switch (_EditMode) switch (_EditMode)
{ {
@@ -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,11 +1070,9 @@ 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);
} }
} }
}
UpdatePlaylist(); UpdatePlaylist();
} }
@@ -1119,7 +1092,8 @@ namespace VocaluxeLib.Menu
{ {
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);
@@ -1184,7 +1158,6 @@ namespace VocaluxeLib.Menu
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,9 +1173,7 @@ 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?
} }
@@ -1224,7 +1194,7 @@ namespace VocaluxeLib.Menu
{ {
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,7 +1207,7 @@ 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++)
{ {
+8 -20
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
} }
} }
+19 -58
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;
@@ -89,12 +89,12 @@ namespace VocaluxeLib.Menu
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,11 +105,9 @@ namespace VocaluxeLib.Menu
set set
{ {
if (value >= 0 && value < _ValueNames.Count) if (value >= 0 && value < _ValueNames.Count)
{
_Selection = value; _Selection = value;
} }
} }
}
public int ValueIndex public int ValueIndex
{ {
@@ -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;
@@ -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;
@@ -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;
@@ -763,7 +727,7 @@ namespace VocaluxeLib.Menu
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()
{ {
+2 -12
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"));
@@ -267,20 +263,14 @@ namespace VocaluxeLib.Menu
{ {
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()
{ {
+4 -9
View File
@@ -6,8 +6,8 @@ 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
{ {
@@ -46,7 +46,7 @@ namespace VocaluxeLib.Menu
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)
+3 -7
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
{ {
@@ -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
{ {
@@ -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++)
{ {
+13 -48
View File
@@ -5,16 +5,14 @@ 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,11 +71,9 @@ 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);
} }
} }
}
public class CNote public class 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,9 +351,7 @@ 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;
} }
} }
@@ -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;
} }
@@ -534,15 +515,11 @@ 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,25 +534,20 @@ 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
{ {
@@ -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
} }
} }
+15 -48
View File
@@ -44,7 +44,7 @@ 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;
@@ -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)
{ {
@@ -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;
@@ -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
@@ -344,25 +334,19 @@ namespace VocaluxeLib.Menu.SingNotes
} }
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,16 +419,12 @@ 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)
{ {
stars.Alpha = _PlayerNotes[n].Alpha; stars.Alpha = _PlayerNotes[n].Alpha;
@@ -454,23 +432,15 @@ 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()
{ {
@@ -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);
} }
@@ -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
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);
+180 -210
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;
} }
@@ -168,7 +163,8 @@ namespace VocaluxeLib.Menu.SongMenu
else else
return _CoverTextureSmall; return _CoverTextureSmall;
} }
set { set
{
_CoverTextureBig = value; _CoverTextureBig = value;
_CoverBigLoaded = true; _CoverBigLoaded = true;
} }
@@ -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; Start = song.Start;
this.Finish = song.Finish; Finish = song.Finish;
this.BPM = song.BPM; BPM = song.BPM;
this.Gap = song.Gap; Gap = song.Gap;
this.VideoGap = song.VideoGap; VideoGap = song.VideoGap;
this.Comment = new List<string>(); 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,13 +645,12 @@ 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++;
@@ -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);
} }
@@ -840,9 +812,9 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
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,30 +825,28 @@ 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));
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))) List<string> files = CHelper.ListFiles(Folder, "*.jpg", false);
{ files.AddRange(CHelper.ListFiles(Folder, "*.png", false));
this.CoverFileName = file;
}
}
}
if (this.BackgroundFileName.Length == 0)
{
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
foreach (String file in files) foreach (String file in files)
{ {
if (Regex.IsMatch(file, @".[CO].", 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)))
{ CoverFileName = file;
this.BackgroundFileName = file;
} }
} }
if (BackgroundFileName.Length == 0)
{
List<string> files = CHelper.ListFiles(Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(Folder, "*.png", false));
foreach (String file in files)
{
if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) &&
(Regex.IsMatch(file, @"" + Regex.Escape(Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(Artist), RegexOptions.IgnoreCase)))
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()
+1 -4
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,9 +201,7 @@ 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())
{ {
+2 -5
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()
{ {
@@ -27,17 +27,11 @@ 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
{ {
@@ -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()
@@ -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"));
@@ -451,9 +439,7 @@ namespace VocaluxeLib.Menu.SongMenu
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,9 +457,7 @@ 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);
@@ -504,21 +488,16 @@ 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)
{ {
_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);
@@ -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);
+2 -5
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) {}
{
}
} }
} }
@@ -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()
{ {
@@ -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;
@@ -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,12 +294,10 @@ 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;
} }
} }
} }
}
public override void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions) public override void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
{ {
@@ -346,9 +328,7 @@ namespace VocaluxeLib.Menu.SongMenu
sel = true; sel = true;
} }
else else
{
tile.Selected = false; tile.Selected = false;
}
i++; i++;
} }
} }
@@ -361,23 +341,20 @@ 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))
{ {
foreach (CStatic tile in _Tiles) foreach (CStatic tile in _Tiles)
@@ -391,11 +368,10 @@ 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;
+1 -2
View File
@@ -1,5 +1,4 @@
using VocaluxeLib.PartyModes;
using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu.SongMenu namespace VocaluxeLib.Menu.SongMenu
{ {
+7 -21
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()
{ {
+9 -27
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;
} }
} }
} }
+1
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
{ {
+4
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")]