コード例 #1
0
ファイル: ActionNode.cs プロジェクト: NotAdvisable/Puppeteer
        private void DrawNodeInfo()
        {
            EditorGUILayout.Space();
            PuppeteerEditorGUIHelper.DrawDivider();
            EditorGUILayout.Space();

            switch (TypeOfNode)
            {
            case NodeType.FINALPATH:
                EditorGUILayout.LabelField(IsActive ? "Node is currently being executed!" : "Part of found plan.");
                break;

            case NodeType.OPEN:
                EditorGUILayout.LabelField("Node wasn't addressed. Others were better.");
                break;

            case NodeType.CLOSED:
                EditorGUILayout.LabelField("Node was discarded. Others were better.");
                break;

            case NodeType.FINAL:
                EditorGUILayout.LabelField(IsActive ? "Node is currently being executed!" : "First node of found plan.");
                break;

            default:
                break;
            }

            EditorGUILayout.Space();
            PuppeteerEditorGUIHelper.DrawDivider();
            EditorGUILayout.Space();
        }
コード例 #2
0
        public override void DrawInspector(PuppeteerPlanVisualiser _visualiser)
        {
            PuppeteerEditorGUIHelper.DrawGraphInspectorHeader(PuppeteerEditorResourceLoader.GoalIcon32.texture, "Goal", GetContentTypeName());

            EditorGUILayout.Space();
            PuppeteerEditorGUIHelper.DrawDivider();
            EditorGUILayout.Space();

            _visualiser.ShowGoalUtilityFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(_visualiser.ShowGoalUtilityFoldout, "Utility");
            if (_visualiser.ShowGoalUtilityFoldout)
            {
                ++EditorGUI.indentLevel;
                PuppeteerEditorGUIHelper.DrawHorizontal("Base Utility", m_GoalDescription.BaseUtility.ToString());

                ++EditorGUI.indentLevel;
                foreach (var utilityPart in m_GoalDescription.UtilityParts)
                {
                    EditorGUILayout.LabelField(string.Format("{0} {1} * {2}", PuppeteerEditorHelper.UtilityOperatorToString(utilityPart.UtilityOperator),
                                                             utilityPart.WorldStateName.ToString(), utilityPart.CurveMultiplier));
                }
                --EditorGUI.indentLevel;

                --EditorGUI.indentLevel;
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

            _visualiser.ShowGoalPartsFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(_visualiser.ShowGoalPartsFoldout, "Goal Parts");
            if (_visualiser.ShowGoalPartsFoldout)
            {
                ++EditorGUI.indentLevel;
                foreach (var goalPart in m_GoalDescription.GoalParts)
                {
                    PuppeteerEditorGUIHelper.DrawHorizontal(goalPart.Key, goalPart.Value.ToString());
                }
                --EditorGUI.indentLevel;
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

            EditorGUILayout.Space();
            PuppeteerEditorGUIHelper.DrawDivider();
            EditorGUILayout.Space();

            if (GUILayout.Button("Open Configuration"))
            {
                var window = PuppeteerConfiguratorWindow.CreateWindow();
                window.OpenEntryInTabOfType <GoalView>(m_GoalDescription.GUID);
            }
        }
コード例 #3
0
ファイル: ActionNode.cs プロジェクト: NotAdvisable/Puppeteer
        public override void DrawInspector(PuppeteerPlanVisualiser _visualiser)
        {
            PuppeteerEditorGUIHelper.DrawGraphInspectorHeader(PuppeteerEditorResourceLoader.ActionIcon32.texture, "Action", GetContentTypeName());
            DrawNodeInfo();

            _visualiser.ShowActionUtilityFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(_visualiser.ShowActionUtilityFoldout, "Utility");
            if (_visualiser.ShowActionUtilityFoldout)
            {
                ++EditorGUI.indentLevel;
                EditorGUILayout.LabelField(m_ActionDescription.BaseUtility.ToString());
                --EditorGUI.indentLevel;
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

            _visualiser.ShowActionPreconditionFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(_visualiser.ShowActionPreconditionFoldout, "Preconditions");
            if (_visualiser.ShowActionPreconditionFoldout)
            {
                ++EditorGUI.indentLevel;
                if (m_ActionDescription.Preconditions.Length == 0)
                {
                    EditorGUILayout.LabelField("none");
                }
                else
                {
                    foreach (var precondition in m_ActionDescription.Preconditions)
                    {
                        PuppeteerEditorGUIHelper.DrawHorizontal(precondition.Key, precondition.Value.ToString());
                    }
                }
                --EditorGUI.indentLevel;
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

            _visualiser.ShowActionEffectsFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(_visualiser.ShowActionEffectsFoldout, "Effects");
            if (_visualiser.ShowActionEffectsFoldout)
            {
                ++EditorGUI.indentLevel;
                foreach (var effect in m_ActionDescription.Effects)
                {
                    PuppeteerEditorGUIHelper.DrawHorizontal(effect.Key, effect.Value.ToString());
                }
                --EditorGUI.indentLevel;
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

            _visualiser.ShowActionGoalWorldStateAtNodeFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(_visualiser.ShowActionGoalWorldStateAtNodeFoldout, "Goal World State at Node");
            if (_visualiser.ShowActionGoalWorldStateAtNodeFoldout)
            {
                ++EditorGUI.indentLevel;
                foreach (KeyValuePair <string, object> goalWorldStateAtNodePair in m_HierarchyNode.GetSortedGoalWorldStateAtNode())
                {
                    PuppeteerEditorGUIHelper.DrawHorizontal(goalWorldStateAtNodePair.Key, goalWorldStateAtNodePair.Value.ToString());
                }
                --EditorGUI.indentLevel;
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

            _visualiser.ShowActionWorldStateAtNodeFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(_visualiser.ShowActionWorldStateAtNodeFoldout, "Total Remaining Preconditions at Node");
            if (_visualiser.ShowActionWorldStateAtNodeFoldout)
            {
                ++EditorGUI.indentLevel;
                if (m_HierarchyNode.GetSortedRemainingPreconditions().Count == 0)
                {
                    EditorGUILayout.LabelField("none");
                }
                else
                {
                    foreach (KeyValuePair <string, object> remainingPreconditions in m_HierarchyNode.GetSortedRemainingPreconditions())
                    {
                        PuppeteerEditorGUIHelper.DrawHorizontal(remainingPreconditions.Key, remainingPreconditions.Value.ToString());
                    }
                }
                --EditorGUI.indentLevel;
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

            EditorGUILayout.Space();
            PuppeteerEditorGUIHelper.DrawDivider();
            EditorGUILayout.Space();

            if (GUILayout.Button("Open Configuration"))
            {
                var window = PuppeteerConfiguratorWindow.CreateWindow();
                window.OpenEntryInTabOfType <ActionView>(m_ActionDescription.GUID);
            }
        }