存档重构,游戏内容解锁机制;教程完善(未完成)
This commit is contained in:
@@ -24,6 +24,11 @@ namespace Ichni.UI
|
||||
public ChapterSelectionUnit connectedChapter;
|
||||
|
||||
public string chapterName;
|
||||
/// <summary>
|
||||
/// 当前章节的运行时锁定状态。仅用于 UI 表现;真正进入剧情或选曲前仍会重新调用
|
||||
/// <see cref="UnlockSaveModule.CanAccessChapter"/>,不能把本字段作为授权依据。
|
||||
/// </summary>
|
||||
public bool isLocked;
|
||||
public bool isExpanded;
|
||||
public bool isDuringAnimation;
|
||||
|
||||
@@ -59,6 +64,7 @@ namespace Ichni.UI
|
||||
{
|
||||
connectedChapter = chapter;
|
||||
expansionRipple.material = new Material(rippleMaterial);
|
||||
RefreshUnlockState();
|
||||
|
||||
expandButton.onClick.AddListener(() =>
|
||||
{
|
||||
@@ -83,6 +89,11 @@ namespace Ichni.UI
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanEnterChapter())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ChapterSelectionManager.instance.currentChapter = connectedChapter;
|
||||
AudioManager.SetSwitch(connectedChapter.chapterSwitch);
|
||||
@@ -97,6 +108,11 @@ namespace Ichni.UI
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanEnterChapter())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ChapterSelectionManager.instance.currentChapter = connectedChapter;
|
||||
AudioManager.SetSwitch(connectedChapter.chapterSwitch);
|
||||
@@ -112,6 +128,36 @@ namespace Ichni.UI
|
||||
allPerfectText.text = allPerfectCount.ToString();
|
||||
beatmapProgressText.text = $"{finishedBeatmapCount}/{beatmapCount}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据统一内容解锁服务刷新章节入口的可交互状态。
|
||||
/// 当前 Prefab 尚无专用锁定美术,因此先禁用两个实际入口;后续补充锁图标时,
|
||||
/// 只需读取 <see cref="isLocked"/>,无需复制解锁判断。
|
||||
/// </summary>
|
||||
private void RefreshUnlockState()
|
||||
{
|
||||
UnlockSaveModule unlockSaveModule = GameSaveManager.instance?.UnlockSaveModule;
|
||||
isLocked = unlockSaveModule == null || !unlockSaveModule.CanAccessChapter(connectedChapter);
|
||||
|
||||
if (enterStorylineButton != null)
|
||||
{
|
||||
enterStorylineButton.interactable = !isLocked;
|
||||
}
|
||||
|
||||
if (enterSongSelectionButton != null)
|
||||
{
|
||||
enterSongSelectionButton.interactable = !isLocked;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 章节的最终入口检查。即使 UI Button 状态被其它脚本意外恢复,也不能绕过解锁规则。
|
||||
/// </summary>
|
||||
private bool CanEnterChapter()
|
||||
{
|
||||
RefreshUnlockState();
|
||||
return !isLocked;
|
||||
}
|
||||
|
||||
private void Expand()
|
||||
{
|
||||
@@ -197,4 +243,4 @@ namespace Ichni.UI
|
||||
shrinkSequence.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user