public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            try
            {
                EditorGUI.BeginProperty(position, label, property);

                var rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);

                if (hideMainFoldout)
                {
                    EditorGUI.LabelField(rect, "Required conditions:");
                }
                else
                {
                    property.isExpanded = EditorGUI.Foldout(rect, property.isExpanded, "Condition");
                }

                // Show last evaluation result:
                if (Application.isPlaying)
                {
                    var lastEvalProperty = property.FindPropertyRelative("lastEvaluationValue");
                    if (lastEvalProperty != null)
                    {
                        var        originalColor  = GUI.color;
                        GUIContent evalGuiContent = null;
                        switch ((Condition.LastEvaluationValue)lastEvalProperty.enumValueIndex)
                        {
                        case Condition.LastEvaluationValue.True:
                            GUI.color      = Color.green;
                            evalGuiContent = new GUIContent("(Last Check: True)");
                            break;

                        case Condition.LastEvaluationValue.False:
                            GUI.color      = Color.red;
                            evalGuiContent = new GUIContent("(Last Check: False)");
                            break;

                        default:
                            evalGuiContent = new GUIContent("(Last Check: None)");
                            break;
                        }
                        var evalSize = GUI.skin.label.CalcSize(evalGuiContent);
                        EditorGUI.LabelField(new Rect(position.x + position.width - evalSize.x, position.y, evalSize.x, EditorGUIUtility.singleLineHeight), evalGuiContent);
                        GUI.color = originalColor;
                    }
                }

                if (property.isExpanded)
                {
                    position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), GUIContent.none);

                    var oldIndentLevel = EditorGUI.indentLevel;
                    EditorGUI.indentLevel = 1;

                    FindProperties(property);

                    // Debugging (make sure using correct database):
                    //EditorGUI.ObjectField(new Rect(position.x + 100, position.y, position.width - 100, EditorGUIUtility.singleLineHeight), EditorTools.selectedDatabase, typeof(DialogueDatabase));

                    // Set up positioning variables:
                    var x     = position.x;
                    var y     = position.y + EditorGUIUtility.singleLineHeight;
                    var width = position.width;

                    EditorTools.SetInitialDatabaseIfNull();

                    rect = new Rect(x, y, width, EditorGUIUtility.singleLineHeight + 2f);
                    y   += rect.height;
                    luaConditionsProperty.isExpanded = EditorGUI.Foldout(rect, luaConditionsProperty.isExpanded, "Lua Conditions");

                    if (luaConditionsProperty.isExpanded)
                    {
                        rect = new Rect(x + 16f, y, 80f, EditorGUIUtility.singleLineHeight + 2f);
                        EditorGUI.LabelField(rect, "Size");
                        rect = new Rect(x + 96f, y, width - 96f, EditorGUIUtility.singleLineHeight + 2f);
                        y   += rect.height;
                        var newArraySize = EditorGUI.IntField(rect, luaConditionsProperty.arraySize);
                        if (newArraySize != luaConditionsProperty.arraySize)
                        {
                            var oldSize = luaConditionsProperty.arraySize;
                            luaConditionsProperty.arraySize = newArraySize;
                            for (int i = oldSize; i < newArraySize; i++)
                            {
                                luaConditionsProperty.GetArrayElementAtIndex(i).stringValue = string.Empty;
                            }
                        }
                        for (int i = 0; i < luaConditionsProperty.arraySize; i++)
                        {
                            var labelGuiContent = new GUIContent("Element " + i);
                            EditorGUI.LabelField(new Rect(x + 16f, y, 80f, EditorGUIUtility.singleLineHeight), labelGuiContent);
                            luaFieldWidth = rect.width - 16f;
                            var element = luaConditionsProperty.GetArrayElementAtIndex(i);
                            var height  = EditorTools.textAreaGuiStyle.CalcHeight(new GUIContent(element.stringValue), luaFieldWidth) + 2f;
                            rect = new Rect(x + 96f, y, width - 96f, height);
                            y   += height;
                            element.stringValue = EditorGUI.TextArea(rect, element.stringValue);
                        }
                    }

                    // Show Lua wizard if Lua Conditions is expanded:
                    if (luaConditionsProperty.isExpanded)
                    {
                        try
                        {
                            rect = new Rect(x, y, width, luaConditionWizardHeight);
                            luaConditionWizard.database = EditorTools.selectedDatabase;
                            if (luaConditionWizard.database != null)
                            {
                                if (!luaConditionWizard.IsOpen)
                                {
                                    luaConditionWizard.OpenWizard(string.Empty);
                                }
                                currentLuaWizardContent = luaConditionWizard.Draw(rect, new GUIContent("Lua Condition Wizard", "Use to add Lua conditions below"), currentLuaWizardContent);
                                if (!luaConditionWizard.IsOpen && !string.IsNullOrEmpty(currentLuaWizardContent))
                                {
                                    luaConditionsProperty.arraySize++;
                                    var luaElement = luaConditionsProperty.GetArrayElementAtIndex(luaConditionsProperty.arraySize - 1);
                                    luaElement.stringValue  = currentLuaWizardContent;
                                    currentLuaWizardContent = string.Empty;
                                    luaConditionWizard.OpenWizard(string.Empty);
                                }
                            }
                            y += rect.height;
                        }
                        catch (System.Exception)
                        {
                            // Don't cause editor problems if Lua wizard has problems.
                        }
                    }

                    // Quest conditions:
                    rect = new Rect(x, y, width, GetArrayHeight(questConditionsProperty));
                    EditorGUI.PropertyField(rect, questConditionsProperty, true);
                    y += rect.height;

                    // Accepted tags:
                    rect = new Rect(x, y, width, GetArrayHeight(acceptedTagsProperty));
                    EditorGUI.PropertyField(rect, acceptedTagsProperty, true);
                    y += rect.height;

                    // Accepted GameObjects:
                    rect = new Rect(x, y, width, GetArrayHeight(acceptedGameObjectsProperty));
                    EditorGUI.PropertyField(rect, acceptedGameObjectsProperty, true);
                    y += rect.height;

                    EditorGUI.indentLevel = oldIndentLevel;
                }
            }
            catch (System.Exception)
            {
                // Don't throw error and cause problems with Unity editor.
            }
            finally
            {
                EditorGUI.EndProperty();
            }
        }
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            // Set up property drawer:
            EditorGUI.BeginProperty(position, GUIContent.none, prop);
            position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

            // Show database field if specified:
            showReferenceDatabase = (attribute as ConversationPopupAttribute).showReferenceDatabase;
            if (EditorTools.selectedDatabase == null)
            {
                EditorTools.SetInitialDatabaseIfNull();
            }
            if (showReferenceDatabase)
            {
                var dbPosition = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
                position = new Rect(position.x, position.y + EditorGUIUtility.singleLineHeight, position.width, position.height - EditorGUIUtility.singleLineHeight);
                var newDatabase = EditorGUI.ObjectField(dbPosition, EditorTools.selectedDatabase, typeof(DialogueDatabase), true) as DialogueDatabase;
                if (newDatabase != EditorTools.selectedDatabase)
                {
                    EditorTools.selectedDatabase = newDatabase;
                    titlesDatabase = null;
                    titles         = null;
                }
            }
            if (EditorTools.selectedDatabase == null)
            {
                usePicker = false;
            }

            // Set up titles array:
            if (titles == null || titlesDatabase != EditorTools.selectedDatabase)
            {
                UpdateTitles(prop.stringValue);
            }

            // Update current index:
            var currentIndex = GetIndex(prop.stringValue);

            // Draw popup or plain text field:
            var rect = new Rect(position.x, position.y, position.width - 48, position.height);

            if (usePicker)
            {
                var newIndex = EditorGUI.Popup(rect, currentIndex, titles);
                if ((newIndex != currentIndex) && (0 <= newIndex && newIndex < titles.Length))
                {
                    currentIndex     = newIndex;
                    prop.stringValue = titles[currentIndex];
                    GUI.changed      = true;
                }
                if (GUI.Button(new Rect(position.x + position.width - 45, position.y, 18, 14), "x"))
                {
                    prop.stringValue = string.Empty;
                    currentIndex     = -1;
                }
            }
            else
            {
                EditorGUI.BeginChangeCheck();
                string value = EditorGUI.TextField(rect, prop.stringValue);
                if (EditorGUI.EndChangeCheck())
                {
                    prop.stringValue = value;
                }
            }

            // Radio button toggle between popup and plain text field:
            rect = new Rect(position.x + position.width - 22, position.y, 22, position.height);
            var newToggleValue = EditorGUI.Toggle(rect, usePicker, EditorStyles.radioButton);

            if (newToggleValue != usePicker)
            {
                usePicker = newToggleValue;
                if (usePicker && (EditorTools.selectedDatabase == null))
                {
                    EditorTools.selectedDatabase = EditorTools.FindInitialDatabase();
                }
                titles = null;
            }

            EditorGUI.EndProperty();
        }
        private void DrawDefines()
        {
            GUILayout.BeginArea(new Rect(5, 256, position.width - 10, position.height - 256));
            EditorGUILayout.LabelField("Current Build Target: " + ObjectNames.NicifyVariableName(EditorUserBuildSettings.activeBuildTarget.ToString()), EditorStyles.boldLabel);

            var define_USE_PHYSICS2D   = false;
            var define_USE_TIMELINE    = false;
            var define_USE_CINEMACHINE = false;
            var define_USE_ARTICY      = false;
            var define_USE_AURORA      = false;
            var define_TMP_PRESENT     = false;
            var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup).Split(';');

            for (int i = 0; i < defines.Length; i++)
            {
                if (string.Equals(ScriptingSymbolNames.USE_PHYSICS2D, defines[i].Trim()))
                {
                    define_USE_PHYSICS2D = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_TIMELINE, defines[i].Trim()))
                {
                    define_USE_TIMELINE = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_CINEMACHINE, defines[i].Trim()))
                {
                    define_USE_CINEMACHINE = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_ARTICY, defines[i].Trim()))
                {
                    define_USE_ARTICY = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_AURORA, defines[i].Trim()))
                {
                    define_USE_AURORA = true;
                }
                if (string.Equals(ScriptingSymbolNames.TMP_PRESENT, defines[i].Trim()))
                {
                    define_TMP_PRESENT = true;
                }
            }
