存档重构,游戏内容解锁机制;教程完善(未完成)

This commit is contained in:
SoulliesOfficial
2026-07-18 16:51:18 -04:00
parent d48ef1e65e
commit dda354ebb9
123 changed files with 4032 additions and 558 deletions

View File

@@ -16,6 +16,10 @@ namespace Ichni.Menu
{
private SongListControllerUI songListController => MenuManager.instance.songSelectionUIPage.songListController;
/// <summary>
/// 供锁标识和预览滤镜使用的运行时状态。进入歌曲前必须调用 <see cref="RefreshUnlockState"/>
/// 重新计算,不能把缓存的显示状态当作最终授权结果。
/// </summary>
public bool isLocked;
public SongItemData connectedSong;
@@ -38,13 +42,26 @@ namespace Ichni.Menu
songNameText.text = song.displaySongName;
composerNameText.text = song.composer;
isLocked = !GameSaveManager.instance.SongSaveModule.CheckStoryKey(song.storyUnlockKey);
lockMark.gameObject.SetActive(isLocked);
RefreshUnlockState();
quickSwitchButton.onClick.AddListener(() =>
{
if (MenuManager.instance.songSelectionUIPage.songListController.selectedTab == this)
{
SongSelectionUIPage songSelectionUIPage = MenuManager.instance.songSelectionUIPage;
// 快速进入会绕过 PlaySongUI 的 Button.interactable必须在此处重复保护空难度状态。
if (songSelectionUIPage.selectedSong == null || songSelectionUIPage.selectedDifficulty == null)
{
return;
}
// 快速进入与标准 Play 共用统一的章节 + 歌曲授权检查,不能因 UI 状态过期而绕过锁定。
if (!RefreshUnlockState())
{
return;
}
if (MenuManager.instance.isEnteringGame)
{
return;
@@ -53,9 +70,9 @@ namespace Ichni.Menu
MenuManager.instance.isEnteringGame = true;
InformationTransistor.instance.SetInformation(
ChapterSelectionManager.instance.currentChapter,
MenuManager.instance.songSelectionUIPage.selectedSong,
MenuManager.instance.songSelectionUIPage.selectedDifficulty);
ChapterSelectionManager.instance.currentChapter,
songSelectionUIPage.selectedSong,
songSelectionUIPage.selectedDifficulty);
AudioManager.Post(AK.EVENTS.ENTERTOGAME);
SongSelectionManager.instance.StopPreviewSong();
@@ -74,6 +91,25 @@ namespace Ichni.Menu
});
}
/// <summary>
/// 重新计算当前 Tab 是否锁定,并同步锁图标。
/// 章节本身被锁定时,即使歌曲规则无条件开放,也仍然视为不可进入。
/// </summary>
/// <returns>返回 true 表示当前章节和歌曲均允许进入。</returns>
public bool RefreshUnlockState()
{
UnlockSaveModule unlockSaveModule = GameSaveManager.instance?.UnlockSaveModule;
ChapterSelectionUnit currentChapter = ChapterSelectionManager.instance?.currentChapter;
isLocked = unlockSaveModule == null || !unlockSaveModule.CanEnterSong(currentChapter, connectedSong);
if (lockMark != null)
{
lockMark.gameObject.SetActive(isLocked);
}
return !isLocked;
}
private void Update()
{
RectTransform centerPoint = songListController.centerPoint;
@@ -113,4 +149,4 @@ namespace Ichni.Menu
}
}
}
}
}