-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathInkCompilerEditor.cs
More file actions
60 lines (46 loc) · 2.14 KB
/
InkCompilerEditor.cs
File metadata and controls
60 lines (46 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace Ink.UnityIntegration {
[CustomEditor(typeof(InkCompiler))]
public class InkCompilerEditor : Editor {
#pragma warning disable
protected InkCompiler data;
public void OnEnable() {
data = (InkCompiler) target;
}
public bool RequiresConstantRepaint() {
return true;
}
public override void OnInspectorGUI() {
serializedObject.Update();
var type = typeof(InkCompiler);
EditorGUILayout.Toggle("Executing Compilation Stack", InkCompiler.executingCompilationStack);
EditorGUILayout.PropertyField(serializedObject.FindProperty("pendingCompilationStack"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("compilationStack"));
// this.DrawDefaultInspector();
var buildBlockedInfo = type.GetField("buildBlocked", BindingFlags.NonPublic | BindingFlags.Static);
bool buildBlocked = (bool)buildBlockedInfo.GetValue(null);
EditorGUILayout.Toggle("Build Blocked", buildBlocked);
var playModeBlockedInfo = type.GetField("playModeBlocked", BindingFlags.NonPublic | BindingFlags.Static);
bool playModeBlocked = (bool)playModeBlockedInfo.GetValue(null);
EditorGUILayout.Toggle("Play Mode Blocked", playModeBlocked);
var hasLockedUnityCompilationInfo = type.GetField("hasLockedUnityCompilation", BindingFlags.NonPublic | BindingFlags.Static);
bool hasLockedUnityCompilation = (bool)hasLockedUnityCompilationInfo.GetValue(null);
EditorGUILayout.Toggle("Has Locked Compilation", hasLockedUnityCompilation);
EditorGUILayout.BeginHorizontal();
var disallowedAutoRefreshInfo = type.GetProperty("disallowedAutoRefresh", BindingFlags.NonPublic | BindingFlags.Static);
bool disallowedAutoRefresh = (bool)disallowedAutoRefreshInfo.GetValue(null);
EditorGUILayout.Toggle("DisallowedAutoRefresh", disallowedAutoRefresh);
#if UNITY_2019_4_OR_NEWER
if(GUILayout.Button("AllowAutoRefresh")) {
AssetDatabase.AllowAutoRefresh();
}
EditorGUILayout.EndHorizontal();
#endif
if(GUI.changed && target != null)
EditorUtility.SetDirty(target);
serializedObject.ApplyModifiedProperties();
}
}
}