Split Notes, Lines and Voices into separate files/classes
This commit is contained in:
1 parent
84fc0fcb91
commit
44c78fad19
32 files changed
+889
-926
No files matched your search
@@ -33,7 +33,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
public SRectF Rect;
|
||||
public SColorF Color;
|
||||
public float Alpha;
|
||||
public CLine[] Lines;
|
||||
public CSongLine[] Lines;
|
||||
public int LineNr;
|
||||
public Stopwatch Timer;
|
||||
public List<CParticleEffect> GoldenStars;
|
||||
@@ -205,7 +205,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
public int AddPlayer(SRectF rect, SColorF color, int playerNr)
|
||||
{
|
||||
SPlayerNotes notes = new SPlayerNotes
|
||||
var notes = new SPlayerNotes
|
||||
{
|
||||
Rect = rect,
|
||||
Color = color,
|
||||
@@ -226,7 +226,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
return notes.ID;
|
||||
}
|
||||
|
||||
public void SetLines(int id, CLine[] lines, int lineNr)
|
||||
public void SetLines(int id, CSongLine[] lines, int lineNr)
|
||||
{
|
||||
if (lines == null)
|
||||
return;
|
||||
@@ -278,7 +278,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
Draw(id, null, player);
|
||||
}
|
||||
|
||||
public void Draw(int id, List<CLine> singLines, int player)
|
||||
public void Draw(int id, List<CSungLine> sungLines, int player)
|
||||
{
|
||||
int n = _FindPlayerNotes(id);
|
||||
if (n == -1)
|
||||
@@ -293,7 +293,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (_PlayerNotes[n].Lines.Length <= _PlayerNotes[n].LineNr)
|
||||
return;
|
||||
|
||||
CLine line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr];
|
||||
CSongLine 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));
|
||||
@@ -311,7 +311,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (beats < 1)
|
||||
return;
|
||||
|
||||
SColorF color = new SColorF(
|
||||
var color = new SColorF(
|
||||
_PlayerNotes[n].Color.R,
|
||||
_PlayerNotes[n].Color.G,
|
||||
_PlayerNotes[n].Color.B,
|
||||
@@ -319,13 +319,13 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
float baseLine = line.BaseLine;
|
||||
int nr = 1;
|
||||
foreach (CNote note in line.Notes)
|
||||
foreach (CSongNote note in line.Notes)
|
||||
{
|
||||
if (note.NoteType != ENoteType.Freestyle)
|
||||
{
|
||||
float width = note.Duration / beats * w;
|
||||
|
||||
SRectF rect = new SRectF(
|
||||
var 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,
|
||||
width,
|
||||
@@ -359,7 +359,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
|
||||
perfline.Draw();
|
||||
|
||||
if (singLines == null || singLines.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || singLines.Count <= CBase.Game.GetPlayers()[player].CurrentLine)
|
||||
if (sungLines == null || sungLines.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || sungLines.Count <= CBase.Game.GetPlayers()[player].CurrentLine)
|
||||
{
|
||||
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
|
||||
{
|
||||
@@ -369,48 +369,45 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (CNote note in singLines[CBase.Game.GetPlayers()[player].CurrentLine].Notes)
|
||||
foreach (CSungNote note in sungLines[CBase.Game.GetPlayers()[player].CurrentLine].Notes)
|
||||
{
|
||||
if (note.StartBeat >= line.FirstNoteBeat && note.EndBeat <= line.LastNoteBeat)
|
||||
float width = note.Duration / beats * w;
|
||||
|
||||
if (note.EndBeat == CBase.Game.GetCurrentBeatD())
|
||||
width -= (1 - (CBase.Game.GetMidBeatD() - CBase.Game.GetCurrentBeatD())) / beats * w;
|
||||
|
||||
var 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,
|
||||
width,
|
||||
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
|
||||
_PlayerNotes[n].Rect.Z
|
||||
);
|
||||
|
||||
float f = (note.Hit) ? 0.7f : 0.4f;
|
||||
|
||||
_DrawNote(rect, color, f);
|
||||
|
||||
if (note.EndBeat >= CBase.Game.GetCurrentBeatD() && note.Hit && note.HitNote.NoteType == ENoteType.Golden)
|
||||
{
|
||||
float width = note.Duration / beats * w;
|
||||
var re = new SRectF(rect) {W = (CBase.Game.GetMidBeatD() - note.StartBeat) / beats * w};
|
||||
_AddFlare(re, n);
|
||||
}
|
||||
|
||||
if (note.EndBeat == CBase.Game.GetCurrentBeatD())
|
||||
width -= (1 - (CBase.Game.GetMidBeatD() - CBase.Game.GetCurrentBeatD())) / beats * w;
|
||||
|
||||
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,
|
||||
width,
|
||||
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
|
||||
_PlayerNotes[n].Rect.Z
|
||||
);
|
||||
|
||||
float f = (note.Hit) ? 0.7f : 0.4f;
|
||||
|
||||
_DrawNote(rect, color, f);
|
||||
|
||||
if (note.EndBeat >= CBase.Game.GetCurrentBeatD() && note.Hit && note.NoteType == ENoteType.Golden)
|
||||
{
|
||||
SRectF re = new SRectF(rect) {W = (CBase.Game.GetMidBeatD() - note.StartBeat) / beats * w};
|
||||
_AddFlare(re, n);
|
||||
}
|
||||
|
||||
if (note.Perfect && note.EndBeat < CBase.Game.GetCurrentBeatD())
|
||||
{
|
||||
_AddPerfectNote(rect, n);
|
||||
note.Perfect = false;
|
||||
}
|
||||
if (note.Perfect && note.EndBeat < CBase.Game.GetCurrentBeatD())
|
||||
{
|
||||
_AddPerfectNote(rect, n);
|
||||
note.Perfect = false;
|
||||
}
|
||||
}
|
||||
|
||||
int currentLine = CBase.Game.GetPlayers()[player].SingLine.Count - 1;
|
||||
int currentLine = CBase.Game.GetPlayers()[player].SungLines.Count - 1;
|
||||
if (currentLine > 0)
|
||||
{
|
||||
if (CBase.Game.GetPlayers()[player].SingLine[currentLine - 1].PerfectLine)
|
||||
if (CBase.Game.GetPlayers()[player].SungLines[currentLine - 1].PerfectLine)
|
||||
{
|
||||
_AddPerfectLine(n);
|
||||
CBase.Game.GetPlayers()[player].SingLine[currentLine - 1].PerfectLine = false;
|
||||
CBase.Game.GetPlayers()[player].SungLines[currentLine - 1].PerfectLine = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +472,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
float dh = (1f - factor) * rect.H / 2;
|
||||
float dw = Math.Min(dh, rect.W / 2);
|
||||
|
||||
SRectF noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z);
|
||||
var noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z);
|
||||
|
||||
CTexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
|
||||
CTexture noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID);
|
||||
@@ -487,7 +484,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
|
||||
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
|
||||
|
||||
SRectF middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
|
||||
var middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
|
||||
if (noteRect.W >= 4 * endsW)
|
||||
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color);
|
||||
else
|
||||
@@ -516,7 +513,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (2 * dw > rect.W)
|
||||
dw = rect.W / 2;
|
||||
|
||||
SRectF r = new SRectF(
|
||||
var r = new SRectF(
|
||||
rect.X + dw + spacing,
|
||||
rect.Y + d + spacing,
|
||||
rect.W - 2 * dw - 2 * spacing,
|
||||
@@ -532,7 +529,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (2 * dx > r.W)
|
||||
dx = r.W / 2;
|
||||
|
||||
SColorF col = new SColorF(color.R, color.G, color.B, color.A * alpha);
|
||||
var col = new SColorF(color.R, color.G, color.B, color.A * alpha);
|
||||
|
||||
CBase.Drawing.DrawTexture(noteBackgroundBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), col);
|
||||
|
||||
@@ -565,7 +562,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (2 * dw > rect.W)
|
||||
dw = rect.W / 2;
|
||||
|
||||
SRectF r = new SRectF(
|
||||
var r = new SRectF(
|
||||
rect.X + dw + spacing,
|
||||
rect.Y + d + spacing,
|
||||
rect.W - 2 * dw - 2 * spacing,
|
||||
@@ -573,8 +570,8 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
rect.Z
|
||||
);
|
||||
|
||||
int numstars = (int)(r.W * 0.25f);
|
||||
CParticleEffect stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(1f, 1f, 0f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticleType.Star);
|
||||
var numstars = (int)(r.W * 0.25f);
|
||||
var stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(1f, 1f, 0f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticleType.Star);
|
||||
_PlayerNotes[n].GoldenStars.Add(stars);
|
||||
}
|
||||
}
|
||||
@@ -589,7 +586,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (2 * dw > rect.W)
|
||||
dw = rect.W / 2;
|
||||
|
||||
SRectF r = new SRectF(
|
||||
var r = new SRectF(
|
||||
rect.X + dw + spacing + rect.W - 2 * dw - 2 * spacing,
|
||||
rect.Y + d + spacing,
|
||||
0f,
|
||||
@@ -597,7 +594,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
rect.Z
|
||||
);
|
||||
|
||||
CParticleEffect flares = new CParticleEffect(_PartyModeID, 15, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticleType.Flare);
|
||||
var flares = new CParticleEffect(_PartyModeID, 15, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticleType.Flare);
|
||||
_PlayerNotes[n].Flares.Add(flares);
|
||||
}
|
||||
|
||||
@@ -611,7 +608,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
if (2 * dw > rect.W)
|
||||
dw = rect.W / 2;
|
||||
|
||||
SRectF r = new SRectF(
|
||||
var r = new SRectF(
|
||||
rect.X + dw + spacing,
|
||||
rect.Y + d + spacing,
|
||||
rect.W - 2 * dw - 2 * spacing,
|
||||
@@ -632,14 +629,14 @@ 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);
|
||||
var 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);
|
||||
}
|
||||
|
||||
private void _AddPerfectLine(int n)
|
||||
{
|
||||
CParticleEffect twinkle = new CParticleEffect(_PartyModeID, 200, _PlayerNotes[n].Color, _PlayerNotes[n].Rect, _Theme.SkinGoldenStarName, 25, EParticleType.Twinkle);
|
||||
var twinkle = new CParticleEffect(_PartyModeID, 200, _PlayerNotes[n].Color, _PlayerNotes[n].Rect, _Theme.SkinGoldenStarName, 25, EParticleType.Twinkle);
|
||||
_PlayerNotes[n].PerfectLineTwinkle.Add(twinkle);
|
||||
}
|
||||
|
||||
@@ -662,7 +659,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
offsetX = noteBounds.W;
|
||||
|
||||
float dy = noteBounds.H / CBase.Settings.GetNumNoteLines();
|
||||
SRectF drawRect = new SRectF(
|
||||
var drawRect = new SRectF(
|
||||
noteBounds.X - dy + offsetX,
|
||||
noteBounds.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (tonePlayer - baseLine) / 2f),
|
||||
dy,
|
||||
@@ -670,7 +667,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
noteBounds.Z
|
||||
);
|
||||
|
||||
SColorF color = new SColorF(
|
||||
var color = new SColorF(
|
||||
_PlayerNotes[n].Color.R,
|
||||
_PlayerNotes[n].Color.G,
|
||||
_PlayerNotes[n].Color.B,
|
||||
|
||||
Reference in new issue
Block a user