コード例 #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
        static void OpenWelcomeDialog()
        {
            var welcomePage = TutorialProjectSettings.Instance.WelcomePage;

            if (welcomePage != null)
            {
                TutorialModalWindow.Show(welcomePage);
            }
            else
            {
                Debug.LogError("No TutorialProjectSettings.WelcomePage set.");
            }
        }
コード例 #3
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();
            }
        }