#if EVALUATION_VERSION || !UNITY_2018_1_OR_NEWER
            define_USE_PHYSICS2D = true;
            define_TMP_PRESENT   = false;
#endif

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.LabelField(new GUIContent("Enable support for:", "NOTE: Enables Dialogue System support. You must still enable each package in Package Manager."));
#if UNITY_2018_1_OR_NEWER && !EVALUATION_VERSION
            var new_USE_PHYSICS2D = EditorGUILayout.ToggleLeft("2D Physics (USE_PHYSICS2D)", define_USE_PHYSICS2D);
#else
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("2D Physics (USE_PHYSICS2D)", "Support is built in for evaluation version or Unity 2017 and earlier."), define_USE_PHYSICS2D);
            EditorGUI.EndDisabledGroup();
            var new_USE_PHYSICS2D = define_USE_PHYSICS2D;
#endif

            var new_USE_TIMELINE    = EditorGUILayout.ToggleLeft(new GUIContent("Timeline (USE_TIMELINE)", "Enable Dialogue System support for Timeline. You must still enable Timeline in Package Manager."), define_USE_TIMELINE);
            var new_USE_CINEMACHINE = EditorGUILayout.ToggleLeft(new GUIContent("Cinemachine (USE_CINEMACHINE)", "Enable Dialogue System support for Cinemachine. You must still enable Cinemachine in Package Manager."), define_USE_CINEMACHINE);
            var new_USE_ARTICY      = EditorGUILayout.ToggleLeft(new GUIContent("articy:draft (USE_ARTICY)", "Enable Dialogue System support for articy:draft XML import."), define_USE_ARTICY);
            var new_USE_AURORA      = EditorGUILayout.ToggleLeft(new GUIContent("Aurora Toolset (USE_AURORA)", "Enable Dialogue System support for Aurora (Neverwinter Nights) Toolset import."), define_USE_AURORA);
