存档重构,游戏内容解锁机制;教程完善(未完成)
This commit is contained in:
@@ -21,6 +21,14 @@ namespace Ichni.Menu
|
||||
public Sprite avatar;
|
||||
public Switch chapterSwitch;
|
||||
|
||||
/// <summary>
|
||||
/// 章节剧情入口与选曲入口共用的内容解锁规则。
|
||||
/// 留空表示章节从新档开始即可访问;需要锁定时请使用 <see cref="UnlockRequirement"/>,
|
||||
/// 并遵守 <see cref="UnlockSaveModule.KeyNamingRule"/> 中的下划线 Key 规则。
|
||||
/// </summary>
|
||||
[LabelText("Unlock Requirement")]
|
||||
public UnlockRequirement unlockRequirement = new UnlockRequirement();
|
||||
|
||||
[Searchable]
|
||||
public List<SongItemData> songs = new List<SongItemData>();
|
||||
|
||||
@@ -54,11 +62,6 @@ namespace Ichni.Menu
|
||||
|
||||
public partial class ChapterSelectionUnit
|
||||
{
|
||||
public List<string> GetRelatedSongNamesOfUnlockKey(string key)
|
||||
{
|
||||
return (from song in songs where song.storyUnlockKey == key select song.songName).ToList();
|
||||
}
|
||||
|
||||
public (int, int, int, int, int) GetChapterSaveInfo()
|
||||
{
|
||||
int beatmapCount = 0;
|
||||
@@ -72,9 +75,19 @@ namespace Ichni.Menu
|
||||
if (GameSaveManager.instance.SongSaveModule.songStatusSaves.TryGetValue(song.songName, out var songStatus))
|
||||
{
|
||||
bool thisSongFinished = false;
|
||||
foreach (BeatmapSave beatmapSave in songStatus.beatmapSaves)
|
||||
foreach (DifficultyData difficulty in song.difficultyDataList)
|
||||
{
|
||||
if (difficulty == null || difficulty.saveDifficultyId < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
beatmapCount++;
|
||||
if (!songStatus.TryGetBeatmapSave(difficulty.saveDifficultyId, out BeatmapSave beatmapSave))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!beatmapSave.IsEmpty())
|
||||
{
|
||||
thisSongFinished = true;
|
||||
@@ -131,17 +144,24 @@ namespace Ichni.Menu
|
||||
[FoldoutGroup("$songName")]
|
||||
public List<DifficultyData> difficultyDataList;
|
||||
|
||||
/// <summary>
|
||||
/// 歌曲自身的内容解锁规则。章节是否开放由 <see cref="ChapterSelectionUnit.unlockRequirement"/> 单独判断;
|
||||
/// 真正进入歌曲时两者必须同时满足。
|
||||
/// </summary>
|
||||
[FoldoutGroup("$songName")]
|
||||
public string storyUnlockKey;
|
||||
|
||||
[FoldoutGroup("$songName")]
|
||||
public string paymentUnlockKey;
|
||||
[LabelText("Unlock Requirement")]
|
||||
public UnlockRequirement unlockRequirement = new UnlockRequirement();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class DifficultyData
|
||||
{
|
||||
public int difficultyIndex;
|
||||
/// <summary>
|
||||
/// 歌曲成绩的稳定 ID,不等同于选曲 UI 的难度列表位置。
|
||||
/// 发布后不要更改或复用既有 ID;新增难度必须使用从未分配过的非负 ID。
|
||||
/// </summary>
|
||||
[FormerlySerializedAs("difficultyIndex")]
|
||||
public int saveDifficultyId;
|
||||
public string difficultyName;
|
||||
public string displayDifficultyName;
|
||||
public int difficultyValue;
|
||||
@@ -149,14 +169,19 @@ namespace Ichni.Menu
|
||||
public Color color;
|
||||
public bool isAvailable;
|
||||
public bool ForceFullScreenJudge = false;
|
||||
|
||||
[MinValue(1)]
|
||||
[Tooltip("仅当 Note、Timing 或判定规则变化,导致成绩不可与旧谱面比较时递增;UI、文本、封面和音量调整不递增。")]
|
||||
public int chartRevision = 1;
|
||||
|
||||
public DifficultyData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DifficultyData(int difficultyIndex, string difficultyName, string displayDifficultyName, int difficultyValue, string charterName, Color color, bool ForceFullScreenJudge = false)
|
||||
public DifficultyData(int saveDifficultyId, string difficultyName, string displayDifficultyName, int difficultyValue, string charterName, Color color, bool ForceFullScreenJudge = false)
|
||||
{
|
||||
this.difficultyIndex = difficultyIndex;
|
||||
this.saveDifficultyId = saveDifficultyId;
|
||||
this.difficultyName = difficultyName;
|
||||
this.displayDifficultyName = displayDifficultyName;
|
||||
this.charterName = charterName;
|
||||
@@ -170,5 +195,13 @@ namespace Ichni.Menu
|
||||
{
|
||||
return string.IsNullOrEmpty(displayDifficultyName) ? difficultyName : displayDifficultyName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回合法的 Revision。配置侧始终至少使用 1;0 只会被视为未初始化值并被钳制。
|
||||
/// </summary>
|
||||
public int GetChartRevision()
|
||||
{
|
||||
return Mathf.Max(1, chartRevision);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user