Example #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            if (GUILayout.Button(Localization.Tr("Show Welcome Dialog")))
            {
                TutorialModalWindow.TryToShow(Target, null);
            }

            if (k_IsAuthoringMode)
            {
                GUILayout.Space(10);
                //base.OnInspectorGUI();
                DrawPropertiesExcluding(serializedObject, k_PropsToIgnore);
            }

            bool eventOffOrRuntimeOnlyExists = false;

            for (int i = 0; i < m_Buttons.arraySize; i++)
            {
                m_CurrentEvent = m_Buttons.GetArrayElementAtIndex(i).FindPropertyRelative(k_OnClickEventPropertyPath);
                if (!TutorialEditorUtils.EventIsNotInState(m_CurrentEvent, UnityEngine.Events.UnityEventCallState.EditorAndRuntime))
                {
                    continue;
                }

                eventOffOrRuntimeOnlyExists = true;
                break;
            }
            if (eventOffOrRuntimeOnlyExists)
            {
                TutorialEditorUtils.RenderEventStateWarning();
            }
            serializedObject.ApplyModifiedProperties();
        }
Example #2
0
        /// <summary>
        /// Renders an event property in the inspector
        /// </summary>
        /// <param name="nameAndTooltip"></param>
        /// <param name="property">The property to render</param>
        /// <param name="spaceAfterProperty">The amount of EditorGUILayout Space to render after the property field</param>
        static void RenderEventProperty(GUIContent nameAndTooltip, SerializedProperty property, float spaceAfterProperty)
        {
            if (property == null)
            {
                return;
            }
            if (TutorialEditorUtils.EventIsNotInState(property, UnityEngine.Events.UnityEventCallState.EditorAndRuntime))
            {
                TutorialEditorUtils.RenderEventStateWarning();
                EditorGUILayout.Space(8);
            }

            EditorGUILayout.LabelField(nameAndTooltip);
            EditorGUILayout.Space(5);
            EditorGUILayout.PropertyField(property);
            EditorGUILayout.Space(spaceAfterProperty);
        }
        void DrawSimplifiedInspector()
        {
            EditorGUILayout.BeginVertical();

            if (m_Type != null)
            {
                EditorGUILayout.LabelField(Localization.Tr("Header Media Type"));
                m_HeaderMediaType = (HeaderMediaType)EditorGUILayout.EnumPopup(GUIContent.none, m_HeaderMediaType);
                m_Type.intValue   = (int)m_HeaderMediaType;

                EditorGUILayout.Space(10);
            }

            RenderProperty(Localization.Tr("Media"), m_HeaderMediaType == HeaderMediaType.Image ? m_Image : m_Video);

            EditorGUILayout.Space(10);

            RenderProperty(Localization.Tr("Narrative Title"), m_NarrativeTitle);

            EditorGUILayout.Space(10);

            RenderProperty(Localization.Tr("Narrative Description"), m_NarrativeDescription);

            EditorGUILayout.Space(10);

            RenderProperty(Localization.Tr("Instruction Title"), m_InstructionTitle);

            EditorGUILayout.Space(10);

            RenderProperty(Localization.Tr("Instruction Description"), m_InstructionDescription);

            if (m_CriteriaCompletion != null)
            {
                EditorGUILayout.Space(10);
                EditorGUILayout.LabelField(Localization.Tr("Completion Criteria"));
                EditorGUILayout.PropertyField(m_CriteriaCompletion, GUIContent.none);
                EditorGUILayout.PropertyField(m_Criteria, GUIContent.none);
            }

            if (m_NextTutorial != null)
            {
                EditorGUILayout.Space(10);
                RenderProperty(Localization.Tr("Next Tutorial"), m_NextTutorial);
                RenderProperty(Localization.Tr("Next Tutorial button text"), m_TutorialButtonText);
            }

            EditorStyles.label.wordWrap = true;

            //DrawLabelWithImage(Localization.Tr("Custom Callbacks");
            EditorGUILayout.BeginHorizontal();

            s_ShowEvents = EditorGUILayout.Foldout(s_ShowEvents, s_EventsSectionTitle);
            if (k_IsAuthoringMode && GUILayout.Button(Localization.Tr("Create Callback Handler")))
            {
                CreateCallbackHandlerScript("TutorialCallbacks.cs");
                InitializeEventWithDefaultData(m_OnBeforePageShown);
                InitializeEventWithDefaultData(m_OnAfterPageShown);
                GUIUtility.ExitGUI();
            }
            EditorGUILayout.EndHorizontal();


            EditorGUILayout.Space(10);
            if (s_ShowEvents)
            {
                if (TutorialEditorUtils.EventIsNotInState(m_OnBeforePageShown, UnityEngine.Events.UnityEventCallState.EditorAndRuntime))
                {
                    TutorialEditorUtils.RenderEventStateWarning();
                    EditorGUILayout.Space(8);
                }
                RenderEventProperty(s_OnBeforeEventsTitle, m_OnBeforePageShown);
                EditorGUILayout.Space(5);
                if (TutorialEditorUtils.EventIsNotInState(m_OnAfterPageShown, UnityEngine.Events.UnityEventCallState.EditorAndRuntime))
                {
                    TutorialEditorUtils.RenderEventStateWarning();
                    EditorGUILayout.Space(8);
                }
                RenderEventProperty(s_OnAfterEventsTitle, m_OnAfterPageShown);
                EditorGUILayout.Space(10);
            }

            RenderProperty(Localization.Tr("Enable Masking"), m_MaskingSettings);

            EditorGUILayout.EndVertical();

            DrawPropertiesExcluding(serializedObject, k_PropertiesToHide);

            serializedObject.ApplyModifiedProperties();
        }