#if EVALUATION_VERSION
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("TextMesh Pro (TMP_PRESENT)", "TextMesh Pro support not available in evaluation version."), define_TMP_PRESENT);
            EditorGUI.EndDisabledGroup();
            var new_TMP_PRESENT = define_TMP_PRESENT;
#else
            var new_TMP_PRESENT = EditorGUILayout.ToggleLeft(new GUIContent("TextMesh Pro (TMP_PRESENT)", "Enable Dialogue System support for TextMesh Pro. You must still enable TextMesh Pro in Package Manager."), define_TMP_PRESENT);
#endif
            var changed = EditorGUI.EndChangeCheck();

            if (new_USE_PHYSICS2D != define_USE_PHYSICS2D)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_PHYSICS2D, new_USE_PHYSICS2D);
            }
            if (new_USE_TIMELINE != define_USE_TIMELINE)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_TIMELINE, new_USE_TIMELINE);
            }
            if (new_USE_CINEMACHINE != define_USE_CINEMACHINE)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_CINEMACHINE, new_USE_CINEMACHINE);
            }
            if (new_USE_ARTICY != define_USE_ARTICY)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_ARTICY, new_USE_ARTICY);
            }
            if (new_USE_AURORA != define_USE_AURORA)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_AURORA, new_USE_AURORA);
            }
            if (new_TMP_PRESENT != define_TMP_PRESENT)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.TMP_PRESENT, new_TMP_PRESENT);
            }

            EditorWindowTools.DrawHorizontalLine();
            GUILayout.EndArea();

            if (changed)
            {
                EditorTools.ReimportScripts();
            }
        }
 public ConditionEditor(DialogueDatabase database, bool drawReferenceDatabase)
 {
     EditorTools.selectedDatabase = database ?? EditorTools.FindInitialDatabase();
     this.drawReferenceDatabase   = drawReferenceDatabase;
 }
        private void DrawDefines()
        {
            GUILayout.BeginArea(new Rect(5, 256, position.width - 10, position.height - 256));
            EditorGUILayout.LabelField("Current Build Target: " + ObjectNames.NicifyVariableName(EditorUserBuildSettings.activeBuildTarget.ToString()), EditorStyles.boldLabel);

            var define_USE_PHYSICS2D    = false;
            var define_USE_NEW_INPUT    = false;
            var define_USE_ADDRESSABLES = false;
            var define_USE_TIMELINE     = false;
            var define_USE_CINEMACHINE  = false;
            var define_USE_ARTICY       = false;
            var define_USE_AURORA       = false;
            var define_USE_TWINE        = false;
            var define_TMP_PRESENT      = false;
            var define_USE_STM          = false;
            var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup).Split(';');

            for (int i = 0; i < defines.Length; i++)
            {
                if (string.Equals(ScriptingSymbolNames.USE_PHYSICS2D, defines[i].Trim()))
                {
                    define_USE_PHYSICS2D = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_NEW_INPUT, defines[i].Trim()))
                {
                    define_USE_NEW_INPUT = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_ADDRESSABLES, defines[i].Trim()))
                {
                    define_USE_ADDRESSABLES = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_TIMELINE, defines[i].Trim()))
                {
                    define_USE_TIMELINE = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_CINEMACHINE, defines[i].Trim()))
                {
                    define_USE_CINEMACHINE = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_ARTICY, defines[i].Trim()))
                {
                    define_USE_ARTICY = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_AURORA, defines[i].Trim()))
                {
                    define_USE_AURORA = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_TWINE, defines[i].Trim()))
                {
                    define_USE_TWINE = true;
                }
                if (string.Equals(ScriptingSymbolNames.TMP_PRESENT, defines[i].Trim()))
                {
                    define_TMP_PRESENT = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_STM, defines[i].Trim()))
                {
                    define_USE_STM = true;
                }
            }
