コード例 #1
0
        internal static void RunStartupCode(TutorialProjectSettings projectSettings)
        {
            if (projectSettings.InitialScene != null)
            {
                EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(projectSettings.InitialScene));
            }

            TutorialManager.WriteAssetsToTutorialDefaultsFolder();

            // Ensure Editor is in predictable state
            EditorPrefs.SetString("ComponentSearchString", string.Empty);
            Tools.current = Tool.Move;

            if (TutorialEditorUtils.FindAssets <TutorialContainer>().Any())
            {
                var existingWindow = EditorWindowUtils.FindOpenInstance <TutorialWindow>();
                if (existingWindow)
                {
                    existingWindow.Close();
                }
                ShowTutorialWindow();
            }

            // NOTE camera settings can be applied successfully only after potential layout changes
            if (projectSettings.InitialCameraSettings != null && projectSettings.InitialCameraSettings.Enabled)
            {
                projectSettings.InitialCameraSettings.Apply();
            }

            if (projectSettings.WelcomePage)
            {
                TutorialModalWindow.Show(projectSettings.WelcomePage);
            }
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            TutorialProjectSettings.DrawDefaultAssetRestoreWarning();

            if (GUILayout.Button(Localization.Tr(MenuItems.ShowTutorials)))
            {
                // Make sure we will display 'this' container in the window.
                var window = Target.ProjectLayout != null
                    ? TutorialWindow.GetOrCreateWindowAndLoadLayout(Target)
                    : TutorialWindow.GetOrCreateWindowNextToInspector();

                window.ActiveContainer = Target;
            }

            EditorGUILayout.Space(10);

            if (SerializedTypeDrawer.UseDefaultEditors)
            {
                base.OnInspectorGUI();
            }
            else
            {
                serializedObject.Update();
                DrawPropertiesExcluding(serializedObject, k_PropertiesToHide);
                serializedObject.ApplyModifiedProperties();
            }
        }
コード例 #3
0
        public override void OnInspectorGUI()
        {
            TutorialProjectSettings.DrawDefaultAssetRestoreWarning();

            if (SerializedTypeDrawer.UseDefaultEditors)
            {
                base.OnInspectorGUI();
            }
            else
            {
                serializedObject.Update();
                DrawPropertiesExcluding(serializedObject, k_PropertiesToHide);
                serializedObject.ApplyModifiedProperties();
            }
        }
コード例 #4
0
        public override void OnInspectorGUI()
        {
            TutorialProjectSettings.DrawDefaultAssetRestoreWarning();

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

            GUILayout.Space(10);

            if (SerializedTypeDrawer.UseDefaultEditors)
            {
                base.OnInspectorGUI();
            }
            else
            {
                serializedObject.Update();

                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();
            }
        }
コード例 #5
0
        public override void OnInspectorGUI()
        {
            TutorialProjectSettings.DrawDefaultAssetRestoreWarning();

            if (!string.IsNullOrEmpty(m_WarningMessage))
            {
                EditorGUILayout.HelpBox(m_WarningMessage, MessageType.Warning);
            }

            if (SerializedTypeDrawer.UseDefaultEditors)
            {
                base.OnInspectorGUI();
            }
            else
            {
                serializedObject.Update();

                // Scene management options are visible only when we have no scenes specified.
                DrawPropertiesExcluding(serializedObject, Target.HasScenes() ? k_PropsToIgnoreNoScene : k_PropsToIgnore);

                serializedObject.ApplyModifiedProperties();
            }

            // Auto completion
            GUILayout.Label(Contents.autoCompletion, EditorStyles.boldLabel);
            using (new EditorGUI.DisabledScope(Target.IsCompleted))
            {
                if (GUILayout.Button(Target.IsAutoCompleting ? Contents.stopAutoCompletion : Contents.startAutoCompletion))
                {
                    if (Target.IsAutoCompleting)
                    {
                        Target.StopAutoCompletion();
                    }
                    else
                    {
                        Target.StartAutoCompletion();
                    }
                }
            }
        }
        public override void OnInspectorGUI()
        {
            TutorialProjectSettings.DrawDefaultAssetRestoreWarning();

            if (GUILayout.Button(Localization.Tr("Run Startup Code")))
            {
                UserStartupCode.RunStartupCode(Target);
            }

            EditorGUILayout.Space(10);

            if (SerializedTypeDrawer.UseDefaultEditors)
            {
                base.OnInspectorGUI();
            }
            else
            {
                serializedObject.Update();
                DrawPropertiesExcluding(serializedObject, k_PropertiesToHide);
                serializedObject.ApplyModifiedProperties();
            }
        }