public void AddPropertyToBlackboard()
    {
        switch ((BlackboardType)typeEnum.value)
        {
        case BlackboardType.None:
            if (exposedProperties.Count > 0)
            {
                return;
            }

            var noneProperty = new NoneProperty()
            {
                PropertyName = "None", propertyType = BlackboardType.None, PropertyValue = "None"
            };
            exposedProperties.Add(noneProperty);
            break;

        case BlackboardType.Character:
            var propertyName = "New_Character";
            CheckPropertyNameAvailability(ref propertyName);

            var characterProperty = new CharacterProperty(propertyName, "New Value", this);

            blackboard.Add(characterProperty.propertyElement);
            exposedProperties.Add(characterProperty);
            break;

        default:
            Debug.Log("Default should not be hit");
            break;
        }
    }
Esempio n. 2
0
    internal void AddPropertyToBlackBoard(ExposedProperty exposedProperty)
    {
        var localPropertyName  = exposedProperty.PropertyName;
        var localPropertyValue = exposedProperty.PropertyValue;

        while (ExposedProperties.Any(x => x.PropertyName == localPropertyName))
        {
            localPropertyName = $"{localPropertyName}(1)"; // Username || Username(1)
        }
        var property = new ExposedProperty();

        property.PropertyName  = localPropertyName;
        property.PropertyValue = localPropertyValue;
        ExposedProperties.Add(property);

        var container       = new VisualElement();
        var blackboardField = new BlackboardField {
            text = property.PropertyName, typeText = "string property"
        };
        var propertyValueTextField = new TextField("Value: ")
        {
            value = localPropertyValue
        };

        propertyValueTextField.RegisterValueChangedCallback(evt =>
        {
            var changingPropertyIndex = ExposedProperties.FindIndex(x => x.PropertyName == property.PropertyName);
            ExposedProperties[changingPropertyIndex].PropertyValue = evt.newValue;
        });
        var blackBoardValueRow = new BlackboardRow(blackboardField, propertyValueTextField);

        container.Add(blackBoardValueRow);

        Blackboard.Add(container);
    }
Esempio n. 3
0
    public override void StartTree(BTFiniteStateMachine sm)
    {
        base.StartTree(sm);
        Transform followPoint = MinionManager.manager.GetPlayerSubMoveGuide(transform.GetComponent <MinionController>().minionIndex);

        Blackboard.Add("FollowTransform", followPoint != null ? followPoint : MinionManager.manager.GetPlayerCoreMoveGuide());
        Blackboard.Add("DestinationSetter", GetComponent <Pathfinding.AIDestinationSetter>());
        Blackboard.Add("Transform", transform);
        Blackboard.Add("NecroInput", FindObjectOfType <NecromancerInput>());

        mRoot = new BTRepeator
                    (this, new BTStepSequencer
                        (this, new BTNode[]
        {
            new BTParallel
                (this, new BTNode[]
                { new BTMoveToPlayer(this), new BTAnimateMovement(this) }
                ),
            new BTParallel
                (this, new BTNode[]
                { new BTLookAtAim(this), new BTAnimateMovement(this) }
                )
        }
                        )
                    );
    }
