Made it easier to check for golden and rap notes

This commit is contained in:
Gary Kertopermono committed 2020-04-05 18:03:27 +02:00
1 parent 8d7116706d
commit 821a85ab17
4 files changed
+35 -5

No files matched your search

+6 -5
View File
@@ -84,8 +84,8 @@ namespace VocaluxeLib.Menu.SingNotes
_Flares.Clear(); _Flares.Clear();
_PerfectNoteEffect.Clear(); _PerfectNoteEffect.Clear();
foreach (CSongNote note in _Lines[_CurrentLine].Notes.Where(note => (note.Type == ENoteType.Golden || note.Type == ENoteType.RapGolden))) foreach (CSongNote note in _Lines[_CurrentLine].Notes.Where(note => (note.IsGoldenNote)))
_AddGoldenNote(_GetNoteRect(note, note.Type == ENoteType.Rap || note.Type == ENoteType.RapGolden)); _AddGoldenNote(_GetNoteRect(note));
} }
public void Draw() public void Draw()
@@ -107,7 +107,7 @@ namespace VocaluxeLib.Menu.SingNotes
{ {
if (note.Type != ENoteType.Freestyle) if (note.Type != ENoteType.Freestyle)
{ {
SRectF rect = _GetNoteRect(note, note.Type == ENoteType.Rap || note.Type == ENoteType.RapGolden); SRectF rect = _GetNoteRect(note);
_DrawNoteBG(rect, color); _DrawNoteBG(rect, color);
_DrawNoteBase(rect, new SColorF(_NoteBaseColor, _NoteBaseColor.A * Alpha), 1f); _DrawNoteBase(rect, new SColorF(_NoteBaseColor, _NoteBaseColor.A * Alpha), 1f);
@@ -130,7 +130,7 @@ namespace VocaluxeLib.Menu.SingNotes
_DrawNoteFill(rect, color, factor); _DrawNoteFill(rect, color, factor);
if (note.EndBeat >= CBase.Game.GetRecordedBeat() && note.Hit && (note.HitNote.Type == ENoteType.Golden || note.HitNote.Type == ENoteType.RapGolden)) if (note.EndBeat >= CBase.Game.GetRecordedBeat() && note.Hit && note.IsGoldenNote)
{ {
SRectF re = rect; SRectF re = rect;
re.W = (CBase.Game.GetMidRecordedBeat() - note.StartBeat) / beats * Rect.W; re.W = (CBase.Game.GetMidRecordedBeat() - note.StartBeat) / beats * Rect.W;
@@ -171,10 +171,11 @@ namespace VocaluxeLib.Menu.SingNotes
perfnote.Draw(); perfnote.Draw();
} }
private SRectF _GetNoteRect(CBaseNote note, bool isRapNote = false) private SRectF _GetNoteRect(CBaseNote note)
{ {
CSongLine line = _Lines[_CurrentLine]; CSongLine line = _Lines[_CurrentLine];
float beats = line.LastNoteBeat - line.FirstNoteBeat + 1; float beats = line.LastNoteBeat - line.FirstNoteBeat + 1;
bool isRapNote = note.IsRapNote;
float width = note.Duration * Rect.W / beats; float width = note.Duration * Rect.W / beats;
float y = Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - line.BaseLine) / 2f) * _NoteLineHeight - _AddNoteHeight / 2; float y = Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - line.BaseLine) / 2f) * _NoteLineHeight - _AddNoteHeight / 2;
+14
View File
@@ -82,6 +82,20 @@ namespace VocaluxeLib.Songs
} }
public abstract int PointsForBeat { get; } public abstract int PointsForBeat { get; }
public bool IsRapNote
{
get { return IsNoteType(ENoteType.Rap, ENoteType.RapGolden); }
}
public bool IsGoldenNote
{
get { return IsNoteType(ENoteType.Golden, ENoteType.RapGolden); }
}
#endregion Properties #endregion Properties
#region Methods
public abstract bool IsNoteType(params ENoteType[] noteTypes);
#endregion Methods
} }
} }
+9
View File
@@ -15,6 +15,8 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System.Linq;
namespace VocaluxeLib.Songs namespace VocaluxeLib.Songs
{ {
/// <summary> /// <summary>
@@ -37,6 +39,13 @@ namespace VocaluxeLib.Songs
} }
#endregion Constructors #endregion Constructors
#region Methods
public override bool IsNoteType(params ENoteType[] noteTypes)
{
return noteTypes.Contains(Type);
}
#endregion Method
#region Properties #region Properties
public ENoteType Type { get; set; } public ENoteType Type { get; set; }
+6
View File
@@ -15,6 +15,8 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System.Linq;
namespace VocaluxeLib.Songs namespace VocaluxeLib.Songs
{ {
/// <summary> /// <summary>
@@ -74,6 +76,10 @@ namespace VocaluxeLib.Songs
Perfect = result; Perfect = result;
} }
public override bool IsNoteType(params ENoteType[] noteTypes)
{
return HitNote != null && noteTypes.Contains(HitNote.Type);
}
#endregion Methods #endregion Methods
public override int PointsForBeat public override int PointsForBeat