Auto cleanup of VocaluxeLib
This commit is contained in:
1 parent
b497b58740
commit
efab579188
37 files changed
+642
-1155
No files matched your search
@@ -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")]
|
||||
@@ -26,10 +26,10 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public class CBackground : IMenuElement
|
||||
{
|
||||
private int _PartyModeID;
|
||||
private readonly int _PartyModeID;
|
||||
private SThemeBackground _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
|
||||
public SColorF Color;
|
||||
|
||||
public string GetThemeName()
|
||||
@@ -43,7 +43,7 @@ namespace VocaluxeLib.Menu
|
||||
_PartyModeID = PartyModeID;
|
||||
_ThemeLoaded = false;
|
||||
_Theme = new SThemeBackground();
|
||||
|
||||
|
||||
Color = new SColorF(0f, 0f, 0f, 1f);
|
||||
}
|
||||
#endregion Constructors
|
||||
@@ -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;
|
||||
@@ -80,7 +78,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_Theme.Name = ElementName;
|
||||
LoadTextures();
|
||||
}
|
||||
}
|
||||
return _ThemeLoaded;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -152,19 +148,17 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (_Theme.TextureName.Length > 0 &&
|
||||
(_Theme.Type == EBackgroundTypes.Texture ||
|
||||
(_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok))))
|
||||
(_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok))))
|
||||
ok = DrawTexture();
|
||||
|
||||
|
||||
if (_Theme.Type == EBackgroundTypes.Color || _Theme.Type == EBackgroundTypes.Texture && !ok ||
|
||||
(_Theme.Type == EBackgroundTypes.Video && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF && !ok))
|
||||
DrawColor();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
public void UnloadTextures() {}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
@@ -175,14 +169,14 @@ namespace VocaluxeLib.Menu
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
#endregion public
|
||||
|
||||
#region internal
|
||||
private void DrawColor()
|
||||
{
|
||||
SRectF bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar()/4);
|
||||
SRectF bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4);
|
||||
|
||||
CBase.Drawing.DrawColor(Color, bounds);
|
||||
}
|
||||
@@ -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,5 +1,4 @@
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
public static class CBase
|
||||
{
|
||||
@@ -25,8 +24,8 @@ namespace VocaluxeLib.Menu
|
||||
public static IPlaylist Playlist;
|
||||
|
||||
public static void Assign(IConfig config, ISettings settings, ITheme theme, IHelper helper, ILog log, IBackgroundMusic backgroundMusic,
|
||||
IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record,
|
||||
ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IInputs input, IPlaylist playlist)
|
||||
IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record,
|
||||
ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IInputs input, IPlaylist playlist)
|
||||
{
|
||||
Config = config;
|
||||
Settings = settings;
|
||||
@@ -50,4 +49,4 @@ namespace VocaluxeLib.Menu
|
||||
Playlist = playlist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-18
@@ -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;
|
||||
@@ -29,7 +29,7 @@ namespace VocaluxeLib.Menu
|
||||
public bool SelText;
|
||||
public CText Text;
|
||||
public CText SText;
|
||||
|
||||
|
||||
public bool Reflection;
|
||||
public float ReflectionSpace;
|
||||
public float ReflectionHeight;
|
||||
@@ -135,7 +135,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", ref _Theme.STextureName, String.Empty);
|
||||
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref Rect.Z);
|
||||
@@ -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);
|
||||
@@ -174,8 +170,8 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= SText.LoadTheme(item, "SText", xmlReader, SkinIndex, true);
|
||||
SText.Z = Rect.Z;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Reflections
|
||||
if (xmlReader.ItemExists(item + "/Reflection"))
|
||||
{
|
||||
@@ -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"));
|
||||
@@ -308,7 +300,7 @@ namespace VocaluxeLib.Menu
|
||||
texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
|
||||
|
||||
CBase.Drawing.DrawTexture(texture, Rect, Color);
|
||||
|
||||
|
||||
if (Reflection)
|
||||
{
|
||||
CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, ReflectionSpace, ReflectionHeight);
|
||||
@@ -317,7 +309,7 @@ namespace VocaluxeLib.Menu
|
||||
else
|
||||
Text.DrawRelative(Rect.X, Rect.Y);
|
||||
}
|
||||
else if(!SelText)
|
||||
else if (!SelText)
|
||||
{
|
||||
if (Texture.index != -1)
|
||||
texture = Texture;
|
||||
@@ -334,7 +326,7 @@ namespace VocaluxeLib.Menu
|
||||
else
|
||||
Text.DrawRelative(Rect.X, Rect.Y);
|
||||
}
|
||||
else if(SelText)
|
||||
else if (SelText)
|
||||
{
|
||||
if (STexture.index != -1)
|
||||
texture = STexture;
|
||||
@@ -377,7 +369,7 @@ namespace VocaluxeLib.Menu
|
||||
public void ReloadTextures()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
@@ -399,4 +391,4 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
public static class CHelper
|
||||
{
|
||||
|
||||
public static int nCk(int n, int k)
|
||||
{
|
||||
if (k > n)
|
||||
@@ -29,14 +28,12 @@ namespace VocaluxeLib.Menu
|
||||
long nk = k;
|
||||
|
||||
for (long i = 1; i <= k - 1; i++)
|
||||
{
|
||||
result = result * (n - i) / (i + 1);
|
||||
}
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Concat strings into one string with ", " as separator.
|
||||
/// Concat strings into one string with ", " as separator.
|
||||
/// </summary>
|
||||
public static string ListStrings(string[] str)
|
||||
{
|
||||
@@ -73,7 +70,7 @@ namespace VocaluxeLib.Menu
|
||||
return 0;
|
||||
}
|
||||
int result = 0;
|
||||
if(int.TryParse(value, out result))
|
||||
if (int.TryParse(value, out result))
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
@@ -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,11 +164,11 @@ 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)
|
||||
where T : struct
|
||||
where T : struct
|
||||
{
|
||||
result = default(T);
|
||||
try
|
||||
@@ -187,7 +176,7 @@ namespace VocaluxeLib.Menu
|
||||
result = (T)Enum.Parse(typeof(T), value, ignoreCase);
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
catch {}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -243,4 +232,4 @@ namespace VocaluxeLib.Menu
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
@@ -37,14 +36,14 @@ namespace VocaluxeLib.Menu
|
||||
get
|
||||
{
|
||||
return (_Type == EType.TBackground ||
|
||||
_Type == EType.TNameSelection ||
|
||||
_Type == EType.TText ||
|
||||
_Type == EType.TStatic ||
|
||||
_Type == EType.TSongMenu ||
|
||||
_Type == EType.TLyric ||
|
||||
_Type == EType.TSingNote ||
|
||||
_Type == EType.TEqualizer ||
|
||||
_Type == EType.TPlaylist);
|
||||
_Type == EType.TNameSelection ||
|
||||
_Type == EType.TText ||
|
||||
_Type == EType.TStatic ||
|
||||
_Type == EType.TSongMenu ||
|
||||
_Type == EType.TLyric ||
|
||||
_Type == EType.TSingNote ||
|
||||
_Type == EType.TEqualizer ||
|
||||
_Type == EType.TPlaylist);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,4 +53,4 @@ namespace VocaluxeLib.Menu
|
||||
_Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
-33
@@ -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"));
|
||||
@@ -215,7 +207,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (n.Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
|
||||
RectangleF rect = CBase.Drawing.GetTextBounds(_Text);
|
||||
_width += rect.Width;
|
||||
_Notes.Add(n);
|
||||
@@ -229,7 +221,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public float GetCurrentLyricPosX()
|
||||
{
|
||||
return _X - _width / 2;
|
||||
return _X - _width / 2;
|
||||
}
|
||||
|
||||
#region draw
|
||||
@@ -254,14 +246,14 @@ namespace VocaluxeLib.Menu
|
||||
default:
|
||||
DrawSlide(ActualBeat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSlide(float CurrentBeat)
|
||||
{
|
||||
float x = _X - _width / 2;
|
||||
|
||||
|
||||
foreach (SNote note in _Notes)
|
||||
{
|
||||
_Text.X = x;
|
||||
@@ -277,7 +269,7 @@ namespace VocaluxeLib.Menu
|
||||
if (CurrentBeat <= note.EndBeat)
|
||||
{
|
||||
_Text.Color = ColorProcessed;
|
||||
|
||||
|
||||
|
||||
float diff = note.EndBeat - note.StartBeat;
|
||||
if (diff == 0)
|
||||
@@ -291,17 +283,16 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
else
|
||||
{
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_Text.Color = Color;
|
||||
_Text.Color = Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
|
||||
x += rect.Width;
|
||||
}
|
||||
}
|
||||
@@ -334,9 +325,9 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (CurrentBeat >= _Notes[note].StartBeat)
|
||||
{
|
||||
bool last = note == _Notes.Count -1;
|
||||
bool last = note == _Notes.Count - 1;
|
||||
int endbeat = _Notes[note].EndBeat;
|
||||
if (note < _Notes.Count -1)
|
||||
if (note < _Notes.Count - 1)
|
||||
endbeat = _Notes[note + 1].StartBeat - 1;
|
||||
|
||||
if (CurrentBeat <= endbeat)
|
||||
@@ -355,7 +346,6 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -363,7 +353,7 @@ namespace VocaluxeLib.Menu
|
||||
_Text.Color = Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
|
||||
x += rect.Width;
|
||||
}
|
||||
|
||||
@@ -428,16 +418,16 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (CurrentBeat >= note.StartBeat)
|
||||
{
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
// not passed
|
||||
_Text.Color = Color;
|
||||
_Text.Color = Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
|
||||
x += rect.Width;
|
||||
}
|
||||
}
|
||||
@@ -491,15 +481,14 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// not passed
|
||||
_Text.Color = Color;
|
||||
_Text.Color = Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
|
||||
x += rect.Width;
|
||||
}
|
||||
|
||||
@@ -539,9 +528,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
#endregion draw
|
||||
|
||||
public void UnloadTextures()
|
||||
{
|
||||
}
|
||||
public void UnloadTextures() {}
|
||||
|
||||
public void LoadTextures()
|
||||
{
|
||||
@@ -582,4 +569,4 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
-116
@@ -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,14 +77,10 @@ namespace VocaluxeLib.Menu
|
||||
get { return _ScreenVersion; }
|
||||
}
|
||||
|
||||
public CMenu()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
{
|
||||
_ThemeName = this.GetType().Name;
|
||||
if(_ThemeName[0]=='C' && Char.IsUpper(_ThemeName[1]))
|
||||
_ThemeName = GetType().Name;
|
||||
if (_ThemeName[0] == 'C' && Char.IsUpper(_ThemeName[1]))
|
||||
_ThemeName = _ThemeName.Remove(0, 1);
|
||||
|
||||
_Interactions = new List<CInteraction>();
|
||||
@@ -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,13 +140,9 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,136 +267,84 @@ 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,9 +610,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
|
||||
{
|
||||
KeyEvent.Handled = _NextInteraction(KeyEvent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -837,9 +772,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public abstract bool UpdateGame();
|
||||
|
||||
public virtual void ApplyVolume()
|
||||
{
|
||||
}
|
||||
public virtual void ApplyVolume() {}
|
||||
|
||||
public virtual void OnShow()
|
||||
{
|
||||
@@ -862,17 +795,13 @@ 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
|
||||
@@ -886,9 +815,7 @@ namespace VocaluxeLib.Menu
|
||||
public void DrawBG()
|
||||
{
|
||||
foreach (CBackground bg in _Backgrounds)
|
||||
{
|
||||
bg.Draw();
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawFG()
|
||||
@@ -901,15 +828,15 @@ namespace VocaluxeLib.Menu
|
||||
for (int i = 0; i < _Interactions.Count; i++)
|
||||
{
|
||||
if (_IsVisible(i) && (
|
||||
_Interactions[i].Type == EType.TButton ||
|
||||
_Interactions[i].Type == EType.TSelectSlide ||
|
||||
_Interactions[i].Type == EType.TStatic ||
|
||||
_Interactions[i].Type == EType.TNameSelection ||
|
||||
_Interactions[i].Type == EType.TText ||
|
||||
_Interactions[i].Type == EType.TSongMenu ||
|
||||
_Interactions[i].Type == EType.TEqualizer ||
|
||||
_Interactions[i].Type == EType.TPlaylist ||
|
||||
_Interactions[i].Type == EType.TParticleEffect))
|
||||
_Interactions[i].Type == EType.TButton ||
|
||||
_Interactions[i].Type == EType.TSelectSlide ||
|
||||
_Interactions[i].Type == EType.TStatic ||
|
||||
_Interactions[i].Type == EType.TNameSelection ||
|
||||
_Interactions[i].Type == EType.TText ||
|
||||
_Interactions[i].Type == EType.TSongMenu ||
|
||||
_Interactions[i].Type == EType.TEqualizer ||
|
||||
_Interactions[i].Type == EType.TPlaylist ||
|
||||
_Interactions[i].Type == EType.TParticleEffect))
|
||||
{
|
||||
ZSort zs = new ZSort();
|
||||
zs.ID = i;
|
||||
@@ -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);
|
||||
@@ -998,7 +921,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
AddScreenSetting(se, null);
|
||||
}
|
||||
|
||||
|
||||
public void AddBackground(CBackground bg, String key)
|
||||
{
|
||||
_AddInteraction(_Backgrounds.Add(bg, key), EType.TBackground);
|
||||
@@ -1085,7 +1008,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the next element in a menu Interaction.
|
||||
/// Selects the next element in a menu Interaction.
|
||||
/// </summary>
|
||||
/// <returns>True if the next element is selected. False if either there is no next element or the Interaction does not provide such a method.</returns>
|
||||
public bool NextElement()
|
||||
@@ -1097,7 +1020,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the previous element in a menu Interaction.
|
||||
/// Selects the previous element in a menu Interaction.
|
||||
/// </summary>
|
||||
/// <returns>True if the previous element is selected. False if either there is no next element or the Interaction does not provide such a method.</returns>
|
||||
public bool PrevElement()
|
||||
@@ -1154,9 +1077,7 @@ namespace VocaluxeLib.Menu
|
||||
if (_Interactions[_Selection].Type == EType.TSelectSlide)
|
||||
{
|
||||
if (_SelectSlides[_Interactions[_Selection].Num].Visible)
|
||||
{
|
||||
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1170,9 +1091,7 @@ namespace VocaluxeLib.Menu
|
||||
if (_Interactions[_Selection].Type == EType.TSelectSlide)
|
||||
{
|
||||
if (_SelectSlides[_Interactions[_Selection].Num].Visible)
|
||||
{
|
||||
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1352,7 +1271,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the next best interaction in a menu.
|
||||
/// Selects the next best interaction in a menu.
|
||||
/// </summary>
|
||||
/// <param name="Key"></param>
|
||||
/// <returns></returns>
|
||||
@@ -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;
|
||||
@@ -1580,7 +1493,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the next element in a menu interaction.
|
||||
/// Selects the next element in a menu interaction.
|
||||
/// </summary>
|
||||
/// <returns>True if the next element is selected. False if either there is no next element or the interaction does not provide such a method.</returns>
|
||||
private bool _NextElement()
|
||||
@@ -1592,10 +1505,10 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the previous element in a menu interaction.
|
||||
/// Selects the previous element in a menu interaction.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method.
|
||||
/// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method.
|
||||
/// </returns>
|
||||
private bool _PrevElement()
|
||||
{
|
||||
@@ -1753,9 +1666,7 @@ namespace VocaluxeLib.Menu
|
||||
return;
|
||||
|
||||
if (_Interactions[_Selection].Type == EType.TSelectSlide)
|
||||
{
|
||||
_SelectSlides[_Interactions[_Selection].Num].Highlighted = !_SelectSlides[_Interactions[_Selection].Num].Highlighted;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _IsHighlighted()
|
||||
@@ -1944,13 +1855,12 @@ namespace VocaluxeLib.Menu
|
||||
_ParticleEffects[_Interactions[interaction].Num].Draw();
|
||||
break;
|
||||
|
||||
//TODO:
|
||||
//case EType.TLyric:
|
||||
// _Lyrics[_Interactions[interaction].Num].Draw(0);
|
||||
// break;
|
||||
//TODO:
|
||||
//case EType.TLyric:
|
||||
// _Lyrics[_Interactions[interaction].Num].Draw(0);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion InteractionHandling
|
||||
|
||||
#region Theme Handling
|
||||
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,43 +271,34 @@ 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);
|
||||
_actualSelection = _Tiles.Count-1;
|
||||
_actualSelection = _Tiles.Count - 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Up:
|
||||
if (_actualSelection - _NumW > -1)
|
||||
{
|
||||
_actualSelection -= _NumW;
|
||||
}
|
||||
else if (_Offset > 0)
|
||||
{
|
||||
UpdateList(_Offset - 1);
|
||||
_actualSelection += _Tiles.Count- _NumW;
|
||||
_actualSelection += _Tiles.Count - _NumW;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -326,9 +306,7 @@ namespace VocaluxeLib.Menu
|
||||
if (_actualSelection + _NumW < _Tiles.Count)
|
||||
{
|
||||
if (_Tiles[_actualSelection + _NumW].PlayerNr != -1)
|
||||
{
|
||||
_actualSelection += _NumW;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -367,7 +345,7 @@ namespace VocaluxeLib.Menu
|
||||
_player = player;
|
||||
PlayerSelector.Color = CBase.Theme.GetPlayerColor(player);
|
||||
}
|
||||
//Normal activation
|
||||
//Normal activation
|
||||
else if (active)
|
||||
{
|
||||
Selection = 0;
|
||||
@@ -376,7 +354,7 @@ namespace VocaluxeLib.Menu
|
||||
PlayerSelector.Color = CBase.Theme.GetPlayerColor(player);
|
||||
PlayerSelector.Visible = true;
|
||||
}
|
||||
//Deactivate
|
||||
//Deactivate
|
||||
else
|
||||
{
|
||||
Selection = -1;
|
||||
@@ -390,13 +368,9 @@ 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,9 +404,7 @@ namespace VocaluxeLib.Menu
|
||||
foreach (CTile tile in _Tiles)
|
||||
{
|
||||
if (CHelper.IsInBounds(tile.Avatar.Rect, mevent))
|
||||
{
|
||||
isOver = true;
|
||||
}
|
||||
}
|
||||
return isOver;
|
||||
}
|
||||
@@ -442,9 +414,7 @@ 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,21 +477,15 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,6 +507,5 @@ namespace VocaluxeLib.Menu
|
||||
Rect.H = 1;
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,9 +124,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
|
||||
{
|
||||
KeyEvent.Handled = _NextInteraction(KeyEvent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -173,10 +168,7 @@ namespace VocaluxeLib.Menu
|
||||
public bool HandleInputThemeEditor(KeyEvent KeyEvent)
|
||||
{
|
||||
_UnsetHighlighted(_Selection);
|
||||
if (KeyEvent.KeyPressed)
|
||||
{
|
||||
|
||||
}
|
||||
if (KeyEvent.KeyPressed) {}
|
||||
else
|
||||
{
|
||||
switch (KeyEvent.Key)
|
||||
@@ -301,13 +293,13 @@ namespace VocaluxeLib.Menu
|
||||
for (int i = 0; i < _Interactions.Count; i++)
|
||||
{
|
||||
if (_IsVisible(i) && (
|
||||
_Interactions[i].Type == EType.TButton ||
|
||||
_Interactions[i].Type == EType.TSelectSlide ||
|
||||
_Interactions[i].Type == EType.TStatic ||
|
||||
_Interactions[i].Type == EType.TNameSelection ||
|
||||
_Interactions[i].Type == EType.TText ||
|
||||
_Interactions[i].Type == EType.TSongMenu ||
|
||||
_Interactions[i].Type == EType.TEqualizer))
|
||||
_Interactions[i].Type == EType.TButton ||
|
||||
_Interactions[i].Type == EType.TSelectSlide ||
|
||||
_Interactions[i].Type == EType.TStatic ||
|
||||
_Interactions[i].Type == EType.TNameSelection ||
|
||||
_Interactions[i].Type == EType.TText ||
|
||||
_Interactions[i].Type == EType.TSongMenu ||
|
||||
_Interactions[i].Type == EType.TEqualizer))
|
||||
{
|
||||
ZSort zs = new ZSort();
|
||||
zs.ID = i;
|
||||
@@ -323,10 +315,7 @@ 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
|
||||
|
||||
@@ -374,7 +363,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the next element in a menu interaction.
|
||||
/// Selects the next element in a menu interaction.
|
||||
/// </summary>
|
||||
/// <returns>True if the next element is selected. False if either there is no next element or the interaction does not provide such a method.</returns>
|
||||
public bool NextElement()
|
||||
@@ -386,7 +375,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the previous element in a menu interaction.
|
||||
/// Selects the previous element in a menu interaction.
|
||||
/// </summary>
|
||||
/// <returns>True if the previous element is selected. False if either there is no next element or the interaction does not provide such a method.</returns>
|
||||
public bool PrevElement()
|
||||
@@ -443,9 +432,7 @@ namespace VocaluxeLib.Menu
|
||||
if (_Interactions[_Selection].Type == EType.TSelectSlide)
|
||||
{
|
||||
if (_SelectSlides[_Interactions[_Selection].Num].Visible)
|
||||
{
|
||||
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,9 +446,7 @@ namespace VocaluxeLib.Menu
|
||||
if (_Interactions[_Selection].Type == EType.TSelectSlide)
|
||||
{
|
||||
if (_SelectSlides[_Interactions[_Selection].Num].Visible)
|
||||
{
|
||||
_SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,7 +593,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the next best interaction in a menu.
|
||||
/// Selects the next best interaction in a menu.
|
||||
/// </summary>
|
||||
/// <param name="Key"></param>
|
||||
/// <returns></returns>
|
||||
@@ -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;
|
||||
@@ -836,7 +815,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the next element in a menu interaction.
|
||||
/// Selects the next element in a menu interaction.
|
||||
/// </summary>
|
||||
/// <returns>True if the next element is selected. False if either there is no next element or the interaction does not provide such a method.</returns>
|
||||
private bool _NextElement()
|
||||
@@ -848,10 +827,10 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the previous element in a menu interaction.
|
||||
/// Selects the previous element in a menu interaction.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method.
|
||||
/// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method.
|
||||
/// </returns>
|
||||
private bool _PrevElement()
|
||||
{
|
||||
@@ -961,9 +940,7 @@ 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
|
||||
@@ -1110,4 +1086,4 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
#endregion Theme Handling
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
@@ -74,4 +74,4 @@ namespace VocaluxeLib.Menu
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 float _Age; //[s]
|
||||
private float _Vx; //movement speed in x-axis [pix/s]
|
||||
private float _Vy; //movement speed in y-axis [pix/s]
|
||||
private float _Vr; //rotation speed [rpm]
|
||||
private float _Rotation; //start rotation 0..360°
|
||||
private float _Vsize; //size changing speed: period [s]
|
||||
private float _Angle; //0..360°
|
||||
private readonly float _MaxAge; //[s]
|
||||
private float _Age; //[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,13 +314,10 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public bool IsAlive
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Stars.Count > 0 || !_SpawnTimer.IsRunning);
|
||||
}
|
||||
get { return (_Stars.Count > 0 || !_SpawnTimer.IsRunning); }
|
||||
}
|
||||
|
||||
public CParticleEffect(int PartyModeID)
|
||||
public CParticleEffect(int PartyModeID)
|
||||
{
|
||||
_PartyModeID = PartyModeID;
|
||||
_Theme = new SThemeParticleEffect();
|
||||
@@ -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);
|
||||
@@ -538,16 +528,16 @@ namespace VocaluxeLib.Menu
|
||||
if (_Theme.TextureName.Length > 0)
|
||||
{
|
||||
star = new CParticle(_PartyModeID, _Theme.TextureName, Color,
|
||||
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
|
||||
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
|
||||
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
|
||||
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
|
||||
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
|
||||
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
|
||||
}
|
||||
else
|
||||
{
|
||||
star = new CParticle(_PartyModeID, Texture, Color,
|
||||
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
|
||||
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
|
||||
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
|
||||
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
|
||||
CBase.Game.GetRandom(h) + Rect.Y - size / 4f,
|
||||
size, lifetime, Rect.Z, vx, vy, vr, vsize, _Type);
|
||||
}
|
||||
|
||||
_Stars.Add(star);
|
||||
@@ -561,9 +551,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_Stars[i].Update();
|
||||
if (!_Stars[i].IsAlive)
|
||||
{
|
||||
_Stars.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
@@ -572,17 +560,13 @@ 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()
|
||||
@@ -604,7 +588,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
if (_Theme.ColorName.Length > 0)
|
||||
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
|
||||
if(_Theme.TextureName.Length > 0)
|
||||
if (_Theme.TextureName.Length > 0)
|
||||
Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
|
||||
}
|
||||
|
||||
@@ -633,4 +617,4 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -161,7 +160,7 @@ namespace VocaluxeLib.Menu
|
||||
if (_EditMode == EEditMode.ChangeOrder && ChangeOrderSource != -1 && PlaylistElements.Count > ChangeOrderSource)
|
||||
{
|
||||
CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, PlaylistElements[ChangeOrderSource].Content);
|
||||
UpdatePlaylist();
|
||||
UpdatePlaylist();
|
||||
}
|
||||
ChangeOrderSource = -1;
|
||||
_EditMode = EEditMode.None;
|
||||
@@ -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;
|
||||
|
||||
@@ -210,7 +209,7 @@ namespace VocaluxeLib.Menu
|
||||
ChangeOrderElement = new PlaylistElement();
|
||||
|
||||
Visible = false;
|
||||
Selected = false;
|
||||
Selected = false;
|
||||
}
|
||||
|
||||
public void Init()
|
||||
@@ -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"));
|
||||
@@ -394,7 +385,7 @@ namespace VocaluxeLib.Menu
|
||||
_Theme.ButtonPlaylistClose.SaveTheme(writer);
|
||||
_Theme.ButtonPlaylistDelete.SaveTheme(writer);
|
||||
_Theme.ButtonPlaylistSave.SaveTheme(writer);
|
||||
_Theme.ButtonPlaylistSing.SaveTheme(writer);
|
||||
_Theme.ButtonPlaylistSing.SaveTheme(writer);
|
||||
|
||||
writer.WriteEndElement();
|
||||
|
||||
@@ -416,13 +407,11 @@ namespace VocaluxeLib.Menu
|
||||
public void Draw(bool ForceDraw)
|
||||
{
|
||||
if (PlaylistElements.Count <= 0)
|
||||
{
|
||||
LoadPlaylist(0);
|
||||
}
|
||||
if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !ForceDraw)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < PlaylistElements.Count; i++ )
|
||||
for (int i = 0; i < PlaylistElements.Count; i++)
|
||||
{
|
||||
if (i == CurrentPlaylistElement && _Selected)
|
||||
{
|
||||
@@ -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);
|
||||
@@ -524,7 +511,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CurrentPlaylistElement == -1 || PlaylistElementContents.Count == 0) //no song is selected
|
||||
if (CurrentPlaylistElement == -1 || PlaylistElementContents.Count == 0) //no song is selected
|
||||
{
|
||||
_Interactions.HandleInput(KeyEvent);
|
||||
CurrentPlaylistElement = GetSelectedSelectionNr();
|
||||
@@ -532,7 +519,7 @@ namespace VocaluxeLib.Menu
|
||||
if (CurrentPlaylistElement != -1)
|
||||
return true;
|
||||
}
|
||||
else if (CurrentPlaylistElement != -1) //a song is selected
|
||||
else if (CurrentPlaylistElement != -1) //a song is selected
|
||||
{
|
||||
int ScrollLimit = PlaylistElements.Count / 2;
|
||||
|
||||
@@ -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);
|
||||
@@ -625,7 +610,7 @@ namespace VocaluxeLib.Menu
|
||||
StartPlaylistSong(CurrentPlaylistElement);
|
||||
break;
|
||||
|
||||
case Keys.Add: //move the selected song up
|
||||
case Keys.Add: //move the selected song up
|
||||
if (PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0))
|
||||
{
|
||||
CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
|
||||
@@ -685,7 +670,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.PageUp: //scroll up
|
||||
case Keys.PageUp: //scroll up
|
||||
if (PlaylistElementContents.Count > 0)
|
||||
{
|
||||
Offset -= PlaylistElements.Count;
|
||||
@@ -697,7 +682,7 @@ namespace VocaluxeLib.Menu
|
||||
CurrentPlaylistElement = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case Keys.PageDown: //scroll down
|
||||
if (PlaylistElementContents.Count > 0)
|
||||
{
|
||||
@@ -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,14 +725,15 @@ 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;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//default actions
|
||||
switch (KeyEvent.Key)
|
||||
{
|
||||
@@ -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,13 +884,11 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
if (!hover_set)
|
||||
{
|
||||
CurrentPlaylistElement = -1;
|
||||
}
|
||||
|
||||
switch (_EditMode)
|
||||
{
|
||||
//Normal mode
|
||||
//Normal mode
|
||||
case EEditMode.None:
|
||||
|
||||
//LB actions
|
||||
@@ -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,9 +1070,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
if (MouseEvent.Y > min)
|
||||
{
|
||||
CBase.Playlist.MovePlaylistSong(ActivePlaylistID, ChangeOrderSource, PlaylistElementContents.Count - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1114,12 +1087,13 @@ namespace VocaluxeLib.Menu
|
||||
private void PrepareList()
|
||||
{
|
||||
PlaylistElements.Clear();
|
||||
|
||||
|
||||
for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++)
|
||||
{
|
||||
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);
|
||||
@@ -1147,7 +1121,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
|
||||
public bool LoadPlaylist(int PlaylistID)
|
||||
public bool LoadPlaylist(int PlaylistID)
|
||||
{
|
||||
if (PlaylistID > -1 && PlaylistID < CBase.Playlist.GetNumPlaylists())
|
||||
{
|
||||
@@ -1180,11 +1154,10 @@ namespace VocaluxeLib.Menu
|
||||
pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode;
|
||||
PlaylistElementContents.Add(pec);
|
||||
}
|
||||
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
public void ClosePlaylist()
|
||||
{
|
||||
Visible = false;
|
||||
@@ -1192,7 +1165,6 @@ namespace VocaluxeLib.Menu
|
||||
ActivePlaylistID = -1;
|
||||
}
|
||||
|
||||
|
||||
private void StartPlaylistSongs()
|
||||
{
|
||||
CBase.Game.Reset();
|
||||
@@ -1201,11 +1173,9 @@ 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?
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenNames); //TODO: What is if someone uses that in PartyMode?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1217,14 +1187,14 @@ namespace VocaluxeLib.Menu
|
||||
CBase.Game.AddSong(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).SongID, CBase.Playlist.GetPlaylistSong(ActivePlaylistID, selected).GameMode);
|
||||
|
||||
if (CBase.Game.GetNumSongs() > 0)
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenNames);
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenNames);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (ActivePlaylistID > -1 && ActivePlaylistID < CBase.Playlist.GetNumPlaylists())
|
||||
{
|
||||
for (int i = 0; i < PlaylistElements.Count; i++ )
|
||||
for (int i = 0; i < PlaylistElements.Count; i++)
|
||||
{
|
||||
if (Offset + i < PlaylistElementContents.Count)
|
||||
{
|
||||
@@ -1237,14 +1207,14 @@ namespace VocaluxeLib.Menu
|
||||
CSong song = CBase.Songs.GetSongByID(pec.SongID);
|
||||
PlaylistElements[i].Cover.Texture = song.CoverTextureSmall;
|
||||
string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title);
|
||||
PlaylistElements[i].Text1.Text = /*(Offset + i + 1).ToString() + ") " + */song.Artist + " - " + song.Title; //TODO: Add text field for the number
|
||||
PlaylistElements[i].Text1.Text = /*(Offset + i + 1).ToString() + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number
|
||||
PlaylistElements[i].SelectSlide.Clear();
|
||||
for (int g = 0; g < pec.Modes.Length; g++)
|
||||
{
|
||||
PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(EGameMode), pec.Modes[g]));
|
||||
if (pec.Modes[g] == pec.Mode)
|
||||
PlaylistElements[i].SelectSlide.SetSelectionByValueIndex(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1277,4 +1247,4 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -65,7 +63,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
writer.WriteStartElement(_Theme.Name);
|
||||
|
||||
writer.WriteComment("<Type>: Type of theme-setting-value: "+ CHelper.ListStrings(Enum.GetNames(typeof(ESettingType))));
|
||||
writer.WriteComment("<Type>: Type of theme-setting-value: " + CHelper.ListStrings(Enum.GetNames(typeof(ESettingType))));
|
||||
writer.WriteElementString("Type", Enum.GetName(typeof(ESettingType), _Theme.Type));
|
||||
writer.WriteComment("<Value>: Value of theme-setting");
|
||||
writer.WriteElementString("Value", _Theme.Value);
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -85,16 +85,16 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public bool Visible = true;
|
||||
public bool Highlighted = false;
|
||||
|
||||
|
||||
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,9 +105,7 @@ namespace VocaluxeLib.Menu
|
||||
set
|
||||
{
|
||||
if (value >= 0 && value < _ValueNames.Count)
|
||||
{
|
||||
_Selection = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -175,7 +171,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_PartyModeID = slide._PartyModeID;
|
||||
_Theme = new SThemeSelectSlide();
|
||||
|
||||
|
||||
_Theme.TextureArrowLeftName = slide._Theme.TextureArrowLeftName;
|
||||
_Theme.TextureArrowRightName = slide._Theme.TextureArrowRightName;
|
||||
|
||||
@@ -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);
|
||||
@@ -348,13 +330,13 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextH", ref TextH);
|
||||
if(xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref TextRelativeX))
|
||||
if (xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref TextRelativeX))
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeX", ref TextRelativeX);
|
||||
if(xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY))
|
||||
if (xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY))
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/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;
|
||||
|
||||
@@ -682,7 +646,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void ProcessMouseMove(int x, int y)
|
||||
{
|
||||
_ArrowLeftSelected = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0;
|
||||
_ArrowLeftSelected = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0;
|
||||
_ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _ValueNames.Count - 1;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -755,15 +719,15 @@ namespace VocaluxeLib.Menu
|
||||
else
|
||||
CBase.Drawing.DrawTexture(TextureArrowRight, RectArrowRight, ColorArrow);
|
||||
}
|
||||
|
||||
if (_NumVisible < 1 || _ValueNames.Count == 0)
|
||||
return;
|
||||
|
||||
if (_NumVisible < 1 || _ValueNames.Count == 0)
|
||||
return;
|
||||
|
||||
float x = Rect.X + (Rect.W - TextRelativeX) * 0.1f;
|
||||
float dx = (Rect.W - TextRelativeX) * 0.8f / _NumVisible;
|
||||
//float y = Rect.Y + (Rect.H - TextH);
|
||||
|
||||
int offset = _Selection - (int)_NumVisible/2;
|
||||
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)
|
||||
@@ -789,7 +754,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
RectangleF bounds = CBase.Drawing.GetTextBounds(Text);
|
||||
Text.X = (x + dx/2f + dx * i)+TextRelativeX;
|
||||
Text.X = (x + dx / 2f + dx * i) + TextRelativeX;
|
||||
|
||||
if (!WithTextures)
|
||||
Text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + TextRelativeY);
|
||||
@@ -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));
|
||||
}
|
||||
_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()
|
||||
{
|
||||
@@ -911,4 +872,4 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"));
|
||||
@@ -261,26 +257,20 @@ namespace VocaluxeLib.Menu
|
||||
rect.W = rect2.Width;
|
||||
rect.H = rect2.Height;
|
||||
}
|
||||
|
||||
|
||||
SColorF color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
|
||||
if (Visible || ForceDraw || (CBase.Settings.GetGameState() == EGameState.EditTheme))
|
||||
{
|
||||
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()
|
||||
{
|
||||
@@ -313,4 +303,4 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,14 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
public class CXMLReader
|
||||
{
|
||||
private XPathNavigator _Navigator;
|
||||
private String _FileName;
|
||||
private readonly XPathNavigator _Navigator;
|
||||
private readonly String _FileName;
|
||||
|
||||
public string FileName
|
||||
{
|
||||
get { return _FileName; }
|
||||
}
|
||||
|
||||
|
||||
//Private method. Use OpenFile factory method to get an instance
|
||||
private CXMLReader(string uri)
|
||||
{
|
||||
@@ -39,14 +39,14 @@ namespace VocaluxeLib.Menu
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool TryGetEnumValue<T>(string Cast, ref T value)
|
||||
where T : struct
|
||||
{
|
||||
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,13 +56,11 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
string val = String.Empty;
|
||||
if (GetValue(Cast, ref val, value.ToString()))
|
||||
{
|
||||
return int.TryParse(val, out value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetIntValueRange(string Cast,ref int value, int min = 0, int max = 100)
|
||||
public bool TryGetIntValueRange(string Cast, ref int value, int min = 0, int max = 100)
|
||||
{
|
||||
bool result = TryGetIntValue(Cast, ref value);
|
||||
if (result)
|
||||
@@ -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)
|
||||
@@ -187,4 +182,4 @@ namespace VocaluxeLib.Menu
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
-22
@@ -121,9 +121,7 @@ namespace VocaluxeLib.Menu
|
||||
void LoadTheme();
|
||||
}
|
||||
|
||||
public interface IHelper
|
||||
{
|
||||
}
|
||||
public interface IHelper {}
|
||||
|
||||
public interface IBackgroundMusic
|
||||
{
|
||||
@@ -146,7 +144,7 @@ namespace VocaluxeLib.Menu
|
||||
public interface IDrawing
|
||||
{
|
||||
RectangleF GetTextBounds(CText text);
|
||||
|
||||
|
||||
void DrawTexture(STexture Texture, SRectF Rect);
|
||||
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color);
|
||||
void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds);
|
||||
@@ -301,7 +299,7 @@ namespace VocaluxeLib.Menu
|
||||
void DeletePlaylist(int PlaylistID);
|
||||
void SavePlaylist(int PlaylistID);
|
||||
int GetNumPlaylists();
|
||||
|
||||
|
||||
void AddPlaylistSong(int PlaylistID, int SongID);
|
||||
void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode);
|
||||
void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode);
|
||||
@@ -315,7 +313,6 @@ namespace VocaluxeLib.Menu
|
||||
CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex);
|
||||
}
|
||||
|
||||
|
||||
[Flags]
|
||||
public enum EModifier
|
||||
{
|
||||
@@ -373,14 +370,14 @@ namespace VocaluxeLib.Menu
|
||||
public bool Handled;
|
||||
public int X;
|
||||
public int Y;
|
||||
public bool LB; //left button click
|
||||
public bool LD; //left button double click
|
||||
public bool RB; //right button click
|
||||
public bool MB; //middle button click
|
||||
public bool LB; //left button click
|
||||
public bool LD; //left button double click
|
||||
public bool RB; //right button click
|
||||
public bool MB; //middle button click
|
||||
|
||||
public bool LBH; //left button hold (when moving)
|
||||
public bool RBH; //right button hold (when moving)
|
||||
public bool MBH; //middle button hold (when moving)
|
||||
public bool LBH; //left button hold (when moving)
|
||||
public bool RBH; //right button hold (when moving)
|
||||
public bool MBH; //middle button hold (when moving)
|
||||
|
||||
public bool ModALT;
|
||||
public bool ModSHIFT;
|
||||
@@ -525,8 +522,8 @@ namespace VocaluxeLib.Menu
|
||||
public float height;
|
||||
public SRectF rect;
|
||||
|
||||
public float w2; //power of 2 width
|
||||
public float h2; //power of 2 height
|
||||
public float w2; //power of 2 width
|
||||
public float h2; //power of 2 height
|
||||
public float width_ratio;
|
||||
public float height_ratio;
|
||||
|
||||
@@ -599,12 +596,12 @@ namespace VocaluxeLib.Menu
|
||||
public enum EDebugLevel
|
||||
{
|
||||
// don't change the order!
|
||||
TR_CONFIG_OFF, //no debug infos
|
||||
TR_CONFIG_OFF, //no debug infos
|
||||
TR_CONFIG_ONLY_FPS,
|
||||
TR_CONFIG_LEVEL1,
|
||||
TR_CONFIG_LEVEL2,
|
||||
TR_CONFIG_LEVEL3,
|
||||
TR_CONFIG_LEVEL_MAX //all debug infos
|
||||
TR_CONFIG_LEVEL_MAX //all debug infos
|
||||
}
|
||||
|
||||
public enum EBufferSize
|
||||
@@ -651,7 +648,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
//TR_CONFIG_LIST, //a simple list
|
||||
//TR_CONFIG_DREIDEL, //as in ultrastar deluxe
|
||||
TR_CONFIG_TILE_BOARD, //chessboard like
|
||||
TR_CONFIG_TILE_BOARD, //chessboard like
|
||||
//TR_CONFIG_BOOK //for playlists
|
||||
}
|
||||
|
||||
@@ -733,7 +730,6 @@ namespace VocaluxeLib.Menu
|
||||
Slide,
|
||||
Zoom
|
||||
}
|
||||
|
||||
#endregion EnumsConfig
|
||||
|
||||
public enum EAlignment
|
||||
@@ -812,11 +808,11 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public class CPoints
|
||||
{
|
||||
private SPlayer[,] _Rounds;
|
||||
private readonly SPlayer[,] _Rounds;
|
||||
|
||||
public CPoints(int NumRounds, SPlayer[] Player)
|
||||
{
|
||||
_Rounds = new SPlayer[NumRounds, Player.Length];
|
||||
_Rounds = new SPlayer[NumRounds,Player.Length];
|
||||
|
||||
for (int round = 0; round < NumRounds; round++)
|
||||
{
|
||||
@@ -954,4 +950,4 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
ScreenNull = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ namespace VocaluxeLib.Menu
|
||||
void UnloadTextures();
|
||||
void LoadTextures();
|
||||
void ReloadTextures();
|
||||
|
||||
|
||||
void MoveElement(int stepX, int stepY);
|
||||
void ResizeElement(int stepW, int stepH);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,16 @@ using System.Collections.Generic;
|
||||
|
||||
namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
public class CNotes
|
||||
public class CNotes
|
||||
{
|
||||
private List<CLines> _Lines = new List<CLines>();
|
||||
|
||||
private readonly List<CLines> _Lines = new List<CLines>();
|
||||
|
||||
public CLines[] Lines
|
||||
{
|
||||
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,9 +71,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
public void SetMedley(int StartBeat, int EndBeat)
|
||||
{
|
||||
foreach (CLines lines in _Lines)
|
||||
{
|
||||
lines.SetMedley(StartBeat, EndBeat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +82,8 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
private int _Tone;
|
||||
private ENoteType _NoteType;
|
||||
private string _Text;
|
||||
private bool _Hit; // for drawing player notes
|
||||
private bool _Perfect; // for drawing perfect note effect
|
||||
private bool _Hit; // for drawing player notes
|
||||
private bool _Perfect; // for drawing perfect note effect
|
||||
|
||||
#region Contructors
|
||||
public 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,13 +351,11 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
int points = 0;
|
||||
foreach (CNote note in _Notes)
|
||||
{
|
||||
points += note.Points;
|
||||
}
|
||||
return points;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public CNote[] Notes
|
||||
{
|
||||
get { return _Notes.ToArray(); }
|
||||
@@ -416,7 +397,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
Max = note.Tone;
|
||||
}
|
||||
|
||||
return Min - (Max-Min)/4;
|
||||
return Min - (Max - Min) / 4;
|
||||
}
|
||||
}
|
||||
#endregion Properties
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -460,7 +441,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
public bool AddNote(CNote Note)
|
||||
{
|
||||
if (_Notes.Count == 0)
|
||||
@@ -534,14 +515,10 @@ 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,24 +534,19 @@ 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
|
||||
@@ -587,7 +559,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Total song length in beats
|
||||
/// Total song length in beats
|
||||
/// </summary>
|
||||
public int Length
|
||||
{
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,16 +44,16 @@ 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;
|
||||
|
||||
/// <summary>
|
||||
/// Player bar positions
|
||||
/// Player bar positions
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// first index = player number; second index = num players seen on screen
|
||||
/// first index = player number; second index = num players seen on screen
|
||||
/// </remarks>
|
||||
public SRectF[,] BarPos
|
||||
{
|
||||
@@ -93,7 +93,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", ref _Theme.SkinToneHelperName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", ref _Theme.SkinPerfectNoteStarName, String.Empty);
|
||||
|
||||
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(), CBase.Settings.GetMaxNumPlayer()];
|
||||
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
|
||||
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
|
||||
{
|
||||
for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++)
|
||||
@@ -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)
|
||||
{
|
||||
@@ -270,10 +262,10 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
return _PlayerNotes[n].Alpha;
|
||||
}
|
||||
|
||||
|
||||
public virtual void Draw(int ID, int Player)
|
||||
{
|
||||
Draw(ID, null, Player);
|
||||
Draw(ID, null, Player);
|
||||
}
|
||||
|
||||
public virtual void Draw(int ID, List<CLine> SingLine, int Player)
|
||||
@@ -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;
|
||||
@@ -311,10 +301,10 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
return;
|
||||
|
||||
SColorF color = new SColorF(
|
||||
_PlayerNotes[n].Color.R,
|
||||
_PlayerNotes[n].Color.G,
|
||||
_PlayerNotes[n].Color.B,
|
||||
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
|
||||
_PlayerNotes[n].Color.R,
|
||||
_PlayerNotes[n].Color.G,
|
||||
_PlayerNotes[n].Color.B,
|
||||
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
|
||||
|
||||
float BaseLine = Line.BaseLine;
|
||||
int Nr = 1;
|
||||
@@ -326,7 +316,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
SRectF rect = new SRectF(
|
||||
_PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w,
|
||||
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine)/2) / CBase.Settings.GetNumNoteLines() * h - dh,
|
||||
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
|
||||
width,
|
||||
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
|
||||
_PlayerNotes[n].Rect.Z
|
||||
@@ -340,29 +330,23 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
AddGoldenNote(rect, n, Nr);
|
||||
Nr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -385,7 +369,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
SRectF rect = new SRectF(
|
||||
_PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w,
|
||||
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine)/2) / CBase.Settings.GetNumNoteLines() * h - dh,
|
||||
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
|
||||
width,
|
||||
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
|
||||
_PlayerNotes[n].Rect.Z
|
||||
@@ -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,15 +419,11 @@ 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)
|
||||
{
|
||||
@@ -454,28 +432,20 @@ 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()
|
||||
{
|
||||
UnloadTextures();
|
||||
LoadTextures();
|
||||
LoadTextures();
|
||||
}
|
||||
|
||||
private int FindPlayerLine(int ID)
|
||||
@@ -604,7 +574,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
const int spacing = 0;
|
||||
|
||||
if ( Nr > _PlayerNotes[n].GoldenStars.Count)
|
||||
if (Nr > _PlayerNotes[n].GoldenStars.Count)
|
||||
{
|
||||
float d = (1f - factor) / 2 * Rect.H;
|
||||
float dw = d;
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -704,7 +675,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
int TonePlayer = CBase.Record.GetToneAbs(_PlayerNotes[n].PlayerNr);
|
||||
|
||||
SRectF Rect = _PlayerNotes[n].Rect;
|
||||
|
||||
|
||||
while (TonePlayer - BaseLine < 0)
|
||||
TonePlayer += 12;
|
||||
|
||||
@@ -719,18 +690,18 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
float dy = Rect.H / (CBase.Settings.GetNumNoteLines());
|
||||
SRectF rect = new SRectF(
|
||||
Rect.X - dy + XOffset,
|
||||
Rect.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (TonePlayer - BaseLine) / 2f),
|
||||
dy,
|
||||
dy,
|
||||
Rect.Z
|
||||
);
|
||||
Rect.X - dy + XOffset,
|
||||
Rect.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (TonePlayer - BaseLine) / 2f),
|
||||
dy,
|
||||
dy,
|
||||
Rect.Z
|
||||
);
|
||||
|
||||
SColorF color = new SColorF(
|
||||
_PlayerNotes[n].Color.R,
|
||||
_PlayerNotes[n].Color.G,
|
||||
_PlayerNotes[n].Color.B,
|
||||
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
|
||||
_PlayerNotes[n].Color.R,
|
||||
_PlayerNotes[n].Color.G,
|
||||
_PlayerNotes[n].Color.B,
|
||||
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
|
||||
|
||||
STexture ToneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID);
|
||||
CBase.Drawing.DrawTexture(ToneHelper, rect, color);
|
||||
@@ -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) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -20,4 +19,4 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
void Draw(int ID, int Player);
|
||||
void Draw(int ID, List<CLine> SingLine, int Player);
|
||||
}
|
||||
}
|
||||
}
|
||||
+186
-216
@@ -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;
|
||||
}
|
||||
|
||||
@@ -165,10 +160,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (_CoverBigLoaded)
|
||||
return _CoverTextureBig;
|
||||
else
|
||||
else
|
||||
return _CoverTextureSmall;
|
||||
}
|
||||
set {
|
||||
set
|
||||
{
|
||||
_CoverTextureBig = value;
|
||||
_CoverBigLoaded = true;
|
||||
}
|
||||
@@ -182,7 +178,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public float Start = 0f;
|
||||
public float Finish = 0f;
|
||||
|
||||
|
||||
public float BPM = 1f;
|
||||
public float Gap = 0f;
|
||||
public float VideoGap = 0f;
|
||||
@@ -213,7 +209,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public EGameMode[] AvailableGameModes
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
List<EGameMode> gms = new List<EGameMode>();
|
||||
if (IsDuet)
|
||||
@@ -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;
|
||||
|
||||
this.Start = song.Start;
|
||||
this.Finish = song.Finish;
|
||||
Artist = song.Artist;
|
||||
Title = song.Title;
|
||||
|
||||
this.BPM = song.BPM;
|
||||
this.Gap = song.Gap;
|
||||
this.VideoGap = song.VideoGap;
|
||||
Start = song.Start;
|
||||
Finish = song.Finish;
|
||||
|
||||
this.Comment = new List<string>();
|
||||
BPM = song.BPM;
|
||||
Gap = song.Gap;
|
||||
VideoGap = song.VideoGap;
|
||||
|
||||
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,24 +604,21 @@ 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)
|
||||
|
||||
public bool ReadNotes(string FilePath, bool forceReload = false)
|
||||
{
|
||||
//Skip loading if already done and no reload is forced
|
||||
if (_NotesLoaded && !forceReload)
|
||||
@@ -669,19 +645,18 @@ 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)
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
FileLineNo++;
|
||||
|
||||
TempC = (char)sr.Peek();
|
||||
if ((TempC == '#') || (TempC == '\r') || (TempC == '\n'))
|
||||
if ((TempC == '#') || (TempC == '\r') || (TempC == '\n'))
|
||||
continue;
|
||||
if ((TempC == ':') || (TempC == 'F') || (TempC == '*') || (TempC == 'P'))
|
||||
{
|
||||
@@ -698,12 +673,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
char chr;
|
||||
switch (TempC)
|
||||
{
|
||||
case 'P':
|
||||
while ((chr = (char)sr.Read()) == ' ') { }
|
||||
while ((chr = (char)sr.Read()) == ' ') {}
|
||||
|
||||
int.TryParse(chr.ToString(), out Param1);
|
||||
if (Param1 == 1)
|
||||
@@ -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();
|
||||
@@ -798,17 +772,15 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
} while (!sr.EndOfStream && (c == 19 || c == 16 || c == 13 || c == 10));
|
||||
TempC = (char)c;
|
||||
FileLineNo++;
|
||||
}while(!sr.EndOfStream && (TempC != 'E'));
|
||||
} while (!sr.EndOfStream && (TempC != 'E'));
|
||||
|
||||
foreach(CLines lines in this.Notes.Lines)
|
||||
{
|
||||
foreach (CLines lines in Notes.Lines)
|
||||
lines.UpdateTimings();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath);
|
||||
if(sr != null)
|
||||
if (sr != null)
|
||||
sr.Dispose();
|
||||
return false;
|
||||
}
|
||||
@@ -816,7 +788,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
FindRefrain();
|
||||
FindShortEnd();
|
||||
_NotesLoaded = true;
|
||||
if(IsDuet)
|
||||
if (IsDuet)
|
||||
CheckDuet();
|
||||
return true;
|
||||
}
|
||||
@@ -824,7 +796,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private bool ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text)
|
||||
{
|
||||
CNote note = new CNote(Start, Length, Tone, Text, NoteType);
|
||||
CLines lines = this.Notes.GetLines(Player);
|
||||
CLines lines = Notes.GetLines(Player);
|
||||
return lines.AddNote(note);
|
||||
}
|
||||
|
||||
@@ -833,16 +805,16 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
CLines lines = Notes.GetLines(Player);
|
||||
CLine line = new CLine();
|
||||
line.StartBeat = Start;
|
||||
lines.AddLine(line);
|
||||
lines.AddLine(line);
|
||||
}
|
||||
|
||||
public void LoadSmallCover()
|
||||
{
|
||||
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));
|
||||
foreach(String file in files)
|
||||
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()
|
||||
@@ -1068,4 +1038,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
return base.MemberwiseClone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,30 +201,28 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private void CreateSongMenu()
|
||||
{
|
||||
if (_SongMenu != null)
|
||||
{
|
||||
_SongMenu.OnHide();
|
||||
}
|
||||
|
||||
switch (CBase.Config.GetSongMenuType())
|
||||
{
|
||||
//case ESongMenu.TR_CONFIG_LIST:
|
||||
// _SongMenu = new CSongMenuList();
|
||||
// break;
|
||||
//case ESongMenu.TR_CONFIG_LIST:
|
||||
// _SongMenu = new CSongMenuList();
|
||||
// break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_DREIDEL:
|
||||
// _SongMenu = new CSongMenuDreidel();
|
||||
// break;
|
||||
//case ESongMenu.TR_CONFIG_DREIDEL:
|
||||
// _SongMenu = new CSongMenuDreidel();
|
||||
// break;
|
||||
|
||||
case ESongMenu.TR_CONFIG_TILE_BOARD:
|
||||
_SongMenu = new CSongMenuTileBoard(_PartyModeID);
|
||||
break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_BOOK:
|
||||
// _SongMenu = new CSongMenuBook();
|
||||
// break;
|
||||
//case ESongMenu.TR_CONFIG_BOOK:
|
||||
// _SongMenu = new CSongMenuBook();
|
||||
// break;
|
||||
}
|
||||
|
||||
_Type = CBase.Config.GetSongMenuType();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
@@ -43,4 +40,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
**/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
struct SThemeSongMenu
|
||||
{
|
||||
public string Name;
|
||||
|
||||
|
||||
public string CoverBackgroundName;
|
||||
public string CoverBigBackgroundName;
|
||||
public string DuetIconName;
|
||||
@@ -27,47 +27,41 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public SThemeSongMenuTileBoard songMenuTileBoard;
|
||||
}
|
||||
|
||||
struct SThemeSongMenuBook
|
||||
{
|
||||
}
|
||||
struct SThemeSongMenuBook {}
|
||||
|
||||
struct SThemeSongMenuDreidel
|
||||
{
|
||||
}
|
||||
struct SThemeSongMenuDreidel {}
|
||||
|
||||
struct SThemeSongMenuList
|
||||
{
|
||||
}
|
||||
struct SThemeSongMenuList {}
|
||||
|
||||
struct SThemeSongMenuTileBoard
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of tiles horizontal
|
||||
/// Number of tiles horizontal
|
||||
/// </summary>
|
||||
public int numW;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles vertical
|
||||
/// Number of tiles vertical
|
||||
/// </summary>
|
||||
public int numH;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles horizontal in small-modus
|
||||
/// Number of tiles horizontal in small-modus
|
||||
/// </summary>
|
||||
public int numWsmall;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles vertical in small-modus
|
||||
/// Number of tiles vertical in small-modus
|
||||
/// </summary>
|
||||
public int numHsmall;
|
||||
|
||||
/// <summary>
|
||||
/// Space between tiles horizontal
|
||||
/// Space between tiles horizontal
|
||||
/// </summary>
|
||||
public float spaceW;
|
||||
|
||||
/// <summary>
|
||||
/// Space between tiles vertical
|
||||
/// Space between tiles vertical
|
||||
/// </summary>
|
||||
public float spaceH;
|
||||
|
||||
@@ -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()
|
||||
@@ -165,7 +158,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
|
||||
protected int _Locked //the real selected song for singing
|
||||
protected int _Locked //the real selected song for singing
|
||||
{
|
||||
get { return _LockedInternal; }
|
||||
set { _LockedInternal = value; }
|
||||
@@ -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"));
|
||||
@@ -406,7 +394,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Theme.songMenuTileBoard.StaticVideoIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer);
|
||||
|
||||
|
||||
writer.WriteEndElement();
|
||||
#endregion SongMenuTileBoard
|
||||
|
||||
@@ -447,13 +435,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
|
||||
float time = CBase.Sound.GetPosition(_actsongstream);
|
||||
|
||||
|
||||
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,15 +457,13 @@ 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);
|
||||
_video = -1;
|
||||
|
||||
CBase.Drawing.RemoveTexture(ref _vidtex);
|
||||
CBase.Drawing.RemoveTexture(ref _vidtex);
|
||||
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
@@ -504,10 +488,7 @@ 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)
|
||||
@@ -515,9 +496,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_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);
|
||||
@@ -659,7 +634,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
CBase.Sound.Fade(_stream, 100f, 3f);
|
||||
_streams.Add(_stream);
|
||||
_actsongstream = _stream;
|
||||
|
||||
|
||||
if (CBase.Songs.GetVisibleSong(_actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
_video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_actsong).Folder, CBase.Songs.GetVisibleSong(_actsong).VideoFileName));
|
||||
@@ -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);
|
||||
@@ -716,4 +689,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
@@ -73,7 +71,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
|
||||
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
@@ -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;
|
||||
@@ -163,8 +157,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (!KeyEvent.KeyPressed)
|
||||
{
|
||||
if (!(KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down ||
|
||||
KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter ||
|
||||
KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp))
|
||||
KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter ||
|
||||
KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp))
|
||||
return;
|
||||
|
||||
bool sel = false;
|
||||
@@ -181,9 +175,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
(KeyEvent.Key != Keys.Escape && KeyEvent.Key != Keys.Back && KeyEvent.Key != Keys.PageUp && KeyEvent.Key != Keys.PageDown))
|
||||
{
|
||||
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,9 +294,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_actualSelection = _Locked;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,9 +328,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
sel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -361,22 +341,19 @@ 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))
|
||||
{
|
||||
@@ -391,10 +368,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
}
|
||||
|
||||
if (MouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
{
|
||||
if (MouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, MouseEvent) &&
|
||||
(!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
UpdateList(_Offset + _NumW * MouseEvent.Wheel);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -728,4 +696,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Theme.songMenuTileBoard.TextSongLength.ReloadTextures();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
using VocaluxeLib.PartyModes;
|
||||
using VocaluxeLib.PartyModes;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
@@ -39,4 +38,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
SRectF GetRect();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
@@ -132,4 +118,4 @@ namespace VocaluxeLib.PartyModes
|
||||
}
|
||||
#endregion Implementation
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,4 +39,4 @@ namespace VocaluxeLib.PartyModes
|
||||
_ScreenSongOptions.Sorting.SearchActive = Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes
|
||||
{
|
||||
|
||||
#region Structs
|
||||
public struct ScreenSongOptions
|
||||
{
|
||||
@@ -21,42 +22,42 @@ namespace VocaluxeLib.PartyModes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration of song selection options
|
||||
/// Configuration of song selection options
|
||||
/// </summary>
|
||||
public struct SelectionOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// If != -1, the SongMenu should set the song selection on the provided song index (visible index) if possible
|
||||
/// If != -1, the SongMenu should set the song selection on the provided song index (visible index) if possible
|
||||
/// </summary>
|
||||
public int SongIndex;
|
||||
|
||||
/// <summary>
|
||||
/// If true, the SongMenu should perform the select random song method
|
||||
/// If true, the SongMenu should perform the select random song method
|
||||
/// </summary>
|
||||
public bool SelectNextRandomSong;
|
||||
|
||||
/// <summary>
|
||||
/// Choosing song only by random
|
||||
/// Choosing song only by random
|
||||
/// </summary>
|
||||
public bool RandomOnly;
|
||||
|
||||
/// <summary>
|
||||
/// If true, it is not allowed to go to MainScreen nor open the playlist nor open the song menu
|
||||
/// If true, it is not allowed to go to MainScreen nor open the playlist nor open the song menu
|
||||
/// </summary>
|
||||
public bool PartyMode;
|
||||
|
||||
/// <summary>
|
||||
/// If true, it is not alled to change or leave the category. It's only valid if Tabs=On.
|
||||
/// If true, it is not alled to change or leave the category. It's only valid if Tabs=On.
|
||||
/// </summary>
|
||||
public bool CategoryChangeAllowed;
|
||||
|
||||
/// <summary>
|
||||
/// The number of jokers left for each team
|
||||
/// The number of jokers left for each team
|
||||
/// </summary>
|
||||
public int[] NumJokers;
|
||||
|
||||
/// <summary>
|
||||
/// The Team Name of the teams (:>)
|
||||
/// The Team Name of the teams (:>)
|
||||
/// </summary>
|
||||
public string[] TeamNames;
|
||||
}
|
||||
@@ -93,4 +94,4 @@ namespace VocaluxeLib.PartyModes
|
||||
void LeavingScore();
|
||||
void LeavingHighscore();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Reference in new issue
Block a user