コード例 #1
0
 public static void Open()
 {
     window = (ValidatorWindow)EditorWindow.GetWindow(typeof(ValidatorWindow), true, "Stratus Validator");
 }
コード例 #2
0
 //------------------------------------------------------------------------/
 // Methods: Static
 //------------------------------------------------------------------------/
 public static void Open(string header, ObjectValidation[] messages)
 {
     window = (ValidatorWindow)EditorWindow.GetWindow(typeof(ValidatorWindow), true, "Stratus Validator");
     window.ShowValidation(header, messages);
 }
コード例 #3
0
        private void Show(Episode episode)
        {
            GUILayout.Label(episode.label, EditorStyles.whiteLargeLabel);
            //StratusEditorUtility.OnLastControlMouseClick(null, null, () => { Selection.activeGameObject = episode.gameObject; });

            EditorGUILayout.BeginHorizontal();
            StratusEditorUtility.ModifyProperty(episode, "mode", GUIContent.none);
            if (GUILayout.Button("Validate", EditorStyles.miniButtonRight))
            {
                ValidatorWindow.Open("Episode Validation", Validation.Aggregate(episode));
            }
            EditorGUILayout.EndHorizontal();

            foreach (var segment in episode.segments)
            {
                if (segment == null || !segmentExpanded.ContainsKey(segment))
                {
                    continue;
                }

                // Show the segment
                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                //episode.initialSegment == episode ? $"{episode.label} *" : episode.label, EditorStyles.whiteLabel
                GUIStyle segmentStyle = EditorStyles.label; // segment == (episode.initialSegment) ? EditorStyles.centeredGreyMiniLabel: GUI.skin.label;
                string   label        = episode.initialSegment == segment ? $"{segment.label} (Initial)" : segment.label;
                segmentExpanded[segment] = EditorGUILayout.Foldout(segmentExpanded[segment], label, false, EditorStyles.foldout);

                //if (EditorGUI.Rect)
                System.Action onRightClick = () =>
                {
                    var menu = new GenericMenu();
                    menu.AddItem(new GUIContent("Select"), false, () => { Selection.activeGameObject = segment.gameObject; });
                    if (!Application.isPlaying)
                    {
                        menu.AddItem(new GUIContent("Set Initial"), false, () => { episode.SetInitialSegment(segment); });
                    }
                    else
                    {
                        menu.AddItem(new GUIContent("Enter"), false, () =>
                        {
                            episode.Enter(segment, true, 0);
                        });
                    }
                    menu.ShowAsContext();
                };

                System.Action onDoubleClick = () =>
                {
                    Trace.Script("Boop");
                    Selection.activeGameObject = segment.gameObject;
                };

                StratusEditorUtility.OnLastControlMouseClick(null, onRightClick, onDoubleClick);

                //var button = new GUIObject();
                //button.label = segment.label;
                //button.onRightClickDown = onRightClick;
                //button.onLeftClickUp = onLeftClick;
                //button.Draw(segmentStyle);


                GUILayout.EndHorizontal();

                ShowSegment(episode, segment);
            }
        }