示例#1
0
        private void DoTopicsList()
        {
            GUILayout.Space(5f);

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

            if (Event.current.type == EventType.Layout)
            {
                guidedTour.UpdateTopicTree();
            }

            var windows = guidedTour.GetWindows();

            foreach (var window in windows)
            {
                FsmEditorGUILayout.LightDivider();
                var topics = guidedTour.GetTopics(window);
                foreach (var topic in topics)
                {
                    DoTopicGUI(topic);
                }
            }

            FsmEditorGUILayout.LightDivider();

            EditorGUILayout.EndScrollView();

            DoAutoScroll();
        }
        /// <summary>
        /// Render the guidedTour
        /// </summary>
        protected void DoGuidedTourGUI()
        {
            InitStyles();

            HandleKeyboardInput();
            DoSplitter();

            // Hints

            if (FsmEditorSettings.ShowHints)
            {
                GUILayout.Box("Click Topics to highlight UI and show more info.\nClick Help Button to open online help.", FsmEditorStyles.HintBox);
            }

            // Guide Topics

            GUILayout.Space(5f);

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

            if (Event.current.type == EventType.Layout)
            {
                guidedTour.UpdateTopicTree();
            }

            var windows = guidedTour.GetWindows();

            foreach (var window in windows)
            {
                FsmEditorGUILayout.LightDivider();
                var topics = guidedTour.GetTopics(window);
                foreach (var topic in topics)
                {
                    DoTopicGUI(topic);
                }
            }

            FsmEditorGUILayout.LightDivider();

            EditorGUILayout.EndScrollView();

            DoAutoScroll();

            GUILayout.FlexibleSpace();

            // Help panel for selected topic

            FsmEditorGUILayout.Divider();

            GUILayout.BeginHorizontal();
            GUILayout.Space(10);

            GUILayout.BeginVertical(GUILayout.Height(helpHeight));

            helpScrollPosition = EditorGUILayout.BeginScrollView(helpScrollPosition);

            if (guidedTour.SelectedTopic != null)
            {
                var topic = guidedTour.SelectedTopic;

                GUILayout.BeginHorizontal();
                GUILayout.Label(topic.Label.text, EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                if (!string.IsNullOrEmpty(topic.HelpUrl))
                {
                    if (FsmEditorGUILayout.HelpButton())
                    {
                        Application.OpenURL(topic.HelpUrl);
                    }
                }
                GUILayout.EndHorizontal();

                if (!string.IsNullOrEmpty(topic.Label.tooltip))
                {
                    EditorGUILayout.Space();
                    GUILayout.Label(topic.Label.tooltip, helpStyle);
                }

                EditorGUILayout.Space();
                topic.HelpText.DoGUILayout(position.width);
            }

            EditorGUILayout.EndScrollView();
            GUILayout.Space(5);
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            // mouse event not used by other UI
            // so must have clicked on empty area
            if (Event.current.type == EventType.MouseDown &&
                Event.current.mousePosition.y < position.height - helpHeight)
            {
                ClearHighlight();
            }
        }