Esempio n. 4
0
        /// <summary>
        /// Generates a Blackboard for the Exposed Properties
        /// </summary>
        private void GenerateBlackBoard()
        {
            var blackboard = new Blackboard(_graphView)
            {
                subTitle = "Exposed Properties"
            };

            blackboard.Add(new BlackboardSection());
            blackboard.addItemRequested  = _blackboard => { _graphView.AddPropertyToBlackBoard(new ExposedProperty()); };
            blackboard.editTextRequested = (blackboard1, element, newValue) =>
            {
                var oldPropertyName = ((BlackboardField)element).text;
                if (_graphView.ExposedProperties.Any(x => x.PropertyName == newValue))
                {
                    EditorUtility.DisplayDialog("Error", "This property name already exists, please chose another one!", "OK");

                    return;
                }

                var propertyIndex = _graphView.ExposedProperties.FindIndex(x => x.PropertyName == oldPropertyName);
                _graphView.ExposedProperties[propertyIndex].PropertyName = newValue;

                ((BlackboardField)element).text = newValue;

                if (_autoSave)
                {
                    RequestDataOperation(true);
                }
            };

            _graphView._blackboard = blackboard;
            _graphView.Add(blackboard);
        }
    // Start is called before the first frame update
    void Start()
    {
        FlockMask = gameObject.layer;

        Sequence   TreeRoot   = new Sequence();
        Detect     DetectNode = new Detect();
        Zap        ZapNode    = new Zap();
        DamageBoid DamageNode = new DamageBoid();

        TreeRoot.children.Add(DetectNode);
        TreeRoot.children.Add(ZapNode);
        TreeRoot.children.Add(DamageNode);

        Blackboard.Add("BoidTarget", null);
        Blackboard.Add("SpeedIncrement", SpeedIncrementOnHit);
        Blackboard.Add("TurnRateDecrement", TurnRateDecrementOnHit);
        Blackboard.Add("LayerMask", FlockMask);

        DetectNode.BoidKey     = "BoidTarget";
        DetectNode.LayerKey    = "LayerMask";
        ZapNode.BoidKey        = "BoidTarget";
        DamageNode.BoidKey     = "BoidTarget";
        DamageNode.SpeedKey    = "SpeedIncrement";
        DamageNode.TurnRateKey = "TurnRateDecrement";

        TreeRoot.tree   = this;
        DetectNode.tree = this;
        ZapNode.tree    = this;
        DamageNode.tree = this;

        root = TreeRoot;
    }
Esempio n. 6
0
    public override void StartTree(BTFiniteStateMachine sm)
    {
        base.StartTree(sm);
        Blackboard.Add("DestinationSetter", GetComponent <Pathfinding.AIDestinationSetter>());
        Blackboard.Add("Transform", transform);
        Blackboard.Add("DestinationSetter", GetComponent <Pathfinding.AIDestinationSetter>());
        Blackboard.Add("Transform", transform);
        Blackboard.Add("NecroInput", FindObjectOfType <NecromancerInput>());

        target = MinionManager.manager.GetTarget();

        mRoot = new BTRepeator
                    (this, new BTStepSequencer
                        (this, new BTNode[]
        {
            new BTParallel
                (this, new BTNode[]
                { new BTMoveToTarget(this, target), new BTAnimateMovement(this) }
                ),
            new BTParallel
                (this, new BTNode[]
                { new BTLookAtAim(this), new BTAnimateMovement(this) }
                )
        }
                        )
                    );
    }
Esempio n. 7
0
 public override void StartTree(BTFiniteStateMachine sm)
 {
     base.StartTree(sm);
     Blackboard.Add("DestinationSetter", GetComponent <Pathfinding.AIDestinationSetter>());
     Blackboard.Add("Transform", transform);
     Blackboard.Add("WaitTime", 5f);
     Blackboard.Add("SearhLayer", GetComponent <Searcher>());
     mRoot = new BTRepeator
                 (this, new BTParallel
                     (this, new BTNode[]
     {
         new BTStepSequencer
             (this, new BTNode[]
         {
             new BTParallel
                 (this, new BTNode[]
                 { new BTMoveToRandomRoomPoint(this), new BTAnimateMovement(this) }
                 ),
             new BTIdleForTime(this)
         }
             ),
         new BTLookForTargets(this)
     })
                 );
 }
