Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/Menu/Data/MenuVisualConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class MenuVisualConfig : ScriptableObject
*/
public Color GetDifficultyColor(Difficulty d) => d switch
{
Difficulty.Easy => Style1Palette.DiffEasy,
Difficulty.BGR => Style1Palette.DiffEasy,
Difficulty.Normal => Style1Palette.DiffNormal,
Difficulty.Hard => Style1Palette.DiffHard,
Difficulty.Expert => Style1Palette.DiffExpert,
Expand Down
2 changes: 1 addition & 1 deletion Assets/Menu/SongSelect/TransitionScreenController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public async UniTask RunTransitionAsync(SongManifest song, Difficulty p1Diff, Di

private static Color GetDifficultyColor(Difficulty diff) => diff switch
{
Difficulty.Easy => Style1Palette.DiffEasy,
Difficulty.BGR => Style1Palette.DiffEasy,
Difficulty.Normal => Style1Palette.DiffNormal,
Difficulty.Hard => Style1Palette.DiffHard,
Difficulty.Expert => Style1Palette.DiffExpert,
Expand Down
2 changes: 1 addition & 1 deletion Assets/Rhythm/Data/Difficulty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
public enum Difficulty
{
Easy,
BGR,
Normal,
Hard,
Expert,
Expand Down
74 changes: 71 additions & 3 deletions Assets/Rhythm/Editor/BeatSongGeneratorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void Open()

private static readonly Difficulty[] AllDifficulties =
{
Difficulty.Easy,
Difficulty.BGR,
Difficulty.Normal,
Difficulty.Hard,
Difficulty.Expert,
Expand Down Expand Up @@ -59,7 +59,13 @@ public static void Open()

private readonly bool[] _enabled = { true, true, true, true, false };
private readonly float[] _interval = { 4f, 2f, 1f, 0.5f, 0.25f };
private readonly float[] _rating = { 1f, 3f, 5f, 7f, 9f };
private readonly float[] _rating = { 2f, 3f, 5f, 7f, 9f };

private float _bgrPhase1Seconds = 30f;
private float _bgrPhase2Seconds = 30f;
private float _bgrPhase1Interval = 4f;
private float _bgrPhase2Interval = 2f;
private float _bgrPhase3Interval = 1f;

#endregion

Expand Down Expand Up @@ -160,6 +166,20 @@ private void DrawDifficulties()
_rating[i] = EditorGUILayout.FloatField(_rating[i], GUILayout.Width(52f));
GUI.enabled = true;
EditorGUILayout.EndHorizontal();

if (i == 0 && _enabled[0])
{
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("Phase 1 (Easy density)", EditorStyles.miniLabel);
_bgrPhase1Seconds = Mathf.Max(1f, EditorGUILayout.FloatField(" Duration (s)", _bgrPhase1Seconds));
_bgrPhase1Interval = Mathf.Max(0.0625f, EditorGUILayout.FloatField(" Beat interval", _bgrPhase1Interval));
EditorGUILayout.LabelField("Phase 2 (Normal density)", EditorStyles.miniLabel);
_bgrPhase2Seconds = Mathf.Max(1f, EditorGUILayout.FloatField(" Duration (s)", _bgrPhase2Seconds));
_bgrPhase2Interval = Mathf.Max(0.0625f, EditorGUILayout.FloatField(" Beat interval", _bgrPhase2Interval));
EditorGUILayout.LabelField("Phase 3 (Hard density — rest of song)", EditorStyles.miniLabel);
_bgrPhase3Interval = Mathf.Max(0.0625f, EditorGUILayout.FloatField(" Beat interval", _bgrPhase3Interval));
EditorGUI.indentLevel--;
}
}
}

Expand Down Expand Up @@ -249,6 +269,29 @@ private void DrawGenerate()
: "valid BPM (> 0)";
EditorGUILayout.HelpBox($"Cannot generate: missing {missing}.", MessageType.Warning);
}

GUILayout.Space(10f);
EditorGUILayout.LabelField("Upgrade Tools", EditorStyles.boldLabel);
if (GUILayout.Button("Upgrade All Easy → BGR"))
{
string[] guids = AssetDatabase.FindAssets("t:BeatmapData");
int upgraded = 0;
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
var bm = AssetDatabase.LoadAssetAtPath<BeatmapData>(path);
if (bm == null || bm.DifficultyLevel != Difficulty.BGR) continue;
double totalBeats = bm.SongClip != null
? Math.Max(0.0, bm.SongClip.length - bm.OffsetSeconds) * bm.BaseBpm / 60.0
: (bm.Notes.Count > 0 ? bm.Notes[^1].Beat : 0);
bm.Notes = GenerateBGRNotes(bm.BaseBpm, totalBeats, _bgrPhase1Seconds, _bgrPhase2Seconds, _bgrPhase1Interval, _bgrPhase2Interval, _bgrPhase3Interval);
bm.DifficultyName = "BGR";
EditorUtility.SetDirty(bm);
upgraded++;
}
AssetDatabase.SaveAssets();
Debug.Log($"[BeatSongGenerator] Upgraded {upgraded} asset(s) to BGR.");
}
}

