Many cleanups according to ReSharper suggestions (Mostly redundant code)
Minor Bug fixes
This commit is contained in:
1 parent
9aa81b7ba2
commit
dcbbc5caf3
96 files changed
+2702
-3322
No files matched your search
@@ -75,11 +75,11 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
_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);
|
||||
bool vid = xmlReader.GetValue(item + "/Video", out _Theme.VideoName, String.Empty);
|
||||
bool tex = xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
|
||||
else
|
||||
{
|
||||
@@ -207,7 +207,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||
RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height);
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
|
||||
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
||||
return true;
|
||||
@@ -222,7 +222,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height);
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
|
||||
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
||||
return true;
|
||||
@@ -237,7 +237,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height);
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
|
||||
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
|
||||
return true;
|
||||
|
||||
@@ -152,8 +152,8 @@ namespace VocaluxeLib.Menu
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", ref _Theme.SelTextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", out _Theme.SelTextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
|
||||
@@ -161,7 +161,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
|
||||
else
|
||||
{
|
||||
@@ -171,7 +171,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor);
|
||||
else
|
||||
{
|
||||
@@ -309,7 +309,7 @@ namespace VocaluxeLib.Menu
|
||||
if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw)
|
||||
return;
|
||||
|
||||
STexture texture = new STexture(-1);
|
||||
STexture texture;
|
||||
|
||||
if (!Selected && !Pressed || !Enabled)
|
||||
{
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace VocaluxeLib.Menu
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
|
||||
@@ -107,7 +107,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/DrawNegative", ref _Theme.DrawNegative);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
|
||||
else
|
||||
{
|
||||
@@ -117,7 +117,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/MaxColor", ref _Theme.MaxColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/MaxColor", out _Theme.MaxColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -68,7 +68,6 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public static int TryReadInt(StreamReader sr)
|
||||
{
|
||||
char chr = '0';
|
||||
string value = String.Empty;
|
||||
|
||||
try
|
||||
@@ -77,7 +76,7 @@ namespace VocaluxeLib.Menu
|
||||
//Check for ' ', ?, ?, \n, \r
|
||||
while (tmp != 32 && tmp != 19 && tmp != 16 && tmp != 13 && tmp != 10)
|
||||
{
|
||||
chr = (char)sr.Read();
|
||||
char chr = (char)sr.Read();
|
||||
value += chr.ToString();
|
||||
tmp = sr.Peek();
|
||||
}
|
||||
@@ -86,20 +85,18 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int result = 0;
|
||||
if (int.TryParse(value, out result))
|
||||
return result;
|
||||
return 0;
|
||||
int result;
|
||||
return int.TryParse(value, out result) ? result : 0;
|
||||
}
|
||||
|
||||
public static void SetRect(RectangleF bounds, ref RectangleF rect, float rectAspect, EAspect aspect)
|
||||
public static void SetRect(RectangleF bounds, out RectangleF rect, float rectAspect, EAspect aspect)
|
||||
{
|
||||
float rW = bounds.Right - bounds.Left;
|
||||
float rH = bounds.Bottom - bounds.Top;
|
||||
float rA = rW / rH;
|
||||
|
||||
float scaledWidth = rW;
|
||||
float scaledHeight = rH;
|
||||
float scaledWidth;
|
||||
float scaledHeight;
|
||||
|
||||
switch (aspect)
|
||||
{
|
||||
@@ -161,16 +158,13 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
foreach (FileInfo file in dir.GetFiles(cast))
|
||||
{
|
||||
if (!fullpath)
|
||||
files.Add(file.Name);
|
||||
else
|
||||
files.Add(file.FullName);
|
||||
files.Add(!fullpath ? file.Name : file.FullName);
|
||||
}
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
foreach (DirectoryInfo di in dir.GetDirectories())
|
||||
files.AddRange(ListFiles(di.FullName, cast, recursive, fullpath));
|
||||
files.AddRange(ListFiles(di.FullName, cast, true, fullpath));
|
||||
}
|
||||
}
|
||||
catch (Exception) {}
|
||||
|
||||
+74
-100
@@ -58,7 +58,6 @@ namespace VocaluxeLib.Menu
|
||||
private float _H;
|
||||
|
||||
private float _Width;
|
||||
private ELyricStyle _Style;
|
||||
|
||||
private float _Alpha = 1f;
|
||||
|
||||
@@ -70,7 +69,7 @@ namespace VocaluxeLib.Menu
|
||||
public SRectF Rect
|
||||
{
|
||||
get { return new SRectF(_X, _Y, _MaxW, _H, _Z); }
|
||||
set
|
||||
private set
|
||||
{
|
||||
_X = value.X;
|
||||
_Y = value.Y;
|
||||
@@ -80,8 +79,8 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
|
||||
public SColorF Color;
|
||||
public SColorF ColorProcessed;
|
||||
private SColorF _Color;
|
||||
private SColorF _ColorProcessed;
|
||||
|
||||
public bool Selected;
|
||||
public bool Visible = true;
|
||||
@@ -96,19 +95,15 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
|
||||
public ELyricStyle LyricStyle
|
||||
{
|
||||
get { return _Style; }
|
||||
set { _Style = value; }
|
||||
}
|
||||
public ELyricStyle LyricStyle { get; set; }
|
||||
|
||||
public CLyric(int partyModeID)
|
||||
{
|
||||
_PartyModeID = partyModeID;
|
||||
_Theme = new SThemeLyrics();
|
||||
_ThemeLoaded = false;
|
||||
Color = new SColorF();
|
||||
ColorProcessed = new SColorF();
|
||||
_Color = new SColorF();
|
||||
_ColorProcessed = new SColorF();
|
||||
|
||||
_X = 0f;
|
||||
_Y = 0f;
|
||||
@@ -119,7 +114,7 @@ namespace VocaluxeLib.Menu
|
||||
_Notes = new List<SNote>();
|
||||
_Text = new CText(_PartyModeID);
|
||||
|
||||
_Style = ELyricStyle.Fill;
|
||||
LyricStyle = ELyricStyle.Fill;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
|
||||
@@ -133,31 +128,31 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _MaxW);
|
||||
_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);
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _Color);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref _Color.G);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _Color.B);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out ColorProcessed);
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out _ColorProcessed);
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref ColorProcessed.R);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref ColorProcessed.G);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref ColorProcessed.B);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref ColorProcessed.A);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref _ColorProcessed.R);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref _ColorProcessed.G);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref _ColorProcessed.B);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref _ColorProcessed.A);
|
||||
}
|
||||
|
||||
if (_ThemeLoaded)
|
||||
{
|
||||
_Theme.Name = elementName;
|
||||
LoadTextures();
|
||||
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", Color, String.Empty);
|
||||
_Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty);
|
||||
}
|
||||
return _ThemeLoaded;
|
||||
}
|
||||
@@ -181,10 +176,10 @@ namespace VocaluxeLib.Menu
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", Color.A.ToString("#0.00"));
|
||||
writer.WriteElementString("R", _Color.R.ToString("#0.00"));
|
||||
writer.WriteElementString("G", _Color.G.ToString("#0.00"));
|
||||
writer.WriteElementString("B", _Color.B.ToString("#0.00"));
|
||||
writer.WriteElementString("A", _Color.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)");
|
||||
@@ -193,10 +188,10 @@ namespace VocaluxeLib.Menu
|
||||
writer.WriteElementString("SColor", _Theme.SelColorName);
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("SR", ColorProcessed.R.ToString("#0.00"));
|
||||
writer.WriteElementString("SG", ColorProcessed.G.ToString("#0.00"));
|
||||
writer.WriteElementString("SB", ColorProcessed.B.ToString("#0.00"));
|
||||
writer.WriteElementString("SA", ColorProcessed.A.ToString("#0.00"));
|
||||
writer.WriteElementString("SR", _ColorProcessed.R.ToString("#0.00"));
|
||||
writer.WriteElementString("SG", _ColorProcessed.G.ToString("#0.00"));
|
||||
writer.WriteElementString("SB", _ColorProcessed.B.ToString("#0.00"));
|
||||
writer.WriteElementString("SA", _ColorProcessed.A.ToString("#0.00"));
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
@@ -213,13 +208,7 @@ namespace VocaluxeLib.Menu
|
||||
_Width = 0f;
|
||||
foreach (CNote note in line.Notes)
|
||||
{
|
||||
SNote n = new SNote();
|
||||
|
||||
n.Text = note.Text;
|
||||
n.StartBeat = note.StartBeat;
|
||||
n.EndBeat = note.EndBeat;
|
||||
n.Duration = note.Duration;
|
||||
n.Type = note.NoteType;
|
||||
SNote n = new SNote {Text = note.Text, StartBeat = note.StartBeat, EndBeat = note.EndBeat, Duration = note.Duration, Type = note.NoteType};
|
||||
|
||||
_Text.Text = note.Text;
|
||||
_Text.Style = EStyle.Bold;
|
||||
@@ -248,7 +237,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
if (Visible || CBase.Settings.GetGameState() == EGameState.EditTheme)
|
||||
{
|
||||
switch (_Style)
|
||||
switch (LyricStyle)
|
||||
{
|
||||
case ELyricStyle.Fill:
|
||||
_DrawFill(actualBeat);
|
||||
@@ -287,28 +276,28 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
if (currentBeat <= note.EndBeat)
|
||||
{
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Color = _ColorProcessed;
|
||||
|
||||
|
||||
float diff = note.EndBeat - note.StartBeat;
|
||||
if (diff == 0)
|
||||
if (Math.Abs(diff) < float.Epsilon)
|
||||
_Text.Draw(0f, 1f);
|
||||
else
|
||||
{
|
||||
_Text.Draw(0f, (currentBeat - note.StartBeat) / diff);
|
||||
_Text.Color = Color;
|
||||
_Text.Color = _Color;
|
||||
_Text.Draw((currentBeat - note.StartBeat) / diff, 1f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Color = _ColorProcessed;
|
||||
_Text.Draw();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_Text.Color = Color;
|
||||
_Text.Color = _Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
@@ -344,7 +333,6 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (currentBeat >= _Notes[note].StartBeat)
|
||||
{
|
||||
bool last = note == _Notes.Count - 1;
|
||||
int endbeat = _Notes[note].EndBeat;
|
||||
if (note < _Notes.Count - 1)
|
||||
endbeat = _Notes[note + 1].StartBeat - 1;
|
||||
@@ -358,10 +346,7 @@ namespace VocaluxeLib.Menu
|
||||
else
|
||||
{
|
||||
// already passed
|
||||
if (note == lastNote)
|
||||
_Text.Color = ColorProcessed;
|
||||
else
|
||||
_Text.Color = Color;
|
||||
_Text.Color = note == lastNote ? _ColorProcessed : _Color;
|
||||
|
||||
_Text.Draw();
|
||||
}
|
||||
@@ -369,7 +354,7 @@ namespace VocaluxeLib.Menu
|
||||
else
|
||||
{
|
||||
// not passed
|
||||
_Text.Color = Color;
|
||||
_Text.Color = _Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
@@ -383,7 +368,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
_Text.X = zoomx;
|
||||
_Text.Text = _Notes[zoomNote].Text;
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Color = _ColorProcessed;
|
||||
_Text.Style = EStyle.Bold;
|
||||
|
||||
if (_Notes[zoomNote].Type == ENoteType.Freestyle)
|
||||
@@ -437,13 +422,13 @@ 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();
|
||||
}
|
||||
|
||||
@@ -464,7 +449,6 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
int jumpNote = -1;
|
||||
int endBeat = -1;
|
||||
float jumpx = 0f;
|
||||
|
||||
for (int note = 0; note < _Notes.Count; note++)
|
||||
@@ -479,24 +463,15 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (currentBeat >= _Notes[note].StartBeat)
|
||||
{
|
||||
bool last = note == _Notes.Count - 1;
|
||||
int endbeat = _Notes[note].EndBeat;
|
||||
if (note < _Notes.Count - 1)
|
||||
endbeat = _Notes[note + 1].StartBeat - 1;
|
||||
|
||||
if (currentBeat <= _Notes[note].EndBeat)
|
||||
{
|
||||
jumpNote = note;
|
||||
endBeat = endbeat;
|
||||
jumpx = _Text.X;
|
||||
}
|
||||
else
|
||||
{
|
||||
// already passed
|
||||
if (note == lastNote)
|
||||
_Text.Color = ColorProcessed;
|
||||
else
|
||||
_Text.Color = Color;
|
||||
_Text.Color = note == lastNote ? _ColorProcessed : _Color;
|
||||
|
||||
_Text.Draw();
|
||||
}
|
||||
@@ -504,45 +479,44 @@ namespace VocaluxeLib.Menu
|
||||
else
|
||||
{
|
||||
// not passed
|
||||
_Text.Color = Color;
|
||||
_Text.Color = _Color;
|
||||
_Text.Draw();
|
||||
}
|
||||
|
||||
x += rect.Width;
|
||||
}
|
||||
|
||||
if (jumpNote > -1)
|
||||
if (jumpNote < 0)
|
||||
return;
|
||||
if (_Notes[jumpNote].Duration == 0)
|
||||
return;
|
||||
|
||||
_Text.X = jumpx;
|
||||
_Text.Text = _Notes[jumpNote].Text;
|
||||
_Text.Color = _ColorProcessed;
|
||||
_Text.Style = EStyle.Bold;
|
||||
|
||||
if (_Notes[jumpNote].Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat;
|
||||
if (diff <= 0f)
|
||||
diff = 1f;
|
||||
|
||||
float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff;
|
||||
if (p > 1f)
|
||||
p = 1f;
|
||||
|
||||
p = 1f - p;
|
||||
|
||||
if (Math.Abs(diff - 1) < float.Epsilon)
|
||||
_Text.Draw();
|
||||
else
|
||||
{
|
||||
if (_Notes[jumpNote].Duration == 0)
|
||||
return;
|
||||
|
||||
_Text.X = jumpx;
|
||||
_Text.Text = _Notes[jumpNote].Text;
|
||||
_Text.Color = ColorProcessed;
|
||||
_Text.Style = EStyle.Bold;
|
||||
|
||||
if (_Notes[jumpNote].Type == ENoteType.Freestyle)
|
||||
_Text.Style = EStyle.BoldItalic;
|
||||
|
||||
float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat;
|
||||
if (diff <= 0f)
|
||||
diff = 1f;
|
||||
|
||||
float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff;
|
||||
if (p > 1f)
|
||||
p = 1f;
|
||||
|
||||
p = 1f - p;
|
||||
|
||||
if (diff == 1)
|
||||
_Text.Draw();
|
||||
else
|
||||
{
|
||||
float y = _Text.Y;
|
||||
_Text.Y -= _Text.Height * 0.1f * p;
|
||||
_Text.Draw();
|
||||
_Text.Y = y;
|
||||
}
|
||||
float y = _Text.Y;
|
||||
_Text.Y -= _Text.Height * 0.1f * p;
|
||||
_Text.Draw();
|
||||
_Text.Y = y;
|
||||
}
|
||||
}
|
||||
#endregion draw
|
||||
@@ -552,10 +526,10 @@ namespace VocaluxeLib.Menu
|
||||
public void LoadTextures()
|
||||
{
|
||||
if (_Theme.ColorName.Length > 0)
|
||||
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
|
||||
_Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
|
||||
|
||||
if (_Theme.SelColorName.Length > 0)
|
||||
ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
|
||||
_ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
|
||||
}
|
||||
|
||||
public void ReloadTextures()
|
||||
|
||||
+122
-292
@@ -42,35 +42,18 @@ namespace VocaluxeLib.Menu
|
||||
private string _ThemePath = String.Empty;
|
||||
protected int _PartyModeID = -1;
|
||||
|
||||
private COrderedDictionaryLite<CBackground> _Backgrounds;
|
||||
private COrderedDictionaryLite<CButton> _Buttons;
|
||||
private COrderedDictionaryLite<CText> _Texts;
|
||||
private COrderedDictionaryLite<CStatic> _Statics;
|
||||
private COrderedDictionaryLite<CSelectSlide> _SelectSlides;
|
||||
private COrderedDictionaryLite<CSongMenu> _SongMenus;
|
||||
private COrderedDictionaryLite<CLyric> _Lyrics;
|
||||
private COrderedDictionaryLite<CSingNotes> _SingNotes;
|
||||
private COrderedDictionaryLite<CNameSelection> _NameSelections;
|
||||
private COrderedDictionaryLite<CEqualizer> _Equalizers;
|
||||
private COrderedDictionaryLite<CPlaylist> _Playlists;
|
||||
private COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
|
||||
private COrderedDictionaryLite<CScreenSetting> _ScreenSettings;
|
||||
|
||||
private int _PrevMouseX;
|
||||
private int _PrevMouseY;
|
||||
|
||||
protected int _MouseDX;
|
||||
protected int _MouseDY;
|
||||
private int _MouseDX;
|
||||
private int _MouseDY;
|
||||
|
||||
protected bool _Active;
|
||||
|
||||
protected abstract int _ScreenVersion { get; }
|
||||
private string _ThemeName;
|
||||
public string ThemeName
|
||||
{
|
||||
get { return _ThemeName; }
|
||||
}
|
||||
public string ThemeName { get; private set; }
|
||||
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
protected string[] _ThemeBackgrounds;
|
||||
protected string[] _ThemeStatics;
|
||||
protected string[] _ThemeTexts;
|
||||
@@ -85,22 +68,32 @@ namespace VocaluxeLib.Menu
|
||||
protected string[] _ThemeParticleEffects;
|
||||
protected string[] _ThemeScreenSettings;
|
||||
|
||||
protected COrderedDictionaryLite<CButton> _Buttons { get; private set; }
|
||||
protected COrderedDictionaryLite<CText> _Texts { get; private set; }
|
||||
protected COrderedDictionaryLite<CBackground> _Backgrounds { get; private set; }
|
||||
protected COrderedDictionaryLite<CStatic> _Statics { get; private set; }
|
||||
protected COrderedDictionaryLite<CSelectSlide> _SelectSlides { get; private set; }
|
||||
protected COrderedDictionaryLite<CSongMenu> _SongMenus { get; private set; }
|
||||
protected COrderedDictionaryLite<CLyric> _Lyrics { get; private set; }
|
||||
protected COrderedDictionaryLite<CSingNotes> _SingNotes { get; private set; }
|
||||
protected COrderedDictionaryLite<CNameSelection> _NameSelections { get; private set; }
|
||||
protected COrderedDictionaryLite<CEqualizer> _Equalizers { get; private set; }
|
||||
protected COrderedDictionaryLite<CPlaylist> _Playlists { get; private set; }
|
||||
protected COrderedDictionaryLite<CParticleEffect> _ParticleEffects { get; private set; }
|
||||
protected COrderedDictionaryLite<CScreenSetting> _ScreenSettings { get; private set; }
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
|
||||
protected SRectF _ScreenArea;
|
||||
public SRectF ScreenArea
|
||||
{
|
||||
get { return _ScreenArea; }
|
||||
}
|
||||
|
||||
public int ThemeScreenVersion
|
||||
{
|
||||
get { return _ScreenVersion; }
|
||||
}
|
||||
|
||||
public virtual void Init()
|
||||
{
|
||||
_ThemeName = GetType().Name;
|
||||
if (_ThemeName[0] == 'C' && Char.IsUpper(_ThemeName[1]))
|
||||
_ThemeName = _ThemeName.Remove(0, 1);
|
||||
ThemeName = GetType().Name;
|
||||
if (ThemeName[0] == 'C' && Char.IsUpper(ThemeName[1]))
|
||||
ThemeName = ThemeName.Remove(0, 1);
|
||||
|
||||
_Interactions = new List<CInteraction>();
|
||||
_Selection = 0;
|
||||
@@ -149,7 +142,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
#region ThemeHandler
|
||||
protected delegate void AddElementHandler<T>(T element, String key);
|
||||
private delegate void AddElementHandler<in T>(T element, String key);
|
||||
|
||||
private void _LoadThemeElement<T>(string[] elements, AddElementHandler<T> addElementHandler, CXMLReader xmlReader, int skinIndex) where T : IMenuElement
|
||||
{
|
||||
@@ -174,8 +167,7 @@ namespace VocaluxeLib.Menu
|
||||
if (xmlReader == null)
|
||||
return;
|
||||
|
||||
bool versionCheck = false;
|
||||
versionCheck = _CheckVersion(_ScreenVersion, xmlReader);
|
||||
bool versionCheck = _CheckVersion(_ScreenVersion, xmlReader);
|
||||
|
||||
int skinIndex = CBase.Theme.GetSkinIndex(_PartyModeID);
|
||||
|
||||
@@ -184,19 +176,19 @@ namespace VocaluxeLib.Menu
|
||||
_ThemePath = xmlPath;
|
||||
_LoadThemeBasics(xmlReader, skinIndex);
|
||||
|
||||
_LoadThemeElement<CBackground>(_ThemeBackgrounds, AddBackground, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CStatic>(_ThemeStatics, AddStatic, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CText>(_ThemeTexts, AddText, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CButton>(_ThemeButtons, AddButton, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, AddSelectSlide, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CSongMenu>(_ThemeSongMenus, AddSongMenu, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CLyric>(_ThemeLyrics, AddLyric, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CSingNotesClassic>(_ThemeSingNotes, AddSingNote, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CNameSelection>(_ThemeNameSelections, AddNameSelection, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CEqualizer>(_ThemeEqualizers, AddEqualizer, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CPlaylist>(_ThemePlaylists, AddPlaylist, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CParticleEffect>(_ThemeParticleEffects, AddParticleEffect, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CScreenSetting>(_ThemeScreenSettings, AddScreenSetting, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CBackground>(_ThemeBackgrounds, _AddBackground, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CStatic>(_ThemeStatics, _AddStatic, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CText>(_ThemeTexts, _AddText, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CButton>(_ThemeButtons, _AddButton, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, _AddSelectSlide, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CSongMenu>(_ThemeSongMenus, _AddSongMenu, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CLyric>(_ThemeLyrics, _AddLyric, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CSingNotesClassic>(_ThemeSingNotes, _AddSingNote, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CNameSelection>(_ThemeNameSelections, _AddNameSelection, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CEqualizer>(_ThemeEqualizers, _AddEqualizer, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CPlaylist>(_ThemePlaylists, _AddPlaylist, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CParticleEffect>(_ThemeParticleEffects, _AddParticleEffect, xmlReader, skinIndex);
|
||||
_LoadThemeElement<CScreenSetting>(_ThemeScreenSettings, _AddScreenSetting, xmlReader, skinIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,10 +197,7 @@ namespace VocaluxeLib.Menu
|
||||
if (_ThemePath.Length == 0)
|
||||
return;
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Indent = true;
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
settings.ConformanceLevel = ConformanceLevel.Document;
|
||||
XmlWriterSettings settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document};
|
||||
|
||||
string file = Path.Combine(_ThemePath, ThemeName + ".xml");
|
||||
using (XmlWriter writer = XmlWriter.Create(file, settings))
|
||||
@@ -447,12 +436,14 @@ namespace VocaluxeLib.Menu
|
||||
#region ElementHandler
|
||||
|
||||
#region Create Elements
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable MemberCanBeProtected.Global
|
||||
public CButton GetNewButton()
|
||||
{
|
||||
return new CButton(_PartyModeID);
|
||||
}
|
||||
|
||||
public CButton GetNewButton(CButton button)
|
||||
public static CButton GetNewButton(CButton button)
|
||||
{
|
||||
return new CButton(button);
|
||||
}
|
||||
@@ -462,12 +453,12 @@ namespace VocaluxeLib.Menu
|
||||
return new CText(_PartyModeID);
|
||||
}
|
||||
|
||||
public CText GetNewText(CText text)
|
||||
public static CText GetNewText(CText text)
|
||||
{
|
||||
return new CText(text);
|
||||
}
|
||||
|
||||
public CText GetNewText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text)
|
||||
public static CText GetNewText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text)
|
||||
{
|
||||
return new CText(x, y, z, h, mw, align, style, font, col, text);
|
||||
}
|
||||
@@ -482,7 +473,7 @@ namespace VocaluxeLib.Menu
|
||||
return new CStatic(_PartyModeID);
|
||||
}
|
||||
|
||||
public CStatic GetNewStatic(CStatic oldStatic)
|
||||
public static CStatic GetNewStatic(CStatic oldStatic)
|
||||
{
|
||||
return new CStatic(oldStatic);
|
||||
}
|
||||
@@ -497,7 +488,7 @@ namespace VocaluxeLib.Menu
|
||||
return new CSelectSlide(_PartyModeID);
|
||||
}
|
||||
|
||||
public CSelectSlide GetNewSelectSlide(CSelectSlide slide)
|
||||
public static CSelectSlide GetNewSelectSlide(CSelectSlide slide)
|
||||
{
|
||||
return new CSelectSlide(slide);
|
||||
}
|
||||
@@ -536,75 +527,10 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type);
|
||||
}
|
||||
// ReSharper restore MemberCanBeProtected.Global
|
||||
// ReSharper restore UnusedMember.Global
|
||||
#endregion Create Elements
|
||||
|
||||
#region Get Elements
|
||||
public COrderedDictionaryLite<CButton> Buttons
|
||||
{
|
||||
get { return _Buttons; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CText> Texts
|
||||
{
|
||||
get { return _Texts; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CBackground> Backgrounds
|
||||
{
|
||||
get { return _Backgrounds; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CStatic> Statics
|
||||
{
|
||||
get { return _Statics; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CSelectSlide> SelectSlides
|
||||
{
|
||||
get { return _SelectSlides; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CSongMenu> SongMenus
|
||||
{
|
||||
get { return _SongMenus; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CLyric> Lyrics
|
||||
{
|
||||
get { return _Lyrics; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CSingNotes> SingNotes
|
||||
{
|
||||
get { return _SingNotes; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CNameSelection> NameSelections
|
||||
{
|
||||
get { return _NameSelections; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CEqualizer> Equalizers
|
||||
{
|
||||
get { return _Equalizers; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CPlaylist> Playlists
|
||||
{
|
||||
get { return _Playlists; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CParticleEffect> ParticleEffects
|
||||
{
|
||||
get { return _ParticleEffects; }
|
||||
}
|
||||
|
||||
public COrderedDictionaryLite<CScreenSetting> ScreenSettings
|
||||
{
|
||||
get { return _ScreenSettings; }
|
||||
}
|
||||
#endregion Get Arrays
|
||||
|
||||
#endregion ElementHandler
|
||||
|
||||
#region MenuHandler
|
||||
@@ -826,18 +752,18 @@ namespace VocaluxeLib.Menu
|
||||
#region Drawing
|
||||
public virtual bool Draw()
|
||||
{
|
||||
DrawBG();
|
||||
DrawFG();
|
||||
_DrawBG();
|
||||
_DrawFG();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void DrawBG()
|
||||
protected void _DrawBG()
|
||||
{
|
||||
foreach (CBackground bg in _Backgrounds)
|
||||
bg.Draw();
|
||||
}
|
||||
|
||||
public void DrawFG()
|
||||
protected void _DrawFG()
|
||||
{
|
||||
if (_Interactions.Count <= 0)
|
||||
return;
|
||||
@@ -846,29 +772,20 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
for (int i = 0; i < _Interactions.Count; i++)
|
||||
{
|
||||
if (_IsVisible(i) && (
|
||||
_Interactions[i].Type == EType.Button ||
|
||||
_Interactions[i].Type == EType.SelectSlide ||
|
||||
_Interactions[i].Type == EType.Static ||
|
||||
_Interactions[i].Type == EType.NameSelection ||
|
||||
_Interactions[i].Type == EType.Text ||
|
||||
_Interactions[i].Type == EType.SongMenu ||
|
||||
_Interactions[i].Type == EType.Equalizer ||
|
||||
_Interactions[i].Type == EType.Playlist ||
|
||||
_Interactions[i].Type == EType.ParticleEffect))
|
||||
{
|
||||
SZSort zs = new SZSort();
|
||||
zs.ID = i;
|
||||
zs.Z = _GetZValue(i);
|
||||
items.Add(zs);
|
||||
}
|
||||
if (!_IsVisible(i) ||
|
||||
(_Interactions[i].Type != EType.Button && _Interactions[i].Type != EType.SelectSlide && _Interactions[i].Type != EType.Static &&
|
||||
_Interactions[i].Type != EType.NameSelection && _Interactions[i].Type != EType.Text && _Interactions[i].Type != EType.SongMenu &&
|
||||
_Interactions[i].Type != EType.Equalizer && _Interactions[i].Type != EType.Playlist && _Interactions[i].Type != EType.ParticleEffect))
|
||||
continue;
|
||||
SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)};
|
||||
items.Add(zs);
|
||||
}
|
||||
|
||||
if (items.Count <= 0)
|
||||
return;
|
||||
|
||||
|
||||
items.Sort(delegate(SZSort s1, SZSort s2) { return s2.Z.CompareTo(s1.Z); });
|
||||
items.Sort((s1, s2) => s2.Z.CompareTo(s1.Z));
|
||||
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
_DrawInteraction(items[i].ID);
|
||||
@@ -876,139 +793,76 @@ namespace VocaluxeLib.Menu
|
||||
#endregion Drawing
|
||||
|
||||
#region Elements
|
||||
public void AddBackground(CBackground bg)
|
||||
{
|
||||
AddBackground(bg, null);
|
||||
}
|
||||
|
||||
public void AddButton(CButton button)
|
||||
{
|
||||
AddButton(button, null);
|
||||
}
|
||||
|
||||
public void AddSelectSlide(CSelectSlide slide)
|
||||
{
|
||||
AddSelectSlide(slide, null);
|
||||
}
|
||||
|
||||
public void AddStatic(CStatic stat)
|
||||
{
|
||||
AddStatic(stat, null);
|
||||
}
|
||||
|
||||
public void AddText(CText text)
|
||||
{
|
||||
AddText(text, null);
|
||||
}
|
||||
|
||||
public void AddSongMenu(CSongMenu songmenu)
|
||||
{
|
||||
AddSongMenu(songmenu, null);
|
||||
}
|
||||
|
||||
public void AddLyric(CLyric lyric)
|
||||
{
|
||||
AddLyric(lyric, null);
|
||||
}
|
||||
|
||||
public void AddSingNote(CSingNotes sn)
|
||||
{
|
||||
AddSingNote(sn, null);
|
||||
}
|
||||
|
||||
public void AddNameSelection(CNameSelection ns)
|
||||
{
|
||||
AddNameSelection(ns, null);
|
||||
}
|
||||
|
||||
public void AddEqualizer(CEqualizer eq)
|
||||
{
|
||||
AddEqualizer(eq, null);
|
||||
}
|
||||
|
||||
public void AddPlaylist(CPlaylist pls)
|
||||
{
|
||||
AddPlaylist(pls, null);
|
||||
}
|
||||
|
||||
public void AddParticleEffect(CParticleEffect pe)
|
||||
{
|
||||
AddParticleEffect(pe, null);
|
||||
}
|
||||
|
||||
public void AddScreenSetting(CScreenSetting se)
|
||||
{
|
||||
AddScreenSetting(se, null);
|
||||
}
|
||||
|
||||
public void AddBackground(CBackground bg, String key)
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
protected void _AddBackground(CBackground bg, String key = null)
|
||||
{
|
||||
_AddInteraction(_Backgrounds.Add(bg, key), EType.Background);
|
||||
}
|
||||
|
||||
public void AddButton(CButton button, String key)
|
||||
protected void _AddButton(CButton button, String key = null)
|
||||
{
|
||||
_AddInteraction(_Buttons.Add(button, key), EType.Button);
|
||||
}
|
||||
|
||||
public void AddSelectSlide(CSelectSlide slide, String key)
|
||||
protected void _AddSelectSlide(CSelectSlide slide, String key = null)
|
||||
{
|
||||
_AddInteraction(_SelectSlides.Add(slide, key), EType.SelectSlide);
|
||||
}
|
||||
|
||||
public void AddStatic(CStatic stat, String key)
|
||||
protected void _AddStatic(CStatic stat, String key = null)
|
||||
{
|
||||
_AddInteraction(_Statics.Add(stat, key), EType.Static);
|
||||
}
|
||||
|
||||
public void AddText(CText text, String key)
|
||||
protected void _AddText(CText text, String key = null)
|
||||
{
|
||||
_AddInteraction(_Texts.Add(text, key), EType.Text);
|
||||
}
|
||||
|
||||
public void AddSongMenu(CSongMenu songmenu, String key)
|
||||
protected void _AddSongMenu(CSongMenu songmenu, String key = null)
|
||||
{
|
||||
_AddInteraction(_SongMenus.Add(songmenu, key), EType.SongMenu);
|
||||
}
|
||||
|
||||
public void AddLyric(CLyric lyric, String key)
|
||||
protected void _AddLyric(CLyric lyric, String key = null)
|
||||
{
|
||||
_AddInteraction(_Lyrics.Add(lyric, key), EType.Lyric);
|
||||
}
|
||||
|
||||
public void AddSingNote(CSingNotes sn, String key)
|
||||
protected void _AddSingNote(CSingNotes sn, String key = null)
|
||||
{
|
||||
_AddInteraction(_SingNotes.Add(sn, key), EType.SingNote);
|
||||
}
|
||||
|
||||
public void AddNameSelection(CNameSelection ns, String key)
|
||||
protected void _AddNameSelection(CNameSelection ns, String key = null)
|
||||
{
|
||||
_AddInteraction(_NameSelections.Add(ns, key), EType.NameSelection);
|
||||
}
|
||||
|
||||
public void AddEqualizer(CEqualizer eq, String key)
|
||||
protected void _AddEqualizer(CEqualizer eq, String key = null)
|
||||
{
|
||||
_AddInteraction(_Equalizers.Add(eq, key), EType.Equalizer);
|
||||
}
|
||||
|
||||
public void AddPlaylist(CPlaylist pls, String key)
|
||||
protected void _AddPlaylist(CPlaylist pls, String key = null)
|
||||
{
|
||||
_AddInteraction(_Playlists.Add(pls, key), EType.Playlist);
|
||||
}
|
||||
|
||||
public void AddParticleEffect(CParticleEffect pe, String key)
|
||||
protected void _AddParticleEffect(CParticleEffect pe, String key = null)
|
||||
{
|
||||
_AddInteraction(_ParticleEffects.Add(pe, key), EType.ParticleEffect);
|
||||
}
|
||||
|
||||
public void AddScreenSetting(CScreenSetting se, String key)
|
||||
protected void _AddScreenSetting(CScreenSetting se, String key = null)
|
||||
{
|
||||
_ScreenSettings.Add(se, key);
|
||||
}
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
#endregion Elements
|
||||
|
||||
#region InteractionHandling
|
||||
public void CheckInteraction()
|
||||
protected void _CheckInteraction()
|
||||
{
|
||||
if (!_IsEnabled(_Selection) || !_IsVisible(_Selection))
|
||||
PrevInteraction();
|
||||
@@ -1050,26 +904,23 @@ namespace VocaluxeLib.Menu
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SetInteractionToButton(CButton button)
|
||||
protected void _SetInteractionToButton(CButton button)
|
||||
{
|
||||
for (int i = 0; i < _Interactions.Count; i++)
|
||||
{
|
||||
if (_Interactions[i].Type == EType.Button)
|
||||
{
|
||||
if (_Buttons[_Interactions[i].Num] == button)
|
||||
{
|
||||
_UnsetSelected();
|
||||
_UnsetHighlighted(_Selection);
|
||||
_Selection = i;
|
||||
_SetSelected();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (_Interactions[i].Type != EType.Button)
|
||||
continue;
|
||||
if (_Buttons[_Interactions[i].Num] != button)
|
||||
continue;
|
||||
_UnsetSelected();
|
||||
_UnsetHighlighted(_Selection);
|
||||
_Selection = i;
|
||||
_SetSelected();
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SetInteractionToSelectSlide(CSelectSlide slide)
|
||||
protected void _SetInteractionToSelectSlide(CSelectSlide slide)
|
||||
{
|
||||
for (int i = 0; i < _Interactions.Count; i++)
|
||||
{
|
||||
@@ -1081,11 +932,10 @@ namespace VocaluxeLib.Menu
|
||||
_UnsetHighlighted(_Selection);
|
||||
_Selection = i;
|
||||
_SetSelected();
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ProcessMouseClick(int x, int y)
|
||||
@@ -1102,7 +952,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public void ProcessMouseMove(int x, int y)
|
||||
{
|
||||
SelectByMouse(x, y);
|
||||
_SelectByMouse(x, y);
|
||||
|
||||
if (_Selection >= _Interactions.Count || _Selection < 0)
|
||||
return;
|
||||
@@ -1114,41 +964,35 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectByMouse(int x, int y)
|
||||
private void _SelectByMouse(int x, int y)
|
||||
{
|
||||
float z = CBase.Settings.GetZFar();
|
||||
for (int i = 0; i < _Interactions.Count; i++)
|
||||
{
|
||||
if ((CBase.Settings.GetGameState() == EGameState.EditTheme) || (!_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i)))
|
||||
{
|
||||
if (_IsMouseOver(x, y, _Interactions[i]))
|
||||
{
|
||||
if (_GetZValue(_Interactions[i]) <= z)
|
||||
{
|
||||
z = _GetZValue(_Interactions[i]);
|
||||
_UnsetSelected();
|
||||
_Selection = i;
|
||||
_SetSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((CBase.Settings.GetGameState() != EGameState.EditTheme) && (_Interactions[i].ThemeEditorOnly || !_IsVisible(i) || !_IsEnabled(i)))
|
||||
continue;
|
||||
if (!_IsMouseOver(x, y, _Interactions[i]))
|
||||
continue;
|
||||
if (_GetZValue(_Interactions[i]) > z)
|
||||
continue;
|
||||
z = _GetZValue(_Interactions[i]);
|
||||
_UnsetSelected();
|
||||
_Selection = i;
|
||||
_SetSelected();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsMouseOver(SMouseEvent mouseEvent)
|
||||
protected bool _IsMouseOver(SMouseEvent mouseEvent)
|
||||
{
|
||||
return IsMouseOver(mouseEvent.X, mouseEvent.Y);
|
||||
return _IsMouseOver(mouseEvent.X, mouseEvent.Y);
|
||||
}
|
||||
|
||||
public bool IsMouseOver(int x, int y)
|
||||
private bool _IsMouseOver(int x, int y)
|
||||
{
|
||||
if (_Selection >= _Interactions.Count || _Selection < 0)
|
||||
return false;
|
||||
|
||||
if (_Interactions.Count > 0)
|
||||
return _IsMouseOver(x, y, _Interactions[_Selection]);
|
||||
else
|
||||
return false;
|
||||
return _Interactions.Count > 0 && _IsMouseOver(x, y, _Interactions[_Selection]);
|
||||
}
|
||||
|
||||
private bool _IsMouseOver(int x, int y, CInteraction interact)
|
||||
@@ -1314,7 +1158,6 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
int element = _Selection;
|
||||
int stage = int.MaxValue;
|
||||
float distance = float.MaxValue;
|
||||
int direction = -1;
|
||||
|
||||
int mute = -1;
|
||||
@@ -1340,7 +1183,6 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
stage = stages[i];
|
||||
element = elements[i];
|
||||
distance = distances[i];
|
||||
direction = i;
|
||||
}
|
||||
}
|
||||
@@ -1469,10 +1311,7 @@ namespace VocaluxeLib.Menu
|
||||
inDirection = true;
|
||||
break;
|
||||
}
|
||||
if (!inDirection)
|
||||
return float.MaxValue;
|
||||
else
|
||||
return distance;
|
||||
return !inDirection ? float.MaxValue : distance;
|
||||
}
|
||||
|
||||
private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect)
|
||||
@@ -1505,10 +1344,7 @@ namespace VocaluxeLib.Menu
|
||||
inDirection = true;
|
||||
break;
|
||||
}
|
||||
if (!inDirection)
|
||||
return float.MaxValue;
|
||||
else
|
||||
return distance;
|
||||
return !inDirection ? float.MaxValue : distance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1679,6 +1515,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable UnusedMember.Local
|
||||
private void _ToggleHighlighted()
|
||||
{
|
||||
if (_Selection >= _Interactions.Count || _Selection < 0)
|
||||
@@ -1693,11 +1530,9 @@ namespace VocaluxeLib.Menu
|
||||
if (_Selection >= _Interactions.Count || _Selection < 0)
|
||||
return false;
|
||||
|
||||
if (_Interactions[_Selection].Type == EType.SelectSlide)
|
||||
return _SelectSlides[_Interactions[_Selection].Num].Highlighted;
|
||||
|
||||
return false;
|
||||
return _Interactions[_Selection].Type == EType.SelectSlide && _SelectSlides[_Interactions[_Selection].Num].Highlighted;
|
||||
}
|
||||
// ReSharper restore UnusedMember.Local
|
||||
|
||||
private bool _IsVisible(int interaction)
|
||||
{
|
||||
@@ -1988,30 +1823,25 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
if (actualVersion == reqVersion)
|
||||
return true;
|
||||
string msg = "Can't load screen file of screen \"" + ThemeName + "\", ";
|
||||
if (actualVersion < reqVersion)
|
||||
msg += "the file ist outdated! ";
|
||||
else
|
||||
{
|
||||
string msg = "Can't load screen file of screen \"" + ThemeName + "\", ";
|
||||
if (actualVersion < reqVersion)
|
||||
msg += "the file ist outdated! ";
|
||||
else
|
||||
msg += "the file is for newer program versions! ";
|
||||
msg += "the file is for newer program versions! ";
|
||||
|
||||
msg += "Current screen version is " + reqVersion.ToString();
|
||||
CBase.Log.LogError(msg);
|
||||
}
|
||||
msg += "Current screen version is " + reqVersion;
|
||||
CBase.Log.LogError(msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex)
|
||||
{
|
||||
string value = String.Empty;
|
||||
|
||||
// Backgrounds
|
||||
CBackground background = new CBackground(_PartyModeID);
|
||||
int i = 1;
|
||||
while (background.LoadTheme("//root/" + ThemeName, "Background" + i.ToString(), xmlReader, skinIndex))
|
||||
while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader, skinIndex))
|
||||
{
|
||||
AddBackground(background);
|
||||
_AddBackground(background);
|
||||
background = new CBackground(_PartyModeID);
|
||||
i++;
|
||||
}
|
||||
@@ -2019,9 +1849,9 @@ namespace VocaluxeLib.Menu
|
||||
// Statics
|
||||
CStatic stat = new CStatic(_PartyModeID);
|
||||
i = 1;
|
||||
while (stat.LoadTheme("//root/" + ThemeName, "Static" + i.ToString(), xmlReader, skinIndex))
|
||||
while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader, skinIndex))
|
||||
{
|
||||
AddStatic(stat);
|
||||
_AddStatic(stat);
|
||||
stat = new CStatic(_PartyModeID);
|
||||
i++;
|
||||
}
|
||||
@@ -2029,9 +1859,9 @@ namespace VocaluxeLib.Menu
|
||||
// Texts
|
||||
CText text = new CText(_PartyModeID);
|
||||
i = 1;
|
||||
while (text.LoadTheme("//root/" + ThemeName, "Text" + i.ToString(), xmlReader, skinIndex))
|
||||
while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader, skinIndex))
|
||||
{
|
||||
AddText(text);
|
||||
_AddText(text);
|
||||
text = new CText(_PartyModeID);
|
||||
i++;
|
||||
}
|
||||
@@ -2039,9 +1869,9 @@ namespace VocaluxeLib.Menu
|
||||
// ParticleEffects
|
||||
CParticleEffect partef = new CParticleEffect(_PartyModeID);
|
||||
i = 1;
|
||||
while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i.ToString(), xmlReader, skinIndex))
|
||||
while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader, skinIndex))
|
||||
{
|
||||
AddParticleEffect(partef);
|
||||
_AddParticleEffect(partef);
|
||||
partef = new CParticleEffect(_PartyModeID);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace VocaluxeLib.Menu
|
||||
public readonly CStatic Avatar;
|
||||
public readonly CText Name;
|
||||
|
||||
public CTile() {}
|
||||
|
||||
public CTile(CStatic av, CText tex, int pl)
|
||||
{
|
||||
Avatar = av;
|
||||
@@ -65,7 +63,7 @@ namespace VocaluxeLib.Menu
|
||||
return _Theme.Name;
|
||||
}
|
||||
|
||||
public bool Selected = false;
|
||||
public bool Selected;
|
||||
public bool Visible = true;
|
||||
|
||||
public SRectF Rect;
|
||||
@@ -85,7 +83,7 @@ namespace VocaluxeLib.Menu
|
||||
private int _TileW;
|
||||
private int _TileH;
|
||||
|
||||
public int Offset = 0;
|
||||
public int Offset;
|
||||
private int _ActualSelection = -1;
|
||||
public int Selection = -1;
|
||||
|
||||
@@ -129,9 +127,9 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", ref _Theme.TextureEmptyTileName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", out _Theme.TextureEmptyTileName, String.Empty);
|
||||
|
||||
if (xmlReader.GetValue(item + "/ColorEmptyTile", ref _Theme.ColorEmptyTileName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/ColorEmptyTile", out _Theme.ColorEmptyTileName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, skinIndex, out ColorEmptyTile);
|
||||
else
|
||||
{
|
||||
@@ -141,7 +139,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref ColorEmptyTile.A);
|
||||
}
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", ref _Theme.TextureTileSelectedName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", out _Theme.TextureTileSelectedName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/W", ref _TileW);
|
||||
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/H", ref _TileH);
|
||||
@@ -151,9 +149,9 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceH", ref _SpaceH);
|
||||
_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.GetValue(item + "/Tiles/Name/Font", out _Theme.NameFont, "Normal");
|
||||
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Tiles/Name/Style", ref _Theme.NameStyle);
|
||||
if (xmlReader.GetValue(item + "/Tiles/Name/Color", ref _Theme.NameColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/Tiles/Name/Color", out _Theme.NameColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, skinIndex, out _Theme.NameColor);
|
||||
else
|
||||
{
|
||||
@@ -493,10 +491,8 @@ namespace VocaluxeLib.Menu
|
||||
_VisibleProfiles.Clear();
|
||||
for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
|
||||
{
|
||||
bool visible = false;
|
||||
bool visible = CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON;
|
||||
//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
|
||||
|
||||
@@ -636,7 +636,6 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
int element = _Selection;
|
||||
int stage = int.MaxValue;
|
||||
float distance = float.MaxValue;
|
||||
int direction = -1;
|
||||
|
||||
int mute = -1;
|
||||
@@ -662,7 +661,6 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
stage = stages[i];
|
||||
element = elements[i];
|
||||
distance = distances[i];
|
||||
direction = i;
|
||||
}
|
||||
}
|
||||
@@ -1039,7 +1037,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
private void _DrawInteraction(int interaction)
|
||||
{
|
||||
bool sel = false;
|
||||
bool sel;
|
||||
switch (_Interactions[interaction].Type)
|
||||
{
|
||||
case EType.Static:
|
||||
|
||||
@@ -385,7 +385,7 @@ namespace VocaluxeLib.Menu
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
|
||||
@@ -393,7 +393,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public EEditMode EditMode;
|
||||
public int ActivePlaylistID = -1;
|
||||
public int Offset = 0;
|
||||
public int Offset;
|
||||
public int CurrentPlaylistElement = -1;
|
||||
|
||||
private CPlaylistElement _ChangeOrderElement;
|
||||
@@ -249,15 +249,15 @@ namespace VocaluxeLib.Menu
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackground", ref _Theme.TextureBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundSelected", ref _Theme.SelTextureBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackground", out _Theme.TextureBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundSelected", out _Theme.SelTextureBackgroundName, 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);
|
||||
_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))
|
||||
if (xmlReader.GetValue(item + "/ColorBackground", out _Theme.ColorBackgroundName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, skinIndex, out BackgroundColor);
|
||||
else
|
||||
{
|
||||
@@ -266,7 +266,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundB", ref BackgroundColor.B);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A);
|
||||
}
|
||||
if (xmlReader.GetValue(item + "/SColorBackground", ref _Theme.SelColorBackgroundName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/SColorBackground", out _Theme.SelColorBackgroundName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorBackgroundName, skinIndex, out BackgroundSelColor);
|
||||
else
|
||||
{
|
||||
@@ -1227,7 +1227,7 @@ 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) + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number
|
||||
_PlaylistElements[i].SelectSlide.Clear();
|
||||
for (int g = 0; g < pec.Modes.Length; g++)
|
||||
{
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace VocaluxeLib.Menu
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Value", ref _Theme.Value, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Value", out _Theme.Value, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type);
|
||||
|
||||
if (_ThemeLoaded)
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
|
||||
public bool Visible = true;
|
||||
public bool Highlighted = false;
|
||||
public bool Highlighted;
|
||||
|
||||
private bool _ArrowLeftSelected;
|
||||
private bool _ArrowRightSelected;
|
||||
@@ -115,7 +115,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
private readonly List<SRectF> _ValueBounds = new List<SRectF>();
|
||||
|
||||
public bool WithTextures = false;
|
||||
public bool WithTextures;
|
||||
|
||||
private int _Selection = -1;
|
||||
public int Selection
|
||||
@@ -249,15 +249,15 @@ namespace VocaluxeLib.Menu
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeft", ref _Theme.TextureArrowLeftName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRight", ref _Theme.TextureArrowRightName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeft", out _Theme.TextureArrowLeftName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRight", out _Theme.TextureArrowRightName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", ref _Theme.SelTextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeftSelected", ref _Theme.SelTextureArrowLeftName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRightSelected", ref _Theme.SelTextureArrowRightName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", out _Theme.SelTextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeftSelected", out _Theme.SelTextureArrowLeftName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRightSelected", out _Theme.SelTextureArrowRightName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinHighlighted", ref _Theme.HighlightTextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinHighlighted", out _Theme.HighlightTextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
|
||||
@@ -265,7 +265,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
|
||||
else
|
||||
{
|
||||
@@ -275,7 +275,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor);
|
||||
else
|
||||
{
|
||||
@@ -285,7 +285,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/HColor", ref _Theme.HighlightColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/HColor", out _Theme.HighlightColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.HighlightColorName, skinIndex, out HighlightColor);
|
||||
else
|
||||
{
|
||||
@@ -307,7 +307,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightW", ref RectArrowRight.W);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/ArrowColor", ref _Theme.ArrowColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/ArrowColor", out _Theme.ArrowColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, skinIndex, out ColorArrow);
|
||||
else
|
||||
{
|
||||
@@ -317,7 +317,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowA", ref ColorArrow.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/ArrowSColor", ref _Theme.SelArrowColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/ArrowSColor", out _Theme.SelArrowColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelArrowColorName, skinIndex, out SelColorArrow);
|
||||
else
|
||||
{
|
||||
@@ -327,7 +327,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSA", ref SelColorArrow.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/TextColor", ref _Theme.TextColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/TextColor", out _Theme.TextColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, skinIndex, out TextColor);
|
||||
else
|
||||
{
|
||||
@@ -337,7 +337,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextA", ref TextColor.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/TextSColor", ref _Theme.SelTextColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/TextSColor", out _Theme.SelTextColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelTextColorName, skinIndex, out SelTextColor);
|
||||
else
|
||||
{
|
||||
@@ -353,7 +353,7 @@ namespace VocaluxeLib.Menu
|
||||
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.GetValue(item + "/TextFont", out _Theme.TextFont, "Normal");
|
||||
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/TextStyle", ref _Theme.TextStyle);
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetIntValue(item + "/NumVisible", ref _NumVisible);
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace VocaluxeLib.Menu
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y);
|
||||
@@ -156,7 +156,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
|
||||
else
|
||||
{
|
||||
@@ -268,8 +268,8 @@ namespace VocaluxeLib.Menu
|
||||
if (aspect != EAspect.Stretch)
|
||||
{
|
||||
RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
|
||||
RectangleF rect2 = new RectangleF(0f, 0f, texture.Width, texture.Height);
|
||||
CHelper.SetRect(bounds2, ref rect2, texture.Width / texture.Height, aspect);
|
||||
RectangleF rect2;
|
||||
CHelper.SetRect(bounds2, out rect2, texture.Width / texture.Height, aspect);
|
||||
|
||||
rect.X = rect2.X;
|
||||
rect.Y = rect2.Y;
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace VocaluxeLib.Menu
|
||||
public SColorF Color; //normal Color
|
||||
public SColorF SelColor; //selected Color for Buttons
|
||||
|
||||
public bool Reflection = false;
|
||||
public bool Reflection;
|
||||
public float ReflectionSpace;
|
||||
public float ReflectionHeight;
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selected = false;
|
||||
public bool Selected;
|
||||
public bool Visible = true;
|
||||
private bool _EditMode;
|
||||
public bool EditMode
|
||||
@@ -461,7 +461,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Height);
|
||||
xmlReader.TryGetFloatValue(item + "/MaxW", ref _MaxWidth);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
|
||||
else
|
||||
{
|
||||
@@ -471,7 +471,7 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
}
|
||||
|
||||
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor);
|
||||
else
|
||||
{
|
||||
@@ -486,9 +486,9 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Align", ref _Align);
|
||||
xmlReader.TryGetEnumValue(item + "/HAlign", ref _HAlign);
|
||||
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Style);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Font", ref _Font, "Normal");
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Font", out _Font, "Normal");
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Text", ref _Theme.Text, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/Text", out _Theme.Text, String.Empty);
|
||||
|
||||
if (xmlReader.ItemExists(item + "/Reflection") && !buttonText)
|
||||
{
|
||||
|
||||
@@ -62,8 +62,8 @@ namespace VocaluxeLib.Menu
|
||||
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)))
|
||||
string val;
|
||||
if (GetValue(cast, out val, Enum.GetName(typeof(T), value)))
|
||||
{
|
||||
CHelper.TryParse(val, out value, true);
|
||||
return true;
|
||||
@@ -73,8 +73,8 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public bool TryGetIntValue(string cast, ref int value)
|
||||
{
|
||||
string val = String.Empty;
|
||||
if (GetValue(cast, ref val, value.ToString()))
|
||||
string val;
|
||||
if (GetValue(cast, out val, value.ToString()))
|
||||
return int.TryParse(val, out value);
|
||||
return false;
|
||||
}
|
||||
@@ -94,37 +94,31 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public bool TryGetFloatValue(string cast, ref float value)
|
||||
{
|
||||
string val = String.Empty;
|
||||
if (GetValue(cast, ref val, value.ToString()))
|
||||
return CHelper.TryParse(val, out value);
|
||||
return false;
|
||||
string val;
|
||||
return GetValue(cast, out val, value.ToString()) && CHelper.TryParse(val, out value);
|
||||
}
|
||||
|
||||
public bool GetValue(string cast, ref string value, string defaultValue)
|
||||
public bool GetValue(string cast, out string value, string defaultValue)
|
||||
{
|
||||
XPathNodeIterator iterator;
|
||||
int results = 0;
|
||||
int resultCt = 0;
|
||||
string val = string.Empty;
|
||||
|
||||
_Navigator.MoveToFirstChild();
|
||||
iterator = _Navigator.Select(cast);
|
||||
XPathNodeIterator iterator = _Navigator.Select(cast);
|
||||
|
||||
while (iterator.MoveNext())
|
||||
{
|
||||
val = iterator.Current.Value;
|
||||
results++;
|
||||
resultCt++;
|
||||
}
|
||||
|
||||
if ((results == 0) || (results > 1))
|
||||
if (resultCt!=1)
|
||||
{
|
||||
value = defaultValue;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = val;
|
||||
return true;
|
||||
}
|
||||
value = val;
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<string> GetValues(string cast)
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace VocaluxeLib.Menu
|
||||
X32 = 32
|
||||
}
|
||||
|
||||
public enum EColorDeep
|
||||
public enum EColorDepth
|
||||
{
|
||||
Bit8 = 8,
|
||||
Bit16 = 16,
|
||||
@@ -136,6 +136,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public enum EBufferSize
|
||||
{
|
||||
// ReSharper disable UnusedMember.Global
|
||||
B0 = 0,
|
||||
B512 = 512,
|
||||
B1024 = 1024,
|
||||
@@ -145,6 +146,7 @@ namespace VocaluxeLib.Menu
|
||||
B3072 = 3072,
|
||||
B3584 = 3584,
|
||||
B4096 = 4096
|
||||
// ReSharper restore UnusedMember.Global
|
||||
}
|
||||
|
||||
public enum EPlaybackLib
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Menu.SingNotes;
|
||||
using VocaluxeLib.Menu.SongMenu;
|
||||
using VocaluxeLib.PartyModes;
|
||||
|
||||
@@ -273,7 +271,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
int Load(string videoFileName);
|
||||
bool Skip(int videoStream, float startPosition, float videoGap);
|
||||
bool GetFrame(int videoStream, ref STexture videoTexture, float time, ref float videoTime);
|
||||
bool GetFrame(int videoStream, ref STexture videoTexture, float time, out float videoTime);
|
||||
bool IsFinished(int videoStream);
|
||||
bool Close(int videoStream);
|
||||
}
|
||||
|
||||
@@ -258,10 +258,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
#region Methods
|
||||
public bool IsPerfect(CNote compareNote)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
if (!Hit)
|
||||
result = false;
|
||||
bool result = Hit;
|
||||
|
||||
if (StartBeat != compareNote.StartBeat)
|
||||
result = false;
|
||||
|
||||
@@ -100,17 +100,17 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinLeft", ref _Theme.SkinLeftName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinMiddle", ref _Theme.SkinMiddleName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinRight", ref _Theme.SkinRightName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinLeft", out _Theme.SkinLeftName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinMiddle", out _Theme.SkinMiddleName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinRight", out _Theme.SkinRightName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundLeft", ref _Theme.SkinBackgroundLeftName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundMiddle", ref _Theme.SkinBackgroundMiddleName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundRight", ref _Theme.SkinBackgroundRightName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundLeft", out _Theme.SkinBackgroundLeftName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundMiddle", out _Theme.SkinBackgroundMiddleName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundRight", out _Theme.SkinBackgroundRightName, String.Empty);
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinGoldenStar", ref _Theme.SkinGoldenStarName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", ref _Theme.SkinToneHelperName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", ref _Theme.SkinPerfectNoteStarName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinGoldenStar", out _Theme.SkinGoldenStarName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", out _Theme.SkinToneHelperName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStarName, String.Empty);
|
||||
|
||||
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
|
||||
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
|
||||
@@ -120,7 +120,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (player <= numplayer)
|
||||
{
|
||||
_BarPos[player, numplayer] = new SRectF();
|
||||
string target = "/BarPositions/P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString();
|
||||
string target = "/BarPositions/P" + (player + 1) + "N" + (numplayer + 1);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z);
|
||||
@@ -182,7 +182,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
{
|
||||
if (player <= numplayer)
|
||||
{
|
||||
string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString();
|
||||
string target = "P" + (player + 1) + "N" + (numplayer + 1);
|
||||
|
||||
writer.WriteElementString(target + "X", _BarPos[player, numplayer].X.ToString("#0"));
|
||||
writer.WriteElementString(target + "Y", _BarPos[player, numplayer].Y.ToString("#0"));
|
||||
|
||||
+217
-238
@@ -127,9 +127,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public SMedley Medley = new SMedley(0);
|
||||
|
||||
public bool CalculateMedley = true;
|
||||
public float PreviewStart = 0f;
|
||||
public float PreviewStart;
|
||||
|
||||
public int ShortEnd = 0;
|
||||
public int ShortEnd;
|
||||
|
||||
public Encoding Encoding = Encoding.Default;
|
||||
public string Folder = String.Empty;
|
||||
@@ -179,8 +179,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (_CoverBigLoaded)
|
||||
return _CoverTextureBig;
|
||||
else
|
||||
return _CoverTextureSmall;
|
||||
return _CoverTextureSmall;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -195,23 +194,23 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public string TitleSorting = String.Empty;
|
||||
public string ArtistSorting = String.Empty;
|
||||
|
||||
public float Start = 0f;
|
||||
public float Finish = 0f;
|
||||
public float Start;
|
||||
public float Finish;
|
||||
|
||||
public float BPM = 1f;
|
||||
public float Gap = 0f;
|
||||
public float VideoGap = 0f;
|
||||
public float Gap;
|
||||
public float VideoGap;
|
||||
|
||||
public string DuetPart1 = String.Empty;
|
||||
public string DuetPart2 = String.Empty;
|
||||
|
||||
public List<string> Comment = new List<string>();
|
||||
private readonly List<string> _Comment = new List<string>();
|
||||
|
||||
// Sorting
|
||||
public int ID;
|
||||
public bool Visible = true;
|
||||
public int CatIndex = -1;
|
||||
public bool Selected = false;
|
||||
private readonly bool _Visible = true;
|
||||
private readonly int _CatIndex = -1;
|
||||
private readonly bool _Selected;
|
||||
public bool IsDuet
|
||||
{
|
||||
get { return Notes.Lines.Length > 1; }
|
||||
@@ -297,14 +296,14 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
Gap = song.Gap;
|
||||
VideoGap = song.VideoGap;
|
||||
|
||||
Comment = new List<string>();
|
||||
foreach (string value in song.Comment)
|
||||
Comment.Add(value);
|
||||
_Comment = new List<string>();
|
||||
foreach (string value in song._Comment)
|
||||
_Comment.Add(value);
|
||||
|
||||
ID = song.ID;
|
||||
Visible = song.Visible;
|
||||
CatIndex = song.CatIndex;
|
||||
Selected = song.Selected;
|
||||
_Visible = song._Visible;
|
||||
_CatIndex = song._CatIndex;
|
||||
_Selected = song._Selected;
|
||||
|
||||
Edition = new List<string>();
|
||||
foreach (string value in song.Edition)
|
||||
@@ -339,23 +338,24 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
return false;
|
||||
|
||||
Folder = Path.GetDirectoryName(filePath);
|
||||
if (Folder == null)
|
||||
return false;
|
||||
|
||||
foreach (string folder in CBase.Config.GetSongFolder())
|
||||
{
|
||||
if (Folder.Contains(folder))
|
||||
if (!Folder.Contains(folder))
|
||||
continue;
|
||||
if (Folder.Length == folder.Length)
|
||||
FolderName = "Songs";
|
||||
else
|
||||
{
|
||||
if (Folder.Length == folder.Length)
|
||||
FolderName = "Songs";
|
||||
else
|
||||
{
|
||||
FolderName = Folder.Substring(folder.Length + 1, Folder.Length - folder.Length - 1);
|
||||
FolderName = Folder.Substring(folder.Length + 1, Folder.Length - folder.Length - 1);
|
||||
|
||||
int pos = FolderName.IndexOf("\\");
|
||||
if (pos >= 0)
|
||||
FolderName = FolderName.Substring(0, pos);
|
||||
}
|
||||
break;
|
||||
int pos = FolderName.IndexOf("\\", StringComparison.Ordinal);
|
||||
if (pos >= 0)
|
||||
FolderName = FolderName.Substring(0, pos);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
FileName = Path.GetFileName(filePath);
|
||||
@@ -366,184 +366,176 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
sr = new StreamReader(filePath, Encoding.Default, true);
|
||||
|
||||
string line;
|
||||
|
||||
int pos = -1;
|
||||
string identifier = String.Empty;
|
||||
string value = String.Empty;
|
||||
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
string line = sr.ReadLine();
|
||||
if (line.Length == 0)
|
||||
continue;
|
||||
if (!line[0].ToString().Equals("#"))
|
||||
break;
|
||||
|
||||
pos = line.IndexOf(":");
|
||||
int pos = line.IndexOf(":", StringComparison.Ordinal);
|
||||
|
||||
if (pos > 0)
|
||||
if (pos <= 0)
|
||||
continue;
|
||||
string identifier = line.Substring(1, pos - 1).Trim().ToUpper();
|
||||
string value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
||||
|
||||
if (value.Length > 0)
|
||||
{
|
||||
identifier = line.Substring(1, pos - 1).Trim().ToUpper();
|
||||
value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
|
||||
|
||||
if (value.Length > 0)
|
||||
switch (identifier)
|
||||
{
|
||||
switch (identifier)
|
||||
{
|
||||
case "ENCODING":
|
||||
Encoding = CEncoding.GetEncoding(value);
|
||||
sr.Dispose();
|
||||
sr = null;
|
||||
sr = new StreamReader(filePath, Encoding);
|
||||
identifier = String.Empty;
|
||||
case "ENCODING":
|
||||
Encoding = CEncoding.GetEncoding(value);
|
||||
sr.Dispose();
|
||||
sr = null;
|
||||
sr = new StreamReader(filePath, Encoding);
|
||||
|
||||
//Scip everything till encoding
|
||||
while (!sr.EndOfStream)
|
||||
//Scip everything till encoding
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
if (line.Length == 0)
|
||||
continue;
|
||||
if (!line[0].ToString().Equals("#"))
|
||||
break;
|
||||
|
||||
pos = line.IndexOf(":", StringComparison.Ordinal);
|
||||
|
||||
if (pos > 0)
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
if (line.Length == 0)
|
||||
continue;
|
||||
if (!line[0].ToString().Equals("#"))
|
||||
identifier = line.Substring(1, pos - 1).Trim().ToUpper();
|
||||
if (identifier == "ENCODING")
|
||||
break;
|
||||
|
||||
pos = line.IndexOf(":");
|
||||
|
||||
if (pos > 0)
|
||||
{
|
||||
identifier = line.Substring(1, pos - 1).Trim().ToUpper();
|
||||
if (identifier == "ENCODING")
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "TITLE":
|
||||
if (value.Length > 0)
|
||||
{
|
||||
Title = value;
|
||||
headerFlags |= EHeaderFlags.Title;
|
||||
}
|
||||
break;
|
||||
case "ARTIST":
|
||||
if (value.Length > 0)
|
||||
{
|
||||
Artist = value;
|
||||
headerFlags |= EHeaderFlags.Artist;
|
||||
}
|
||||
break;
|
||||
case "TITLE-ON-SORTING":
|
||||
if (value.Length > 0)
|
||||
TitleSorting = value;
|
||||
break;
|
||||
case "ARTIST-ON-SORTING":
|
||||
if (value.Length > 0)
|
||||
ArtistSorting = value;
|
||||
break;
|
||||
case "P1":
|
||||
if (value.Length > 0)
|
||||
DuetPart1 = value;
|
||||
break;
|
||||
case "P2":
|
||||
if (value.Length > 0)
|
||||
DuetPart2 = value;
|
||||
break;
|
||||
case "MP3":
|
||||
if (File.Exists(Path.Combine(Folder, value)))
|
||||
{
|
||||
MP3FileName = value;
|
||||
headerFlags |= EHeaderFlags.MP3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "TITLE":
|
||||
if (value.Length > 0)
|
||||
{
|
||||
Title = value;
|
||||
headerFlags |= EHeaderFlags.Title;
|
||||
}
|
||||
break;
|
||||
case "ARTIST":
|
||||
if (value.Length > 0)
|
||||
{
|
||||
Artist = value;
|
||||
headerFlags |= EHeaderFlags.Artist;
|
||||
}
|
||||
break;
|
||||
case "TITLE-ON-SORTING":
|
||||
if (value.Length > 0)
|
||||
TitleSorting = value;
|
||||
break;
|
||||
case "ARTIST-ON-SORTING":
|
||||
if (value.Length > 0)
|
||||
ArtistSorting = value;
|
||||
break;
|
||||
case "P1":
|
||||
if (value.Length > 0)
|
||||
DuetPart1 = value;
|
||||
break;
|
||||
case "P2":
|
||||
if (value.Length > 0)
|
||||
DuetPart2 = value;
|
||||
break;
|
||||
case "MP3":
|
||||
if (File.Exists(Path.Combine(Folder, value)))
|
||||
{
|
||||
MP3FileName = value;
|
||||
headerFlags |= EHeaderFlags.MP3;
|
||||
}
|
||||
else
|
||||
{
|
||||
CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, value));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "BPM":
|
||||
if (CHelper.TryParse(value, out BPM))
|
||||
{
|
||||
BPM *= 4;
|
||||
headerFlags |= EHeaderFlags.BPM;
|
||||
}
|
||||
break;
|
||||
case "EDITION":
|
||||
if (value.Length > 1)
|
||||
Edition.Add(value);
|
||||
break;
|
||||
case "GENRE":
|
||||
if (value.Length > 1)
|
||||
Genre.Add(value);
|
||||
break;
|
||||
case "YEAR":
|
||||
int num;
|
||||
if (value.Length == 4 && int.TryParse(value, out num) && num != 0)
|
||||
Year = value;
|
||||
break;
|
||||
case "LANGUAGE":
|
||||
if (value.Length > 1)
|
||||
Language.Add(value);
|
||||
break;
|
||||
case "COMMENT":
|
||||
if (value.Length > 1)
|
||||
_Comment.Add(value);
|
||||
break;
|
||||
case "GAP":
|
||||
if (CHelper.TryParse(value, out Gap))
|
||||
Gap /= 1000f;
|
||||
break;
|
||||
case "COVER":
|
||||
if (File.Exists(Path.Combine(Folder, value)))
|
||||
CoverFileName = value;
|
||||
break;
|
||||
case "BACKGROUND":
|
||||
if (File.Exists(Path.Combine(Folder, value)))
|
||||
BackgroundFileName = value;
|
||||
break;
|
||||
case "VIDEO":
|
||||
if (File.Exists(Path.Combine(Folder, value)))
|
||||
VideoFileName = value;
|
||||
else
|
||||
CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, value));
|
||||
break;
|
||||
case "VIDEOGAP":
|
||||
CHelper.TryParse(value, out VideoGap);
|
||||
break;
|
||||
case "VIDEOASPECT":
|
||||
CHelper.TryParse(value, out VideoAspect, true);
|
||||
break;
|
||||
case "START":
|
||||
CHelper.TryParse(value, out Start);
|
||||
break;
|
||||
case "END":
|
||||
if (CHelper.TryParse(value, out Finish))
|
||||
Finish /= 1000f;
|
||||
break;
|
||||
case "PREVIEWSTART":
|
||||
if (CHelper.TryParse(value, out PreviewStart))
|
||||
{
|
||||
if (PreviewStart < 0f)
|
||||
PreviewStart = 0f;
|
||||
else
|
||||
{
|
||||
CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, value));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "BPM":
|
||||
if (CHelper.TryParse(value, out BPM))
|
||||
{
|
||||
BPM *= 4;
|
||||
headerFlags |= EHeaderFlags.BPM;
|
||||
}
|
||||
break;
|
||||
case "EDITION":
|
||||
if (value.Length > 1)
|
||||
Edition.Add(value);
|
||||
break;
|
||||
case "GENRE":
|
||||
if (value.Length > 1)
|
||||
Genre.Add(value);
|
||||
break;
|
||||
case "YEAR":
|
||||
int num = 0;
|
||||
if (value.Length == 4 && int.TryParse(value, out num) && num != 0)
|
||||
Year = value;
|
||||
break;
|
||||
case "LANGUAGE":
|
||||
if (value.Length > 1)
|
||||
Language.Add(value);
|
||||
break;
|
||||
case "COMMENT":
|
||||
if (value.Length > 1)
|
||||
Comment.Add(value);
|
||||
break;
|
||||
case "GAP":
|
||||
if (CHelper.TryParse(value, out Gap))
|
||||
Gap /= 1000f;
|
||||
break;
|
||||
case "COVER":
|
||||
if (File.Exists(Path.Combine(Folder, value)))
|
||||
CoverFileName = value;
|
||||
break;
|
||||
case "BACKGROUND":
|
||||
if (File.Exists(Path.Combine(Folder, value)))
|
||||
BackgroundFileName = value;
|
||||
break;
|
||||
case "VIDEO":
|
||||
if (File.Exists(Path.Combine(Folder, value)))
|
||||
VideoFileName = value;
|
||||
else
|
||||
CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, value));
|
||||
break;
|
||||
case "VIDEOGAP":
|
||||
CHelper.TryParse(value, out VideoGap);
|
||||
break;
|
||||
case "VIDEOASPECT":
|
||||
CHelper.TryParse(value, out VideoAspect, true);
|
||||
break;
|
||||
case "START":
|
||||
CHelper.TryParse(value, out Start);
|
||||
break;
|
||||
case "END":
|
||||
if (CHelper.TryParse(value, out Finish))
|
||||
Finish /= 1000f;
|
||||
break;
|
||||
case "PREVIEWSTART":
|
||||
if (CHelper.TryParse(value, out PreviewStart))
|
||||
{
|
||||
if (PreviewStart < 0f)
|
||||
PreviewStart = 0f;
|
||||
else
|
||||
headerFlags |= EHeaderFlags.PreviewStart;
|
||||
}
|
||||
break;
|
||||
case "MEDLEYSTARTBEAT":
|
||||
if (int.TryParse(value, out Medley.StartBeat))
|
||||
headerFlags |= EHeaderFlags.MedleyStartBeat;
|
||||
break;
|
||||
case "MEDLEYENDBEAT":
|
||||
if (int.TryParse(value, out Medley.EndBeat))
|
||||
headerFlags |= EHeaderFlags.MedleyEndBeat;
|
||||
break;
|
||||
case "CALCMEDLEY":
|
||||
if (value.ToUpper() == "OFF")
|
||||
CalculateMedley = false;
|
||||
break;
|
||||
case "RELATIVE":
|
||||
if (value.ToUpper() == "YES" && value.ToUpper() != "NO")
|
||||
Relative = EOffOn.TR_CONFIG_ON;
|
||||
break;
|
||||
}
|
||||
headerFlags |= EHeaderFlags.PreviewStart;
|
||||
}
|
||||
break;
|
||||
case "MEDLEYSTARTBEAT":
|
||||
if (int.TryParse(value, out Medley.StartBeat))
|
||||
headerFlags |= EHeaderFlags.MedleyStartBeat;
|
||||
break;
|
||||
case "MEDLEYENDBEAT":
|
||||
if (int.TryParse(value, out Medley.EndBeat))
|
||||
headerFlags |= EHeaderFlags.MedleyEndBeat;
|
||||
break;
|
||||
case "CALCMEDLEY":
|
||||
if (value.ToUpper() == "OFF")
|
||||
CalculateMedley = false;
|
||||
break;
|
||||
case "RELATIVE":
|
||||
if (value.ToUpper() == "YES" && value.ToUpper() != "NO")
|
||||
Relative = EOffOn.TR_CONFIG_ON;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} //end of while
|
||||
@@ -589,15 +581,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
}
|
||||
|
||||
if ((headerFlags & EHeaderFlags.PreviewStart) == 0 || PreviewStart == 0f)
|
||||
if ((headerFlags & EHeaderFlags.PreviewStart) == 0 || Math.Abs(PreviewStart) < float.Epsilon)
|
||||
{
|
||||
//PreviewStart is not set or <=0
|
||||
if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0)
|
||||
//fallback to MedleyStart
|
||||
PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM);
|
||||
else
|
||||
//else set to 0, it will be set in FindRefrainStart
|
||||
PreviewStart = 0f;
|
||||
PreviewStart = (headerFlags & EHeaderFlags.MedleyStartBeat) != 0 ? CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) : 0f;
|
||||
}
|
||||
|
||||
if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0 && (headerFlags & EHeaderFlags.MedleyEndBeat) != 0)
|
||||
@@ -648,14 +635,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
|
||||
char tempC = char.MinValue;
|
||||
int param1 = 0;
|
||||
int param2 = 0;
|
||||
int param3 = 0;
|
||||
int currentPos = 0;
|
||||
string paramS = String.Empty;
|
||||
bool isNewSentence = false;
|
||||
|
||||
string line = String.Empty;
|
||||
int player = 0;
|
||||
int fileLineNo = 0;
|
||||
|
||||
@@ -669,7 +651,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
//Search for Note Beginning
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
sr.ReadLine();
|
||||
fileLineNo++;
|
||||
|
||||
tempC = (char)sr.Peek();
|
||||
@@ -684,16 +666,18 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
if (sr.EndOfStream)
|
||||
{
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". No lyrics/notes found: " + filePath);
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". No lyrics/notes found: " + filePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
char chr;
|
||||
int param2;
|
||||
int param1;
|
||||
switch (tempC)
|
||||
{
|
||||
case 'P':
|
||||
char chr;
|
||||
while ((chr = (char)sr.Read()) == ' ') {}
|
||||
|
||||
int.TryParse(chr.ToString(), out param1);
|
||||
@@ -705,7 +689,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
player = 2;
|
||||
else
|
||||
{
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Wrong or missing number after \"P\": " + filePath);
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". Wrong or missing number after \"P\": " + filePath);
|
||||
return false;
|
||||
}
|
||||
sr.ReadLine();
|
||||
@@ -720,10 +704,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
param2 = CHelper.TryReadInt(sr);
|
||||
|
||||
sr.Read();
|
||||
param3 = CHelper.TryReadInt(sr);
|
||||
int param3 = CHelper.TryReadInt(sr);
|
||||
|
||||
sr.Read();
|
||||
paramS = sr.ReadLine();
|
||||
string paramS = sr.ReadLine();
|
||||
|
||||
ENoteType noteType;
|
||||
|
||||
@@ -751,7 +735,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
case '-':
|
||||
if (isNewSentence)
|
||||
{
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Double sentence break: " + filePath);
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". Double sentence break: " + filePath);
|
||||
return false;
|
||||
}
|
||||
sr.Read();
|
||||
@@ -779,10 +763,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
sr.ReadLine();
|
||||
break;
|
||||
default:
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Unexpected or missing character (" + tempC + "): " + filePath);
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". Unexpected or missing character (" + tempC + "): " + filePath);
|
||||
return false;
|
||||
}
|
||||
int c = 0;
|
||||
int c;
|
||||
do
|
||||
{
|
||||
c = sr.Read();
|
||||
@@ -796,7 +780,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + filePath);
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". An unhandled exception occured (" + e.Message + "): " + filePath);
|
||||
if (sr != null)
|
||||
sr.Dispose();
|
||||
return false;
|
||||
@@ -919,29 +903,26 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
for (int j = i + 1; j < lines.LineCount; j++)
|
||||
{
|
||||
if (sentences[i] == sentences[j] && sentences[i].Length > 0)
|
||||
if (sentences[i] != sentences[j] || sentences[i] == "")
|
||||
continue;
|
||||
SSeries tempSeries = new SSeries {Start = i, End = i};
|
||||
|
||||
int max;
|
||||
if (j + j - i > lines.LineCount)
|
||||
max = lines.LineCount - 1 - j;
|
||||
else
|
||||
max = j - i - 1;
|
||||
|
||||
for (int k = 1; k <= max; k++)
|
||||
{
|
||||
SSeries tempSeries = new SSeries();
|
||||
tempSeries.Start = i;
|
||||
tempSeries.End = i;
|
||||
|
||||
int max = 0;
|
||||
if (j + j - i - 1 > lines.LineCount - 1)
|
||||
max = lines.LineCount - 1 - j;
|
||||
if (sentences[i + k] == sentences[j + k] && sentences[i + k]!="")
|
||||
tempSeries.End = i + k;
|
||||
else
|
||||
max = j - i - 1;
|
||||
|
||||
for (int k = 1; k <= max; k++)
|
||||
{
|
||||
if (sentences[i + k] == sentences[j + k] && sentences[i + k].Length > 0)
|
||||
tempSeries.End = i + k;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
tempSeries.Length = tempSeries.End - tempSeries.Start + 1;
|
||||
series.Add(tempSeries);
|
||||
break;
|
||||
}
|
||||
|
||||
tempSeries.Length = tempSeries.End - tempSeries.Start + 1;
|
||||
series.Add(tempSeries);
|
||||
}
|
||||
}
|
||||
return series;
|
||||
@@ -981,12 +962,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
Medley.StartBeat = lines.Line[series[longest].Start].FirstNoteBeat;
|
||||
Medley.EndBeat = lines.Line[series[longest].End].LastNoteBeat;
|
||||
|
||||
bool foundEnd = false;
|
||||
bool foundEnd = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
|
||||
CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM);
|
||||
|
||||
// set end if duration > MedleyMinDuration
|
||||
if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
|
||||
CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM))
|
||||
foundEnd = true;
|
||||
|
||||
if (!foundEnd)
|
||||
{
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public CSongMenuDreidel(int partyModeID)
|
||||
: base(partyModeID) {}
|
||||
|
||||
// ReSharper disable RedundantOverridenMember
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -58,5 +59,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_SongLength = _Theme.songMenuDreidel.TextSongLength;
|
||||
**/
|
||||
}
|
||||
// ReSharper restore RedundantOverridenMember
|
||||
}
|
||||
}
|
||||
@@ -112,19 +112,19 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private int _Actsongstream = -1;
|
||||
protected STexture _Vidtex = new STexture(-1);
|
||||
|
||||
protected bool _Initialized = false;
|
||||
protected int _LastKnownNumSongs = 0;
|
||||
protected bool _Initialized;
|
||||
protected int _LastKnownNumSongs;
|
||||
protected int _LastKnownCategory = -1;
|
||||
|
||||
protected SRectF _Rect = new SRectF();
|
||||
protected SColorF _Color = new SColorF();
|
||||
protected SRectF _Rect;
|
||||
protected SColorF _Color;
|
||||
|
||||
private int _SelectedInternal = -1;
|
||||
private int _SelectedPending = -1;
|
||||
protected long _PendingTime = 500L;
|
||||
|
||||
private int _LockedInternal = -1;
|
||||
protected bool _Active = false;
|
||||
protected bool _Active;
|
||||
|
||||
protected float _MaxVolume = 100f;
|
||||
|
||||
@@ -269,14 +269,14 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
string item = xmlPath + "/" + elementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/CoverBackground", ref _Theme.CoverBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/CoverBigBackground", ref _Theme.CoverBigBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/DuetIcon", ref _Theme.DuetIconName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/VideoIcon", ref _Theme.VideoIconName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyCalcIcon", ref _Theme.MedleyCalcIcon, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", ref _Theme.MedleyTagIcon, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/CoverBackground", out _Theme.CoverBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/CoverBigBackground", out _Theme.CoverBigBackgroundName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/DuetIcon", out _Theme.DuetIconName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/VideoIcon", out _Theme.VideoIconName, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyCalcIcon", out _Theme.MedleyCalcIcon, String.Empty);
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", out _Theme.MedleyTagIcon, String.Empty);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _Color);
|
||||
else
|
||||
{
|
||||
@@ -453,8 +453,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
float time = CBase.Sound.GetPosition(_Actsongstream);
|
||||
|
||||
float vtime = 0f;
|
||||
CBase.Video.GetFrame(_Video, ref _Vidtex, time, ref vtime);
|
||||
float vtime;
|
||||
CBase.Video.GetFrame(_Video, ref _Vidtex, time, out vtime);
|
||||
if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L)
|
||||
_Vidtex.Color.A = _VideoFadeTimer.ElapsedMilliseconds / 3000f;
|
||||
else
|
||||
@@ -489,14 +489,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void Draw()
|
||||
@@ -543,20 +539,14 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public virtual void SetSelectedSong(int visibleSongNr)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void SetSelectedCategory(int categoryNr)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual void SetSmallView(bool smallView)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
}
|
||||
|
||||
public virtual bool IsSmallView()
|
||||
|
||||
@@ -463,7 +463,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_CoverBig.Draw(1f, EAspect.Crop);
|
||||
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
|
||||
RectangleF rect = new RectangleF(0f, 0f, _Vidtex.Width, _Vidtex.Height);
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
|
||||
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
|
||||
SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
|
||||
|
||||
|
||||
Reference in new issue
Block a user