Esempio n. 8
0
        private void GenerateBlackboard()
        {
            var blackboard = new Blackboard(m_dialogueGraphView);

            blackboard.Add(new BlackboardSection {
                title = "Exposed Properties"
            });
            blackboard.addItemRequested  = bb => { m_dialogueGraphView.AddPropertyToBlackboard(new ExposedProperty()); };
            blackboard.editTextRequested = (bb1, element, newValue) =>
            {
                var oldPropertyName = ((BlackboardField)element).text;
                if (m_dialogueGraphView.ExposedProperties.Any(x => x.PropertyName == newValue))
                {
                    EditorUtility.DisplayDialog("Error", "This property name already exisits, please choose another name.", "OK");
                    return;
                }

                var propertyIndex = m_dialogueGraphView.ExposedProperties.FindIndex(x => x.PropertyName == oldPropertyName);
                m_dialogueGraphView.ExposedProperties[propertyIndex].PropertyName = newValue;
                ((BlackboardField)element).text = newValue;
            };

            blackboard.SetPosition(new Rect(10, 30, 200, 300));
            m_dialogueGraphView.Add(blackboard);

            m_dialogueGraphView.Blackboard = blackboard;
        }
        public override void Check(Blackboard agentBoard)
        {
            var col = Physics2D.OverlapBox(transform.position, _size, 0, targetLayers);



            if (col?.transform != null)
            {
                var node = new Grid.Grid.Node();

                if (_grid.Get().Value.TryGetNodeAtWorldPosition(col.transform.position, ref node))
                {
                    _hasTarget    = true;
                    _agent.Target = col.transform;
                    agentBoard.Add <Grid.Grid.Node?>(targetNodeKey, node);
                    return;
                }
            }

            if (removeTargetOnExit)
            {
                _hasTarget    = false;
                _agent.Target = null;
                agentBoard.Remove(targetNodeKey);
            }
        }
        private void GenerateBlackBoard()
        {
            var blackboard = new Blackboard(_graphView);

            blackboard.Add(new BlackboardSection {
                title = "Exposed Variables"
            });
            blackboard.addItemRequested = _blackboard =>
            {
                _graphView.AddPropertyToBlackBoard(ExposedProperty.CreateInstance(), false);
            };
            blackboard.editTextRequested = (_blackboard, element, newValue) =>
            {
                var oldPropertyName = ((BlackboardField)element).text;
                if (_graphView.ExposedProperties.Any(x => x.PropertyName == newValue))
                {
                    EditorUtility.DisplayDialog("Error", "This property name already exists, please chose another one.",
                                                "OK");
                    return;
                }

                var targetIndex = _graphView.ExposedProperties.FindIndex(x => x.PropertyName == oldPropertyName);
                _graphView.ExposedProperties[targetIndex].PropertyName = newValue;
                ((BlackboardField)element).text = newValue;
            };
            blackboard.SetPosition(new Rect(10, 30, 200, 300));
            _graphView.Add(blackboard);
            _graphView.Blackboard = blackboard;
        }
        private void GenerateBlackBoard()
        {
            var blackboard = new Blackboard(_graphView);

            //Blackboard section is basically a header label
            blackboard.Add(new BlackboardSection {
                title = "Exposed Properties"
            });
            blackboard.addItemRequested = blackboard1 =>
            {
                _graphView.AddPropertyToBlackBoard(new ExposedProperty());
            };
            blackboard.editTextRequested = (blackboard1, element, newValue) =>
            {
                var oldProperty = ((BlackboardField)element).text;
                if (_graphView.exposedProperties.Any(x => x.propertyName == newValue))
                {
                    EditorUtility.DisplayDialog("Error!", "This property name already exists, please choose another one!", "OK");
                    return;
                }

                var propertyIndex = _graphView.exposedProperties.FindIndex(x => x.propertyName == oldProperty);
                _graphView.exposedProperties[propertyIndex].propertyName = newValue;
                ((BlackboardField)element).text = newValue;
            };

            blackboard.SetPosition(new Rect(10, 3, 200, 300));
            _graphView._blackboard = blackboard;
            _graphView.Add(blackboard);
        }
Esempio n. 12
0
        /// <summary>
        /// The Blackboard contains the values of each Exposed Property
        /// This Method allows us to create a new exposed property and adds it to the BlackBoard
        /// </summary>
        /// <param name="exposedProperty"></param>
        /// <param name="refreshing"></param>
        public void AddPropertyToBlackBoard(Runtime.ExposedProperty exposedProperty, bool refreshing = false)
        {
            var localPropertyName  = exposedProperty.PropertyName;
            var localPropertyValue = exposedProperty.PropertyValue;


            while (ExposedProperties.Any(x => x.PropertyName == localPropertyName) && !refreshing)
            {
                localPropertyName = $"{localPropertyName}(1)";
            }

            if (!refreshing)
            {
                var property = new Runtime.ExposedProperty();
                property.PropertyName  = localPropertyName;
                property.PropertyValue = localPropertyValue;

                ExposedProperties.Add(property);
            }
            int j = ExposedProperties.Count - 1;

            var container       = new VisualElement();
            var blackboardField = new BlackboardField {
                text = localPropertyName, typeText = "string"
            };

            blackboardField.Add(new Button(() => { RemovePropertyFromBlackboard(j); })
            {
                text = "x"
            });

            container.Add(blackboardField);

            var propertyValueTextField = new TextField(label: "Value:")
            {
                value = localPropertyValue
            };

            propertyValueTextField.RegisterValueChangedCallback(evt => {
                int i = j;

                var changingPropertyIndex = ExposedProperties.FindIndex(x => x.PropertyName == localPropertyName);


                ExposedProperties[i].PropertyValue = evt.newValue;
            });

            var blackBoardValueRow = new BlackboardRow(blackboardField, propertyValueTextField);

            container.Add(blackBoardValueRow);

            _blackboard.Add(container);
            if (_dialogueGraph.GetAutoSave())
            {
                _dialogueGraph.RequestDataOperation(true);
            }
        }
