예제 #1
0
        public override void DrawCommandGUI()
        {
            Flowchart flowchart = FlowchartWindow.GetFlowchart();

            if (flowchart == null)
            {
                return;
            }

            serializedObject.Update();

            EditorGUILayout.PropertyField(textProp);

            EditorGUILayout.PropertyField(descriptionProp);

            BlockEditor.BlockField(targetBlockProp,
                                   new GUIContent("Target Block", "Block to call when option is selected"),
                                   new GUIContent("<None>"),
                                   flowchart);

            EditorGUILayout.PropertyField(hideIfVisitedProp);
            EditorGUILayout.PropertyField(interactableProp);
            EditorGUILayout.PropertyField(setMenuDialogProp);

            serializedObject.ApplyModifiedProperties();
        }
예제 #2
0
        public override void DrawCommandGUI()
        {
            serializedObject.Update();

            Call t = target as Call;

            Flowchart flowchart = null;

            if (targetFlowchartProp.objectReferenceValue == null)
            {
                flowchart = t.GetFlowchart();
            }
            else
            {
                flowchart = targetFlowchartProp.objectReferenceValue as Flowchart;
            }

            EditorGUILayout.PropertyField(targetFlowchartProp);

            if (flowchart != null)
            {
                BlockEditor.BlockField(targetBlockProp,
                                       new GUIContent("Target Block", "Block to call"),
                                       new GUIContent("<None>"),
                                       flowchart);

                EditorGUILayout.PropertyField(startIndexProp);
            }

            EditorGUILayout.PropertyField(callModeProp);

            serializedObject.ApplyModifiedProperties();
        }
예제 #3
0
        public override void OnInspectorGUI()
        {
            BlockInspector blockInspector = target as BlockInspector;
            Block          block          = blockInspector.block;

            if (block == null)
            {
                return;
            }

            Flowchart flowchart = block.GetFlowchart();

            if (activeBlockEditor == null ||
                block != activeBlockEditor.target)
            {
                DestroyImmediate(activeBlockEditor);
                activeBlockEditor = Editor.CreateEditor(block) as BlockEditor;
            }

            activeBlockEditor.DrawBlockName(flowchart);

            UpdateWindowHeight();

            float width  = EditorGUIUtility.currentViewWidth;
            float height = windowHeight;

            // Using a custom rect area to get the correct 5px indent for the scroll views
            Rect blockRect = new Rect(5, topPanelHeight, width - 5, height + 10);

            GUILayout.BeginArea(blockRect);

            blockScrollPos = GUILayout.BeginScrollView(blockScrollPos, GUILayout.Height(flowchart.blockViewHeight));
            activeBlockEditor.DrawBlockGUI(flowchart);
            GUILayout.EndScrollView();

            Command inspectCommand = null;

            if (flowchart.selectedCommands.Count == 1)
            {
                inspectCommand = flowchart.selectedCommands[0];
            }

            if (Application.isPlaying &&
                inspectCommand != null &&
                inspectCommand.parentBlock != block)
            {
                GUILayout.EndArea();
                Repaint();
                return;
            }

            // Only change the activeCommand at the start of the GUI call sequence
            if (Event.current.type == EventType.Layout)
            {
                activeCommand = inspectCommand;
            }

            DrawCommandUI(flowchart, inspectCommand);
        }
		public override void OnInspectorGUI () 
		{
			BlockInspector blockInspector = target as BlockInspector;
			Block block = blockInspector.block;

			if (block == null)
			{
				return;
			}

			Flowchart flowchart = block.GetFlowchart();

			if (activeBlockEditor == null ||
			    block != activeBlockEditor.target)
			{
				DestroyImmediate(activeBlockEditor);
				activeBlockEditor = Editor.CreateEditor(block) as BlockEditor;
			}

			activeBlockEditor.DrawBlockName(flowchart);

			// Using a custom rect area to get the correct 5px indent for the scroll views
			Rect blockRect = new Rect(5, topPanelHeight, Screen.width - 6, Screen.height - 70);
			GUILayout.BeginArea(blockRect);

			blockScrollPos = GUILayout.BeginScrollView(blockScrollPos, GUILayout.Height(flowchart.blockViewHeight));
			activeBlockEditor.DrawBlockGUI(flowchart);
			GUILayout.EndScrollView();

			Command inspectCommand = null;
			if (flowchart.selectedCommands.Count == 1)
			{
				inspectCommand = flowchart.selectedCommands[0];
			}

			if (Application.isPlaying &&
			    inspectCommand != null &&
			    inspectCommand.parentBlock != block)
			{
				GUILayout.EndArea();
				Repaint();
				return;
			}

			// Only change the activeCommand at the start of the GUI call sequence
			if (Event.current.type == EventType.Layout)
			{
				activeCommand = inspectCommand;
			}

			DrawCommandUI(flowchart, inspectCommand);
		}