#endregion
Expand Down Expand Up @@ -316,12 +359,37 @@ private BeatmapData CreateBeatmap(string folder, Difficulty diff,
bm.DifficultyLevel = diff;
bm.DifficultyName = diff.ToString();
bm.DifficultyRating = rating;
bm.Notes = GenerateNotes(interval, totalBeats);
bm.Notes = (diff == Difficulty.BGR)
? GenerateBGRNotes(_bpm, totalBeats, _bgrPhase1Seconds, _bgrPhase2Seconds, _bgrPhase1Interval, _bgrPhase2Interval, _bgrPhase3Interval)
: GenerateNotes(interval, totalBeats);

AssetDatabase.CreateAsset(bm, path);
return bm;
}

private static List<NoteData> GenerateBGRNotes(float bpm, double totalBeats,
float phase1Seconds, float phase2Seconds,
float phase1Interval, float phase2Interval, float phase3Interval)
{
double switchBeat1 = phase1Seconds * bpm / 60.0;
double switchBeat2 = (phase1Seconds + phase2Seconds) * bpm / 60.0;

var notes = new List<NoteData>();

for (double b = 0; b < switchBeat1; b += phase1Interval)
notes.Add(new NoteData { Beat = Math.Round(b, 6), Lane = 0, NoteType = NoteType.Normal, EditorId = Guid.NewGuid().ToString() });

double p2Start = Math.Ceiling(switchBeat1 / phase2Interval) * phase2Interval;
for (double b = p2Start; b < switchBeat2; b += phase2Interval)
notes.Add(new NoteData { Beat = Math.Round(b, 6), Lane = 0, NoteType = NoteType.Normal, EditorId = Guid.NewGuid().ToString() });

double p3Start = Math.Ceiling(switchBeat2 / phase3Interval) * phase3Interval;
for (double b = p3Start; b <= totalBeats; b += phase3Interval)
notes.Add(new NoteData { Beat = Math.Round(b, 6), Lane = 0, NoteType = NoteType.Normal, EditorId = Guid.NewGuid().ToString() });

return notes;
}

private List<NoteData> GenerateNotes(float interval, double totalBeats)
{
var notes = new List<NoteData>();
Expand Down
8 changes: 4 additions & 4 deletions Assets/Scenes/GameScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -6489,8 +6489,8 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 84f4dc4f60fba7e4db3098b36887c32b, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name:
m_EditorClassIdentifier:
_waypoints:
- {fileID: 516113166}
- {fileID: 667602993}
Expand All @@ -6502,15 +6502,15 @@ MonoBehaviour:
time: 0
value: 0
inSlope: 0
outSlope: 0
outSlope: 1
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
inSlope: 1
outSlope: 0
tangentMode: 0
weightedMode: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ MonoBehaviour:
FocusedNodeColor: {r: 1, g: 1, b: 1, a: 1}
CarrierColor: {r: 1, g: 0.42, b: 0.32, a: 1}
CarrierReadyColor: {r: 0.55, g: 1, b: 0.82, a: 1}
PreviewNodeColor: {r: 0.55, g: 0.55, b: 0.62, a: 1}
PreviewNodeColor: {r: 0.19677822, g: 0.19677822, b: 0.20754719, a: 1}
PreviewEdgeOffset: 1
PreviewNextValueOffset: 1
HeatmapLow: {r: 0.18, g: 0.45, b: 1, a: 1}
Expand Down
Loading