Esempio n. 13
0
        private void AddItemRequested(Blackboard blackboard)
        {
            var property = new ExposedProperty();

            property.propertyName = ValidateName(property.propertyName);
            graphView.exposedProperties.Add(property);

            blackboard.Add(GenerateBlackboardField(property));
        }
Esempio n. 14
0
        public override StepResult Run(Blackboard blackboard)
        {
            var logger = blackboard.Get <ILogger>("Logger");

            var expectedFilePath = blackboard.Get <string>(ExpectedFilePathKey);

            if (expectedFilePath == null)
            {
                logger.Log($"Failed to find expected file path key ${ExpectedFilePathKey}");
                return(StepResult.Failed);
            }
            var actualFilePath = blackboard.Get <string>(ActualFilePathKey);

            if (actualFilePath == null)
            {
                logger.Log($"Failed to find expected file path key ${ActualFilePathKey}");
                return(StepResult.Failed);
            }

            bool foundDiffs = blackboard.GetValue <bool>(DiffsGeneratedKey);
            var  tool       = new VisualDiffTool();

            tool.VisualDisplay = VisualDisplay;
            bool result = tool.Diff(expectedFilePath, actualFilePath);

            if (!result)
            {
                foundDiffs = true;
                logger.Log($"Expected file '{expectedFilePath}' and actual file '{actualFilePath}' had differences", ILogger.Verbosity.Error);
                if (!string.IsNullOrWhiteSpace(tool.mDiffText))
                {
                    blackboard.Add(Key, tool.mDiffText);
                }
            }
            blackboard.Add(DiffsGeneratedKey, foundDiffs, Blackboard.AddMode.Override);

            var artifactList = blackboard.Get <ArtifactsList>();

            artifactList.Add(expectedFilePath);
            artifactList.Add(actualFilePath);

            return(StepResult.Success);
        }
Esempio n. 15
0
        public override StepResult Run(Blackboard blackboard)
        {
            var logger          = blackboard.Get <ILogger>("Logger");
            var spirvBinaryPath = blackboard.Get <string>(SpvPathKey);
            var tool            = new SpirVDisassemblerTool();
            var disassembly     = tool.Run(spirvBinaryPath);

            blackboard.Add(Key, disassembly);
            return(StepResult.Success);
        }
        public IEnumerator BlackboardSelectionIsRestoredWhenEnteringPlaymode_AddFieldsAfterAddingBBToGV()
        {
            { // Create initial blackboard.
                var blackboard = new Blackboard();
                blackboard.SetupBuildAndUpdate(null, CommandDispatcher, graphView);

                var inSection = new BlackboardSection(blackboard, "Section 1");
                blackboard.Add(inSection);

                var field = new BlackboardField {
                    viewDataKey = "bfield"
                };
                var propertyView = new Label("Prop");
                var row          = new BlackboardRow();
                row.Add(field);
                row.Add(propertyView);
                inSection.Add(row);

                graphView.AddElement(blackboard);

                CommandDispatcher.Dispatch(new SelectElementsCommand(SelectElementsCommand.SelectionMode.Add, row.Model));

                Assert.True(row.IsSelected());
            }

            // Allow 1 frame to let the persistent data get saved
            yield return(null);

            // This will re-create the window, flushing all temporary state
            yield return(new EnterPlayMode());

            // Allow 1 frame to let the persistence be restored
            yield return(null);

            { // Add blackboard to graphview first then add field to blackboard.
                var blackboard = new Blackboard();
                blackboard.SetupBuildAndUpdate(null, CommandDispatcher, graphView);

                graphView.AddElement(blackboard);

                var inSection = new BlackboardSection(blackboard, "Section 1");
                blackboard.Add(inSection);

                var field = new BlackboardField {
                    viewDataKey = "bfield"
                };
                var propertyView = new Label("Prop");
                var row          = new BlackboardRow();
                row.Add(field);
                row.Add(propertyView);
                inSection.Add(row);

                Assert.True(row.IsSelected());
            }
        }
