mirror of
https://github.com/Ratstail91/Mementos.git
synced 2025-11-29 02:24:28 +11:00
Committed everything
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
using System.Text;
|
||||
using Ink.UnityIntegration;
|
||||
using System.Linq;
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
using UnityEditor.Build.Reporting;
|
||||
#endif
|
||||
|
||||
class InkPreBuildValidationCheck :
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
IPreprocessBuildWithReport
|
||||
#else
|
||||
IPreprocessBuild
|
||||
#endif
|
||||
{
|
||||
public int callbackOrder { get { return 0; } }
|
||||
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
public void OnPreprocessBuild(BuildReport report) {
|
||||
PreprocessValidationStep();
|
||||
}
|
||||
#else
|
||||
public void OnPreprocessBuild(BuildTarget target, string path) {
|
||||
PreprocessValidationStep();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void PreprocessValidationStep () {
|
||||
AssertNotCompiling();
|
||||
CheckForInvalidFiles();
|
||||
}
|
||||
|
||||
static void AssertNotCompiling () {
|
||||
if(InkCompiler.compiling) {
|
||||
StringBuilder sb = new StringBuilder("Ink is currently compiling!");
|
||||
var errorString = sb.ToString();
|
||||
InkCompiler.buildBlocked = true;
|
||||
if(UnityEditor.EditorUtility.DisplayDialog("Ink Build Error!", errorString, "Ok")) {
|
||||
Debug.LogError(errorString);
|
||||
}
|
||||
}
|
||||
}
|
||||
// When syncronous compilation is allowed we should try to replace this error with a compile.
|
||||
static void CheckForInvalidFiles () {
|
||||
var filesToRecompile = InkLibrary.GetFilesRequiringRecompile();
|
||||
if(filesToRecompile.Any()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("There are Ink files which should be compiled, but appear not to be. You can resolve this by either:");
|
||||
sb.AppendLine(" - Compiling your files via 'Assets/Recompile Ink'");
|
||||
var resolveStep = " - Disabling 'Compile Automatically' "+(InkSettings.instance.compileAutomatically ? "in your Ink Settings file" : "for each of the files listed below");
|
||||
sb.AppendLine(resolveStep);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Files:");
|
||||
var filesAsString = string.Join(", ", filesToRecompile.Select(x => x.filePath).ToArray());
|
||||
sb.AppendLine(filesAsString);
|
||||
var errorString = sb.ToString();
|
||||
if(!UnityEditor.EditorUtility.DisplayDialog("Ink Build Error!", errorString, "Build anyway", "Cancel build")) {
|
||||
Debug.LogError(errorString);
|
||||
} else {
|
||||
Debug.LogWarning(errorString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 260430d96c5f0aa46a31363984dc9088
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user