removed a ton of xml comments and such
This commit is contained in:
@@ -4,18 +4,11 @@ using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Jovian.EncounterSystem.Editor {
|
||||
/// <summary>Severity of a <see cref="ValidationIssue"/>.</summary>
|
||||
public enum ValidationSeverity {
|
||||
Warning,
|
||||
Error
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One thing the validator found wrong. <see cref="asset"/> is the click-through target
|
||||
/// (table, dialog option set, reward), <see cref="encounter"/> identifies the specific
|
||||
/// encounter the issue pertains to when applicable, and <see cref="path"/> describes where
|
||||
/// inside the asset the issue lives.
|
||||
/// </summary>
|
||||
public class ValidationIssue {
|
||||
public Object asset;
|
||||
public Encounter encounter;
|
||||
@@ -24,13 +17,8 @@ namespace Jovian.EncounterSystem.Editor {
|
||||
public string message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scans every <see cref="EncounterTable"/> and <see cref="Reward"/> asset in the project and
|
||||
/// returns the list of issues found. Intended to be driven from a menu item, the browser window,
|
||||
/// or pre-commit tooling. Runs on demand — does not cache.
|
||||
/// </summary>
|
||||
/// <summary>Project-wide scan of encounter tables and rewards. Runs on demand, no caching.</summary>
|
||||
public static class EncounterValidator {
|
||||
/// <summary>Walk every encounter table and reward asset, returning all issues found.</summary>
|
||||
public static List<ValidationIssue> ValidateProject() {
|
||||
var issues = new List<ValidationIssue>();
|
||||
|
||||
@@ -48,7 +36,6 @@ namespace Jovian.EncounterSystem.Editor {
|
||||
return issues;
|
||||
}
|
||||
|
||||
/// <summary>Return the issues for a single encounter inside a table. Useful for per-row badges.</summary>
|
||||
public static List<ValidationIssue> ValidateEncounter(EncounterTable table, int index) {
|
||||
var issues = new List<ValidationIssue>();
|
||||
if(table?.encounters == null || index < 0 || index >= table.encounters.Count) {
|
||||
@@ -197,38 +184,39 @@ namespace Jovian.EncounterSystem.Editor {
|
||||
}
|
||||
|
||||
private static void ValidateDialogLineRef(EncounterDialogOptionSet optionSet, Encounter encounter, string path, DialogLineRef lineRef, List<ValidationIssue> issues) {
|
||||
var hasLibrary = lineRef.library != null;
|
||||
var library = optionSet.library;
|
||||
var hasId = !string.IsNullOrEmpty(lineRef.id);
|
||||
var hasInline = !string.IsNullOrEmpty(lineRef.inlineText);
|
||||
|
||||
if(!hasLibrary && !hasInline) {
|
||||
if(!hasId && !hasInline) {
|
||||
issues.Add(new ValidationIssue {
|
||||
asset = optionSet,
|
||||
encounter = encounter,
|
||||
path = path,
|
||||
severity = ValidationSeverity.Warning,
|
||||
message = "Dialog line is empty (no library reference and no inline text)."
|
||||
message = "Dialog line is empty (no id and no inline text)."
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if(hasLibrary && hasId && string.IsNullOrEmpty(lineRef.library.Resolve(lineRef.id))) {
|
||||
if(hasId && library == null) {
|
||||
issues.Add(new ValidationIssue {
|
||||
asset = optionSet,
|
||||
encounter = encounter,
|
||||
path = path,
|
||||
severity = ValidationSeverity.Error,
|
||||
message = $"DialogLineRef id '{lineRef.id}' not found in library '{lineRef.library.name}'."
|
||||
message = $"DialogLineRef references id '{lineRef.id}' but the option set has no library assigned."
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if(hasLibrary && !hasId && !hasInline) {
|
||||
if(hasId && library != null && string.IsNullOrEmpty(library.Resolve(lineRef.id))) {
|
||||
issues.Add(new ValidationIssue {
|
||||
asset = optionSet,
|
||||
encounter = encounter,
|
||||
path = path,
|
||||
severity = ValidationSeverity.Warning,
|
||||
message = "Library assigned but no id picked; will fall back to empty inline text."
|
||||
severity = ValidationSeverity.Error,
|
||||
message = $"DialogLineRef id '{lineRef.id}' not found in library '{library.name}'."
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -271,7 +259,6 @@ namespace Jovian.EncounterSystem.Editor {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Menu-driven runner that prints the validator report to the console with click-through asset pings.</summary>
|
||||
public static class EncounterValidatorMenu {
|
||||
[MenuItem("Jovian/Encounters/Validate All")]
|
||||
public static void ValidateAll() {
|
||||
|
||||
Reference in New Issue
Block a user