Exemple #1
0
        public void Draw(SerializedObject serializedObject, SerializedProperty categorizedContentListProperty)
        {
            UnityEngine.Assertions.Assert.IsNotNull(serializedObject, "Quest Machine: Internal error - SerializedObject is null in CategorizedQuestContentInspectorGUI.");
            UnityEngine.Assertions.Assert.IsNotNull(categorizedContentListProperty, "Quest Machine: Internal error - categorizedUIContentListProperty is null.");
            if (serializedObject == null || categorizedContentListProperty == null)
            {
                return;
            }

            // Get references to content lists:
            ValidateCategorizedContentListSize(categorizedContentListProperty);
            var dialogueContentList = categorizedContentListProperty.GetArrayElementAtIndex((int)QuestContentCategory.Dialogue).FindPropertyRelative("m_contentList");
            var journalContentList  = categorizedContentListProperty.GetArrayElementAtIndex((int)QuestContentCategory.Journal).FindPropertyRelative("m_contentList");
            var hudContentList      = categorizedContentListProperty.GetArrayElementAtIndex((int)QuestContentCategory.HUD).FindPropertyRelative("m_contentList");

            UnityEngine.Assertions.Assert.IsNotNull(dialogueContentList, "Quest Machine: Internal error - Dialogue UI content list is null.");
            UnityEngine.Assertions.Assert.IsNotNull(journalContentList, "Quest Machine: Internal error - Journal UI content list is null.");
            UnityEngine.Assertions.Assert.IsNotNull(hudContentList, "Quest Machine: Internal error - HUD UI content list is null.");
            if (dialogueContentList == null || journalContentList == null || hudContentList == null)
            {
                return;
            }

            // Draw content lists:
            m_dialogueContentListDrawer.Draw(serializedObject, dialogueContentList, true);
            m_journalContentListDrawer.Draw(serializedObject, journalContentList, true);
            m_hudContentListDrawer.Draw(serializedObject, hudContentList, true);
        }
Exemple #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();
            }
        }