mirror of
https://github.com/maxartz15/Validator.git
synced 2025-06-25 19:16:06 +02:00
Base validator
SceneValidator & AssetValidator of objects that implement IValidatable.
This commit is contained in:
9
Runtime/IValidatable.cs
Normal file
9
Runtime/IValidatable.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Validator
|
||||
{
|
||||
public interface IValidatable
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
public void Validate(Report report);
|
||||
#endif
|
||||
}
|
||||
}
|
11
Runtime/IValidatable.cs.meta
Normal file
11
Runtime/IValidatable.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9745876369d865247b2bae9393491734
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
60
Runtime/Report.cs
Normal file
60
Runtime/Report.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Validator
|
||||
{
|
||||
public enum WarningType
|
||||
{
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
}
|
||||
|
||||
public class Report
|
||||
{
|
||||
public struct ReportMessage
|
||||
{
|
||||
public Object Target => target;
|
||||
public WarningType WarningType => warningType;
|
||||
public string Category => category;
|
||||
public string Message => message;
|
||||
public string Solution => solution;
|
||||
|
||||
private readonly Object target;
|
||||
private readonly WarningType warningType;
|
||||
private readonly string category;
|
||||
private readonly string message;
|
||||
private readonly string solution;
|
||||
|
||||
public ReportMessage(Object target, WarningType warningLevel, string category, string message, string solution)
|
||||
{
|
||||
this.target = target;
|
||||
this.warningType = warningLevel;
|
||||
this.category = category;
|
||||
this.message = message;
|
||||
this.solution = solution;
|
||||
}
|
||||
}
|
||||
|
||||
public string Name => name;
|
||||
|
||||
public IList<ReportMessage> Reports => reports.AsReadOnly();
|
||||
private readonly string name;
|
||||
private readonly List<ReportMessage> reports = new List<ReportMessage>();
|
||||
|
||||
public Report(string name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void Log(ReportMessage report)
|
||||
{
|
||||
reports.Add(report);
|
||||
}
|
||||
|
||||
public void Log(Object target, WarningType warningType, string category, string message, string solution)
|
||||
{
|
||||
Log(new ReportMessage(target, warningType, category, message, solution));
|
||||
}
|
||||
}
|
||||
}
|
11
Runtime/Report.cs.meta
Normal file
11
Runtime/Report.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d39518e0aab78db47adc586ce678d8a9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Runtime/ReportCategories.cs
Normal file
9
Runtime/ReportCategories.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Validator
|
||||
{
|
||||
public static partial class ReportCategories
|
||||
{
|
||||
public const string Art = "Art";
|
||||
public const string Design = "Design";
|
||||
public const string Code = "Code";
|
||||
}
|
||||
}
|
11
Runtime/ReportCategories.cs.meta
Normal file
11
Runtime/ReportCategories.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2016a6a28d54304ea9cd64801c4f0b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,5 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace COMPANYNAME.PACKAGENAME
|
||||
{
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "COMPANYNAME.PACKAGENAME",
|
||||
"name": "VertexColor.Validator",
|
||||
"rootNamespace": "Validator",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
@ -8,5 +9,6 @@
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": []
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
7
Runtime/VertexColor.Validator.asmdef.meta
Normal file
7
Runtime/VertexColor.Validator.asmdef.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 334c4fbff44e0f9439f29f9d8e0ce6e9
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user