Auto cleanup of VocaluxeLib
This commit is contained in:
1 parent
b497b58740
commit
efab579188
37 files changed
+642
-1155
No files matched your search
+186
-216
@@ -31,7 +31,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public string Name = String.Empty;
|
||||
private STexture _CoverTextureSmall = new STexture(-1);
|
||||
private STexture _CoverTextureBig = new STexture(-1);
|
||||
private bool _CoverBigLoaded = false;
|
||||
private bool _CoverBigLoaded;
|
||||
|
||||
public CCategory(string name)
|
||||
{
|
||||
@@ -42,10 +42,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
get { return _CoverTextureSmall; }
|
||||
|
||||
set
|
||||
{
|
||||
_CoverTextureSmall = value;
|
||||
}
|
||||
set { _CoverTextureSmall = value; }
|
||||
}
|
||||
|
||||
public STexture CoverTextureBig
|
||||
@@ -102,9 +99,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public class CSong
|
||||
{
|
||||
private bool _CoverSmallLoaded = false;
|
||||
private bool _CoverBigLoaded = false;
|
||||
private bool _NotesLoaded = false;
|
||||
private bool _CoverSmallLoaded;
|
||||
private bool _CoverBigLoaded;
|
||||
private bool _NotesLoaded;
|
||||
private STexture _CoverTextureSmall = new STexture(-1);
|
||||
private STexture _CoverTextureBig = new STexture(-1);
|
||||
|
||||
@@ -146,9 +143,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
get
|
||||
{
|
||||
if (!_CoverSmallLoaded)
|
||||
{
|
||||
LoadSmallCover();
|
||||
}
|
||||
return _CoverTextureSmall;
|
||||
}
|
||||
|
||||
@@ -165,10 +160,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (_CoverBigLoaded)
|
||||
return _CoverTextureBig;
|
||||
else
|
||||
else
|
||||
return _CoverTextureSmall;
|
||||
}
|
||||
set {
|
||||
set
|
||||
{
|
||||
_CoverTextureBig = value;
|
||||
_CoverBigLoaded = true;
|
||||
}
|
||||
@@ -182,7 +178,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public float Start = 0f;
|
||||
public float Finish = 0f;
|
||||
|
||||
|
||||
public float BPM = 1f;
|
||||
public float Gap = 0f;
|
||||
public float VideoGap = 0f;
|
||||
@@ -213,7 +209,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public EGameMode[] AvailableGameModes
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
List<EGameMode> gms = new List<EGameMode>();
|
||||
if (IsDuet)
|
||||
@@ -229,9 +225,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
|
||||
//No point creating a song without a text file --> Use factory method LoadSong
|
||||
private CSong()
|
||||
{
|
||||
}
|
||||
private CSong() {}
|
||||
|
||||
public static CSong LoadSong(string FilePath)
|
||||
{
|
||||
@@ -243,81 +237,73 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public CSong(CSong song)
|
||||
{
|
||||
this._CoverTextureSmall = song._CoverTextureSmall;
|
||||
this._CoverTextureBig = song._CoverTextureBig;
|
||||
_CoverTextureSmall = song._CoverTextureSmall;
|
||||
_CoverTextureBig = song._CoverTextureBig;
|
||||
|
||||
this.Medley = new SMedley();
|
||||
this.Medley.Source = song.Medley.Source;
|
||||
this.Medley.StartBeat = song.Medley.StartBeat;
|
||||
this.Medley.EndBeat = song.Medley.EndBeat;
|
||||
this.Medley.FadeInTime = song.Medley.FadeInTime;
|
||||
this.Medley.FadeOutTime = song.Medley.FadeOutTime;
|
||||
Medley = new SMedley();
|
||||
Medley.Source = song.Medley.Source;
|
||||
Medley.StartBeat = song.Medley.StartBeat;
|
||||
Medley.EndBeat = song.Medley.EndBeat;
|
||||
Medley.FadeInTime = song.Medley.FadeInTime;
|
||||
Medley.FadeOutTime = song.Medley.FadeOutTime;
|
||||
|
||||
this.CalculateMedley = song.CalculateMedley;
|
||||
this.PreviewStart = song.PreviewStart;
|
||||
CalculateMedley = song.CalculateMedley;
|
||||
PreviewStart = song.PreviewStart;
|
||||
|
||||
this.ShortEnd = song.ShortEnd;
|
||||
this.DuetPart1 = song.DuetPart1;
|
||||
this.DuetPart2 = song.DuetPart2;
|
||||
ShortEnd = song.ShortEnd;
|
||||
DuetPart1 = song.DuetPart1;
|
||||
DuetPart2 = song.DuetPart2;
|
||||
|
||||
this.Encoding = song.Encoding;
|
||||
this.Folder = song.Folder;
|
||||
this.FolderName = song.FolderName;
|
||||
this.FileName = song.FileName;
|
||||
this.Relative = song.Relative;
|
||||
Encoding = song.Encoding;
|
||||
Folder = song.Folder;
|
||||
FolderName = song.FolderName;
|
||||
FileName = song.FileName;
|
||||
Relative = song.Relative;
|
||||
|
||||
this.MP3FileName = song.MP3FileName;
|
||||
this.CoverFileName = song.CoverFileName;
|
||||
this.BackgroundFileName = song.BackgroundFileName;
|
||||
this.VideoFileName = song.VideoFileName;
|
||||
MP3FileName = song.MP3FileName;
|
||||
CoverFileName = song.CoverFileName;
|
||||
BackgroundFileName = song.BackgroundFileName;
|
||||
VideoFileName = song.VideoFileName;
|
||||
|
||||
this.VideoAspect = song.VideoAspect;
|
||||
this._CoverSmallLoaded = song._CoverSmallLoaded;
|
||||
this._CoverBigLoaded = song._CoverBigLoaded;
|
||||
this._NotesLoaded = song._NotesLoaded;
|
||||
VideoAspect = song.VideoAspect;
|
||||
_CoverSmallLoaded = song._CoverSmallLoaded;
|
||||
_CoverBigLoaded = song._CoverBigLoaded;
|
||||
_NotesLoaded = song._NotesLoaded;
|
||||
|
||||
this.Artist = song.Artist;
|
||||
this.Title = song.Title;
|
||||
|
||||
this.Start = song.Start;
|
||||
this.Finish = song.Finish;
|
||||
Artist = song.Artist;
|
||||
Title = song.Title;
|
||||
|
||||
this.BPM = song.BPM;
|
||||
this.Gap = song.Gap;
|
||||
this.VideoGap = song.VideoGap;
|
||||
Start = song.Start;
|
||||
Finish = song.Finish;
|
||||
|
||||
this.Comment = new List<string>();
|
||||
BPM = song.BPM;
|
||||
Gap = song.Gap;
|
||||
VideoGap = song.VideoGap;
|
||||
|
||||
Comment = new List<string>();
|
||||
foreach (string value in song.Comment)
|
||||
{
|
||||
this.Comment.Add(value);
|
||||
}
|
||||
Comment.Add(value);
|
||||
|
||||
this.ID = song.ID;
|
||||
this.Visible = song.Visible;
|
||||
this.CatIndex = song.CatIndex;
|
||||
this.Selected = song.Selected;
|
||||
ID = song.ID;
|
||||
Visible = song.Visible;
|
||||
CatIndex = song.CatIndex;
|
||||
Selected = song.Selected;
|
||||
|
||||
this.Edition = new List<string>();
|
||||
Edition = new List<string>();
|
||||
foreach (string value in song.Edition)
|
||||
{
|
||||
this.Edition.Add(value);
|
||||
}
|
||||
Edition.Add(value);
|
||||
|
||||
this.Genre = new List<string>();
|
||||
Genre = new List<string>();
|
||||
foreach (string value in song.Genre)
|
||||
{
|
||||
this.Genre.Add(value);
|
||||
}
|
||||
Genre.Add(value);
|
||||
|
||||
this.Year = song.Year;
|
||||
Year = song.Year;
|
||||
|
||||
this.Language = new List<string>();
|
||||
Language = new List<string>();
|
||||
foreach (string value in song.Language)
|
||||
{
|
||||
this.Language.Add(value);
|
||||
}
|
||||
Language.Add(value);
|
||||
|
||||
this.Notes = new CNotes(song.Notes);
|
||||
Notes = new CNotes(song.Notes);
|
||||
}
|
||||
|
||||
public string GetMP3()
|
||||
@@ -335,33 +321,32 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (!File.Exists(FilePath))
|
||||
return false;
|
||||
|
||||
this.Folder = Path.GetDirectoryName(FilePath);
|
||||
Folder = Path.GetDirectoryName(FilePath);
|
||||
|
||||
foreach (string folder in CBase.Config.GetSongFolder())
|
||||
{
|
||||
if (this.Folder.Contains(folder))
|
||||
if (Folder.Contains(folder))
|
||||
{
|
||||
if (this.Folder.Length == folder.Length)
|
||||
this.FolderName = "Songs";
|
||||
if (Folder.Length == folder.Length)
|
||||
FolderName = "Songs";
|
||||
else
|
||||
{
|
||||
this.FolderName = this.Folder.Substring(folder.Length + 1, this.Folder.Length - folder.Length - 1);
|
||||
FolderName = Folder.Substring(folder.Length + 1, Folder.Length - folder.Length - 1);
|
||||
|
||||
int pos = this.FolderName.IndexOf("\\");
|
||||
int pos = FolderName.IndexOf("\\");
|
||||
if (pos >= 0)
|
||||
this.FolderName = this.FolderName.Substring(0, pos);
|
||||
FolderName = FolderName.Substring(0, pos);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.FileName = Path.GetFileName(FilePath);
|
||||
FileName = Path.GetFileName(FilePath);
|
||||
|
||||
EHeaderFlags HeaderFlags = new EHeaderFlags();
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
|
||||
sr = new StreamReader(FilePath, Encoding.Default, true);
|
||||
|
||||
string line;
|
||||
@@ -375,7 +360,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
line = sr.ReadLine();
|
||||
if (line.Length == 0)
|
||||
continue;
|
||||
if (!line[0].ToString().Equals("#")) break;
|
||||
if (!line[0].ToString().Equals("#"))
|
||||
break;
|
||||
|
||||
pos = line.IndexOf(":");
|
||||
|
||||
@@ -389,10 +375,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
switch (Identifier)
|
||||
{
|
||||
case "ENCODING":
|
||||
this.Encoding = CEncoding.GetEncoding(Value);
|
||||
Encoding = CEncoding.GetEncoding(Value);
|
||||
sr.Dispose();
|
||||
sr = null;
|
||||
sr = new StreamReader(FilePath, this.Encoding);
|
||||
sr = new StreamReader(FilePath, Encoding);
|
||||
Identifier = String.Empty;
|
||||
|
||||
//Scip everything till encoding
|
||||
@@ -401,7 +387,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
line = sr.ReadLine();
|
||||
if (line.Length == 0)
|
||||
continue;
|
||||
if (!line[0].ToString().Equals("#")) break;
|
||||
if (!line[0].ToString().Equals("#"))
|
||||
break;
|
||||
|
||||
pos = line.IndexOf(":");
|
||||
|
||||
@@ -416,136 +403,128 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
case "TITLE":
|
||||
if (Value.Length > 0)
|
||||
{
|
||||
this.Title = Value;
|
||||
Title = Value;
|
||||
HeaderFlags |= EHeaderFlags.Title;
|
||||
}
|
||||
break;
|
||||
case "ARTIST":
|
||||
if (Value.Length > 0)
|
||||
{
|
||||
this.Artist = Value;
|
||||
Artist = Value;
|
||||
HeaderFlags |= EHeaderFlags.Artist;
|
||||
}
|
||||
break;
|
||||
case "TITLE-ON-SORTING":
|
||||
if (Value.Length > 0)
|
||||
{
|
||||
this.TitleSorting = Value;
|
||||
}
|
||||
TitleSorting = Value;
|
||||
break;
|
||||
case "ARTIST-ON-SORTING":
|
||||
if (Value.Length > 0)
|
||||
{
|
||||
this.ArtistSorting = Value;
|
||||
}
|
||||
ArtistSorting = Value;
|
||||
break;
|
||||
case "P1":
|
||||
if (Value.Length > 0)
|
||||
{
|
||||
this.DuetPart1 = Value;
|
||||
}
|
||||
DuetPart1 = Value;
|
||||
break;
|
||||
case "P2":
|
||||
if (Value.Length > 0)
|
||||
{
|
||||
this.DuetPart2 = Value;
|
||||
}
|
||||
DuetPart2 = Value;
|
||||
break;
|
||||
case "MP3":
|
||||
if (File.Exists(Path.Combine(this.Folder, Value)))
|
||||
if (File.Exists(Path.Combine(Folder, Value)))
|
||||
{
|
||||
this.MP3FileName = Value;
|
||||
MP3FileName = Value;
|
||||
HeaderFlags |= EHeaderFlags.MP3;
|
||||
}
|
||||
else
|
||||
{
|
||||
CBase.Log.LogError("Can't find audio file: " + Path.Combine(this.Folder, Value));
|
||||
CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, Value));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "BPM":
|
||||
if (CHelper.TryParse(Value, out this.BPM))
|
||||
if (CHelper.TryParse(Value, out BPM))
|
||||
{
|
||||
this.BPM *= 4;
|
||||
BPM *= 4;
|
||||
HeaderFlags |= EHeaderFlags.BPM;
|
||||
}
|
||||
break;
|
||||
case "EDITION":
|
||||
if (Value.Length > 1)
|
||||
this.Edition.Add(Value);
|
||||
Edition.Add(Value);
|
||||
break;
|
||||
case "GENRE":
|
||||
if (Value.Length > 1)
|
||||
this.Genre.Add(Value);
|
||||
Genre.Add(Value);
|
||||
break;
|
||||
case "YEAR":
|
||||
int num = 0;
|
||||
if (Value.Length == 4 && int.TryParse(Value, out num) && num != 0)
|
||||
{
|
||||
this.Year = Value;
|
||||
}
|
||||
Year = Value;
|
||||
break;
|
||||
case "LANGUAGE":
|
||||
if (Value.Length > 1)
|
||||
this.Language.Add(Value);
|
||||
Language.Add(Value);
|
||||
break;
|
||||
case "COMMENT":
|
||||
if (Value.Length > 1)
|
||||
this.Comment.Add(Value);
|
||||
Comment.Add(Value);
|
||||
break;
|
||||
case "GAP":
|
||||
if (CHelper.TryParse(Value, out this.Gap))
|
||||
this.Gap /= 1000f;
|
||||
if (CHelper.TryParse(Value, out Gap))
|
||||
Gap /= 1000f;
|
||||
break;
|
||||
case "COVER":
|
||||
if (File.Exists(Path.Combine(this.Folder, Value)))
|
||||
this.CoverFileName = Value;
|
||||
if (File.Exists(Path.Combine(Folder, Value)))
|
||||
CoverFileName = Value;
|
||||
break;
|
||||
case "BACKGROUND":
|
||||
if (File.Exists(Path.Combine(this.Folder, Value)))
|
||||
this.BackgroundFileName = Value;
|
||||
if (File.Exists(Path.Combine(Folder, Value)))
|
||||
BackgroundFileName = Value;
|
||||
break;
|
||||
case "VIDEO":
|
||||
if (File.Exists(Path.Combine(this.Folder, Value)))
|
||||
this.VideoFileName = Value;
|
||||
if (File.Exists(Path.Combine(Folder, Value)))
|
||||
VideoFileName = Value;
|
||||
else
|
||||
CBase.Log.LogError("Can't find video file: " + Path.Combine(this.Folder, Value));
|
||||
CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, Value));
|
||||
break;
|
||||
case "VIDEOGAP":
|
||||
CHelper.TryParse(Value, out this.VideoGap);
|
||||
CHelper.TryParse(Value, out VideoGap);
|
||||
break;
|
||||
case "VIDEOASPECT":
|
||||
CHelper.TryParse<EAspect>(Value, out this.VideoAspect, true);
|
||||
CHelper.TryParse(Value, out VideoAspect, true);
|
||||
break;
|
||||
case "START":
|
||||
CHelper.TryParse(Value, out this.Start);
|
||||
CHelper.TryParse(Value, out Start);
|
||||
break;
|
||||
case "END":
|
||||
if (CHelper.TryParse(Value, out this.Finish))
|
||||
this.Finish /= 1000f;
|
||||
if (CHelper.TryParse(Value, out Finish))
|
||||
Finish /= 1000f;
|
||||
break;
|
||||
case "PREVIEWSTART":
|
||||
if (CHelper.TryParse(Value, out this.PreviewStart))
|
||||
if (this.PreviewStart < 0f)
|
||||
this.PreviewStart = 0f;
|
||||
if (CHelper.TryParse(Value, out PreviewStart))
|
||||
{
|
||||
if (PreviewStart < 0f)
|
||||
PreviewStart = 0f;
|
||||
else
|
||||
HeaderFlags |= EHeaderFlags.PreviewStart;
|
||||
}
|
||||
break;
|
||||
case "MEDLEYSTARTBEAT":
|
||||
if (int.TryParse(Value, out this.Medley.StartBeat))
|
||||
if (int.TryParse(Value, out Medley.StartBeat))
|
||||
HeaderFlags |= EHeaderFlags.MedleyStartBeat;
|
||||
break;
|
||||
case "MEDLEYENDBEAT":
|
||||
if (int.TryParse(Value, out this.Medley.EndBeat))
|
||||
if (int.TryParse(Value, out Medley.EndBeat))
|
||||
HeaderFlags |= EHeaderFlags.MedleyEndBeat;
|
||||
break;
|
||||
case "CALCMEDLEY":
|
||||
if (Value.ToUpper() == "OFF")
|
||||
this.CalculateMedley = false;
|
||||
CalculateMedley = false;
|
||||
break;
|
||||
case "RELATIVE":
|
||||
if (Value.ToUpper() == "YES" && Value.ToUpper() != "NO")
|
||||
this.Relative = EOffOn.TR_CONFIG_ON;
|
||||
Relative = EOffOn.TR_CONFIG_ON;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -586,33 +565,33 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
#region check medley tags
|
||||
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0)
|
||||
{
|
||||
if (this.Medley.StartBeat > this.Medley.EndBeat)
|
||||
if (Medley.StartBeat > Medley.EndBeat)
|
||||
{
|
||||
CBase.Log.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath);
|
||||
HeaderFlags = HeaderFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat;
|
||||
}
|
||||
}
|
||||
|
||||
if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || this.PreviewStart == 0f)
|
||||
if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || PreviewStart == 0f)
|
||||
{
|
||||
//PreviewStart is not set or <=0
|
||||
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0)
|
||||
//fallback to MedleyStart
|
||||
this.PreviewStart = CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM);
|
||||
PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM);
|
||||
else
|
||||
//else set to 0, it will be set in FindRefrainStart
|
||||
this.PreviewStart = 0f;
|
||||
PreviewStart = 0f;
|
||||
}
|
||||
|
||||
if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0)
|
||||
{
|
||||
this.Medley.Source = EMedleySource.Tag;
|
||||
this.Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
|
||||
this.Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
|
||||
Medley.Source = EMedleySource.Tag;
|
||||
Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
|
||||
Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
|
||||
}
|
||||
#endregion check medley tags
|
||||
|
||||
this.Encoding = sr.CurrentEncoding;
|
||||
Encoding = sr.CurrentEncoding;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -625,24 +604,21 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
CheckFiles();
|
||||
|
||||
//Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag.
|
||||
if (this.ArtistSorting.Length == 0)
|
||||
{
|
||||
this.ArtistSorting = this.Artist;
|
||||
}
|
||||
if (ArtistSorting.Length == 0)
|
||||
ArtistSorting = Artist;
|
||||
|
||||
if (this.TitleSorting.Length == 0)
|
||||
{
|
||||
this.TitleSorting = this.Title;
|
||||
}
|
||||
if (TitleSorting.Length == 0)
|
||||
TitleSorting = Title;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ReadNotes()
|
||||
{
|
||||
return ReadNotes(Path.Combine(this.Folder, this.FileName));
|
||||
return ReadNotes(Path.Combine(Folder, FileName));
|
||||
}
|
||||
public bool ReadNotes(string FilePath, bool forceReload=false)
|
||||
|
||||
public bool ReadNotes(string FilePath, bool forceReload = false)
|
||||
{
|
||||
//Skip loading if already done and no reload is forced
|
||||
if (_NotesLoaded && !forceReload)
|
||||
@@ -669,19 +645,18 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
sr = new StreamReader(FilePath, Encoding, true);
|
||||
|
||||
sr = new StreamReader(FilePath, this.Encoding, true);
|
||||
|
||||
this.Notes.Reset();
|
||||
Notes.Reset();
|
||||
|
||||
//Search for Note Beginning
|
||||
while(!sr.EndOfStream)
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
FileLineNo++;
|
||||
|
||||
TempC = (char)sr.Peek();
|
||||
if ((TempC == '#') || (TempC == '\r') || (TempC == '\n'))
|
||||
if ((TempC == '#') || (TempC == '\r') || (TempC == '\n'))
|
||||
continue;
|
||||
if ((TempC == ':') || (TempC == 'F') || (TempC == '*') || (TempC == 'P'))
|
||||
{
|
||||
@@ -698,12 +673,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
char chr;
|
||||
switch (TempC)
|
||||
{
|
||||
case 'P':
|
||||
while ((chr = (char)sr.Read()) == ' ') { }
|
||||
while ((chr = (char)sr.Read()) == ' ') {}
|
||||
|
||||
int.TryParse(chr.ToString(), out Param1);
|
||||
if (Param1 == 1)
|
||||
@@ -743,7 +717,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
else
|
||||
NoteType = ENoteType.Normal;
|
||||
|
||||
if (this.Relative == EOffOn.TR_CONFIG_ON)
|
||||
if (Relative == EOffOn.TR_CONFIG_ON)
|
||||
Param1 += currentPos;
|
||||
|
||||
if (Player != 2)
|
||||
@@ -766,7 +740,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
sr.Read();
|
||||
Param1 = CHelper.TryReadInt(sr);
|
||||
|
||||
if (this.Relative == EOffOn.TR_CONFIG_ON)
|
||||
if (Relative == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
Param1 += currentPos;
|
||||
sr.Read();
|
||||
@@ -798,17 +772,15 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
} while (!sr.EndOfStream && (c == 19 || c == 16 || c == 13 || c == 10));
|
||||
TempC = (char)c;
|
||||
FileLineNo++;
|
||||
}while(!sr.EndOfStream && (TempC != 'E'));
|
||||
} while (!sr.EndOfStream && (TempC != 'E'));
|
||||
|
||||
foreach(CLines lines in this.Notes.Lines)
|
||||
{
|
||||
foreach (CLines lines in Notes.Lines)
|
||||
lines.UpdateTimings();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath);
|
||||
if(sr != null)
|
||||
if (sr != null)
|
||||
sr.Dispose();
|
||||
return false;
|
||||
}
|
||||
@@ -816,7 +788,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
FindRefrain();
|
||||
FindShortEnd();
|
||||
_NotesLoaded = true;
|
||||
if(IsDuet)
|
||||
if (IsDuet)
|
||||
CheckDuet();
|
||||
return true;
|
||||
}
|
||||
@@ -824,7 +796,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private bool ParseNote(int Player, ENoteType NoteType, int Start, int Length, int Tone, string Text)
|
||||
{
|
||||
CNote note = new CNote(Start, Length, Tone, Text, NoteType);
|
||||
CLines lines = this.Notes.GetLines(Player);
|
||||
CLines lines = Notes.GetLines(Player);
|
||||
return lines.AddNote(note);
|
||||
}
|
||||
|
||||
@@ -833,16 +805,16 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
CLines lines = Notes.GetLines(Player);
|
||||
CLine line = new CLine();
|
||||
line.StartBeat = Start;
|
||||
lines.AddLine(line);
|
||||
lines.AddLine(line);
|
||||
}
|
||||
|
||||
public void LoadSmallCover()
|
||||
{
|
||||
if (_CoverSmallLoaded)
|
||||
return;
|
||||
if (this.CoverFileName.Length > 0)
|
||||
if (CoverFileName.Length > 0)
|
||||
{
|
||||
if (!CBase.DataBase.GetCover(Path.Combine(this.Folder, this.CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
|
||||
if (!CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
|
||||
_CoverTextureSmall = CBase.Cover.GetNoCover();
|
||||
}
|
||||
else
|
||||
@@ -853,29 +825,27 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
private void CheckFiles()
|
||||
{
|
||||
if(this.CoverFileName.Length == 0){
|
||||
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
|
||||
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
|
||||
foreach(String file in files)
|
||||
if (CoverFileName.Length == 0)
|
||||
{
|
||||
List<string> files = CHelper.ListFiles(Folder, "*.jpg", false);
|
||||
files.AddRange(CHelper.ListFiles(Folder, "*.png", false));
|
||||
foreach (String file in files)
|
||||
{
|
||||
if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase)))
|
||||
{
|
||||
this.CoverFileName = file;
|
||||
}
|
||||
if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) &&
|
||||
(Regex.IsMatch(file, @"" + Regex.Escape(Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(Artist), RegexOptions.IgnoreCase)))
|
||||
CoverFileName = file;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.BackgroundFileName.Length == 0)
|
||||
if (BackgroundFileName.Length == 0)
|
||||
{
|
||||
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
|
||||
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
|
||||
List<string> files = CHelper.ListFiles(Folder, "*.jpg", false);
|
||||
files.AddRange(CHelper.ListFiles(Folder, "*.png", false));
|
||||
foreach (String file in files)
|
||||
{
|
||||
|
||||
if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase)))
|
||||
{
|
||||
this.BackgroundFileName = file;
|
||||
}
|
||||
if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) &&
|
||||
(Regex.IsMatch(file, @"" + Regex.Escape(Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(Artist), RegexOptions.IgnoreCase)))
|
||||
BackgroundFileName = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -885,12 +855,12 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (DuetPart1.Length == 0)
|
||||
{
|
||||
DuetPart1 = "Part 1";
|
||||
CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + this.Artist + " - " + this.Title + "\".");
|
||||
CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + Artist + " - " + Title + "\".");
|
||||
}
|
||||
if (DuetPart2.Length == 0)
|
||||
{
|
||||
DuetPart2 = "Part 2";
|
||||
CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + this.Artist + " - " + this.Title + "\".");
|
||||
CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + Artist + " - " + Title + "\".");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -903,7 +873,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
private List<Series> GetSeries()
|
||||
{
|
||||
CLines lines = this.Notes.GetLines(0);
|
||||
CLines lines = Notes.GetLines(0);
|
||||
|
||||
if (lines.LineCount == 0)
|
||||
return null;
|
||||
@@ -954,16 +924,16 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
private void FindRefrain()
|
||||
{
|
||||
if (this.IsDuet)
|
||||
if (IsDuet)
|
||||
{
|
||||
this.Medley.Source = EMedleySource.None;
|
||||
Medley.Source = EMedleySource.None;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.Medley.Source == EMedleySource.Tag)
|
||||
if (Medley.Source == EMedleySource.Tag)
|
||||
return;
|
||||
|
||||
if (!this.CalculateMedley)
|
||||
if (!CalculateMedley)
|
||||
return;
|
||||
|
||||
List<Series> series = GetSeries();
|
||||
@@ -978,55 +948,56 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
longest = i;
|
||||
}
|
||||
|
||||
CLines lines = this.Notes.GetLines(0);
|
||||
CLines lines = Notes.GetLines(0);
|
||||
|
||||
// set medley vars
|
||||
if (series.Count > 0 && series[longest].length > CBase.Settings.GetMedleyMinSeriesLength())
|
||||
{
|
||||
this.Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat;
|
||||
this.Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat;
|
||||
Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat;
|
||||
Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat;
|
||||
|
||||
bool foundEnd = false;
|
||||
|
||||
|
||||
// set end if duration > MedleyMinDuration
|
||||
if (CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CBase.Settings.GetMedleyMinDuration() >
|
||||
CBase.Game.GetTimeFromBeats(this.Medley.EndBeat, this.BPM))
|
||||
if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
|
||||
CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM))
|
||||
foundEnd = true;
|
||||
|
||||
if (!foundEnd)
|
||||
{
|
||||
for (int i = series[longest].start + 1; i < lines.LineCount - 1; i++)
|
||||
{
|
||||
if (CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CBase.Settings.GetMedleyMinDuration() >
|
||||
CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, this.BPM))
|
||||
if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() >
|
||||
CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, BPM))
|
||||
{
|
||||
foundEnd = true;
|
||||
this.Medley.EndBeat = lines.Line[i].LastNoteBeat;
|
||||
Medley.EndBeat = lines.Line[i].LastNoteBeat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundEnd)
|
||||
{
|
||||
this.Medley.Source = EMedleySource.Calculated;
|
||||
this.Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
|
||||
this.Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
|
||||
Medley.Source = EMedleySource.Calculated;
|
||||
Medley.FadeInTime = CBase.Settings.GetDefaultMedleyFadeInTime();
|
||||
Medley.FadeOutTime = CBase.Settings.GetDefaultMedleyFadeOutTime();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.PreviewStart == 0f)
|
||||
|
||||
if (PreviewStart == 0f)
|
||||
{
|
||||
if (this.Medley.Source == EMedleySource.Calculated)
|
||||
this.PreviewStart = CBase.Game.GetTimeFromBeats(this.Medley.StartBeat, this.BPM);
|
||||
if (Medley.Source == EMedleySource.Calculated)
|
||||
PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM);
|
||||
}
|
||||
}
|
||||
|
||||
private void FindShortEnd(){
|
||||
private void FindShortEnd()
|
||||
{
|
||||
List<Series> series = GetSeries();
|
||||
if (series == null)
|
||||
return;
|
||||
|
||||
CLines lines = this.Notes.GetLines(0);
|
||||
CLines lines = Notes.GetLines(0);
|
||||
|
||||
//Calculate length of singing
|
||||
int stop = (lines.Line[lines.Line.Length - 1].LastNoteBeat - lines.Line[0].FirstNoteBeat) / 2 + lines.Line[0].StartBeat;
|
||||
@@ -1038,12 +1009,12 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (stop < (lines.Line[series[i].start].FirstNoteBeat + ((lines.Line[series[i].end].LastNoteBeat - lines.Line[series[i].start].FirstNoteBeat) / 2)))
|
||||
{
|
||||
this.ShortEnd = lines.Line[series[i].start-1].LastNote.EndBeat;
|
||||
ShortEnd = lines.Line[series[i].start - 1].LastNote.EndBeat;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ShortEnd = lines.Line[series[i].end].LastNote.EndBeat;
|
||||
ShortEnd = lines.Line[series[i].end].LastNote.EndBeat;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1054,13 +1025,12 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
if (lines.Line[i].FirstNoteBeat < stop && lines.Line[i].LastNoteBeat > stop)
|
||||
{
|
||||
this.ShortEnd = lines.Line[i].LastNoteBeat;
|
||||
ShortEnd = lines.Line[i].LastNoteBeat;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ShortEnd = stop;
|
||||
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
@@ -1068,4 +1038,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
return base.MemberwiseClone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
public class CSongMenu : ISongMenu
|
||||
{
|
||||
private int _PartyModeID;
|
||||
private readonly int _PartyModeID;
|
||||
|
||||
private ISongMenu _SongMenu;
|
||||
private ESongMenu _Type;
|
||||
@@ -154,7 +154,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
_SongMenu.SetSmallView(SmallView);
|
||||
}
|
||||
|
||||
#endregion ISongMenu
|
||||
|
||||
#region IMenuElement
|
||||
@@ -202,30 +201,28 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private void CreateSongMenu()
|
||||
{
|
||||
if (_SongMenu != null)
|
||||
{
|
||||
_SongMenu.OnHide();
|
||||
}
|
||||
|
||||
switch (CBase.Config.GetSongMenuType())
|
||||
{
|
||||
//case ESongMenu.TR_CONFIG_LIST:
|
||||
// _SongMenu = new CSongMenuList();
|
||||
// break;
|
||||
//case ESongMenu.TR_CONFIG_LIST:
|
||||
// _SongMenu = new CSongMenuList();
|
||||
// break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_DREIDEL:
|
||||
// _SongMenu = new CSongMenuDreidel();
|
||||
// break;
|
||||
//case ESongMenu.TR_CONFIG_DREIDEL:
|
||||
// _SongMenu = new CSongMenuDreidel();
|
||||
// break;
|
||||
|
||||
case ESongMenu.TR_CONFIG_TILE_BOARD:
|
||||
_SongMenu = new CSongMenuTileBoard(_PartyModeID);
|
||||
break;
|
||||
|
||||
//case ESongMenu.TR_CONFIG_BOOK:
|
||||
// _SongMenu = new CSongMenuBook();
|
||||
// break;
|
||||
//case ESongMenu.TR_CONFIG_BOOK:
|
||||
// _SongMenu = new CSongMenuBook();
|
||||
// break;
|
||||
}
|
||||
|
||||
_Type = CBase.Config.GetSongMenuType();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuBook : CSongMenuFramework
|
||||
{
|
||||
public CSongMenuBook(int PartyModeID)
|
||||
: base(PartyModeID)
|
||||
{
|
||||
}
|
||||
: base(PartyModeID) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuDreidel : CSongMenuFramework
|
||||
{
|
||||
@@ -24,9 +23,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
*/
|
||||
|
||||
public CSongMenuDreidel(int PartyModeID)
|
||||
: base(PartyModeID)
|
||||
{
|
||||
}
|
||||
: base(PartyModeID) {}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
@@ -43,4 +40,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
**/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
struct SThemeSongMenu
|
||||
{
|
||||
public string Name;
|
||||
|
||||
|
||||
public string CoverBackgroundName;
|
||||
public string CoverBigBackgroundName;
|
||||
public string DuetIconName;
|
||||
@@ -27,47 +27,41 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public SThemeSongMenuTileBoard songMenuTileBoard;
|
||||
}
|
||||
|
||||
struct SThemeSongMenuBook
|
||||
{
|
||||
}
|
||||
struct SThemeSongMenuBook {}
|
||||
|
||||
struct SThemeSongMenuDreidel
|
||||
{
|
||||
}
|
||||
struct SThemeSongMenuDreidel {}
|
||||
|
||||
struct SThemeSongMenuList
|
||||
{
|
||||
}
|
||||
struct SThemeSongMenuList {}
|
||||
|
||||
struct SThemeSongMenuTileBoard
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of tiles horizontal
|
||||
/// Number of tiles horizontal
|
||||
/// </summary>
|
||||
public int numW;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles vertical
|
||||
/// Number of tiles vertical
|
||||
/// </summary>
|
||||
public int numH;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles horizontal in small-modus
|
||||
/// Number of tiles horizontal in small-modus
|
||||
/// </summary>
|
||||
public int numWsmall;
|
||||
|
||||
/// <summary>
|
||||
/// Number of tiles vertical in small-modus
|
||||
/// Number of tiles vertical in small-modus
|
||||
/// </summary>
|
||||
public int numHsmall;
|
||||
|
||||
/// <summary>
|
||||
/// Space between tiles horizontal
|
||||
/// Space between tiles horizontal
|
||||
/// </summary>
|
||||
public float spaceW;
|
||||
|
||||
/// <summary>
|
||||
/// Space between tiles vertical
|
||||
/// Space between tiles vertical
|
||||
/// </summary>
|
||||
public float spaceH;
|
||||
|
||||
@@ -92,9 +86,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
protected SThemeSongMenu _Theme;
|
||||
private bool _ThemeLoaded;
|
||||
|
||||
private Stopwatch _timer = new Stopwatch();
|
||||
private Stopwatch _VideoFadeTimer = new Stopwatch();
|
||||
private List<int> _streams = new List<int>();
|
||||
private readonly Stopwatch _timer = new Stopwatch();
|
||||
private readonly Stopwatch _VideoFadeTimer = new Stopwatch();
|
||||
private readonly List<int> _streams = new List<int>();
|
||||
private int _video = -1;
|
||||
private int _actsong = -1;
|
||||
private int _actsongstream = -1;
|
||||
@@ -155,7 +149,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected virtual void SetSelectedNow()
|
||||
@@ -165,7 +158,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_SelectedInternal = _SelectedPending;
|
||||
}
|
||||
|
||||
protected int _Locked //the real selected song for singing
|
||||
protected int _Locked //the real selected song for singing
|
||||
{
|
||||
get { return _LockedInternal; }
|
||||
set { _LockedInternal = value; }
|
||||
@@ -206,7 +199,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
return _actsong;
|
||||
}
|
||||
|
||||
private bool _Selected = false;
|
||||
private bool _Selected;
|
||||
private bool _Visible = true;
|
||||
|
||||
public bool IsSelected()
|
||||
@@ -267,9 +260,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", ref _Theme.MedleyTagIcon, String.Empty);
|
||||
|
||||
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out _Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R);
|
||||
@@ -309,7 +300,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallZ", ref _Theme.songMenuTileBoard.TileRectSmall.Z);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallW", ref _Theme.songMenuTileBoard.TileRectSmall.W);
|
||||
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SongMenuTileBoard/TileRectSmallH", ref _Theme.songMenuTileBoard.TileRectSmall.H);
|
||||
|
||||
#endregion SongMenuTileBoard
|
||||
|
||||
if (_ThemeLoaded)
|
||||
@@ -349,9 +339,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)");
|
||||
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
|
||||
if (_Theme.ColorName.Length > 0)
|
||||
{
|
||||
writer.WriteElementString("Color", _Theme.ColorName);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteElementString("R", _Color.R.ToString("#0.00"));
|
||||
@@ -406,7 +394,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Theme.songMenuTileBoard.StaticVideoIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer);
|
||||
_Theme.songMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer);
|
||||
|
||||
|
||||
writer.WriteEndElement();
|
||||
#endregion SongMenuTileBoard
|
||||
|
||||
@@ -447,13 +435,11 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
|
||||
float time = CBase.Sound.GetPosition(_actsongstream);
|
||||
|
||||
|
||||
float vtime = 0f;
|
||||
CBase.Video.GetFrame(_video, ref _vidtex, time, ref vtime);
|
||||
if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L)
|
||||
{
|
||||
_vidtex.color.A = (_VideoFadeTimer.ElapsedMilliseconds / 3000f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_vidtex.color.A = 1f;
|
||||
@@ -471,15 +457,13 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public virtual void OnHide()
|
||||
{
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
CBase.Sound.FadeAndStop(stream, 0f, 0.75f);
|
||||
}
|
||||
_streams.Clear();
|
||||
|
||||
CBase.Video.Close(_video);
|
||||
_video = -1;
|
||||
|
||||
CBase.Drawing.RemoveTexture(ref _vidtex);
|
||||
CBase.Drawing.RemoveTexture(ref _vidtex);
|
||||
|
||||
_timer.Stop();
|
||||
_timer.Reset();
|
||||
@@ -504,10 +488,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
return;
|
||||
|
||||
if (_video != -1)
|
||||
{
|
||||
CBase.Drawing.DrawTexture(_vidtex, new SRectF(0, 0, 1280, 720, 0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual void ApplyVolume(float VolumeMax)
|
||||
@@ -515,9 +496,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_MaxVolume = VolumeMax;
|
||||
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
CBase.Sound.SetStreamVolumeMax(stream, _MaxVolume);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsActive()
|
||||
@@ -568,9 +547,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void UnloadTextures()
|
||||
{
|
||||
}
|
||||
public virtual void UnloadTextures() {}
|
||||
|
||||
public virtual void LoadTextures()
|
||||
{
|
||||
@@ -630,9 +607,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (CBase.Songs.GetCurrentCategoryIndex() >= 0 && (CBase.Songs.GetNumVisibleSongs() > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0)))
|
||||
{
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
CBase.Sound.FadeAndStop(stream, 0f, 1f);
|
||||
}
|
||||
_streams.Clear();
|
||||
|
||||
CBase.Video.Close(_video);
|
||||
@@ -659,7 +634,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
CBase.Sound.Fade(_stream, 100f, 3f);
|
||||
_streams.Add(_stream);
|
||||
_actsongstream = _stream;
|
||||
|
||||
|
||||
if (CBase.Songs.GetVisibleSong(_actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
_video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_actsong).Folder, CBase.Songs.GetVisibleSong(_actsong).VideoFileName));
|
||||
@@ -676,9 +651,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
protected void Reset()
|
||||
{
|
||||
foreach (int stream in _streams)
|
||||
{
|
||||
CBase.Sound.FadeAndStop(stream, 0f, 0.75f);
|
||||
}
|
||||
_streams.Clear();
|
||||
|
||||
CBase.Video.Close(_video);
|
||||
@@ -716,4 +689,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
#endregion ThemeEdit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
class CSongMenuList : CSongMenuFramework
|
||||
{
|
||||
public CSongMenuList(int PartyModeID)
|
||||
: base(PartyModeID)
|
||||
{
|
||||
}
|
||||
: base(PartyModeID) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,12 +36,10 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
private int _Offset = -1;
|
||||
private int _actualSelection = -1;
|
||||
|
||||
private bool _SmallView = false;
|
||||
private bool _SmallView;
|
||||
|
||||
public CSongMenuTileBoard(int PartyModeID)
|
||||
: base(PartyModeID)
|
||||
{
|
||||
}
|
||||
: base(PartyModeID) {}
|
||||
|
||||
public override int GetActualSelection()
|
||||
{
|
||||
@@ -73,7 +71,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
for (int j = 0; j < _NumW; j++)
|
||||
{
|
||||
SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
|
||||
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
_Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
|
||||
CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
@@ -105,18 +103,14 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Locked = _PreviewSelected;
|
||||
_actualSelection = _PreviewSelected;
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && CBase.Songs.GetNumCategories() > 0 && CBase.Songs.GetCurrentCategoryIndex() == -1)
|
||||
{
|
||||
EnterCategory(0);
|
||||
}
|
||||
_actualSelection = -1;
|
||||
_Locked = -1;
|
||||
_PreviewSelected = -1;
|
||||
@@ -163,8 +157,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (!KeyEvent.KeyPressed)
|
||||
{
|
||||
if (!(KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down ||
|
||||
KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter ||
|
||||
KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp))
|
||||
KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter ||
|
||||
KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp))
|
||||
return;
|
||||
|
||||
bool sel = false;
|
||||
@@ -181,9 +175,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
(KeyEvent.Key != Keys.Escape && KeyEvent.Key != Keys.Back && KeyEvent.Key != Keys.PageUp && KeyEvent.Key != Keys.PageDown))
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
@@ -204,9 +196,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
KeyEvent.Handled = true;
|
||||
}
|
||||
else if (_actualSelection > -1 && _PreviewSelected >= 0)
|
||||
{
|
||||
_Locked = _actualSelection;
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Escape:
|
||||
@@ -224,16 +214,12 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
case Keys.PageUp:
|
||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
PrevCategory();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.PageDown:
|
||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
NextCategory();
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
@@ -252,7 +238,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Locked++;
|
||||
UpdateList();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -271,7 +256,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
break;
|
||||
}
|
||||
|
||||
if (_Locked > _NumW - 1 && (!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0))
|
||||
if (_Locked > _NumW - 1 &&
|
||||
(!SongOptions.Selection.RandomOnly || SongOptions.Selection.CategoryChangeAllowed && CBase.Songs.GetCurrentCategoryIndex() < 0))
|
||||
{
|
||||
_Locked -= _NumW;
|
||||
UpdateList();
|
||||
@@ -292,7 +278,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Locked += _NumW;
|
||||
UpdateList();
|
||||
}
|
||||
|
||||
}
|
||||
else if (_Locked < CBase.Songs.GetNumVisibleSongs() - _NumW && !SongOptions.Selection.RandomOnly)
|
||||
{
|
||||
@@ -300,7 +285,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
UpdateList();
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,9 +294,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_actualSelection = _Locked;
|
||||
|
||||
for (int i = 0; i < _Tiles.Count; i++)
|
||||
{
|
||||
_Tiles[i].Selected = _Locked == i + _Offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,9 +328,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
sel = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -361,22 +341,19 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (!sel)
|
||||
_actualSelection = -1;
|
||||
|
||||
if ((MouseEvent.RB) && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON && SongOptions.Selection.CategoryChangeAllowed)
|
||||
if ((MouseEvent.RB) && (CBase.Songs.GetNumCategories() > 0) && CBase.Songs.GetCurrentCategoryIndex() >= 0 && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_ON &&
|
||||
SongOptions.Selection.CategoryChangeAllowed)
|
||||
{
|
||||
ShowCategories();
|
||||
MouseEvent.Handled = true;
|
||||
return;
|
||||
}
|
||||
else if (MouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !SongOptions.Selection.PartyMode)
|
||||
{
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenMain);
|
||||
}
|
||||
else if (_PreviewSelected != -1 && MouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !SongOptions.Selection.PartyMode)
|
||||
{
|
||||
if (CHelper.IsInBounds(_CoverBig.Rect, MouseEvent) || CHelper.IsInBounds(_TextBG.Rect, MouseEvent))
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
}
|
||||
else if ((MouseEvent.LB) && (CBase.Songs.GetCurrentCategoryIndex() == -1))
|
||||
{
|
||||
@@ -391,10 +368,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
}
|
||||
|
||||
if (MouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, MouseEvent) && (!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
{
|
||||
if (MouseEvent.Wheel != 0 && CHelper.IsInBounds(_ScrollRect, MouseEvent) &&
|
||||
(!SongOptions.Selection.RandomOnly || CBase.Songs.GetCurrentCategoryIndex() < 0 && SongOptions.Selection.CategoryChangeAllowed))
|
||||
UpdateList(_Offset + _NumW * MouseEvent.Wheel);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
@@ -479,7 +455,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_CoverBig.Draw(1f, EAspect.Crop);
|
||||
|
||||
|
||||
|
||||
_Artist.Draw();
|
||||
_Title.Draw();
|
||||
_SongLength.Draw();
|
||||
@@ -487,7 +462,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_VideoIcon.Draw();
|
||||
_MedleyCalcIcon.Draw();
|
||||
_MedleyTagIcon.Draw();
|
||||
|
||||
}
|
||||
|
||||
public override int GetSelectedSong()
|
||||
@@ -520,9 +494,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (_Locked == -1 || !sel)
|
||||
{
|
||||
if (_PreviewSelected > -1)
|
||||
{
|
||||
_Locked = _PreviewSelected;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Locked = 0;
|
||||
@@ -534,9 +506,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
|
||||
_PreviewSelected = itemNr;
|
||||
SetSelectedNow();
|
||||
@@ -613,9 +583,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
SelectSong(_PreviewSelected);
|
||||
|
||||
foreach (CStatic tile in _Tiles)
|
||||
{
|
||||
tile.Selected = false;
|
||||
}
|
||||
|
||||
if (_actualSelection >= 0 && _actualSelection < _Tiles.Count)
|
||||
_Tiles[_actualSelection].Selected = true;
|
||||
@@ -728,4 +696,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Theme.songMenuTileBoard.TextSongLength.ReloadTextures();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
using VocaluxeLib.PartyModes;
|
||||
using VocaluxeLib.PartyModes;
|
||||
|
||||
namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
@@ -39,4 +38,4 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
SRectF GetRect();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user