Auto cleanup of VocaluxeLib

This commit is contained in:
Flamefire committed 2013-03-22 21:12:45 +01:00
1 parent b497b58740
commit efab579188
37 files changed
+642 -1155

No files matched your search

+22 -57
View File
@@ -3,18 +3,16 @@ using System.Collections.Generic;
namespace VocaluxeLib.Menu.SingNotes
{
public class CNotes
public class CNotes
{
private List<CLines> _Lines = new List<CLines>();
private readonly List<CLines> _Lines = new List<CLines>();
public CLines[] Lines
{
get { return _Lines.ToArray(); }
}
public CNotes()
{
}
public CNotes() {}
public int LinesCount
{
@@ -24,17 +22,13 @@ namespace VocaluxeLib.Menu.SingNotes
public CNotes(CNotes notes)
{
foreach (CLines lines in notes._Lines)
{
_Lines.Add(new CLines(lines));
}
}
public CLines GetLines(int Index)
{
while (Index >= _Lines.Count)
{
_Lines.Add(new CLines());
}
return _Lines[Index];
}
@@ -77,9 +71,7 @@ namespace VocaluxeLib.Menu.SingNotes
public void SetMedley(int StartBeat, int EndBeat)
{
foreach (CLines lines in _Lines)
{
lines.SetMedley(StartBeat, EndBeat);
}
}
}
@@ -90,8 +82,8 @@ namespace VocaluxeLib.Menu.SingNotes
private int _Tone;
private ENoteType _NoteType;
private string _Text;
private bool _Hit; // for drawing player notes
private bool _Perfect; // for drawing perfect note effect
private bool _Hit; // for drawing player notes
private bool _Perfect; // for drawing perfect note effect
#region Contructors
public CNote()
@@ -122,7 +114,7 @@ namespace VocaluxeLib.Menu.SingNotes
this.StartBeat = StartBeat;
this.Duration = Duration;
this.Tone = Tone;
this.NoteType = ENoteType.Normal;
NoteType = ENoteType.Normal;
this.Text = Text;
}
@@ -132,7 +124,7 @@ namespace VocaluxeLib.Menu.SingNotes
this.StartBeat = StartBeat;
this.Duration = Duration;
this.Tone = Tone;
this.NoteType = ENoteType.Normal;
NoteType = ENoteType.Normal;
this.Text = Text;
this.Hit = Hit;
}
@@ -172,10 +164,7 @@ namespace VocaluxeLib.Menu.SingNotes
public int EndBeat
{
get
{
return _StartBeat + _Duration - 1;
}
get { return _StartBeat + _Duration - 1; }
}
public int Duration
@@ -274,24 +263,20 @@ namespace VocaluxeLib.Menu.SingNotes
{
private int _StartBeat = int.MinValue;
private int _EndBeat = int.MinValue;
private bool _PerfectLine = false; // for drawing perfect line effect
private bool _PerfectLine; // for drawing perfect line effect
private bool _VisibleInTimeLine = true;
private int _MinBeat = int.MaxValue;
private int _MaxBeat = int.MinValue;
private List<CNote> _Notes = new List<CNote>();
private readonly List<CNote> _Notes = new List<CNote>();
#region Constructors
public CLine()
{
}
public CLine() {}
public CLine(CLine line)
{
foreach (CNote note in line._Notes)
{
_Notes.Add(new CNote(note));
}
_StartBeat = line._StartBeat;
_EndBeat = line._EndBeat;
_PerfectLine = line._PerfectLine;
@@ -350,9 +335,7 @@ namespace VocaluxeLib.Menu.SingNotes
{
string lyrics = String.Empty;
foreach (CNote note in _Notes)
{
lyrics += note.Text;
}
return lyrics;
}
}
@@ -368,13 +351,11 @@ namespace VocaluxeLib.Menu.SingNotes
{
int points = 0;
foreach (CNote note in _Notes)
{
points += note.Points;
}
return points;
}
}
public CNote[] Notes
{
get { return _Notes.ToArray(); }
@@ -416,7 +397,7 @@ namespace VocaluxeLib.Menu.SingNotes
Max = note.Tone;
}
return Min - (Max-Min)/4;
return Min - (Max - Min) / 4;
}
}
#endregion Properties
@@ -433,7 +414,7 @@ namespace VocaluxeLib.Menu.SingNotes
if (CompareLine.Points == 0)
return false;
_PerfectLine = (this.Points == CompareLine.Points);
_PerfectLine = (Points == CompareLine.Points);
return _PerfectLine;
}
@@ -460,7 +441,7 @@ namespace VocaluxeLib.Menu.SingNotes
}
return start;
}
public bool AddNote(CNote Note)
{
if (_Notes.Count == 0)
@@ -534,14 +515,10 @@ namespace VocaluxeLib.Menu.SingNotes
private void updateMinMaxBeat(CNote Note)
{
if (Note.StartBeat < _MinBeat)
{
_MinBeat = Note.StartBeat;
}
if (Note.EndBeat > _MaxBeat)
{
_MaxBeat = Note.EndBeat;
}
}
private void updateMinMaxBeat()
@@ -557,24 +534,19 @@ namespace VocaluxeLib.Menu.SingNotes
_MaxBeat = int.MinValue;
}
}
#endregion Methods
}
public class CLines
{
private List<CLine> _Lines = new List<CLine>();
private readonly List<CLine> _Lines = new List<CLine>();
public CLines()
{
}
public CLines() {}
public CLines(CLines lines)
{
foreach (CLine line in lines._Lines)
{
_Lines.Add(new CLine(line));
}
}
public CLine[] Line
@@ -587,7 +559,7 @@ namespace VocaluxeLib.Menu.SingNotes
}
/// <summary>
/// Total song length in beats
/// Total song length in beats
/// </summary>
public int Length
{
@@ -624,9 +596,7 @@ namespace VocaluxeLib.Menu.SingNotes
{
int points = 0;
foreach (CLine line in _Lines)
{
points += line.Points;
}
return points;
}
}
@@ -730,15 +700,14 @@ namespace VocaluxeLib.Menu.SingNotes
}
return false;
}
public void UpdateTimings()
{
CNote LastNote, FirstNote;
int min, max, s;
if (_Lines.Count > 0)
{
_Lines[0].StartBeat = -10000;
}
for (int i = 1; i < _Lines.Count; i++)
{
@@ -776,18 +745,14 @@ namespace VocaluxeLib.Menu.SingNotes
LastNote = _Lines[_Lines.Count - 1].LastNote;
if (LastNote != null)
{
_Lines[_Lines.Count - 1].EndBeat = LastNote.EndBeat;
}
}
public void SetMedley(int StartBeat, int EndBeat)
{
foreach (CLine line in _Lines)
{
line.SetMedley(StartBeat, EndBeat);
}
}
#endregion Methods
}
}
}
+37 -70
View File
@@ -44,16 +44,16 @@ namespace VocaluxeLib.Menu.SingNotes
private SThemeSingBar _Theme;
private bool _ThemeLoaded;
private List<SPlayerNotes> _PlayerNotes;
private readonly List<SPlayerNotes> _PlayerNotes;
private int _ActID;
private SRectF[,] _BarPos;
/// <summary>
/// Player bar positions
/// Player bar positions
/// </summary>
/// <remarks>
/// first index = player number; second index = num players seen on screen
/// first index = player number; second index = num players seen on screen
/// </remarks>
public SRectF[,] BarPos
{
@@ -93,7 +93,7 @@ namespace VocaluxeLib.Menu.SingNotes
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", ref _Theme.SkinToneHelperName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", ref _Theme.SkinPerfectNoteStarName, String.Empty);
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(), CBase.Settings.GetMaxNumPlayer()];
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
{
for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++)
@@ -182,6 +182,7 @@ namespace VocaluxeLib.Menu.SingNotes
return false;
}
public virtual void Reset()
{
_PlayerNotes.Clear();
@@ -209,10 +210,7 @@ namespace VocaluxeLib.Menu.SingNotes
return notes.ID;
}
public virtual void RemovePlayer(int ID)
{
}
public virtual void RemovePlayer(int ID) {}
public virtual void AddLine(int ID, CLine[] Line, int LineNr, int Player)
{
@@ -241,15 +239,9 @@ namespace VocaluxeLib.Menu.SingNotes
_PlayerNotes.Add(notes);
}
public virtual void RemoveLine(int ID)
{
public virtual void RemoveLine(int ID) {}
}
public virtual void AddNote(int ID, CNote Note)
{
}
public virtual void AddNote(int ID, CNote Note) {}
public virtual void SetAlpha(int ID, float Alpha)
{
@@ -270,10 +262,10 @@ namespace VocaluxeLib.Menu.SingNotes
return _PlayerNotes[n].Alpha;
}
public virtual void Draw(int ID, int Player)
{
Draw(ID, null, Player);
Draw(ID, null, Player);
}
public virtual void Draw(int ID, List<CLine> SingLine, int Player)
@@ -294,9 +286,7 @@ namespace VocaluxeLib.Menu.SingNotes
CLine Line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr];
if (CBase.Config.GetDrawNoteLines() == EOffOn.TR_CONFIG_ON)
{
DrawNoteLines(_PlayerNotes[n].Rect, new SColorF(0.5f, 0.5f, 0.5f, 0.5f * _PlayerNotes[n].Alpha));
}
if (Line.NoteCount == 0)
return;
@@ -311,10 +301,10 @@ namespace VocaluxeLib.Menu.SingNotes
return;
SColorF color = new SColorF(
_PlayerNotes[n].Color.R,
_PlayerNotes[n].Color.G,
_PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
_PlayerNotes[n].Color.R,
_PlayerNotes[n].Color.G,
_PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
float BaseLine = Line.BaseLine;
int Nr = 1;
@@ -326,7 +316,7 @@ namespace VocaluxeLib.Menu.SingNotes
SRectF rect = new SRectF(
_PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w,
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine)/2) / CBase.Settings.GetNumNoteLines() * h - dh,
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
width,
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
_PlayerNotes[n].Rect.Z
@@ -340,29 +330,23 @@ namespace VocaluxeLib.Menu.SingNotes
AddGoldenNote(rect, n, Nr);
Nr++;
}
}
}
}
if (CBase.Config.GetDrawToneHelper() == EOffOn.TR_CONFIG_ON)
{
DrawToneHelper(n, (int)BaseLine, (CBase.Game.GetMidBeatD() - Line.FirstNoteBeat) / beats * w);
}
int i = 0;
while (i < _PlayerNotes[n].PerfectLineTwinkle.Count)
{
if (!_PlayerNotes[n].PerfectLineTwinkle[i].IsAlive)
{
_PlayerNotes[n].PerfectLineTwinkle.RemoveAt(i);
}
else
i++;
}
foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
{
perfline.Draw();
}
if (SingLine == null || SingLine.Count == 0 || CBase.Game.GetPlayer()[Player].CurrentLine == -1 || SingLine.Count <= CBase.Game.GetPlayer()[Player].CurrentLine)
{
@@ -385,7 +369,7 @@ namespace VocaluxeLib.Menu.SingNotes
SRectF rect = new SRectF(
_PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w,
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine)/2) / CBase.Settings.GetNumNoteLines() * h - dh,
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - BaseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
width,
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
_PlayerNotes[n].Rect.Z
@@ -426,9 +410,7 @@ namespace VocaluxeLib.Menu.SingNotes
while (i < _PlayerNotes[n].Flares.Count)
{
if (!_PlayerNotes[n].Flares[i].IsAlive)
{
_PlayerNotes[n].Flares.RemoveAt(i);
}
else
i++;
}
@@ -437,15 +419,11 @@ namespace VocaluxeLib.Menu.SingNotes
while (i < _PlayerNotes[n].PerfectNoteEffect.Count)
{
if (!_PlayerNotes[n].PerfectNoteEffect[i].IsAlive)
{
_PlayerNotes[n].PerfectNoteEffect.RemoveAt(i);
}
else
i++;
}
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
{
@@ -454,28 +432,20 @@ namespace VocaluxeLib.Menu.SingNotes
}
foreach (CParticleEffect flare in _PlayerNotes[n].Flares)
{
flare.Draw();
}
foreach (CParticleEffect perfnote in _PlayerNotes[n].PerfectNoteEffect)
{
perfnote.Draw();
}
}
public void UnloadTextures()
{
}
public void UnloadTextures() {}
public void LoadTextures()
{
}
public void LoadTextures() {}
public void ReloadTextures()
{
UnloadTextures();
LoadTextures();
LoadTextures();
}
private int FindPlayerLine(int ID)
@@ -604,7 +574,7 @@ namespace VocaluxeLib.Menu.SingNotes
{
const int spacing = 0;
if ( Nr > _PlayerNotes[n].GoldenStars.Count)
if (Nr > _PlayerNotes[n].GoldenStars.Count)
{
float d = (1f - factor) / 2 * Rect.H;
float dw = d;
@@ -689,7 +659,8 @@ namespace VocaluxeLib.Menu.SingNotes
Rect.Z
);
CParticleEffect stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35, EParticleType.PerfNoteStar);
CParticleEffect stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35,
EParticleType.PerfNoteStar);
_PlayerNotes[n].PerfectNoteEffect.Add(stars);
}
@@ -704,7 +675,7 @@ namespace VocaluxeLib.Menu.SingNotes
int TonePlayer = CBase.Record.GetToneAbs(_PlayerNotes[n].PlayerNr);
SRectF Rect = _PlayerNotes[n].Rect;
while (TonePlayer - BaseLine < 0)
TonePlayer += 12;
@@ -719,18 +690,18 @@ namespace VocaluxeLib.Menu.SingNotes
float dy = Rect.H / (CBase.Settings.GetNumNoteLines());
SRectF rect = new SRectF(
Rect.X - dy + XOffset,
Rect.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (TonePlayer - BaseLine) / 2f),
dy,
dy,
Rect.Z
);
Rect.X - dy + XOffset,
Rect.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (TonePlayer - BaseLine) / 2f),
dy,
dy,
Rect.Z
);
SColorF color = new SColorF(
_PlayerNotes[n].Color.R,
_PlayerNotes[n].Color.G,
_PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
_PlayerNotes[n].Color.R,
_PlayerNotes[n].Color.G,
_PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
STexture ToneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID);
CBase.Drawing.DrawTexture(ToneHelper, rect, color);
@@ -754,13 +725,9 @@ namespace VocaluxeLib.Menu.SingNotes
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{
}
public void MoveElement(int stepX, int stepY) {}
public void ResizeElement(int stepW, int stepH)
{
}
public void ResizeElement(int stepW, int stepH) {}
#endregion ThemeEdit
}
}
}
@@ -1,12 +1,8 @@
namespace VocaluxeLib.Menu.SingNotes
namespace VocaluxeLib.Menu.SingNotes
{
class CSingNotesClassic : CSingNotes
{
public CSingNotesClassic(int PartyModeID)
: base(PartyModeID)
{
}
: base(PartyModeID) {}
}
}
}
+1 -2
View File
@@ -8,7 +8,6 @@ namespace VocaluxeLib.Menu.SingNotes
int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr);
void RemovePlayer(int ID);
void AddLine(int ID, CLine[] Line, int LineNr, int Player);
void RemoveLine(int ID);
@@ -20,4 +19,4 @@ namespace VocaluxeLib.Menu.SingNotes
void Draw(int ID, int Player);
void Draw(int ID, List<CLine> SingLine, int Player);
}
}
}