Skip to content

Commit

Permalink
codestyle: make BeatInfo's fields readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymonf committed Sep 19, 2023
1 parent 4dc47ab commit 726b076
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions BAKKA_Editor/Note.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,35 @@ namespace BAKKA_Editor;

internal class BeatInfo
{
public int Beat;
public int Measure;
public readonly int Beat;
public readonly int Measure;
public readonly float MeasureDecimal;

public BeatInfo(int measure, int beat)
{
Measure = measure;
Beat = beat;
MeasureDecimal = GetMeasureDecimal();
}

public BeatInfo(float measure)
{
Measure = (int) Math.Floor(measure);
Beat = (int) ((measure - Measure) * 1920.0f);
MeasureDecimal = GetMeasureDecimal();
}

public BeatInfo(BeatInfo info)
{
Measure = info.Measure;
Beat = info.Beat;
MeasureDecimal = GetMeasureDecimal();
}

public float MeasureDecimal => Measure + Beat / 1920.0f;
private float GetMeasureDecimal()
{
return Measure + Beat / 1920.0f;
}
}

internal class TimeSignature
Expand Down

0 comments on commit 726b076

Please sign in to comment.