#if EVALUATION_VERSION || !UNITY_2018_1_OR_NEWER
            define_USE_PHYSICS2D    = true;
            define_USE_NEW_INPUT    = false;
            define_USE_ADDRESSABLES = false;
            define_TMP_PRESENT      = false;
            define_USE_STM          = false;
            define_USE_ARTICY       = true;
            define_USE_AURORA       = true;
            define_USE_TWINE        = true;
#endif

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.LabelField(new GUIContent("Enable support for:", "NOTE: Enables Dialogue System support. You must still enable each package in Package Manager."));
#if UNITY_2018_1_OR_NEWER && !EVALUATION_VERSION
            var new_USE_PHYSICS2D    = EditorGUILayout.ToggleLeft("2D Physics (USE_PHYSICS2D)", define_USE_PHYSICS2D);
            var new_USE_NEW_INPUT    = EditorGUILayout.ToggleLeft("New Input System (USE_NEW_INPUT)", define_USE_NEW_INPUT);
            var new_USE_ADDRESSABLES = EditorGUILayout.ToggleLeft("Addressables (USE_ADDRESSABLES)", define_USE_ADDRESSABLES);
#else
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("2D Physics (USE_PHYSICS2D)", "Support is built in for evaluation version or Unity 2017 and earlier."), define_USE_PHYSICS2D);
            EditorGUILayout.ToggleLeft(new GUIContent("New Input System (USE_NEW_INPUT)", "New Input System support not available in evaluation version."), define_USE_NEW_INPUT);
            EditorGUI.EndDisabledGroup();
            var new_USE_PHYSICS2D    = define_USE_PHYSICS2D;
            var new_USE_NEW_INPUT    = define_USE_NEW_INPUT;
            var new_USE_ADDRESSABLES = define_USE_ADDRESSABLES;
