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
+380 -893

No files matched your search

+29 -23
View File
@@ -8,26 +8,32 @@
// "Meldung(en) unterdrücken", und klicken Sie auf "In Projektunterdrückungsdatei".
// 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)")]
[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: System.Diagnostics.CodeAnalysis.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.#Theme")]
[assembly: System.Diagnostics.CodeAnalysis.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.#Log")]
[assembly: System.Diagnostics.CodeAnalysis.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.#Drawing")]
[assembly: System.Diagnostics.CodeAnalysis.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.#Fonts")]
[assembly: System.Diagnostics.CodeAnalysis.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.#Game")]
[assembly: System.Diagnostics.CodeAnalysis.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.#Record")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Songs")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Video")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Sound")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Cover")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#DataBase")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Input")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Playlist")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "Vocaluxe.Menu.EColorDeep")]
using System.Diagnostics.CodeAnalysis;
[assembly:
SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Vocaluxe.Menu.CHelper.TryParse(System.String,System.Single@)", Scope = "member",
Target = "Vocaluxe.Menu.SongMenu.CSong.#ReadHeader(System.String)")]
[assembly:
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: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Config")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Settings")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Theme")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Helper")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Log")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#BackgroundMusic")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Drawing")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Graphics")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Fonts")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Language")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Game")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Profiles")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Record")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Songs")]
[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")]
+5 -15
View File
@@ -26,7 +26,7 @@ namespace VocaluxeLib.Menu
public class CBackground : IMenuElement
{
private int _PartyModeID;
private readonly int _PartyModeID;
private SThemeBackground _Theme;
private bool _ThemeLoaded;
@@ -54,16 +54,14 @@ namespace VocaluxeLib.Menu
string item = XmlPath + "/" + ElementName;
_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 tex = xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
_ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
bool success = true;
@@ -102,9 +100,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Background color for type \"Color\" from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
else
{
if (_Theme.Type != EBackgroundTypes.None)
@@ -162,9 +158,7 @@ namespace VocaluxeLib.Menu
return true;
}
public void UnloadTextures()
{
}
public void UnloadTextures() {}
public void LoadTextures()
{
@@ -234,13 +228,9 @@ namespace VocaluxeLib.Menu
#endregion internal
#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
}
}
+1 -2
View File
@@ -1,5 +1,4 @@
namespace VocaluxeLib.Menu
namespace VocaluxeLib.Menu
{
public static class CBase
{
+1 -9
View File
@@ -18,7 +18,7 @@ namespace VocaluxeLib.Menu
{
private SThemeButton _Theme;
private bool _ThemeLoaded;
private int _PartyModeID;
private readonly int _PartyModeID;
public STexture Texture;
public STexture STexture;
@@ -143,9 +143,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
_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))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor);
}
else
{
_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("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
else
{
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("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName);
}
else
{
writer.WriteElementString("SR", SColor.R.ToString("#0.00"));
+2 -13
View File
@@ -9,7 +9,6 @@ namespace VocaluxeLib.Menu
{
public static class CHelper
{
public static int nCk(int n, int k)
{
if (k > n)
@@ -29,9 +28,7 @@ namespace VocaluxeLib.Menu
long nk = k;
for (long i = 1; i <= k - 1; i++)
{
result = result * (n - i) / (i + 1);
}
return (int)result;
}
@@ -128,8 +125,6 @@ namespace VocaluxeLib.Menu
Rect = new RectangleF(Left, Upper, Rigth - Left, Lower - Upper);
}
public static List<string> ListFiles(string path, string cast)
{
return ListFiles(path, cast, false, false);
@@ -147,7 +142,6 @@ namespace VocaluxeLib.Menu
try
{
foreach (FileInfo file in dir.GetFiles(cast))
{
if (!fullpath)
@@ -159,15 +153,10 @@ namespace VocaluxeLib.Menu
if (recursive)
{
foreach (DirectoryInfo di in dir.GetDirectories())
{
files.AddRange(ListFiles(di.FullName, cast, recursive, fullpath));
}
}
}
catch (Exception)
{
}
catch (Exception) {}
return files;
}
@@ -175,7 +164,7 @@ namespace VocaluxeLib.Menu
public static bool TryParse<T>(string value, out T result)
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)
+3 -4
View File
@@ -1,5 +1,4 @@
namespace VocaluxeLib.Menu
namespace VocaluxeLib.Menu
{
public enum EType
{
@@ -19,8 +18,8 @@ namespace VocaluxeLib.Menu
class CInteraction
{
private int _Num;
private EType _Type;
private readonly int _Num;
private readonly EType _Type;
public int Num
{
+3 -16
View File
@@ -25,11 +25,11 @@ namespace VocaluxeLib.Menu
public class CLyric : IMenuElement
{
private int _PartyModeID;
private readonly int _PartyModeID;
private SThemeLyrics _Theme;
private bool _ThemeLoaded;
private List<SNote> _Notes;
private readonly List<SNote> _Notes;
private CText _Text;
private float _X;
@@ -115,9 +115,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
_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))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out ColorProcessed);
}
else
{
_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("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
else
{
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("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName);
}
else
{
writer.WriteElementString("SR", ColorProcessed.R.ToString("#0.00"));
@@ -294,7 +286,6 @@ namespace VocaluxeLib.Menu
_Text.Color = ColorProcessed;
_Text.Draw();
}
}
else
{
@@ -355,7 +346,6 @@ namespace VocaluxeLib.Menu
_Text.Draw();
}
}
else
{
@@ -491,7 +481,6 @@ namespace VocaluxeLib.Menu
_Text.Draw();
}
}
else
{
@@ -539,9 +528,7 @@ namespace VocaluxeLib.Menu
}
#endregion draw
public void UnloadTextures()
{
}
public void UnloadTextures() {}
public void LoadTextures()
{
+5 -95
View File
@@ -19,7 +19,7 @@ namespace VocaluxeLib.Menu
public abstract class CMenu : IMenu
{
private List<CInteraction> _Interactions;
private int _Selection = 0;
private int _Selection;
private string _ThemePath = String.Empty;
protected int _PartyModeID = -1;
@@ -37,7 +37,6 @@ namespace VocaluxeLib.Menu
private COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
private COrderedDictionaryLite<CScreenSetting> _ScreenSettings;
private int _PrevMouseX;
private int _PrevMouseY;
@@ -78,13 +77,9 @@ namespace VocaluxeLib.Menu
get { return _ScreenVersion; }
}
public CMenu()
{
}
public virtual void Init()
{
_ThemeName = this.GetType().Name;
_ThemeName = GetType().Name;
if (_ThemeName[0] == 'C' && Char.IsUpper(_ThemeName[1]))
_ThemeName = _ThemeName.Remove(0, 1);
@@ -135,7 +130,6 @@ namespace VocaluxeLib.Menu
}
#region ThemeHandler
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
@@ -146,16 +140,12 @@ namespace VocaluxeLib.Menu
{
T Element = (T)Activator.CreateInstance(typeof(T), _PartyModeID);
if (Element.LoadTheme("//root/" + ThemeName, elName, xmlReader, SkinIndex))
{
MAddElement(Element, elName);
}
else
{
CBase.Log.LogError("Can't load " + typeof(T).Name.Substring(1) + " \"" + elName + "\" in screen " + ThemeName);
}
}
}
}
public virtual void LoadTheme(string XmlPath)
{
@@ -204,7 +194,6 @@ namespace VocaluxeLib.Menu
string file = Path.Combine(_ThemePath, ThemeName + ".xml");
using (XmlWriter writer = XmlWriter.Create(file, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("root");
@@ -278,137 +267,85 @@ namespace VocaluxeLib.Menu
public virtual void ReloadTextures()
{
foreach (CBackground background in _Backgrounds)
{
background.ReloadTextures();
}
foreach (CButton button in _Buttons)
{
button.ReloadTextures();
}
foreach (CText text in _Texts)
{
text.ReloadTextures();
}
foreach (CStatic stat in _Statics)
{
stat.ReloadTextures();
}
foreach (CSelectSlide slide in _SelectSlides)
{
slide.ReloadTextures();
}
foreach (CSongMenu sm in _SongMenus)
{
sm.ReloadTextures();
}
foreach (CLyric lyric in _Lyrics)
{
lyric.ReloadTextures();
}
foreach (CSingNotes sn in _SingNotes)
{
sn.ReloadTextures();
}
foreach (CNameSelection ns in _NameSelections)
{
ns.ReloadTextures();
}
foreach (CEqualizer eq in _Equalizers)
{
eq.ReloadTextures();
}
foreach (CPlaylist pls in _Playlists)
{
pls.ReloadTextures();
}
foreach (CParticleEffect pe in _ParticleEffects)
{
pe.ReloadTextures();
}
foreach (CScreenSetting se in _ScreenSettings)
{
se.ReloadTextures();
}
}
public virtual void UnloadTextures()
{
foreach (CBackground background in _Backgrounds)
{
background.UnloadTextures();
}
foreach (CButton button in _Buttons)
{
button.UnloadTextures();
}
foreach (CText text in _Texts)
{
text.UnloadTextures();
}
foreach (CStatic stat in _Statics)
{
stat.UnloadTextures();
}
foreach (CSelectSlide slide in _SelectSlides)
{
slide.UnloadTextures();
}
foreach (CSongMenu sm in _SongMenus)
{
sm.UnloadTextures();
}
foreach (CLyric lyric in _Lyrics)
{
lyric.UnloadTextures();
}
foreach (CSingNotes sn in _SingNotes)
{
sn.UnloadTextures();
}
foreach (CNameSelection ns in _NameSelections)
{
ns.UnloadTextures();
}
foreach (CPlaylist pls in _Playlists)
{
pls.UnloadTextures();
}
foreach (CEqualizer eq in _Equalizers)
{
eq.UnloadTextures();
}
foreach (CParticleEffect pe in _ParticleEffects)
{
pe.UnloadTextures();
}
foreach (CScreenSetting se in _ScreenSettings)
{
se.UnloadTextures();
}
}
public virtual void ReloadTheme(string XmlPath)
{
@@ -489,6 +426,7 @@ namespace VocaluxeLib.Menu
#endregion GetLists
#region ElementHandler
#region Create Elements
public CButton GetNewButton()
{
@@ -515,7 +453,6 @@ namespace VocaluxeLib.Menu
return new CText(x, y, z, h, mw, align, style, font, col, text);
}
public CBackground GetNewBackground()
{
return new CBackground(_PartyModeID);
@@ -633,7 +570,6 @@ namespace VocaluxeLib.Menu
get { return _Equalizers; }
}
public COrderedDictionaryLite<CPlaylist> Playlists
{
get { return _Playlists; }
@@ -649,6 +585,7 @@ namespace VocaluxeLib.Menu
get { return _ScreenSettings; }
}
#endregion Get Arrays
#endregion ElementHandler
#region MenuHandler
@@ -673,10 +610,8 @@ namespace VocaluxeLib.Menu
}
if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
{
KeyEvent.Handled = _NextInteraction(KeyEvent);
}
}
else
{
if (KeyEvent.Key == Keys.Tab)
@@ -837,9 +772,7 @@ namespace VocaluxeLib.Menu
public abstract bool UpdateGame();
public virtual void ApplyVolume()
{
}
public virtual void ApplyVolume() {}
public virtual void OnShow()
{
@@ -862,18 +795,14 @@ namespace VocaluxeLib.Menu
protected void ResumeBG()
{
foreach (CBackground bg in _Backgrounds)
{
bg.Resume();
}
}
protected void PauseBG()
{
foreach (CBackground bg in _Backgrounds)
{
bg.Pause();
}
}
#region Drawing
public virtual bool Draw()
@@ -886,10 +815,8 @@ namespace VocaluxeLib.Menu
public void DrawBG()
{
foreach (CBackground bg in _Backgrounds)
{
bg.Draw();
}
}
public void DrawFG()
{
@@ -925,15 +852,11 @@ namespace VocaluxeLib.Menu
items.Sort(delegate(ZSort s1, ZSort s2) { return (s2.z.CompareTo(s1.z)); });
for (int i = 0; i < items.Count; i++)
{
_DrawInteraction(items[i].ID);
}
}
#endregion Drawing
#region Elements
public void AddBackground(CBackground bg)
{
AddBackground(bg, null);
@@ -1154,11 +1077,9 @@ namespace VocaluxeLib.Menu
if (_Interactions[_Selection].Type == EType.TSelectSlide)
{
if (_SelectSlides[_Interactions[_Selection].Num].Visible)
{
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y);
}
}
}
public void ProcessMouseMove(int x, int y)
{
@@ -1170,11 +1091,9 @@ namespace VocaluxeLib.Menu
if (_Interactions[_Selection].Type == EType.TSelectSlide)
{
if (_SelectSlides[_Interactions[_Selection].Num].Visible)
{
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y);
}
}
}
public void SelectByMouse(int x, int y)
{
@@ -1364,9 +1283,7 @@ namespace VocaluxeLib.Menu
int[] elements = new int[4];
for (int i = 0; i < 4; i++)
{
Directions[i] = new KeyEvent();
}
Directions[0].Key = Keys.Up;
Directions[1].Key = Keys.Right;
@@ -1374,9 +1291,7 @@ namespace VocaluxeLib.Menu
Directions[3].Key = Keys.Left;
for (int i = 0; i < 4; i++)
{
elements[i] = _GetNextElement(Directions[i], out Distances[i], out stages[i]);
}
int element = _Selection;
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))
inDirection = true;
break;
}
if (!inDirection)
return float.MaxValue;
@@ -1571,7 +1485,6 @@ namespace VocaluxeLib.Menu
if (vector.X > 0f)
inDirection = true;
break;
}
if (!inDirection)
return float.MaxValue;
@@ -1753,10 +1666,8 @@ namespace VocaluxeLib.Menu
return;
if (_Interactions[_Selection].Type == EType.TSelectSlide)
{
_SelectSlides[_Interactions[_Selection].Num].Highlighted = !_SelectSlides[_Interactions[_Selection].Num].Highlighted;
}
}
private bool _IsHighlighted()
{
@@ -1950,7 +1861,6 @@ namespace VocaluxeLib.Menu
// break;
}
}
#endregion InteractionHandling
#region Theme Handling
+1 -4
View File
@@ -27,9 +27,7 @@ namespace VocaluxeLib.Menu
_PartyMode = PartyMode;
}
public virtual void DataToScreen(Object Data)
{
}
public virtual void DataToScreen(Object Data) {}
/*
public sealed override void LoadTheme()
@@ -48,6 +46,5 @@ namespace VocaluxeLib.Menu
{
}
*/
}
}
+12 -52
View File
@@ -21,15 +21,13 @@ namespace VocaluxeLib.Menu
public class CNameSelection : IMenuElement
{
class CTile
private class CTile
{
public int PlayerNr;
public CStatic Avatar;
public CText Name;
public readonly CStatic Avatar;
public readonly CText Name;
public CTile()
{
}
public CTile() {}
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 bool _ThemeLoaded;
@@ -52,7 +50,7 @@ namespace VocaluxeLib.Menu
public bool Visible = true;
public SRectF Rect;
private List<CTile> _Tiles;
private readonly List<CTile> _Tiles;
private STexture _TextureEmptyTile;
private STexture _TextureTileSelected;
@@ -72,13 +70,12 @@ namespace VocaluxeLib.Menu
private int _actualSelection = -1;
public int Selection = -1;
int _player = -1;
private int _player = -1;
private List<int> VisibleProfiles;
private readonly List<int> VisibleProfiles;
private CStatic PlayerSelector;
public CNameSelection(int PartyModeID)
{
_PartyModeID = PartyModeID;
@@ -116,9 +113,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", ref _Theme.TextureEmptyTileName, String.Empty);
if (xmlReader.GetValue(item + "/ColorEmptyTile", ref _Theme.ColorEmptyTileName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, SkinIndex, out ColorEmptyTile);
}
else
{
_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/H", ref _Theme.NameHeight);
_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))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, SkinIndex, out _Theme.NameColor);
}
else
{
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("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorEmptyTileName.Length > 0)
{
writer.WriteElementString("ColorEmptyTile", _Theme.ColorEmptyTileName);
}
else
{
writer.WriteElementString("R", ColorEmptyTile.R.ToString("#0.00"));
@@ -214,9 +205,7 @@ namespace VocaluxeLib.Menu
writer.WriteElementString("Font", _Theme.NameFont);
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
if (_Theme.NameColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.NameColorName);
}
else
{
writer.WriteElementString("R", _Theme.NameColor.R.ToString("#0.00"));
@@ -282,27 +271,20 @@ namespace VocaluxeLib.Menu
if (_actualSelection + 1 < _Tiles.Count)
{
if (_Tiles[_actualSelection + 1].PlayerNr != -1)
{
_actualSelection++;
}
}
else
{
int offset = _Offset;
UpdateList(_Offset + 1);
if (offset != _Offset)
{
_actualSelection = 0;
}
}
break;
case Keys.Left:
if (_actualSelection - 1 > -1)
{
_actualSelection--;
}
else if (_Offset > 0)
{
UpdateList(_Offset - 1);
@@ -312,9 +294,7 @@ namespace VocaluxeLib.Menu
case Keys.Up:
if (_actualSelection - _NumW > -1)
{
_actualSelection -= _NumW;
}
else if (_Offset > 0)
{
UpdateList(_Offset - 1);
@@ -326,10 +306,8 @@ namespace VocaluxeLib.Menu
if (_actualSelection + _NumW < _Tiles.Count)
{
if (_Tiles[_actualSelection + _NumW].PlayerNr != -1)
{
_actualSelection += _NumW;
}
}
else
{
int offset = _Offset;
@@ -390,14 +368,10 @@ namespace VocaluxeLib.Menu
{
UpdateVisibleProfiles();
if (_Tiles.Count * (_Offset + 1) - VisibleProfiles.Count >= _Tiles.Count * _Offset)
{
UpdateList(_Offset - 1);
}
else
{
UpdateList(_Offset);
}
}
public void UpdateList(int offset)
{
@@ -430,10 +404,8 @@ namespace VocaluxeLib.Menu
foreach (CTile tile in _Tiles)
{
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
{
isOver = true;
}
}
return isOver;
}
@@ -442,10 +414,8 @@ namespace VocaluxeLib.Menu
foreach (CTile tile in _Tiles)
{
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
{
return tile.PlayerNr;
}
}
return -1;
}
@@ -455,17 +425,13 @@ namespace VocaluxeLib.Menu
foreach (CTile tile in _Tiles)
{
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
{
return tile.Avatar;
}
}
return new CStatic(_PartyModeID);
}
public void UnloadTextures()
{
}
public void UnloadTextures() {}
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);
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));
}
}
@@ -510,23 +477,17 @@ namespace VocaluxeLib.Menu
bool visible = false;
//Show profile only if active
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
{
visible = true;
}
for (int p = 0; p < CBase.Game.GetNumPlayer(); p++)
{
//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)
{
visible = false;
}
}
if (visible)
{
VisibleProfiles.Add(i);
}
}
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
@@ -546,6 +507,5 @@ namespace VocaluxeLib.Menu
Rect.H = 1;
}
#endregion ThemeEdit
}
}
+7 -31
View File
@@ -8,7 +8,7 @@ namespace VocaluxeLib.Menu
class CObjectInteractions
{
private List<CInteraction> _Interactions;
private int _Selection = 0;
private int _Selection;
private List<CStatic> _Statics;
private List<CText> _Texts;
@@ -73,6 +73,7 @@ namespace VocaluxeLib.Menu
Active = false;
}
#region GetLists
public List<CButton> GetButtons()
{
@@ -86,23 +87,19 @@ namespace VocaluxeLib.Menu
#endregion GetLists
#region ElementHandler
#region Get Arrays
public CButton[] Buttons
{
get
{
return _Buttons.ToArray();
}
get { return _Buttons.ToArray(); }
}
public CSelectSlide[] SelectSlides
{
get
{
return _SelectSlides.ToArray();
}
get { return _SelectSlides.ToArray(); }
}
#endregion Get Arrays
#endregion ElementHandler
#region MenuHandler
@@ -127,10 +124,8 @@ namespace VocaluxeLib.Menu
}
if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
{
KeyEvent.Handled = _NextInteraction(KeyEvent);
}
}
else
{
if (KeyEvent.Key == Keys.Tab)
@@ -173,10 +168,7 @@ namespace VocaluxeLib.Menu
public bool HandleInputThemeEditor(KeyEvent KeyEvent)
{
_UnsetHighlighted(_Selection);
if (KeyEvent.KeyPressed)
{
}
if (KeyEvent.KeyPressed) {}
else
{
switch (KeyEvent.Key)
@@ -323,11 +315,8 @@ namespace VocaluxeLib.Menu
items.Sort(delegate(ZSort s1, ZSort s2) { return (s2.z.CompareTo(s1.z)); });
for (int i = 0; i < items.Count; i++)
{
_DrawInteraction(items[i].ID);
}
}
#endregion Drawing
#region Elements
@@ -443,11 +432,9 @@ namespace VocaluxeLib.Menu
if (_Interactions[_Selection].Type == EType.TSelectSlide)
{
if (_SelectSlides[_Interactions[_Selection].Num].Visible)
{
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y);
}
}
}
public void ProcessMouseMove(int x, int y)
{
@@ -459,11 +446,9 @@ namespace VocaluxeLib.Menu
if (_Interactions[_Selection].Type == EType.TSelectSlide)
{
if (_SelectSlides[_Interactions[_Selection].Num].Visible)
{
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y);
}
}
}
public void SelectByMouse(int x, int y)
{
@@ -620,9 +605,7 @@ namespace VocaluxeLib.Menu
int[] elements = new int[4];
for (int i = 0; i < 4; i++)
{
Directions[i] = new KeyEvent();
}
Directions[0].Key = Keys.Up;
Directions[1].Key = Keys.Right;
@@ -630,9 +613,7 @@ namespace VocaluxeLib.Menu
Directions[3].Key = Keys.Left;
for (int i = 0; i < 4; i++)
{
elements[i] = _GetNextElement(Directions[i], out Distances[i], out stages[i]);
}
int element = _Selection;
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))
inDirection = true;
break;
}
if (!inDirection)
return float.MaxValue;
@@ -827,7 +807,6 @@ namespace VocaluxeLib.Menu
if (vector.X > 0f)
inDirection = true;
break;
}
if (!inDirection)
return float.MaxValue;
@@ -961,10 +940,8 @@ namespace VocaluxeLib.Menu
return;
if (_Interactions[_Selection].Type == EType.TSelectSlide)
{
_SelectSlides[_Interactions[_Selection].Num].Highlighted = !_SelectSlides[_Interactions[_Selection].Num].Highlighted;
}
}
private bool _IsHighlighted()
{
@@ -1071,7 +1048,6 @@ namespace VocaluxeLib.Menu
break;
}
}
#endregion InteractionHandling
#region Theme Handling
+3 -3
View File
@@ -6,9 +6,9 @@ namespace VocaluxeLib.Menu
{
public class COrderedDictionaryLite<T> : IEnumerable<T>
{
private List<T> _Items;
private Dictionary<String, int> _htIndex;
private CMenu _Parent;
private readonly List<T> _Items;
private readonly Dictionary<String, int> _htIndex;
private readonly CMenu _Parent;
public COrderedDictionaryLite(CMenu Parent)
{
+20 -36
View File
@@ -24,25 +24,25 @@ namespace VocaluxeLib.Menu
class CParticle
{
#region private vars
private int _PartyModeID;
private string _TextureName;
private STexture _Texture;
private readonly int _PartyModeID;
private readonly string _TextureName;
private readonly STexture _Texture;
private SRectF _Rect;
private float _Size;
private SColorF _Color;
private float _Alpha;
private float _Angle; //0..360°
private float _MaxAge; //[s]
private readonly float _MaxAge; //[s]
private float _Age; //[s]
private float _Vx; //movement speed in x-axis [pix/s]
private float _Vy; //movement speed in y-axis [pix/s]
private float _Vr; //rotation speed [rpm]
private float _Rotation; //start rotation 0..360°
private float _Vsize; //size changing speed: period [s]
private readonly float _Vx; //movement speed in x-axis [pix/s]
private readonly float _Vy; //movement speed in y-axis [pix/s]
private readonly float _Vr; //rotation speed [rpm]
private readonly float _Rotation; //start rotation 0..360°
private readonly float _Vsize; //size changing speed: period [s]
private float _LastTime;
private EParticleType _Type;
private readonly EParticleType _Type;
private Stopwatch _Timer;
private readonly Stopwatch _Timer;
#endregion private vars
#region public vars
@@ -91,7 +91,8 @@ namespace VocaluxeLib.Menu
#endregion public vars
#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;
_TextureName = textureName;
@@ -114,7 +115,8 @@ namespace VocaluxeLib.Menu
_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;
_TextureName = String.Empty;
@@ -175,9 +177,7 @@ namespace VocaluxeLib.Menu
case EParticleType.PerfNoteStar:
_Alpha = 1f - _Age / _MaxAge;
break;
}
}
// update position
@@ -219,7 +219,6 @@ namespace VocaluxeLib.Menu
X += _Vx * timediff;
Y += _Vy * timediff;
break;
}
@@ -248,7 +247,6 @@ namespace VocaluxeLib.Menu
case EParticleType.PerfNoteStar:
size = _Size * (1f - CurrentTime / _Vsize);
break;
}
_Rect.X += (_Rect.W - size) / 2f;
@@ -289,7 +287,7 @@ namespace VocaluxeLib.Menu
public class CParticleEffect : IMenuElement
{
private int _PartyModeID;
private readonly int _PartyModeID;
private SThemeParticleEffect _Theme;
private bool _ThemeLoaded;
@@ -300,11 +298,11 @@ namespace VocaluxeLib.Menu
public bool Selected;
public bool Visible;
private List<CParticle> _Stars;
private readonly List<CParticle> _Stars;
private int _MaxNumber;
private float _Size;
private EParticleType _Type;
private Stopwatch _SpawnTimer;
private readonly Stopwatch _SpawnTimer;
private float _NextSpawnTime;
public float Alpha = 1f;
@@ -316,10 +314,7 @@ namespace VocaluxeLib.Menu
public bool IsAlive
{
get
{
return (_Stars.Count > 0 || !_SpawnTimer.IsRunning);
}
get { return (_Stars.Count > 0 || !_SpawnTimer.IsRunning); }
}
public CParticleEffect(int PartyModeID)
@@ -380,9 +375,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
_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.TryGetEnumValue<EParticleType>(item + "/Type", ref _Type);
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Type);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Size", ref _Size);
_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("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
@@ -522,7 +513,6 @@ namespace VocaluxeLib.Menu
vr = CBase.Game.GetRandom(500) / 50f + 10f;
vsize = lifetime * 2f;
break;
}
int w = (int)(Rect.W - size / 4f);
@@ -561,9 +551,7 @@ namespace VocaluxeLib.Menu
{
_Stars[i].Update();
if (!_Stars[i].IsAlive)
{
_Stars.RemoveAt(i);
}
else
i++;
}
@@ -572,18 +560,14 @@ namespace VocaluxeLib.Menu
public void Pause()
{
foreach (CParticle star in _Stars)
{
star.Pause();
}
}
public void Resume()
{
foreach (CParticle star in _Stars)
{
star.Resume();
}
}
public void Draw()
{
+19 -49
View File
@@ -21,7 +21,7 @@ namespace VocaluxeLib.Menu
public CPlaylistSong(int SongID, EGameMode gm)
{
this.SongID = SongID;
this.GameMode = gm;
GameMode = gm;
}
public CPlaylistSong()
@@ -65,14 +65,14 @@ namespace VocaluxeLib.Menu
public class CPlaylist : IMenuElement
{
class PlaylistElementContent
private class PlaylistElementContent
{
public EGameMode[] Modes;
public int SongID;
public EGameMode Mode;
}
class PlaylistElement
private class PlaylistElement
{
public CStatic Cover;
public CStatic Background;
@@ -80,9 +80,7 @@ namespace VocaluxeLib.Menu
public CSelectSlide SelectSlide;
public int Content;
public PlaylistElement()
{
}
public PlaylistElement() {}
public PlaylistElement(PlaylistElement pe)
{
@@ -125,7 +123,8 @@ namespace VocaluxeLib.Menu
Text1.Y += diffY;
}
}
private int _PartyModeID;
private readonly int _PartyModeID;
private SThemePlaylist _Theme;
private bool _ThemeLoaded;
@@ -134,10 +133,10 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
private CObjectInteractions _Interactions;
private readonly CObjectInteractions _Interactions;
private List<PlaylistElement> PlaylistElements;
private List<PlaylistElementContent> PlaylistElementContents;
private readonly List<PlaylistElement> PlaylistElements;
private readonly List<PlaylistElementContent> PlaylistElementContents;
public SRectF CompleteRect;
public SRectF Rect;
@@ -176,8 +175,8 @@ namespace VocaluxeLib.Menu
private PlaylistElement ChangeOrderElement;
private int ChangeOrderSource = -1;
private int OldMousePosX = 0;
private int OldMousePosY = 0;
private int OldMousePosX;
private int OldMousePosY;
public int DragAndDropSongID = -1;
@@ -241,9 +240,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/ColorBackground", ref _Theme.ColorBackgroundName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, SkinIndex, out BackgroundColor);
}
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundR", ref BackgroundColor.R);
@@ -252,9 +249,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A);
}
if (xmlReader.GetValue(item + "/SColorBackground", ref _Theme.SColorBackgroundName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorBackgroundName, SkinIndex, out BackgroundSColor);
}
else
{
_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("or <BackgroundR>, <BackgroundG>, <BackgroundB>, <BackgroundA> (lower priority)");
if (_Theme.ColorBackgroundName.Length > 0)
{
writer.WriteElementString("ColorBackground", _Theme.ColorBackgroundName);
}
else
{
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("or <SBackgroundR>, <SBackgroundG>, <SBackgroundB>, <SBackgroundA> (lower priority)");
if (_Theme.SColorBackgroundName.Length > 0)
{
writer.WriteElementString("SColorBackground", _Theme.SColorBackgroundName);
}
else
{
writer.WriteElementString("SBackgroundR", BackgroundSColor.R.ToString("#0.00"));
@@ -416,9 +407,7 @@ namespace VocaluxeLib.Menu
public void Draw(bool ForceDraw)
{
if (PlaylistElements.Count <= 0)
{
LoadPlaylist(0);
}
if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !ForceDraw)
return;
@@ -500,9 +489,7 @@ namespace VocaluxeLib.Menu
if (_EditMode == EEditMode.PlaylistName)
{
if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
{
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + KeyEvent.Unicode;
}
else if (KeyEvent.Key == Keys.Enter)
{
CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
@@ -609,9 +596,7 @@ namespace VocaluxeLib.Menu
Update();
if (PlaylistElementContents.Count - 1 < CurrentPlaylistElement)
{
CurrentPlaylistElement = PlaylistElementContents.Count - 1;
}
if (CurrentPlaylistElement != -1)
_Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide);
@@ -728,7 +713,8 @@ namespace VocaluxeLib.Menu
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();
}
break;
@@ -739,7 +725,8 @@ namespace VocaluxeLib.Menu
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();
}
break;
@@ -762,17 +749,11 @@ namespace VocaluxeLib.Menu
case Keys.Enter:
if (_Theme.ButtonPlaylistClose.Selected)
{
ClosePlaylist();
}
else if (_Theme.ButtonPlaylistSing.Selected)
{
StartPlaylistSongs();
}
else if (_Theme.ButtonPlaylistSave.Selected)
{
CBase.Playlist.SavePlaylist(ActivePlaylistID);
}
else if (_Theme.ButtonPlaylistDelete.Selected)
{
CBase.Playlist.DeletePlaylist(ActivePlaylistID);
@@ -903,9 +884,7 @@ namespace VocaluxeLib.Menu
}
}
if (!hover_set)
{
CurrentPlaylistElement = -1;
}
switch (_EditMode)
{
@@ -917,7 +896,8 @@ namespace VocaluxeLib.Menu
{
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();
}
if (_Theme.ButtonPlaylistClose.Selected)
@@ -951,14 +931,11 @@ namespace VocaluxeLib.Menu
//Start selected song with double click
if (MouseEvent.LD && CurrentPlaylistElement != -1)
{
StartPlaylistSong(CurrentPlaylistElement);
}
//Change order with holding LB
if (MouseEvent.LBH && CurrentPlaylistElement != -1 && PlaylistElementContents.Count > 0 && DragAndDropSongID == -1)
{
ChangeOrderSource = CurrentPlaylistElement + Offset;
//Update of Drag/Drop-Texture
@@ -1077,9 +1054,7 @@ namespace VocaluxeLib.Menu
else if (CurrentPlaylistElement == -1)
{
if (MouseEvent.Y < PlaylistElements[0].Background.Rect.Y && Offset == 0)
{
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, 0);
}
else
{
if (PlaylistElements.Count + Offset >= PlaylistElementContents.Count)
@@ -1095,11 +1070,9 @@ namespace VocaluxeLib.Menu
}
if (MouseEvent.Y > min)
{
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, PlaylistElementContents.Count - 1);
}
}
}
UpdatePlaylist();
}
@@ -1119,7 +1092,8 @@ namespace VocaluxeLib.Menu
{
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.Rect.Y += Rect.Y + (i * _Theme.EntryHeight);
@@ -1184,7 +1158,6 @@ namespace VocaluxeLib.Menu
Update();
}
public void ClosePlaylist()
{
Visible = false;
@@ -1192,7 +1165,6 @@ namespace VocaluxeLib.Menu
ActivePlaylistID = -1;
}
private void StartPlaylistSongs()
{
CBase.Game.Reset();
@@ -1201,9 +1173,7 @@ namespace VocaluxeLib.Menu
if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists())
{
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);
}
if (CBase.Game.GetNumSongs() > 0)
CBase.Graphics.FadeTo(EScreens.ScreenNames); //TODO: What is if someone uses that in PartyMode?
}
+7 -19
View File
@@ -20,7 +20,7 @@ namespace VocaluxeLib.Menu
public class CScreenSetting : IMenuElement
{
private int _PartyModeID;
private readonly int _PartyModeID;
private SScreenSetting _Theme;
private bool _ThemeLoaded;
@@ -50,12 +50,10 @@ namespace VocaluxeLib.Menu
_ThemeLoaded = true;
_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)
{
_Theme.Name = ElementName;
}
return _ThemeLoaded;
}
@@ -95,17 +93,11 @@ namespace VocaluxeLib.Menu
return null;
}
public void UnloadTextures()
{
}
public void UnloadTextures() {}
public void LoadTextures()
{
}
public void LoadTextures() {}
public void ReloadTextures()
{
}
public void ReloadTextures() {}
#region Private
private int GetIntValue(string _string)
@@ -132,13 +124,9 @@ namespace VocaluxeLib.Menu
#endregion Private
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
}
public void MoveElement(int stepX, int stepY) {}
public void ResizeElement(int stepW, int stepH)
{
}
public void ResizeElement(int stepW, int stepH) {}
#endregion ThemeEdit
}
}
+15 -54
View File
@@ -35,7 +35,7 @@ namespace VocaluxeLib.Menu
public class CSelectSlide : IMenuElement, ICloneable
{
private int _PartyModeID;
private readonly int _PartyModeID;
private SThemeSelectSlide _Theme;
private bool _ThemeLoaded;
@@ -89,12 +89,12 @@ namespace VocaluxeLib.Menu
private bool _ArrowLeftSelected;
private bool _ArrowRightSelected;
private List<string> _ValueNames;
private List<int> _ValuePartyModeIDs;
private List<STexture> _Textures;
private List<int> _ValueIndexes;
private readonly List<string> _ValueNames;
private readonly List<int> _ValuePartyModeIDs;
private readonly List<STexture> _Textures;
private readonly List<int> _ValueIndexes;
private List<SRectF> _ValueBounds = new List<SRectF>();
private readonly List<SRectF> _ValueBounds = new List<SRectF>();
public bool WithTextures = false;
@@ -105,11 +105,9 @@ namespace VocaluxeLib.Menu
set
{
if (value >= 0 && value < _ValueNames.Count)
{
_Selection = value;
}
}
}
public int ValueIndex
{
@@ -118,16 +116,14 @@ namespace VocaluxeLib.Menu
if (_Selection >= 0 && _ValueIndexes.Count > _Selection)
return _ValueIndexes[_Selection];
else return -1;
else
return -1;
}
}
public int NumValues
{
get
{
return _ValueNames.Count;
}
get { return _ValueNames.Count; }
}
private int _NumVisible = -1;
@@ -252,9 +248,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
_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))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor);
}
else
{
_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))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.HColorName, SkinIndex, out HColor);
}
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/HR", ref HColor.R);
@@ -300,9 +290,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H);
if (xmlReader.GetValue(item + "/ArrowColor", ref _Theme.ArrowColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, SkinIndex, out ColorArrow);
}
else
{
_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))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SArrowColorName, SkinIndex, out SColorArrow);
}
else
{
_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))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, SkinIndex, out TextColor);
}
else
{
_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))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.STextColorName, SkinIndex, out STextColor);
}
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextSR", ref STextColor.R);
@@ -354,7 +336,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextMaxW", ref MaxW);
_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);
@@ -418,9 +400,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
else
{
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("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName);
}
else
{
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("or <HR>, <HG>, <HB>, <HA> (lower priority)");
if (_Theme.HColorName.Length > 0)
{
writer.WriteElementString("HColor", _Theme.HColorName);
}
else
{
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("or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)");
if (_Theme.ArrowColorName.Length > 0)
{
writer.WriteElementString("ArrowColor", _Theme.ArrowColorName);
}
else
{
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("or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower priority)");
if (_Theme.SArrowColorName.Length > 0)
{
writer.WriteElementString("ArrowSColor", _Theme.SArrowColorName);
}
else
{
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("or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)");
if (_Theme.TextColorName.Length > 0)
{
writer.WriteElementString("TextColor", _Theme.TextColorName);
}
else
{
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("or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)");
if (_Theme.STextColorName.Length > 0)
{
writer.WriteElementString("TextSColor", _Theme.STextColorName);
}
else
{
writer.WriteElementString("TextSR", STextColor.R.ToString("#0.00"));
@@ -579,9 +547,7 @@ namespace VocaluxeLib.Menu
public void AddValues(string[] values)
{
foreach (string value in values)
{
AddValue(value, new STexture(-1), _PartyModeID);
}
_ValueBounds.Clear();
}
@@ -592,9 +558,7 @@ namespace VocaluxeLib.Menu
return;
for (int i = 0; i < values.Length; i++)
{
AddValue(values[i], textures[i]);
}
if (Selection == -1)
Selection = 0;
@@ -700,7 +664,7 @@ namespace VocaluxeLib.Menu
{
if (CHelper.IsInBounds(_ValueBounds[i], x, y))
{
int offset = _Selection - (int)_NumVisible / 2;
int offset = _Selection - _NumVisible / 2;
if (_ValueNames.Count - _NumVisible - offset < 0)
offset = _ValueNames.Count - _NumVisible;
@@ -763,7 +727,7 @@ namespace VocaluxeLib.Menu
float dx = (Rect.W - TextRelativeX) * 0.8f / _NumVisible;
//float y = Rect.Y + (Rect.H - TextH);
int offset = _Selection - (int)_NumVisible/2;
int offset = _Selection - _NumVisible / 2;
if (_ValueNames.Count - _NumVisible - offset < 0)
offset = _ValueNames.Count - _NumVisible;
@@ -779,7 +743,8 @@ namespace VocaluxeLib.Menu
_ValueBounds.Clear();
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);
if (i + offset == _Selection)
@@ -807,15 +772,11 @@ namespace VocaluxeLib.Menu
_ValueBounds.Add(rect);
}
else
{
_ValueBounds.Add(new SRectF(Text.X - bounds.Width / 2f, Text.Y, bounds.Width, bounds.Height, Rect.Z));
}
}
}
public void UnloadTextures()
{
}
public void UnloadTextures() {}
public void LoadTextures()
{
+2 -12
View File
@@ -13,7 +13,7 @@ namespace VocaluxeLib.Menu
public class CStatic : IMenuElement
{
private int _PartyModeID;
private readonly int _PartyModeID;
private SThemeStatic _Theme;
private bool _ThemeLoaded;
@@ -138,9 +138,7 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
_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("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
@@ -267,20 +263,14 @@ namespace VocaluxeLib.Menu
{
CBase.Drawing.DrawTexture(texture, rect, color, bounds);
if (Reflection)
{
CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
}
}
if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme))
{
CBase.Drawing.DrawColor(new SColorF(1f, 1f, 1f, 0.5f), rect);
}
}
public void UnloadTextures()
{
}
public void UnloadTextures() {}
public void LoadTextures()
{
+3 -8
View File
@@ -6,8 +6,8 @@ namespace VocaluxeLib.Menu
{
public class CXMLReader
{
private XPathNavigator _Navigator;
private String _FileName;
private readonly XPathNavigator _Navigator;
private readonly String _FileName;
public string FileName
{
@@ -46,7 +46,7 @@ namespace VocaluxeLib.Menu
string val = String.Empty;
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 false;
@@ -56,9 +56,7 @@ namespace VocaluxeLib.Menu
{
string val = String.Empty;
if (GetValue(Cast, ref val, value.ToString()))
{
return int.TryParse(val, out value);
}
return false;
}
@@ -79,9 +77,7 @@ namespace VocaluxeLib.Menu
{
string val = String.Empty;
if (GetValue(Cast, ref val, value.ToString()))
{
return CHelper.TryParse(val, out value);
}
return false;
}
@@ -110,7 +106,6 @@ namespace VocaluxeLib.Menu
Value = val;
return true;
}
}
public List<string> GetValues(string Cast)
+2 -6
View File
@@ -121,9 +121,7 @@ namespace VocaluxeLib.Menu
void LoadTheme();
}
public interface IHelper
{
}
public interface IHelper {}
public interface IBackgroundMusic
{
@@ -315,7 +313,6 @@ namespace VocaluxeLib.Menu
CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex);
}
[Flags]
public enum EModifier
{
@@ -733,7 +730,6 @@ namespace VocaluxeLib.Menu
Slide,
Zoom
}
#endregion EnumsConfig
public enum EAlignment
@@ -812,7 +808,7 @@ namespace VocaluxeLib.Menu
public class CPoints
{
private SPlayer[,] _Rounds;
private readonly SPlayer[,] _Rounds;
public CPoints(int NumRounds, SPlayer[] Player)
{
+12 -47
View File
@@ -5,16 +5,14 @@ namespace VocaluxeLib.Menu.SingNotes
{
public class CNotes
{
private List<CLines> _Lines = new List<CLines>();
private readonly List<CLines> _Lines = new List<CLines>();
public CLines[] Lines
{
get { return _Lines.ToArray(); }
}
public CNotes()
{
}
public CNotes() {}
public int LinesCount
{
@@ -24,17 +22,13 @@ namespace VocaluxeLib.Menu.SingNotes
public CNotes(CNotes notes)
{
foreach (CLines lines in notes._Lines)
{
_Lines.Add(new CLines(lines));
}
}
public CLines GetLines(int Index)
{
while (Index >= _Lines.Count)
{
_Lines.Add(new CLines());
}
return _Lines[Index];
}
@@ -77,11 +71,9 @@ namespace VocaluxeLib.Menu.SingNotes
public void SetMedley(int StartBeat, int EndBeat)
{
foreach (CLines lines in _Lines)
{
lines.SetMedley(StartBeat, EndBeat);
}
}
}
public class CNote
{
@@ -122,7 +114,7 @@ namespace VocaluxeLib.Menu.SingNotes
this.StartBeat = StartBeat;
this.Duration = Duration;
this.Tone = Tone;
this.NoteType = ENoteType.Normal;
NoteType = ENoteType.Normal;
this.Text = Text;
}
@@ -132,7 +124,7 @@ namespace VocaluxeLib.Menu.SingNotes
this.StartBeat = StartBeat;
this.Duration = Duration;
this.Tone = Tone;
this.NoteType = ENoteType.Normal;
NoteType = ENoteType.Normal;
this.Text = Text;
this.Hit = Hit;
}
@@ -172,10 +164,7 @@ namespace VocaluxeLib.Menu.SingNotes
public int EndBeat
{
get
{
return _StartBeat + _Duration - 1;
}
get { return _StartBeat + _Duration - 1; }
}
public int Duration
@@ -274,24 +263,20 @@ namespace VocaluxeLib.Menu.SingNotes
{
private int _StartBeat = 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 int _MinBeat = int.MaxValue;
private int _MaxBeat = int.MinValue;
private List<CNote> _Notes = new List<CNote>();
private readonly List<CNote> _Notes = new List<CNote>();
#region Constructors
public CLine()
{
}
public CLine() {}
public CLine(CLine line)
{
foreach (CNote note in line._Notes)
{
_Notes.Add(new CNote(note));
}
_StartBeat = line._StartBeat;
_EndBeat = line._EndBeat;
_PerfectLine = line._PerfectLine;
@@ -350,9 +335,7 @@ namespace VocaluxeLib.Menu.SingNotes
{
string lyrics = String.Empty;
foreach (CNote note in _Notes)
{
lyrics += note.Text;
}
return lyrics;
}
}
@@ -368,9 +351,7 @@ namespace VocaluxeLib.Menu.SingNotes
{
int points = 0;
foreach (CNote note in _Notes)
{
points += note.Points;
}
return points;
}
}
@@ -433,7 +414,7 @@ namespace VocaluxeLib.Menu.SingNotes
if (CompareLine.Points == 0)
return false;
_PerfectLine = (this.Points == CompareLine.Points);
_PerfectLine = (Points == CompareLine.Points);
return _PerfectLine;
}
@@ -534,15 +515,11 @@ namespace VocaluxeLib.Menu.SingNotes
private void updateMinMaxBeat(CNote Note)
{
if (Note.StartBeat < _MinBeat)
{
_MinBeat = Note.StartBeat;
}
if (Note.EndBeat > _MaxBeat)
{
_MaxBeat = Note.EndBeat;
}
}
private void updateMinMaxBeat()
{
@@ -557,25 +534,20 @@ namespace VocaluxeLib.Menu.SingNotes
_MaxBeat = int.MinValue;
}
}
#endregion Methods
}
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)
{
foreach (CLine line in lines._Lines)
{
_Lines.Add(new CLine(line));
}
}
public CLine[] Line
{
@@ -624,9 +596,7 @@ namespace VocaluxeLib.Menu.SingNotes
{
int points = 0;
foreach (CLine line in _Lines)
{
points += line.Points;
}
return points;
}
}
@@ -730,15 +700,14 @@ namespace VocaluxeLib.Menu.SingNotes
}
return false;
}
public void UpdateTimings()
{
CNote LastNote, FirstNote;
int min, max, s;
if (_Lines.Count > 0)
{
_Lines[0].StartBeat = -10000;
}
for (int i = 1; i < _Lines.Count; i++)
{
@@ -776,18 +745,14 @@ namespace VocaluxeLib.Menu.SingNotes
LastNote = _Lines[_Lines.Count - 1].LastNote;
if (LastNote != null)
{
_Lines[_Lines.Count - 1].EndBeat = LastNote.EndBeat;
}
}
public void SetMedley(int StartBeat, int EndBeat)
{
foreach (CLine line in _Lines)
{
line.SetMedley(StartBeat, EndBeat);
}
}
#endregion Methods
}
}
+11 -44
View File
@@ -44,7 +44,7 @@ namespace VocaluxeLib.Menu.SingNotes
private SThemeSingBar _Theme;
private bool _ThemeLoaded;
private List<SPlayerNotes> _PlayerNotes;
private readonly List<SPlayerNotes> _PlayerNotes;
private int _ActID;
private SRectF[,] _BarPos;
@@ -182,6 +182,7 @@ namespace VocaluxeLib.Menu.SingNotes
return false;
}
public virtual void Reset()
{
_PlayerNotes.Clear();
@@ -209,10 +210,7 @@ namespace VocaluxeLib.Menu.SingNotes
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)
{
@@ -241,15 +239,9 @@ namespace VocaluxeLib.Menu.SingNotes
_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)
{
@@ -294,9 +286,7 @@ namespace VocaluxeLib.Menu.SingNotes
CLine Line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr];
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));
}
if (Line.NoteCount == 0)
return;
@@ -344,25 +334,19 @@ namespace VocaluxeLib.Menu.SingNotes
}
if (CBase.Config.GetDrawToneHelper() == EOffOn.TR_CONFIG_ON)
{
DrawToneHelper(n, (int)BaseLine, (CBase.Game.GetMidBeatD() - Line.FirstNoteBeat) / beats * w);
}
int i = 0;
while (i < _PlayerNotes[n].PerfectLineTwinkle.Count)
{
if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive)
{
_PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i);
}
else
i++;
}
foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
{
perfline.Draw();
}
if (SingLine == null || SingLine.Count == 0 || CBase.Game.GetPlayer()[Player].CurrentLine == -1 || SingLine.Count <= CBase.Game.GetPlayer()[Player].CurrentLine)
{
@@ -426,9 +410,7 @@ namespace VocaluxeLib.Menu.SingNotes
while (i < _PlayerNotes[n].Flares.Count)
{
if (!_PlayerNotes[n].Flares[i].IsAlive)
{
_PlayerNotes[n].Flares.RemoveAt(i);
}
else
i++;
}
@@ -437,16 +419,12 @@ namespace VocaluxeLib.Menu.SingNotes
while (i < _PlayerNotes[n].PerfectNoteEffect.Count)
{
if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive)
{
_PlayerNotes[n].PerfectNoteEffect.RemoveAt(i);
}
else
i++;
}
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
{
stars.Alpha = _PlayerNotes[n].Alpha;
@@ -454,23 +432,15 @@ namespace VocaluxeLib.Menu.SingNotes
}
foreach (CParticleEffect flare in _PlayerNotes[n].Flares)
{
flare.Draw();
}
foreach (CParticleEffect perfnote in _PlayerNotes[n].PerfectNoteEffect)
{
perfnote.Draw();
}
}
public void UnloadTextures()
{
}
public void UnloadTextures() {}
public void LoadTextures()
{
}
public void LoadTextures() {}
public void ReloadTextures()
{
@@ -689,7 +659,8 @@ namespace VocaluxeLib.Menu.SingNotes
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);
}
@@ -754,13 +725,9 @@ namespace VocaluxeLib.Menu.SingNotes
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
}
public void MoveElement(int stepX, int stepY) {}
public void ResizeElement(int stepW, int stepH)
{
}
public void ResizeElement(int stepW, int stepH) {}
#endregion ThemeEdit
}
}
@@ -1,12 +1,8 @@
namespace VocaluxeLib.Menu.SingNotes
namespace VocaluxeLib.Menu.SingNotes
{
class CSingNotesClassic : CSingNotes
{
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);
void RemovePlayer(int ID);
void AddLine(int ID, CLine[] Line, int LineNr, int Player);
void RemoveLine(int ID);
+170 -200
View File
@@ -31,7 +31,7 @@ namespace VocaluxeLib.Menu.SongMenu
public string Name = String.Empty;
private STexture _CoverTextureSmall = new STexture(-1);
private STexture _CoverTextureBig = new STexture(-1);
private bool _CoverBigLoaded = false;
private bool _CoverBigLoaded;
public CCategory(string name)
{
@@ -42,10 +42,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
get { return _CoverTextureSmall; }
set
{
_CoverTextureSmall = value;
}
set { _CoverTextureSmall = value; }
}
public STexture CoverTextureBig
@@ -102,9 +99,9 @@ namespace VocaluxeLib.Menu.SongMenu
public class CSong
{
private bool _CoverSmallLoaded = false;
private bool _CoverBigLoaded = false;
private bool _NotesLoaded = false;
private bool _CoverSmallLoaded;
private bool _CoverBigLoaded;
private bool _NotesLoaded;
private STexture _CoverTextureSmall = new STexture(-1);
private STexture _CoverTextureBig = new STexture(-1);
@@ -146,9 +143,7 @@ namespace VocaluxeLib.Menu.SongMenu
get
{
if (!_CoverSmallLoaded)
{
LoadSmallCover();
}
return _CoverTextureSmall;
}
@@ -168,7 +163,8 @@ namespace VocaluxeLib.Menu.SongMenu
else
return _CoverTextureSmall;
}
set {
set
{
_CoverTextureBig = value;
_CoverBigLoaded = true;
}
@@ -229,9 +225,7 @@ namespace VocaluxeLib.Menu.SongMenu
}
//No point creating a song without a text file --> Use factory method LoadSong
private CSong()
{
}
private CSong() {}
public static CSong LoadSong(string FilePath)
{
@@ -243,81 +237,73 @@ namespace VocaluxeLib.Menu.SongMenu
public CSong(CSong song)
{
this._CoverTextureSmall = song._CoverTextureSmall;
this._CoverTextureBig = song._CoverTextureBig;
_CoverTextureSmall = song._CoverTextureSmall;
_CoverTextureBig = song._CoverTextureBig;
this.Medley = new SMedley();
this.Medley.Source = song.Medley.Source;
this.Medley.StartBeat = song.Medley.StartBeat;
this.Medley.EndBeat = song.Medley.EndBeat;
this.Medley.FadeInTime = song.Medley.FadeInTime;
this.Medley.FadeOutTime = song.Medley.FadeOutTime;
Medley = new SMedley();
Medley.Source = song.Medley.Source;
Medley.StartBeat = song.Medley.StartBeat;
Medley.EndBeat = song.Medley.EndBeat;
Medley.FadeInTime = song.Medley.FadeInTime;
Medley.FadeOutTime = song.Medley.FadeOutTime;
this.CalculateMedley = song.CalculateMedley;
this.PreviewStart = song.PreviewStart;
CalculateMedley = song.CalculateMedley;
PreviewStart = song.PreviewStart;
this.ShortEnd = song.ShortEnd;
this.DuetPart1 = song.DuetPart1;
this.DuetPart2 = song.DuetPart2;
ShortEnd = song.ShortEnd;
DuetPart1 = song.DuetPart1;
DuetPart2 = song.DuetPart2;
this.Encoding = song.Encoding;
this.Folder = song.Folder;
this.FolderName = song.FolderName;
this.FileName = song.FileName;
this.Relative = song.Relative;
Encoding = song.Encoding;
Folder = song.Folder;
FolderName = song.FolderName;
FileName = song.FileName;
Relative = song.Relative;
this.MP3FileName = song.MP3FileName;
this.CoverFileName = song.CoverFileName;
this.BackgroundFileName = song.BackgroundFileName;
this.VideoFileName = song.VideoFileName;
MP3FileName = song.MP3FileName;
CoverFileName = song.CoverFileName;
BackgroundFileName = song.BackgroundFileName;
VideoFileName = song.VideoFileName;
this.VideoAspect = song.VideoAspect;
this._CoverSmallLoaded = song._CoverSmallLoaded;
this._CoverBigLoaded = song._CoverBigLoaded;
this._NotesLoaded = song._NotesLoaded;
VideoAspect = song.VideoAspect;
_CoverSmallLoaded = song._CoverSmallLoaded;
_CoverBigLoaded = song._CoverBigLoaded;
_NotesLoaded = song._NotesLoaded;
this.Artist = song.Artist;
this.Title = song.Title;
Artist = song.Artist;
Title = song.Title;
this.Start = song.Start;
this.Finish = song.Finish;
Start = song.Start;
Finish = song.Finish;
this.BPM = song.BPM;
this.Gap = song.Gap;
this.VideoGap = song.VideoGap;
BPM = song.BPM;
Gap = song.Gap;
VideoGap = song.VideoGap;
this.Comment = new List<string>();
Comment = new List<string>();
foreach (string value in song.Comment)
{
this.Comment.Add(value);
}
Comment.Add(value);
this.ID = song.ID;
this.Visible = song.Visible;
this.CatIndex = song.CatIndex;
this.Selected = song.Selected;
ID = song.ID;
Visible = song.Visible;
CatIndex = song.CatIndex;
Selected = song.Selected;
this.Edition = new List<string>();
Edition = new List<string>();
foreach (string value in song.Edition)
{
this.Edition.Add(value);
}
Edition.Add(value);
this.Genre = new List<string>();
Genre = new List<string>();
foreach (string value in song.Genre)
{
this.Genre.Add(value);
}
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)
{
this.Language.Add(value);
}
Language.Add(value);
this.Notes = new CNotes(song.Notes);
Notes = new CNotes(song.Notes);
}
public string GetMP3()
@@ -335,33 +321,32 @@ namespace VocaluxeLib.Menu.SongMenu
if (!File.Exists(FilePath))
return false;
this.Folder = Path.GetDirectoryName(FilePath);
Folder = Path.GetDirectoryName(FilePath);
foreach (string folder in CBase.Config.GetSongFolder())
{
if (this.Folder.Contains(folder))
if (Folder.Contains(folder))
{
if (this.Folder.Length == folder.Length)
this.FolderName = "Songs";
if (Folder.Length == folder.Length)
FolderName = "Songs";
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)
this.FolderName = this.FolderName.Substring(0, pos);
FolderName = FolderName.Substring(0, pos);
}
break;
}
}
this.FileName = Path.GetFileName(FilePath);
FileName = Path.GetFileName(FilePath);
EHeaderFlags HeaderFlags = new EHeaderFlags();
StreamReader sr = null;
try
{
sr = new StreamReader(FilePath, Encoding.Default, true);
string line;
@@ -375,7 +360,8 @@ namespace VocaluxeLib.Menu.SongMenu
line = sr.ReadLine();
if (line.Length == 0)
continue;
if (!line[0].ToString().Equals("#")) break;
if (!line[0].ToString().Equals("#"))
break;
pos = line.IndexOf(":");
@@ -389,10 +375,10 @@ namespace VocaluxeLib.Menu.SongMenu
switch (Identifier)
{
case "ENCODING":
this.Encoding = CEncoding.GetEncoding(Value);
Encoding = CEncoding.GetEncoding(Value);
sr.Dispose();
sr = null;
sr = new StreamReader(FilePath, this.Encoding);
sr = new StreamReader(FilePath, Encoding);
Identifier = String.Empty;
//Scip everything till encoding
@@ -401,7 +387,8 @@ namespace VocaluxeLib.Menu.SongMenu
line = sr.ReadLine();
if (line.Length == 0)
continue;
if (!line[0].ToString().Equals("#")) break;
if (!line[0].ToString().Equals("#"))
break;
pos = line.IndexOf(":");
@@ -416,136 +403,128 @@ namespace VocaluxeLib.Menu.SongMenu
case "TITLE":
if (Value.Length > 0)
{
this.Title = Value;
Title = Value;
HeaderFlags |= EHeaderFlags.Title;
}
break;
case "ARTIST":
if (Value.Length > 0)
{
this.Artist = Value;
Artist = Value;
HeaderFlags |= EHeaderFlags.Artist;
}
break;
case "TITLE-ON-SORTING":
if (Value.Length > 0)
{
this.TitleSorting = Value;
}
TitleSorting = Value;
break;
case "ARTIST-ON-SORTING":
if (Value.Length > 0)
{
this.ArtistSorting = Value;
}
ArtistSorting = Value;
break;
case "P1":
if (Value.Length > 0)
{
this.DuetPart1 = Value;
}
DuetPart1 = Value;
break;
case "P2":
if (Value.Length > 0)
{
this.DuetPart2 = Value;
}
DuetPart2 = Value;
break;
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;
}
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;
}
break;
case "BPM":
if (CHelper.TryParse(Value, out this.BPM))
if (CHelper.TryParse(Value, out BPM))
{
this.BPM *= 4;
BPM *= 4;
HeaderFlags |= EHeaderFlags.BPM;
}
break;
case "EDITION":
if (Value.Length > 1)
this.Edition.Add(Value);
Edition.Add(Value);
break;
case "GENRE":
if (Value.Length > 1)
this.Genre.Add(Value);
Genre.Add(Value);
break;
case "YEAR":
int num = 0;
if (Value.Length == 4 && int.TryParse(Value, out num) && num != 0)
{
this.Year = Value;
}
Year = Value;
break;
case "LANGUAGE":
if (Value.Length > 1)
this.Language.Add(Value);
Language.Add(Value);
break;
case "COMMENT":
if (Value.Length > 1)
this.Comment.Add(Value);
Comment.Add(Value);
break;
case "GAP":
if (CHelper.TryParse(Value, out this.Gap))
this.Gap /= 1000f;
if (CHelper.TryParse(Value, out Gap))
Gap /= 1000f;
break;
case "COVER":
if (File.Exists(Path.Combine(this.Folder, Value)))
this.CoverFileName = Value;
if (File.Exists(Path.Combine(Folder, Value)))
CoverFileName = Value;
break;
case "BACKGROUND":
if (File.Exists(Path.Combine(this.Folder, Value)))
this.BackgroundFileName = Value;
if (File.Exists(Path.Combine(Folder, Value)))
BackgroundFileName = Value;
break;
case "VIDEO":
if (File.Exists(Path.Combine(this.Folder, Value)))
this.VideoFileName = Value;
if (File.Exists(Path.Combine(Folder, Value)))
VideoFileName = Value;
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;
case "VIDEOGAP":
CHelper.TryParse(Value, out this.VideoGap);
CHelper.TryParse(Value, out VideoGap);
break;
case "VIDEOASPECT":
CHelper.TryParse<EAspect>(Value, out this.VideoAspect, true);
CHelper.TryParse(Value, out VideoAspect, true);
break;
case "START":
CHelper.TryParse(Value, out this.Start);
CHelper.TryParse(Value, out Start);
break;
case "END":
if (CHelper.TryParse(Value, out this.Finish))
this.Finish /= 1000f;
if (CHelper.TryParse(Value, out Finish))
Finish /= 1000f;
break;
case "PREVIEWSTART":
if (CHelper.TryParse(Value, out this.PreviewStart))
if (this.PreviewStart < 0f)
this.PreviewStart = 0f;
if (CHelper.TryParse(Value, out PreviewStart))
{
if (PreviewStart < 0f)
PreviewStart = 0f;
else
HeaderFlags |= EHeaderFlags.PreviewStart;
}
break;
case "MEDLEYSTARTBEAT":
if (int.TryParse(Value, out this.Medley.StartBeat))
if (int.TryParse(Value, out Medley.StartBeat))
HeaderFlags |= EHeaderFlags.MedleyStartBeat;
break;
case "MEDLEYENDBEAT":
if (int.TryParse(Value, out this.Medley.EndBeat))
if (int.TryParse(Value, out Medley.EndBeat))
HeaderFlags |= EHeaderFlags.MedleyEndBeat;
break;
case "CALCMEDLEY":
if (Value.ToUpper() == "OFF")
this.CalculateMedley = false;
CalculateMedley = false;
break;
case "RELATIVE":
if (Value.ToUpper() == "YES" && Value.ToUpper() != "NO")
this.Relative = EOffOn.TR_CONFIG_ON;
Relative = EOffOn.TR_CONFIG_ON;
break;
}
}
@@ -586,33 +565,33 @@ namespace VocaluxeLib.Menu.SongMenu
#region check medley tags
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);
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
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0)
//fallback to MedleyStart
this.PreviewStart = CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM);
PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM);
else
//else set to 0, it will be set in FindRefrainStart
this.PreviewStart = 0f;
PreviewStart = 0f;
}
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0)
{
this.Medley.Source = EMedleySource.Tag;
this.Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
this.Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
Medley.Source = EMedleySource.Tag;
Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
}
#endregion check medley tags
this.Encoding = sr.CurrentEncoding;
Encoding = sr.CurrentEncoding;
}
catch (Exception e)
{
@@ -625,23 +604,20 @@ namespace VocaluxeLib.Menu.SongMenu
CheckFiles();
//Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag.
if (this.ArtistSorting.Length == 0)
{
this.ArtistSorting = this.Artist;
}
if (ArtistSorting.Length == 0)
ArtistSorting = Artist;
if (this.TitleSorting.Length == 0)
{
this.TitleSorting = this.Title;
}
if (TitleSorting.Length == 0)
TitleSorting = Title;
return true;
}
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)
{
//Skip loading if already done and no reload is forced
@@ -669,10 +645,9 @@ namespace VocaluxeLib.Menu.SongMenu
StreamReader sr = null;
try
{
sr = new StreamReader(FilePath, Encoding, true);
sr = new StreamReader(FilePath, this.Encoding, true);
this.Notes.Reset();
Notes.Reset();
//Search for Note Beginning
while (!sr.EndOfStream)
@@ -698,7 +673,6 @@ namespace VocaluxeLib.Menu.SongMenu
do
{
char chr;
switch (TempC)
{
@@ -743,7 +717,7 @@ namespace VocaluxeLib.Menu.SongMenu
else
NoteType = ENoteType.Normal;
if (this.Relative == EOffOn.TR_CONFIG_ON)
if (Relative == EOffOn.TR_CONFIG_ON)
Param1 += currentPos;
if (Player != 2)
@@ -766,7 +740,7 @@ namespace VocaluxeLib.Menu.SongMenu
sr.Read();
Param1 = CHelper.TryReadInt(sr);
if (this.Relative == EOffOn.TR_CONFIG_ON)
if (Relative == EOffOn.TR_CONFIG_ON)
{
Param1 += currentPos;
sr.Read();
@@ -800,11 +774,9 @@ namespace VocaluxeLib.Menu.SongMenu
FileLineNo++;
} while (!sr.EndOfStream && (TempC != 'E'));
foreach(CLines lines in this.Notes.Lines)
{
foreach (CLines lines in Notes.Lines)
lines.UpdateTimings();
}
}
catch (Exception e)
{
CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath);
@@ -824,7 +796,7 @@ namespace VocaluxeLib.Menu.SongMenu
private bool ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text)
{
CNote note = new CNote(Start, Length, Tone, Text, NoteType);
CLines lines = this.Notes.GetLines(Player);
CLines lines = Notes.GetLines(Player);
return lines.AddNote(note);
}
@@ -840,9 +812,9 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (_CoverSmallLoaded)
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();
}
else
@@ -853,29 +825,27 @@ namespace VocaluxeLib.Menu.SongMenu
private void CheckFiles()
{
if(this.CoverFileName.Length == 0){
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
if (CoverFileName.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, @".[CO].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase)))
{
this.CoverFileName = file;
}
if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) &&
(Regex.IsMatch(file, @"" + Regex.Escape(Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(Artist), RegexOptions.IgnoreCase)))
CoverFileName = file;
}
}
if (this.BackgroundFileName.Length == 0)
if (BackgroundFileName.Length == 0)
{
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
List<string> files = CHelper.ListFiles(Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(Folder, "*.png", false));
foreach (String file in files)
{
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)))
{
this.BackgroundFileName = file;
}
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)
{
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)
{
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()
{
CLines lines = this.Notes.GetLines(0);
CLines lines = Notes.GetLines(0);
if (lines.LineCount == 0)
return null;
@@ -954,16 +924,16 @@ namespace VocaluxeLib.Menu.SongMenu
private void FindRefrain()
{
if (this.IsDuet)
if (IsDuet)
{
this.Medley.Source = EMedleySource.None;
Medley.Source = EMedleySource.None;
return;
}
if (this.Medley.Source == EMedleySource.Tag)
if (Medley.Source == EMedleySource.Tag)
return;
if (!this.CalculateMedley)
if (!CalculateMedley)
return;
List<Series> series = GetSeries();
@@ -978,55 +948,56 @@ namespace VocaluxeLib.Menu.SongMenu
longest = i;
}
CLines lines = this.Notes.GetLines(0);
CLines lines = Notes.GetLines(0);
// set medley vars
if (series.Count > 0 && series[longest].length > CBase.Settings.GetMedleyMinSeriesLength())
{
this.Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat;
this.Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat;
Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat;
Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat;
bool foundEnd = false;
// set end if duration > MedleyMinDuration
if (CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(this.Medley.EndBeat, this.BPM))
if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM))
foundEnd = true;
if (!foundEnd)
{
for (int i = series[longest].start + 1; i < lines.LineCount - 1; i++)
{
if (CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, this.BPM))
if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, BPM))
{
foundEnd = true;
this.Medley.EndBeat = lines.Line[i].LastNoteBeat;
Medley.EndBeat = lines.Line[i].LastNoteBeat;
}
}
}
if (foundEnd)
{
this.Medley.Source = EMedleySource.Calculated;
this.Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
this.Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
Medley.Source = EMedleySource.Calculated;
Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
}
}
if (this.PreviewStart == 0f)
if (PreviewStart == 0f)
{
if (this.Medley.Source == EMedleySource.Calculated)
this.PreviewStart = CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM);
if (Medley.Source == EMedleySource.Calculated)
PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM);
}
}
private void FindShortEnd(){
private void FindShortEnd()
{
List<Series> series = GetSeries();
if (series == null)
return;
CLines lines = this.Notes.GetLines(0);
CLines lines = Notes.GetLines(0);
//Calculate length of singing
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)))
{
this.ShortEnd = lines.Line[series[i].start-1].LastNote.EndBeat;
ShortEnd = lines.Line[series[i].start - 1].LastNote.EndBeat;
return;
}
else
{
this.ShortEnd = lines.Line[series[i].end].LastNote.EndBeat;
ShortEnd = lines.Line[series[i].end].LastNote.EndBeat;
return;
}
}
@@ -1054,13 +1025,12 @@ namespace VocaluxeLib.Menu.SongMenu
{
if (lines.Line[i].FirstNoteBeat < stop && lines.Line[i].LastNoteBeat > stop)
{
this.ShortEnd = lines.Line[i].LastNoteBeat;
ShortEnd = lines.Line[i].LastNoteBeat;
return;
}
}
ShortEnd = stop;
}
public object Clone()
+1 -4
View File
@@ -5,7 +5,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
public class CSongMenu : ISongMenu
{
private int _PartyModeID;
private readonly int _PartyModeID;
private ISongMenu _SongMenu;
private ESongMenu _Type;
@@ -154,7 +154,6 @@ namespace VocaluxeLib.Menu.SongMenu
{
_SongMenu.SetSmallView(SmallView);
}
#endregion ISongMenu
#region IMenuElement
@@ -202,9 +201,7 @@ namespace VocaluxeLib.Menu.SongMenu
private void CreateSongMenu()
{
if (_SongMenu != null)
{
_SongMenu.OnHide();
}
switch (CBase.Config.GetSongMenuType())
{
+2 -5
View File
@@ -1,11 +1,8 @@
namespace VocaluxeLib.Menu.SongMenu
namespace VocaluxeLib.Menu.SongMenu
{
class CSongMenuBook : CSongMenuFramework
{
public CSongMenuBook(int PartyModeID)
: base(PartyModeID)
{
}
: base(PartyModeID) {}
}
}
@@ -1,5 +1,4 @@
namespace VocaluxeLib.Menu.SongMenu
namespace VocaluxeLib.Menu.SongMenu
{
class CSongMenuDreidel : CSongMenuFramework
{
@@ -24,9 +23,7 @@ namespace VocaluxeLib.Menu.SongMenu
*/
public CSongMenuDreidel(int PartyModeID)
: base(PartyModeID)
{
}
: base(PartyModeID) {}
public override void Init()
{
@@ -27,17 +27,11 @@ namespace VocaluxeLib.Menu.SongMenu
public SThemeSongMenuTileBoard songMenuTileBoard;
}
struct SThemeSongMenuBook
{
}
struct SThemeSongMenuBook {}
struct SThemeSongMenuDreidel
{
}
struct SThemeSongMenuDreidel {}
struct SThemeSongMenuList
{
}
struct SThemeSongMenuList {}
struct SThemeSongMenuTileBoard
{
@@ -92,9 +86,9 @@ namespace VocaluxeLib.Menu.SongMenu
protected SThemeSongMenu _Theme;
private bool _ThemeLoaded;
private Stopwatch _timer = new Stopwatch();
private Stopwatch _VideoFadeTimer = new Stopwatch();
private List<int> _streams = new List<int>();
private readonly Stopwatch _timer = new Stopwatch();
private readonly Stopwatch _VideoFadeTimer = new Stopwatch();
private readonly List<int> _streams = new List<int>();
private int _video = -1;
private int _actsong = -1;
private int _actsongstream = -1;
@@ -155,7 +149,6 @@ namespace VocaluxeLib.Menu.SongMenu
_SelectedInternal = _SelectedPending;
}
}
}
protected virtual void SetSelectedNow()
@@ -206,7 +199,7 @@ namespace VocaluxeLib.Menu.SongMenu
return _actsong;
}
private bool _Selected = false;
private bool _Selected;
private bool _Visible = true;
public bool IsSelected()
@@ -267,9 +260,7 @@ namespace VocaluxeLib.Menu.SongMenu
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", ref _Theme.MedleyTagIcon, String.Empty);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out _Color);
}
else
{
_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/TileRectSmallW", ref _Theme.songMenuTileBoard.TileRectSmall.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallH", ref _Theme.songMenuTileBoard.TileRectSmall.H);
#endregion SongMenuTileBoard
if (_ThemeLoaded)
@@ -349,9 +339,7 @@ namespace VocaluxeLib.Menu.SongMenu
writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
else
{
writer.WriteElementString("R", _Color.R.ToString("#0.00"));
@@ -451,9 +439,7 @@ namespace VocaluxeLib.Menu.SongMenu
float vtime = 0f;
CBase.Video.GetFrame(_video, ref _vidtex, time, ref vtime);
if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L)
{
_vidtex.color.A = (_VideoFadeTimer.ElapsedMilliseconds / 3000f);
}
else
{
_vidtex.color.A = 1f;
@@ -471,9 +457,7 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual void OnHide()
{
foreach (int stream in _streams)
{
CBase.Sound.FadeAndStop(stream, 0f, 0.75f);
}
_streams.Clear();
CBase.Video.Close(_video);
@@ -504,21 +488,16 @@ namespace VocaluxeLib.Menu.SongMenu
return;
if (_video != -1)
{
CBase.Drawing.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0));
}
}
public virtual void ApplyVolume(float VolumeMax)
{
_MaxVolume = VolumeMax;
foreach (int stream in _streams)
{
CBase.Sound.SetStreamVolumeMax(stream, _MaxVolume);
}
}
public virtual bool IsActive()
{
@@ -568,9 +547,7 @@ namespace VocaluxeLib.Menu.SongMenu
return false;
}
public virtual void UnloadTextures()
{
}
public virtual void UnloadTextures() {}
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)))
{
foreach (int stream in _streams)
{
CBase.Sound.FadeAndStop(stream, 0f, 1f);
}
_streams.Clear();
CBase.Video.Close(_video);
@@ -676,9 +651,7 @@ namespace VocaluxeLib.Menu.SongMenu
protected void Reset()
{
foreach (int stream in _streams)
{
CBase.Sound.FadeAndStop(stream, 0f, 0.75f);
}
_streams.Clear();
CBase.Video.Close(_video);
+2 -5
View File
@@ -1,11 +1,8 @@
namespace VocaluxeLib.Menu.SongMenu
namespace VocaluxeLib.Menu.SongMenu
{
class CSongMenuList : CSongMenuFramework
{
public CSongMenuList(int PartyModeID)
: base(PartyModeID)
{
}
: base(PartyModeID) {}
}
}
@@ -36,12 +36,10 @@ namespace VocaluxeLib.Menu.SongMenu
private int _Offset = -1;
private int _actualSelection = -1;
private bool _SmallView = false;
private bool _SmallView;
public CSongMenuTileBoard(int PartyModeID)
: base(PartyModeID)
{
}
: base(PartyModeID) {}
public override int GetActualSelection()
{
@@ -105,18 +103,14 @@ namespace VocaluxeLib.Menu.SongMenu
_Locked = _PreviewSelected;
_actualSelection = _PreviewSelected;
for (int i = 0; i < _Tiles.Count; i++)
{
_Tiles[i].Selected = _Locked == i + _Offset;
}
}
}
public override void OnShow()
{
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetCurrentCategoryIndex() == -1)
{
EnterCategory(0);
}
_actualSelection = -1;
_Locked = -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))
{
if (_PreviewSelected > -1)
{
_Locked = _PreviewSelected;
}
else
{
_Locked = 0;
@@ -204,9 +196,7 @@ namespace VocaluxeLib.Menu.SongMenu
KeyEvent.Handled = true;
}
else if (_actualSelection > -1 && _PreviewSelected >= 0)
{
_Locked = _actualSelection;
}
break;
case Keys.Escape:
@@ -224,16 +214,12 @@ namespace VocaluxeLib.Menu.SongMenu
case Keys.PageUp:
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{
PrevCategory();
}
break;
case Keys.PageDown:
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
{
NextCategory();
}
break;
case Keys.Left:
@@ -252,7 +238,6 @@ namespace VocaluxeLib.Menu.SongMenu
_Locked++;
UpdateList();
}
}
else
{
@@ -271,7 +256,8 @@ namespace VocaluxeLib.Menu.SongMenu
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;
UpdateList();
@@ -292,7 +278,6 @@ namespace VocaluxeLib.Menu.SongMenu
_Locked += _NumW;
UpdateList();
}
}
else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly)
{
@@ -300,7 +285,6 @@ namespace VocaluxeLib.Menu.SongMenu
UpdateList();
}
break;
}
}
@@ -310,12 +294,10 @@ namespace VocaluxeLib.Menu.SongMenu
_actualSelection = _Locked;
for (int i = 0; i < _Tiles.Count; i++)
{
_Tiles[i].Selected = _Locked == i + _Offset;
}
}
}
}
public override void HandleMouse(ref MouseEvent MouseEvent, ScreenSongOptions SongOptions)
{
@@ -346,9 +328,7 @@ namespace VocaluxeLib.Menu.SongMenu
sel = true;
}
else
{
tile.Selected = false;
}
i++;
}
}
@@ -361,23 +341,20 @@ namespace VocaluxeLib.Menu.SongMenu
if (!sel)
_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();
MouseEvent.Handled = true;
return;
}
else if (MouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode)
{
CBase.Graphics.FadeTo(EScreens.ScreenMain);
}
else if (_PreviewSelected != -1 && MouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !SongOptions.Selection.PartyMode)
{
if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent))
{
_Locked = _PreviewSelected;
}
}
else if ((MouseEvent.LB) && (CBase.Songs.GetCurrentCategoryIndex() == -1))
{
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);
}
}
public override void Draw()
{
@@ -479,7 +455,6 @@ namespace VocaluxeLib.Menu.SongMenu
_CoverBig.Draw(1f, EAspect.Crop);
_Artist.Draw();
_Title.Draw();
_SongLength.Draw();
@@ -487,7 +462,6 @@ namespace VocaluxeLib.Menu.SongMenu
_VideoIcon.Draw();
_MedleyCalcIcon.Draw();
_MedleyTagIcon.Draw();
}
public override int GetSelectedSong()
@@ -520,9 +494,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (_Locked == -1 || !sel)
{
if (_PreviewSelected > -1)
{
_Locked = _PreviewSelected;
}
else
{
_Locked = 0;
@@ -534,9 +506,7 @@ namespace VocaluxeLib.Menu.SongMenu
}
foreach (CStatic tile in _Tiles)
{
tile.Selected = false;
}
_PreviewSelected = itemNr;
SetSelectedNow();
@@ -613,9 +583,7 @@ namespace VocaluxeLib.Menu.SongMenu
SelectSong(_PreviewSelected);
foreach (CStatic tile in _Tiles)
{
tile.Selected = false;
}
if (_actualSelection >= 0 && _actualSelection < _Tiles.Count)
_Tiles[_actualSelection].Selected = true;
+1 -2
View File
@@ -1,5 +1,4 @@
using VocaluxeLib.PartyModes;
using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu.SongMenu
{
+7 -21
View File
@@ -25,22 +25,16 @@ namespace VocaluxeLib.PartyModes
return false;
}
public void Initialize()
{
}
public void Initialize() {}
public void AddScreen(CMenuParty Screen, string ScreenName)
{
_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)
{
@@ -63,13 +57,9 @@ namespace VocaluxeLib.PartyModes
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()
{
@@ -96,9 +86,7 @@ namespace VocaluxeLib.PartyModes
return 1;
}
public virtual void SetSearchString(string SearchString, bool Visible)
{
}
public virtual void SetSearchString(string SearchString, bool Visible) {}
public virtual void JokerUsed(int TeamNr)
{
@@ -112,9 +100,7 @@ namespace VocaluxeLib.PartyModes
_ScreenSongOptions.Selection.NumJokers[TeamNr]--;
}
public virtual void SongSelected(int SongID)
{
}
public virtual void SongSelected(int SongID) {}
public virtual void FinishedSinging()
{
+9 -27
View File
@@ -6,12 +6,11 @@ namespace VocaluxeLib.PartyModes
public class CScreenPartyDummy : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
protected override int _ScreenVersion { get { return 1; } }
private CText Warning;
public CScreenPartyDummy()
protected override int _ScreenVersion
{
get { return 1; }
}
private CText Warning;
public override void LoadTheme(string XmlPath)
{
@@ -27,30 +26,19 @@ namespace VocaluxeLib.PartyModes
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)
{
base.HandleInput(KeyEvent);
if (KeyEvent.KeyPressed)
{
}
if (KeyEvent.KeyPressed) {}
else
{
switch (KeyEvent.Key)
@@ -68,15 +56,10 @@ namespace VocaluxeLib.PartyModes
{
base.HandleMouse(MouseEvent);
if (MouseEvent.LB && IsMouseOver(MouseEvent))
{
}
if (MouseEvent.LB && IsMouseOver(MouseEvent)) {}
if (MouseEvent.RB)
{
FadeTo(EScreens.ScreenParty);
}
return true;
}
@@ -91,6 +74,5 @@ namespace VocaluxeLib.PartyModes
base.Draw();
return true;
}
}
}
+1
View File
@@ -3,6 +3,7 @@ using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes
{
#region Structs
public struct ScreenSongOptions
{
+4
View File
@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("VocaluxeLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -16,9 +17,11 @@ using System.Runtime.InteropServices;
// 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
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// 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")]
// 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
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]