Esempio n. 17
0
        private void CreateBlackBoard()
        {
            var blackboard = new Blackboard(graph);

            blackboard.Add(new BlackboardSection {
                title = "Dialogue Properties"
            });
            blackboard.addItemRequested = BuildBlackboardMenu;

            blackboard.SetPosition(new Rect(10, 30, 200, 300));
            graph.Add(blackboard);
        }
Esempio n. 18
0
        public void AddToBlackboard(Blackboard board, BlackboardKey key)
        {
            switch (option)
            {
            case 0:
                board.Add(key, ScriptableObject);
                break;

            case 1:
                board.Add(key, Vector2Int);
                break;

            case 2:
                board.Add(key, Float);
                break;

            case 3:
                board.Add(key, Int);
                break;
            }
        }
Esempio n. 19
0
    public void AddPropertyToBlackBoard(ExposedVariable exposedVariable)
    {
        var localVariableName  = exposedVariable.variableName;
        var localVariableValue = exposedVariable.variableValue;

        int iterator = 1;

        while (exposedVariables.Any(x => x.variableName == localVariableName))
        {
            localVariableName = $"{localVariableName}({iterator})";
            iterator++;

            /* FIX Later
             * if (localVariableName.Contains($"({iterator - 1})")) {
             *  localVariableName = $"{localVariableName.Substring(0, localVariableName.Length -3}" +"({iterator})";
             * }
             */
        }


        var variable = new ExposedVariable();

        variable.variableName  = localVariableName;
        variable.variableValue = localVariableValue;
        exposedVariables.Add(variable);


        var container       = new VisualElement();
        var blackboardField = new BlackboardField {
            text = variable.variableName, typeText = "int variable"
        };

        // blackboardField.RegisterCallback<DragAndDrop>(evt => { });
        container.Add(blackboardField);


        var variableValueTextField = new TextField("Value:")
        {
            value = variable.variableValue
        };

        variableValueTextField.RegisterValueChangedCallback(evt => {
            var changingVariableIndex = exposedVariables.FindIndex(x => x.variableName == variable.variableName);
            exposedVariables[changingVariableIndex].variableValue = evt.newValue;
        });
        var blackboardValueRow = new BlackboardRow(blackboardField, variableValueTextField);

        container.Add(blackboardValueRow);


        blackboard.Add(container);
    }
