removed a ton of xml comments and such
This commit is contained in:
@@ -3,17 +3,12 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Jovian.EncounterSystem {
|
||||
/// <summary>Tag for a quest log entry.</summary>
|
||||
public enum QuestLogEventType {
|
||||
Started,
|
||||
Advanced,
|
||||
Completed
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One chronological entry in the quest log. Names are cached alongside ids so a loaded save
|
||||
/// can display the log even if the underlying encounter has since been renamed or removed.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class QuestLogEntry {
|
||||
public QuestLogEventType type;
|
||||
@@ -23,34 +18,24 @@ namespace Jovian.EncounterSystem {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chronological, serializable record of quest events. Subscribes to <see cref="QuestProgress"/>
|
||||
/// events at construction time — build it before any encounter fires so nothing is missed.
|
||||
/// Chronological, serialisable record of quest events. Subscribes at construction —
|
||||
/// build before any encounter fires or early entries will be missed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is the save payload for quest progression. On load, call <see cref="Restore"/> with the
|
||||
/// saved entries and then <see cref="QuestProgress.LoadResolvedIds"/> with
|
||||
/// <see cref="ResolvedEncounterIds"/> to rehydrate the gating set.
|
||||
/// </remarks>
|
||||
public class QuestLog {
|
||||
private readonly List<QuestLogEntry> entries = new();
|
||||
|
||||
/// <summary>The log in chronological order.</summary>
|
||||
public IReadOnlyList<QuestLogEntry> Entries => entries;
|
||||
|
||||
/// <summary>Subscribe to <paramref name="progress"/>'s quest events; every fire appends an entry.</summary>
|
||||
public QuestLog(QuestProgress progress) {
|
||||
progress.QuestStarted += quest => Record(QuestLogEventType.Started, null, quest);
|
||||
progress.QuestAdvanced += (from, to) => Record(QuestLogEventType.Advanced, from, to);
|
||||
progress.QuestCompleted += quest => Record(QuestLogEventType.Completed, null, quest);
|
||||
}
|
||||
|
||||
/// <summary>Return a copy of the current entries suitable for serialization.</summary>
|
||||
public List<QuestLogEntry> CreateSnapshot() {
|
||||
return new List<QuestLogEntry>(entries);
|
||||
}
|
||||
|
||||
/// <summary>Replace the current entries with those from a save. Pass the list straight from
|
||||
/// the save payload.</summary>
|
||||
public void Restore(IEnumerable<QuestLogEntry> saved) {
|
||||
entries.Clear();
|
||||
if(saved == null) {
|
||||
@@ -60,8 +45,6 @@ namespace Jovian.EncounterSystem {
|
||||
entries.AddRange(saved);
|
||||
}
|
||||
|
||||
/// <summary>Enumerate the distinct encounter ids present in the log — what
|
||||
/// <see cref="QuestProgress.LoadResolvedIds"/> needs on load.</summary>
|
||||
public IEnumerable<string> ResolvedEncounterIds() {
|
||||
return entries
|
||||
.Select(entry => entry.encounterInternalId)
|
||||
|
||||
Reference in New Issue
Block a user