예제 #5
0
        public override void DrawCommandGUI()
        {
            Flowchart flowchart = FlowchartWindow.GetFlowchart();

            if (flowchart == null)
            {
                return;
            }

            serializedObject.Update();

            EditorGUILayout.PropertyField(durationProp);

            BlockEditor.BlockField(targetBlockProp,
                                   new GUIContent("Target Block", "Block to call when timer expires"),
                                   new GUIContent("<None>"),
                                   flowchart);

            serializedObject.ApplyModifiedProperties();
        }
예제 #6
0
        public override void DrawCommandGUI()
        {
            serializedObject.Update();

            AddOption t = target as AddOption;

            EditorGUILayout.PropertyField(optionTextProp, new GUIContent("Option Text", "Text to display on the option button."));

            BlockEditor.BlockField(targetBlockProp,
                                   new GUIContent("Target Block", "Block to execute when this option is selected by the player."),
                                   new GUIContent("<Continue>"),
                                   t.GetFlowchart());

            serializedObject.ApplyModifiedProperties();

            base.DrawCommandGUI();

            serializedObject.Update();
            EditorGUILayout.PropertyField(hideOnSelectedProp, new GUIContent("Hide On Selected", "Hide this option forever once the player has selected it."));
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            BlockInspector blockInspector = target as BlockInspector;
            Block          block          = blockInspector.block;

            if (block == null)
            {
                return;
            }

            Flowchart flowchart = block.GetFlowchart();

            BlockEditor blockEditor = Editor.CreateEditor(block) as BlockEditor;

            blockEditor.DrawBlockName(flowchart);

            // Using a custom rect area to get the correct 5px indent for the scroll views
            Rect blockRect = new Rect(5, topPanelHeight, Screen.width - 6, Screen.height - 70);

            GUILayout.BeginArea(blockRect);

            blockScrollPos = GUILayout.BeginScrollView(blockScrollPos, GUILayout.Height(flowchart.blockViewHeight));
            blockEditor.DrawBlockGUI(flowchart);
            GUILayout.EndScrollView();

            Command inspectCommand = null;

            if (flowchart.selectedCommands.Count == 1)
            {
                inspectCommand = flowchart.selectedCommands[0];
            }

            if (Application.isPlaying &&
                inspectCommand != null &&
                inspectCommand.parentBlock != block)
            {
                GUILayout.EndArea();
                Repaint();
                DestroyImmediate(blockEditor);
                return;
            }

            ResizeScrollView(flowchart);

            GUILayout.Space(7);

            blockEditor.DrawButtonToolbar();

            commandScrollPos = GUILayout.BeginScrollView(commandScrollPos);

            if (inspectCommand != null)
            {
                CommandEditor commandEditor = Editor.CreateEditor(inspectCommand) as CommandEditor;
                commandEditor.DrawCommandInspectorGUI();
                DestroyImmediate(commandEditor);
            }

            GUILayout.EndScrollView();

            GUILayout.EndArea();

            // Draw the resize bar after everything else has finished drawing
            // This is mainly to avoid incorrect indenting.
            Rect resizeRect = new Rect(0, topPanelHeight + flowchart.blockViewHeight + 1, Screen.width, 4f);

            GUI.color = new Color(0.64f, 0.64f, 0.64f);
            GUI.DrawTexture(resizeRect, EditorGUIUtility.whiteTexture);
            resizeRect.height = 1;
            GUI.color         = new Color32(132, 132, 132, 255);
            GUI.DrawTexture(resizeRect, EditorGUIUtility.whiteTexture);
            resizeRect.y += 3;
            GUI.DrawTexture(resizeRect, EditorGUIUtility.whiteTexture);
            GUI.color = Color.white;

            Repaint();

            DestroyImmediate(blockEditor);
        }