first playable medley stage

This commit is contained in:
Alexander Eckart committed 2012-03-11 17:49:53 +01:00
1 parent 830875d24e
commit 3cace96905
6 files changed
+252 -37

No files matched your search

+1 -1
View File
@@ -112,7 +112,7 @@ namespace Vocaluxe.Base
public const float LyricHelperMinTime = 0.2f; public const float LyricHelperMinTime = 0.2f;
public const float DefaultMedleyFadeInTime = 8f; public const float DefaultMedleyFadeInTime = 8f;
public const float DefaultMedleyFadeOutTIme = 2f; public const float DefaultMedleyFadeOutTime = 2f;
public const int MedleyMinSeriesLength = 3; public const int MedleyMinSeriesLength = 3;
public const float MedleyMinDuration = 40f; public const float MedleyMinDuration = 40f;
+57 -25
View File
@@ -85,14 +85,14 @@ namespace Vocaluxe.GameModes
{ {
protected bool _Initialized = false; protected bool _Initialized = false;
protected EGameMode _GameMode; protected EGameMode _GameMode;
protected List<int> _SongIDs; protected List<CSong> _Songs;
protected int _ActualSong; protected int _ActualSong;
protected CPoints _Points; protected CPoints _Points;
#region Implementation #region Implementation
public virtual void Init() public virtual void Init()
{ {
_SongIDs = new List<int>(); _Songs = new List<CSong>();
Reset(); Reset();
} }
@@ -105,12 +105,9 @@ namespace Vocaluxe.GameModes
{ {
if (CSongs.VisibleSongs.Length > VisibleIndex) if (CSongs.VisibleSongs.Length > VisibleIndex)
{ {
//int ID = CSongs.VisibleSongs[VisibleIndex].ID; _Songs.Add(new CSong(CSongs.VisibleSongs[VisibleIndex]));
//if (!_SongIDs.Exists(delegate(int i) { return (i == ID); })) SongManipulation(_Songs.Count - 1);
//{ return true;
_SongIDs.Add(CSongs.VisibleSongs[VisibleIndex].ID);
return true;
//}
} }
return false; return false;
} }
@@ -119,12 +116,9 @@ namespace Vocaluxe.GameModes
{ {
if (CSongs.AllSongs.Length > AbsoluteIndex) if (CSongs.AllSongs.Length > AbsoluteIndex)
{ {
//int ID = CSongs.AllSongs[AbsoluteIndex].ID; _Songs.Add(CSongs.AllSongs[AbsoluteIndex]);
//if (!_SongIDs.Exists(delegate(int i) { return (i == ID); })) SongManipulation(_Songs.Count - 1);
//{
_SongIDs.Add(CSongs.AllSongs[AbsoluteIndex].ID);
return true; return true;
//}
} }
return false; return false;
} }
@@ -133,7 +127,24 @@ namespace Vocaluxe.GameModes
{ {
if (CSongs.VisibleSongs.Length > VisibleIndex) if (CSongs.VisibleSongs.Length > VisibleIndex)
{ {
return _SongIDs.Remove(CSongs.VisibleSongs[VisibleIndex].ID); int ID = CSongs.VisibleSongs[VisibleIndex].ID;
int index = -1;
for (int i = 0; i < _Songs.Count; i++)
{
if (_Songs[i].ID == ID)
{
index = i;
break;
}
}
if (index > -1)
{
_Songs.RemoveAt(index);
return true;
}
return false;
} }
return false; return false;
} }
@@ -142,14 +153,31 @@ namespace Vocaluxe.GameModes
{ {
if (CSongs.AllSongs.Length > AbsoluteIndex) if (CSongs.AllSongs.Length > AbsoluteIndex)
{ {
return _SongIDs.Remove(CSongs.AllSongs[AbsoluteIndex].ID); int ID = CSongs.AllSongs[AbsoluteIndex].ID;
int index = -1;
for (int i = 0; i < _Songs.Count; i++)
{
if (_Songs[i].ID == ID)
{
index = i;
break;
}
}
if (index > -1)
{
_Songs.RemoveAt(index);
return true;
}
return false;
} }
return false; return false;
} }
public virtual void ClearSongs() public virtual void ClearSongs()
{ {
_SongIDs.Clear(); _Songs.Clear();
} }
public virtual void Reset() public virtual void Reset()
@@ -159,16 +187,16 @@ namespace Vocaluxe.GameModes
public virtual void Start(SPlayer[] Player) public virtual void Start(SPlayer[] Player)
{ {
_Points = new CPoints(_SongIDs.Count, Player); _Points = new CPoints(_Songs.Count, Player);
} }
public virtual void NextRound(SPlayer[] Player) public virtual void NextRound(SPlayer[] Player)
{ {
if (_ActualSong < _SongIDs.Count && _SongIDs.Count > 0) if (_ActualSong < _Songs.Count && _Songs.Count > 0)
{ {
if (_ActualSong > -1) if (_ActualSong > -1)
{ {
_Points.SetPoints(_ActualSong, _SongIDs[_ActualSong], Player, _GameMode == EGameMode.Medley, _GameMode == EGameMode.Duet); _Points.SetPoints(_ActualSong, _Songs[_ActualSong].ID, Player, _GameMode == EGameMode.Medley, _GameMode == EGameMode.Duet);
} }
_ActualSong++; _ActualSong++;
} }
@@ -176,7 +204,7 @@ namespace Vocaluxe.GameModes
public virtual bool IsFinished() public virtual bool IsFinished()
{ {
return (_ActualSong == _SongIDs.Count || _SongIDs.Count == 0); return (_ActualSong == _Songs.Count || _Songs.Count == 0);
} }
public virtual int GetActualRoundNr() public virtual int GetActualRoundNr()
@@ -186,22 +214,22 @@ namespace Vocaluxe.GameModes
public virtual CSong GetSong() public virtual CSong GetSong()
{ {
if (_ActualSong >= 0 && _ActualSong < _SongIDs.Count) if (_ActualSong >= 0 && _ActualSong < _Songs.Count)
{ {
return CSongs.GetSong(_SongIDs[_ActualSong]); return _Songs[_ActualSong];
} }
return null; return null;
} }
public virtual int GetNumSongs() public virtual int GetNumSongs()
{ {
return _SongIDs.Count; return _Songs.Count;
} }
public virtual CSong GetSong(int Num) public virtual CSong GetSong(int Num)
{ {
if (Num - 1 < _SongIDs.Count) if (Num - 1 < _Songs.Count)
return CSongs.GetSong(_SongIDs[Num - 1]); return _Songs[Num - 1];
return null; return null;
} }
@@ -211,5 +239,9 @@ namespace Vocaluxe.GameModes
return _Points; return _Points;
} }
#endregion Implementation #endregion Implementation
protected virtual void SongManipulation(int SongIndex)
{
}
} }
} }
+18
View File
@@ -2,6 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Lib.Song;
namespace Vocaluxe.GameModes namespace Vocaluxe.GameModes
{ {
class CGameModeMedley : CGameMode class CGameModeMedley : CGameMode
@@ -13,5 +16,20 @@ namespace Vocaluxe.GameModes
_GameMode = EGameMode.Medley; _GameMode = EGameMode.Medley;
_Initialized = true; _Initialized = true;
} }
protected override void SongManipulation(int SongIndex)
{
CSong song = _Songs[SongIndex];
// set medley mode timings
song.Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap;
if (song.Start < 0f)
song.Start = 0f;
song.Finish = CGame.GetTimeFromBeats(song.Medley.EndBeat, song.BPM) + song.Medley.FadeOutTime + song.Gap;
// set lines to medley mode
song.Notes.SetMedley(song.Medley.StartBeat, song.Medley.EndBeat);
}
} }
} }
+67 -4
View File
@@ -15,6 +15,18 @@ namespace Vocaluxe.Lib.Song
get { return _Lines.ToArray(); } get { return _Lines.ToArray(); }
} }
public CNotes()
{
}
public CNotes(CNotes notes)
{
foreach (CLines lines in notes._Lines)
{
_Lines.Add(new CLines(lines));
}
}
public CLines GetLines(int Index) public CLines GetLines(int Index)
{ {
while (Index >= _Lines.Count) while (Index >= _Lines.Count)
@@ -54,6 +66,13 @@ namespace Vocaluxe.Lib.Song
_Lines.Clear(); _Lines.Clear();
} }
public void SetMedley(int StartBeat, int EndBeat)
{
foreach (CLines lines in _Lines)
{
lines.SetMedley(StartBeat, EndBeat);
}
}
} }
public enum ENoteType public enum ENoteType
@@ -85,6 +104,17 @@ namespace Vocaluxe.Lib.Song
_Perfect = false; _Perfect = false;
} }
public CNote(CNote note)
{
_StartBeat = note._StartBeat;
_Duration = note._Duration;
_Tone = note._Tone;
_NoteType = note._NoteType;
_Text = note._Text;
_Hit = note._Hit;
_Perfect = note._Perfect;
}
public CNote(int StartBeat, int Duration, int Tone, string Text) public CNote(int StartBeat, int Duration, int Tone, string Text)
: this() : this()
{ {
@@ -245,16 +275,26 @@ namespace Vocaluxe.Lib.Song
private int _EndBeat; private int _EndBeat;
private bool _PerfectLine; // for drawing perfect line effect private bool _PerfectLine; // for drawing perfect line effect
private List<CNote> _Notes; private List<CNote> _Notes = new List<CNote>();
#region Constructors #region Constructors
public CLine() public CLine()
{ {
_Notes = new List<CNote>();
StartBeat = int.MinValue; StartBeat = int.MinValue;
EndBeat = int.MaxValue; EndBeat = int.MaxValue;
_PerfectLine = false; _PerfectLine = false;
} }
public CLine(CLine line)
{
foreach (CNote note in line._Notes)
{
_Notes.Add(new CNote(note));
}
_StartBeat = line._StartBeat;
_EndBeat = line._EndBeat;
_PerfectLine = line._PerfectLine;
}
#endregion Constructors #endregion Constructors
#region Properties #region Properties
@@ -475,16 +515,32 @@ namespace Vocaluxe.Lib.Song
{ {
_Notes.Clear(); _Notes.Clear();
} }
public void SetMedley(int StartBeat, int EndBeat)
{
foreach (CNote note in _Notes)
{
if (note.StartBeat < StartBeat || note.EndBeat > EndBeat)
note.NoteType = ENoteType.Freestyle;
}
}
#endregion Methods #endregion Methods
} }
public class CLines public class CLines
{ {
private List<CLine> _Lines; private List<CLine> _Lines = new List<CLine>();
public CLines() public CLines()
{ {
_Lines = new List<CLine>(); }
public CLines(CLines lines)
{
foreach (CLine line in lines._Lines)
{
_Lines.Add(new CLine(line));
}
} }
public CLine[] Line public CLine[] Line
@@ -648,6 +704,13 @@ namespace Vocaluxe.Lib.Song
} }
} }
public void SetMedley(int StartBeat, int EndBeat)
{
foreach (CLine line in _Lines)
{
line.SetMedley(StartBeat, EndBeat);
}
}
#endregion Methods #endregion Methods
} }
} }
+86 -7
View File
@@ -53,7 +53,7 @@ namespace Vocaluxe.Lib.Song
private STexture _CoverTextureSmall = new STexture(-1); private STexture _CoverTextureSmall = new STexture(-1);
private STexture _CoverTextureBig = new STexture(-1); private STexture _CoverTextureBig = new STexture(-1);
private SMedley Medley = new SMedley(0); public SMedley Medley = new SMedley(0);
public bool CalculateMedley = true; public bool CalculateMedley = true;
public float PreviewStart = 0f; public float PreviewStart = 0f;
@@ -74,9 +74,7 @@ namespace Vocaluxe.Lib.Song
{ {
get { return _CoverLoaded; } get { return _CoverLoaded; }
} }
public bool CoverBigLoaded = false; public bool CoverBigLoaded = false;
public bool BackgroundLoaded = false;
public STexture CoverTextureSmall public STexture CoverTextureSmall
{ {
@@ -111,8 +109,6 @@ namespace Vocaluxe.Lib.Song
set { _CoverTextureBig = value; } set { _CoverTextureBig = value; }
} }
public CBackground Background = new CBackground();
public string Title = String.Empty; public string Title = String.Empty;
public string Artist = String.Empty; public string Artist = String.Empty;
@@ -143,6 +139,83 @@ namespace Vocaluxe.Lib.Song
// Notes // Notes
public CNotes Notes = new CNotes(); public CNotes Notes = new CNotes();
public CSong()
{
}
public CSong(CSong song)
{
this._CoverTextureSmall = song._CoverTextureSmall;
this._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;
this.CalculateMedley = song.CalculateMedley;
this.PreviewStart = song.PreviewStart;
this.Encoding = song.Encoding;
this.Folder = song.Folder;
this.FolderName = song.FolderName;
this.FileName = song.FileName;
this.MP3FileName = song.MP3FileName;
this.CoverFileName = song.CoverFileName;
this.BackgroundFileName = song.BackgroundFileName;
this.VideoFileName = song.VideoFileName;
this.VideoAspect = song.VideoAspect;
this._CoverLoaded = song._CoverLoaded;
this.CoverBigLoaded = song.CoverBigLoaded;
this.Artist = song.Artist;
this.Title = song.Title;
this.Start = song.Start;
this.Finish = song.Finish;
this.BPM = song.BPM;
this.Gap = song.Gap;
this.VideoGap = song.VideoGap;
this.Comment = new List<string>();
foreach (string value in song.Comment)
{
this.Comment.Add(value);
}
this.ID = song.ID;
this.Visible = song.Visible;
this.CatIndex = song.CatIndex;
this.Selected = song.Selected;
this.Edition = new List<string>();
foreach (string value in song.Edition)
{
this.Edition.Add(value);
}
this.Genre = new List<string>();
foreach (string value in song.Genre)
{
this.Genre.Add(value);
}
this.Year = song.Year;
this.Language = new List<string>();
foreach (string value in song.Language)
{
this.Language.Add(value);
}
this.Notes = new CNotes(song.Notes);
}
public string GetMP3() public string GetMP3()
{ {
return Path.Combine(Folder, MP3FileName); return Path.Combine(Folder, MP3FileName);
@@ -418,7 +491,7 @@ namespace Vocaluxe.Lib.Song
{ {
this.Medley.Source = EMedleySource.Tag; this.Medley.Source = EMedleySource.Tag;
this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime; this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime;
this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTIme; this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTime;
} }
#endregion check medley tags #endregion check medley tags
@@ -644,6 +717,12 @@ namespace Vocaluxe.Lib.Song
private void FindRefrain() private void FindRefrain()
{ {
if (this.IsDuet)
{
this.Medley.Source = EMedleySource.None;
return;
}
if (this.Medley.Source == EMedleySource.Tag) if (this.Medley.Source == EMedleySource.Tag)
return; return;
@@ -735,7 +814,7 @@ namespace Vocaluxe.Lib.Song
{ {
this.Medley.Source = EMedleySource.Calculated; this.Medley.Source = EMedleySource.Calculated;
this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime; this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime;
this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTIme; this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTime;
} }
} }
+23
View File
@@ -8,6 +8,7 @@ using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Draw; using Vocaluxe.Lib.Draw;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu; using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu; using Vocaluxe.Menu.SongMenu;
@@ -133,6 +134,11 @@ namespace Vocaluxe.Screens
SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
} }
break; break;
case Keys.S:
if (CSongs.NumVisibleSongs > 0)
StartMedleySong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
break;
} }
} }
@@ -234,6 +240,23 @@ namespace Vocaluxe.Screens
} }
} }
private void StartMedleySong(int SongNr)
{
if ((CSongs.Category >= 0) && (SongNr >= 0))
{
if (CSongs.VisibleSongs[SongNr].Medley.Source != EMedleySource.None)
CGame.SetGameMode(GameModes.EGameMode.Medley);
else
return;
CGame.Reset();
CGame.ClearSongs();
CGame.AddVisibleSong(SongNr);
CGraphics.FadeTo(EScreens.ScreenNames);
}
}
private void StartRandomAllSongs() private void StartRandomAllSongs()
{ {
CGame.Reset(); CGame.Reset();