长音符再修复 加入了关卡连接 优化了一些默认加载

This commit is contained in:
FloatGaming
2026-01-13 11:22:39 +08:00
parent 2738089af1
commit 2f9d4aae0c
426 changed files with 299413 additions and 1050 deletions
@@ -161,6 +161,15 @@ public class SongButton : MonoBehaviour
{
selectedInfo.UpdateSelectedSongDisplay();
}
// Save per-DLC selected song index to PlayerPrefs
string dlcKey = SongSelectUI.CurrentDlcKey;
if (string.IsNullOrEmpty(dlcKey)) dlcKey = "default_0";
string prefsKey = "song_selected_" + dlcKey;
int index = GetIndexAmongSongButtons();
PlayerPrefs.SetInt(prefsKey, index);
PlayerPrefs.Save();
Debug.Log($"SongButton: saved selected song index {index} for key {prefsKey}");
}
else
{
@@ -168,6 +177,23 @@ public class SongButton : MonoBehaviour
}
}
private int GetIndexAmongSongButtons()
{
// Use parent traversal to find only SongButton siblings, to avoid mismatch when other UI children exist.
var parent = transform.parent;
if (parent == null) return 0;
int idx = 0;
for (int i = 0; i < parent.childCount; i++)
{
var child = parent.GetChild(i);
var sb = child != null ? child.GetComponent<SongButton>() : null;
if (sb == null) continue;
if (sb == this) return idx;
idx++;
}
return 0;
}
private void FadeInSelectedBorder()
{
if (selected_boarder != null)