#endif

            var new_USE_TIMELINE    = EditorGUILayout.ToggleLeft(new GUIContent("Timeline (USE_TIMELINE)", "Enable Dialogue System support for Timeline. You must still enable Timeline in Package Manager."), define_USE_TIMELINE);
            var new_USE_CINEMACHINE = EditorGUILayout.ToggleLeft(new GUIContent("Cinemachine (USE_CINEMACHINE)", "Enable Dialogue System support for Cinemachine. You must still enable Cinemachine in Package Manager."), define_USE_CINEMACHINE);

#if EVALUATION_VERSION
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("articy:draft (USE_ARTICY)", "Enable Dialogue System support for articy:draft XML import."), define_USE_ARTICY);
            EditorGUILayout.ToggleLeft(new GUIContent("Aurora Toolset (USE_AURORA)", "Enable Dialogue System support for Aurora (Neverwinter Nights) Toolset import."), define_USE_AURORA);
            EditorGUI.EndDisabledGroup();
            var new_USE_ARTICY = define_USE_ARTICY;
            var new_USE_AURORA = define_USE_AURORA;
            var new_USE_TWINE  = define_USE_TWINE;
#else
            var new_USE_ARTICY = EditorGUILayout.ToggleLeft(new GUIContent("articy:draft (USE_ARTICY)", "Enable Dialogue System support for articy:draft XML import."), define_USE_ARTICY);
            var new_USE_AURORA = EditorGUILayout.ToggleLeft(new GUIContent("Aurora Toolset (USE_AURORA)", "Enable Dialogue System support for Aurora (Neverwinter Nights) Toolset import."), define_USE_AURORA);
            var new_USE_TWINE  = EditorGUILayout.ToggleLeft(new GUIContent("Twine (USE_TWINE)", "Enable Dialogue System support for Twine import."), define_USE_TWINE);
#endif

#if EVALUATION_VERSION
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("TextMesh Pro (TMP_PRESENT)", "TextMesh Pro support not available in evaluation version."), define_TMP_PRESENT);
            EditorGUILayout.ToggleLeft(new GUIContent("Super Text Mesh (USE_STM)", "Super Text Mesh support not available in evaluation version."), define_USE_STM);
            EditorGUI.EndDisabledGroup();
            var new_TMP_PRESENT = define_TMP_PRESENT;
            var new_USE_STM     = define_USE_STM;
#else
            var new_TMP_PRESENT = EditorGUILayout.ToggleLeft(new GUIContent("TextMesh Pro (TMP_PRESENT)", "Enable Dialogue System support for TextMesh Pro. You must still enable TextMesh Pro in Package Manager."), define_TMP_PRESENT);
            var new_USE_STM     = EditorGUILayout.ToggleLeft(new GUIContent("Super Text Mesh (USE_STM)", "Enable Dialogue System support for Super Text Mesh. Requires Super Text Mesh in project."), define_USE_STM);
