示例#1
0
        private void DrawConnectionInfo(SerializedObject serializedObject, SerializedProperty nodeProperty)
        {
            UnityEngine.Assertions.Assert.IsNotNull(serializedObject, "Quest Machine: Internal error - serializedObject is null.");
            UnityEngine.Assertions.Assert.IsNotNull(nodeProperty, "Quest Machine: Internal error - nodeProperty is null.");

            // Only applicable to Condition nodes:
            var nodeTypeProperty = nodeProperty.FindPropertyRelative("m_nodeType");

            UnityEngine.Assertions.Assert.IsNotNull(nodeTypeProperty, "Quest Machine: Internal error - m_nodeType is null.");
            if (nodeTypeProperty == null)
            {
                return;
            }
            var nodeType = (QuestNodeType)nodeTypeProperty.enumValueIndex;

            if (nodeType != QuestNodeType.Condition)
            {
                return;
            }

            QuestEditorPrefs.trueConnectionFoldout = QuestEditorUtility.EditorGUILayoutFoldout("Conditions", "Conditions that must be true for the node to become true.", QuestEditorPrefs.trueConnectionFoldout);
            if (!QuestEditorPrefs.trueConnectionFoldout)
            {
                return;
            }

            try
            {
                QuestEditorUtility.EditorGUILayoutBeginGroup();
                EditorGUILayout.HelpBox("The conditions below must be true for the node to become true.", MessageType.None);
                if (questConditionsInspectorGUI == null)
                {
                    questConditionsInspectorGUI = new QuestConditionSetInspectorGUI();
                }
                questConditionsInspectorGUI.Draw(nodeProperty.FindPropertyRelative("m_conditionSet"));
            }
            finally
            {
                QuestEditorUtility.EditorGUILayoutEndGroup();
            }
        }
示例#2
0
        private void DrawOfferConditions(SerializedObject serializedObject)
        {
            UnityEngine.Assertions.Assert.IsNotNull(serializedObject, "Quest Machine: Internal error - serializedObject is null.");
            QuestEditorPrefs.offerFoldout = QuestEditorUtility.EditorGUILayoutFoldout("Offer", "Conditions that must be true before the quest giver can offer the quest.", QuestEditorPrefs.offerFoldout);
            if (!QuestEditorPrefs.offerFoldout)
            {
                return;
            }

            try
            {
                QuestEditorUtility.EditorGUILayoutBeginGroup();
                EditorGUILayout.HelpBox("If you specify conditions below, then they must be true before the quest giver can offer the quest.", MessageType.None);
                if (m_offerConditionSetInspectorGUI == null)
                {
                    m_offerConditionSetInspectorGUI = new QuestConditionSetInspectorGUI();
                }
                m_offerConditionSetInspectorGUI.Draw(serializedObject.FindProperty("m_offerConditionSet"));
                if (m_offerConditionsUnmetContentListDrawer == null)
                {
                    m_offerConditionsUnmetContentListDrawer =
                        new QuestContentListInspectorGUI(new GUIContent("Offer Conditions Unmet Text", "Show this dialogue content when the offer conditions are unmet."), QuestContentCategory.OfferConditionsUnmet);
                }
                if (m_offerContentListDrawer == null)
                {
                    m_offerContentListDrawer =
                        new QuestContentListInspectorGUI(new GUIContent("Offer Text", "Show this dialogue text to offer the quest to the player."), QuestContentCategory.Offer);
                }
                m_offerConditionsUnmetContentListDrawer.Draw(serializedObject, serializedObject.FindProperty("m_offerConditionsUnmetContentList"), true);
                m_offerContentListDrawer.Draw(serializedObject, serializedObject.FindProperty("m_offerContentList"), true);
            }
            finally
            {
                QuestEditorUtility.EditorGUILayoutEndGroup();
            }
        }
示例#3
0
        private void DrawAutostartConditions(SerializedObject serializedObject)
        {
            UnityEngine.Assertions.Assert.IsNotNull(serializedObject, "Quest Machine: Internal error - serializedObject is null.");
            QuestEditorPrefs.autostartFoldout = QuestEditorUtility.EditorGUILayoutFoldout("Autostart", "Conditions that autostart the quest when true.", QuestEditorPrefs.autostartFoldout);
            if (!QuestEditorPrefs.autostartFoldout)
            {
                return;
            }

            try
            {
                QuestEditorUtility.EditorGUILayoutBeginGroup();
                EditorGUILayout.HelpBox("If you specify conditions below, then the quest will automatically become active when the conditions become true.", MessageType.None);
                if (m_autostartConditionSetInspectorGUI == null)
                {
                    m_autostartConditionSetInspectorGUI = new QuestConditionSetInspectorGUI();
                }
                m_autostartConditionSetInspectorGUI.Draw(serializedObject.FindProperty("m_autostartConditionSet"));
            }
            finally
            {
                QuestEditorUtility.EditorGUILayoutEndGroup();
            }
        }