Esempio n. 20
0
        public override StepResult Run(Blackboard blackboard)
        {
            var logger   = blackboard.Get <ILogger>("Logger");
            var testData = blackboard.Get <TestData>();

            blackboard.Add(ScriptPathKey, testData.ScriptFilePath);
            blackboard.Add(SpvBinaryPathKey, testData.SpvBinaryFilePath);
            blackboard.Add(ExpectedDisassemblyPathKey, testData.DisassemblerTest.ExpectedFilePath);
            blackboard.Add(ActualDisassemblyPathKey, testData.DisassemblerTest.GeneratedFilePath);
            blackboard.Add(DiffDisassemblyPathKey, testData.DisassemblerTest.DiffFilePath);
            blackboard.Add(ExpectedGlslPathKey, testData.GlslTest.ExpectedFilePath);
            blackboard.Add(ActualGlslPathKey, testData.GlslTest.GeneratedFilePath);
            blackboard.Add(DiffGlslPathKey, testData.GlslTest.DiffFilePath);
            return(StepResult.Success);
        }
    private void GenerateBlackBoard()
    {
        var blackboard = new Blackboard(graphView);

        blackboard.scrollable = true;

        blackboard.Add(graphView.typeEnum);
        blackboard.Add(new BlackboardSection {
            title = "Exposed properties"
        });
        blackboard.addItemRequested = _blackboard =>
        {
            graphView.AddPropertyToBlackboard();
        };

        blackboard.editTextRequested = (bb, element, newValue) =>
        {
            var oldPropertyName = ((BlackboardField)element).text;

            if (newValue == null)
            {
                return;
            }

            graphView.CheckPropertyNameAvailability(ref newValue);

            var propertyIndex = graphView.exposedProperties.FindIndex(x => x.PropertyName == oldPropertyName);
            graphView.exposedProperties[propertyIndex].PropertyName = newValue;
            ((BlackboardField)element).text = newValue;
        };

        blackboard.SetPosition(new Rect(10, 180, 240, 300));

        graphView.Add(blackboard);
        graphView.blackboard = blackboard;

        graphView.AddPropertyToBlackboard();
    }
        public IEnumerator BlackboardSelectionIsRestoredWhenEnteringPlaymode_AddFieldsBeforeAddingBBToGV()
        {
            { // Create initial blackboard.
                var blackboard = new Blackboard();

                var inSection = new BlackboardSection();
                blackboard.Add(inSection);

                var field = new BlackboardField()
                {
                    viewDataKey = "bfield"
                };
                var propertyView = new Label("Prop");
                var row          = new BlackboardRow(field, propertyView);
                inSection.Add(row);

                graphView.AddElement(blackboard);

                graphView.AddToSelection(field);
                Assert.True(field.selected);
            }

            // Allow 1 frame to let the persistent data get saved
            yield return(null);

            // This will re-create the window, flushing all temporary state
            yield return(new EnterPlayMode());

            // Allow 1 frame to let the persistence be restored
            yield return(null);

            { // Add field to blackboard first then add blackboard to graphview.
                var blackboard = new Blackboard();

                var inSection = new BlackboardSection();
                blackboard.Add(inSection);

                var field = new BlackboardField()
                {
                    viewDataKey = "bfield"
                };
                var propertyView = new Label("Prop");
                var row          = new BlackboardRow(field, propertyView);
                inSection.Add(row);

                graphView.AddElement(blackboard);

                Assert.True(field.selected);
            }
        }
Esempio n. 23
0
        private void addVariableToBlackboard(Blackboard bb)
        {
            Type typeInput = _typeSelectionInputTree.GetCompleteType();

            if (!string.IsNullOrEmpty(_keyNameSelection) && typeInput != null)
            {
                bb.Add(_keyNameSelection, typeInput);

                // Restart the type selection.
                // GetCompleteType() sets a node's type so MakeGenericType() fails
                // in subsequent calls.
                _typeSelectionInputTree = new TypeSelectionTree();
            }
        }
Esempio n. 24
0
    public void AddPropertyToBlackBoard(ExposedProperty exposedProperty)
    {
        int    duplicateNameIndex = 1;
        string localPropertyName  = exposedProperty.PropertyName;
        string localPropertyValue = exposedProperty.PropertyValue;

        while (ExposedProperties.Any(x => x.PropertyName == localPropertyName))
        {
            localPropertyName = $"{localPropertyName}{duplicateNameIndex}"; // Name || Name1 || Name12
            duplicateNameIndex++;
        }

        ExposedProperty property = new ExposedProperty();

        property.PropertyName  = localPropertyName;
        property.PropertyValue = localPropertyValue;
        ExposedProperties.Add(property);

        VisualElement   container = new VisualElement();
        BlackboardField field     = new BlackboardField
        {
            text     = property.PropertyName,
            typeText = "string",
        };

        container.Add(field);

        TextField propertyValueTextField = new TextField("Value : ")
        {
            value = localPropertyValue,
            style = { width = new Length(80, LengthUnit.Percent) }
        };


        propertyValueTextField.RegisterValueChangedCallback(delegate(ChangeEvent <string> evt)
        {
            int changingPropertyIndex = ExposedProperties.FindIndex(x => x.PropertyName == property.PropertyName);
            ExposedProperties[changingPropertyIndex].PropertyValue = evt.newValue;
        });

        BlackboardRow blackboardRow = new BlackboardRow(field, propertyValueTextField);

        container.Add(blackboardRow);


        if (Blackboard != null)
        {
            Blackboard.Add(container);
        }
    }
Esempio n. 25
0
        public override StepResult Run(Blackboard blackboard)
        {
            var logger           = blackboard.Get <ILogger>("Logger");
            var spirvBinaryPath  = blackboard.Get <string>(SpvPathKey);
            var tool             = new SpirVValidatorTool();
            var validatorResults = tool.Run(spirvBinaryPath);

            if (!string.IsNullOrWhiteSpace(validatorResults))
            {
                logger.Log($"SpirV validator found issues for file '{spirvBinaryPath}'", ILogger.Verbosity.Error);
            }

            blackboard.Add(Key, validatorResults);
            return(StepResult.Success);
        }
