剧情+对话完善
This commit is contained in:
@@ -49,6 +49,19 @@ namespace Ichni.Menu
|
||||
public bool isDuringSnap = false;
|
||||
public RectTransform closestTab;
|
||||
|
||||
// 仅供 Story SongBlock 在“下一次初始化列表”时指定初始歌曲;不写入章节缓存,
|
||||
// 以免剧情入口覆盖玩家平时在该章节记录的歌曲/难度选择。
|
||||
private SongItemData _initialSongSelectionOverride;
|
||||
|
||||
/// <summary>
|
||||
/// 请求下一次 <see cref="InitializeList"/> 自动选中指定歌曲。
|
||||
/// 此请求是一次性的:无论目标是否仍存在,初始化完成后都会清除。
|
||||
/// </summary>
|
||||
public void RequestInitialSongSelection(SongItemData song)
|
||||
{
|
||||
_initialSongSelectionOverride = song;
|
||||
}
|
||||
|
||||
public void InitializeList()
|
||||
{
|
||||
// FadeOut 通常已经清理过旧 Tab,但这里仍保持幂等,防止重复初始化时残留旧引用或重复 UI。
|
||||
@@ -66,6 +79,7 @@ namespace Ichni.Menu
|
||||
MenuManager.instance.songSelectionUIPage.selectedSong = null;
|
||||
MenuManager.instance.songSelectionUIPage.selectedSave = null;
|
||||
MenuManager.instance.songSelectionUIPage.difficultySelectionContainer.SetUp(null);
|
||||
_initialSongSelectionOverride = null;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -106,6 +120,32 @@ namespace Ichni.Menu
|
||||
menuInformationRecorder.SetRecordForChapter(currentChapter, resolvedSong, preferredDifficultyIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Story SongBlock 的目标歌曲优先于常规章节缓存,但只影响本次页面打开。
|
||||
// 先比对对象引用,再按稳定 songName 兼容热更新或重建后的 SongItemData 实例。
|
||||
if (_initialSongSelectionOverride != null)
|
||||
{
|
||||
int overrideIndex = songItems.FindIndex(item => item != null &&
|
||||
item.GetComponent<SongSelectionTab>()?.connectedSong == _initialSongSelectionOverride);
|
||||
|
||||
if (overrideIndex < 0 && !string.IsNullOrEmpty(_initialSongSelectionOverride.songName))
|
||||
{
|
||||
overrideIndex = songItems.FindIndex(item => item != null &&
|
||||
item.GetComponent<SongSelectionTab>()?.connectedSong?.songName ==
|
||||
_initialSongSelectionOverride.songName);
|
||||
}
|
||||
|
||||
if (overrideIndex >= 0)
|
||||
{
|
||||
songIndex = overrideIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"[SongListControllerUI] 请求自动选中的歌曲 '{_initialSongSelectionOverride.songName}' 不在当前章节列表中,已保留常规缓存选择。");
|
||||
}
|
||||
|
||||
_initialSongSelectionOverride = null;
|
||||
}
|
||||
|
||||
StartCoroutine(SnapToItem(songItems[songIndex], true));
|
||||
closestTab = songItems[songIndex];
|
||||
|
||||
Reference in New Issue
Block a user