#endif
            var changed = EditorGUI.EndChangeCheck();

            if (new_USE_PHYSICS2D != define_USE_PHYSICS2D)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_PHYSICS2D, new_USE_PHYSICS2D);
            }
            if (new_USE_NEW_INPUT != define_USE_NEW_INPUT)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_NEW_INPUT, new_USE_NEW_INPUT);
            }
            if (new_USE_ADDRESSABLES != define_USE_ADDRESSABLES)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_ADDRESSABLES, new_USE_ADDRESSABLES);
            }
            if (new_USE_TIMELINE != define_USE_TIMELINE)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_TIMELINE, new_USE_TIMELINE, true);
            }
            if (new_USE_CINEMACHINE != define_USE_CINEMACHINE)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_CINEMACHINE, new_USE_CINEMACHINE);
            }
            if (new_USE_ARTICY != define_USE_ARTICY)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_ARTICY, new_USE_ARTICY);
            }
            if (new_USE_AURORA != define_USE_AURORA)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_AURORA, new_USE_AURORA);
            }
            if (new_USE_TWINE != define_USE_TWINE)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_TWINE, new_USE_TWINE);
            }
            if (new_TMP_PRESENT != define_TMP_PRESENT)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.TMP_PRESENT, new_TMP_PRESENT, true);
            }
            if (new_USE_STM != define_USE_STM)
            {
                if (new_USE_STM)
                {
                    if (EditorUtility.DisplayDialog("Enable Super Text Mesh Support", "This will enable Super Text Mesh support. Your project must already contain Super Text Mesh.\n\n*IMPORTANT*: Before pressing OK, you MUST move the Clavian folder into the Plugins folder!\n\nTo continue, press OK. If you need to install Super Text Mesh or move the folder first, press Cancel.", "OK", "Cancel"))
                    {
                        MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_STM, new_USE_STM);
                    }
                    else
                    {
                        changed = false;
                    }
                }
                else
                {
                    MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_STM, new_USE_STM);
                }
            }

            EditorWindowTools.DrawHorizontalLine();
            GUILayout.EndArea();

            if (changed)
            {
                EditorTools.ReimportScripts();
            }
        }
Exemple #6
0
 public void OnEnable()
 {
     EditorTools.SetInitialDatabaseIfNull();
 }
Exemple #7
0
        public override void OnInspectorGUI()
        {
            var trigger = target as QuestTrigger;

            if (trigger == null)
            {
                return;
            }

            serializedObject.Update();
            EditorWindowTools.DrawDeprecatedTriggerHelpBox();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("trigger"), true);

            // Quest picker:
            if (questPicker != null)
            {
                serializedObject.ApplyModifiedProperties();
                questPicker.Draw();
                trigger.questName          = questPicker.currentQuest;
                trigger.useQuestNamePicker = questPicker.usePicker;
                trigger.selectedDatabase   = questPicker.database;
                serializedObject.Update();
            }

            if (trigger.selectedDatabase != null)
            {
                EditorTools.selectedDatabase = trigger.selectedDatabase;
            }
            if (EditorTools.selectedDatabase == null)
            {
                EditorTools.selectedDatabase = EditorTools.FindInitialDatabase();
            }

            // Quest state
            var setQuestStateProperty = serializedObject.FindProperty("setQuestState");

            EditorGUILayout.PropertyField(setQuestStateProperty, true);
            if (setQuestStateProperty.boolValue)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("questState"), true);
            }

            // Quest entry state:
            var setQuestEntryStateProperty = serializedObject.FindProperty("setQuestEntryState");

            EditorGUILayout.PropertyField(setQuestEntryStateProperty, true);
            if (setQuestEntryStateProperty.boolValue)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("questEntryNumber"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("questEntryState"), true);
            }

            // Lua code / wizard:
            if (EditorTools.selectedDatabase != luaScriptWizard.database)
            {
                luaScriptWizard.database = EditorTools.selectedDatabase;
                luaScriptWizard.RefreshWizardResources();
            }
            serializedObject.ApplyModifiedProperties();
            trigger.luaCode = luaScriptWizard.Draw(new GUIContent("Lua Code", "The Lua code to run when the condition is true"), trigger.luaCode);

            serializedObject.Update();

            // Alert:
            EditorGUILayout.PropertyField(serializedObject.FindProperty("alertMessage"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("localizedTextTable"), true);

            // Send Messages list:
            EditorGUILayout.PropertyField(serializedObject.FindProperty("sendMessages"), true);

            EditorGUILayout.PropertyField(serializedObject.FindProperty("once"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("condition"), true);
            serializedObject.ApplyModifiedProperties();
        }