Esempio n. 26
0
        private void GenerateBlackBoard()
        {
            var blackboard = new Blackboard(graph);

            blackboard.Add(new BlackboardSection {
                title = "Exposed Variables"
            });
            blackboard.addItemRequested = board =>
            {
            };

            blackboard.SetPosition(new Rect(10, 30, 200, 300));
            graph.Add(blackboard);
            //graph.Blackboard = blackboard;
        }
Esempio n. 27
0
        public void AddExposedProperty(ExposedProperty property)
        {
            if (Properties.Any(x => x.Name == property.Name && x.Type == property.Type))
            {
                return;
            }

            Properties.Add(property);
            var container = new VisualElement();

            container.Add(new BlackboardField()
            {
                text     = property.Name,
                typeText = property.Type.Name,
            });
            Blackboard.Add(container);
        }
Esempio n. 28
0
    public override bool Do(Blackboard state)
    {
        Pawn target = state.Get <Cell>("Cell")
                      ?.GetContent <Pawn>();

        if (target != null)
        {
            foreach (PawnStatus status in target.Statuses)
            {
                state.Add(status.Name, status);
            }

            return(target.Statuses.Any());
        }

        return(false);
    }
        public void AddPropertyToBlackBoard(ExposedProperty property, bool loadMode = false)
        {
            var localPropertyName  = property.PropertyName;
            var localPropertyValue = property.PropertyValue;
            // var localPropertySprite = property.PropertySprite;
            var localPropertyNameCharacter = property.PropertyNameCharacter;

            if (!loadMode)
            {
                while (ExposedProperties.Any(x => x.PropertyName == localPropertyName))
                {
                    localPropertyName = $"{localPropertyName}(1)";
                }
            }

            var item = ExposedProperty.CreateInstance();

            item.PropertyName          = localPropertyName;
            item.PropertyValue         = localPropertyValue;
            item.PropertyNameCharacter = localPropertyNameCharacter;
            // item.PropertySprite = localPropertySprite;
            ExposedProperties.Add(item);

            var container = new VisualElement();
            //Serch Elements in BlackBoard
            var field = new BlackboardField {
                text = localPropertyName, typeText = "string"
            };

            container.Add(field);

            var propertyValueTextField = new TextField("Value:")
            {
                value = localPropertyValue
            };

            propertyValueTextField.RegisterValueChangedCallback(evt =>
            {
                var index = ExposedProperties.FindIndex(x => x.PropertyName == item.PropertyName);
                ExposedProperties[index].PropertyValue = evt.newValue;
            });
            var sa = new BlackboardRow(field, propertyValueTextField);

            container.Add(sa);
            Blackboard.Add(container);
        }
    internal void AddPropertyToBlackBoard(ExposedProperty exposedProperty)
    {
        //local var for the blackboard prop
        var localPropertyName  = exposedProperty.PropertyName;
        var localPropertyValue = exposedProperty.PropertyValue;

        //loop through and find the any duplicts and another +1 to name
        while (ExposedProperties.Any(x => x.PropertyName == localPropertyName))
        {
            localPropertyName = $"{localPropertyName}(1)"; //
        }
        var property = new ExposedProperty();

        property.PropertyName  = localPropertyName;
        property.PropertyValue = localPropertyValue;
        ExposedProperties.Add(property);

        var container       = new VisualElement();
        var blackboardField = new BlackboardField
        {
            text     = property.PropertyName,
            typeText = "string property"
        };

        container.Add(blackboardField);
        //add value fiels into black board
        var propertyValueTextField = new TextField("value")
        {
            value = localPropertyValue
        };

        propertyValueTextField.RegisterValueChangedCallback(evt =>
        {
            var changingPropertyIndex = ExposedProperties.FindIndex(x => x.PropertyName == property.PropertyName);
            ExposedProperties[changingPropertyIndex].PropertyValue = evt.newValue;
        });

        var blackBoardValueRow = new BlackboardRow(blackboardField, propertyValueTextField);

        container.Add(blackBoardValueRow);
        Blackboard.Add(container);
    }