Example #1
0
 public VisualVariableNodePanel(VisualNode _visualNode, VisualVariable _visualVariable) : base(_visualNode)
 {
     if (_visualVariable != null)
     {
         visualVariable = _visualVariable;
     }
     else
     {
         throw new Exception("Null variable created");
     }
 }
Example #2
0
        public VisualVariableCreatePanelPart(VisualVariable _visualVariable)
        {
            if (_visualVariable != null)
            {
                visualVariable = _visualVariable;

                nameLabel.Text = visualVariable.variableName;
            }
            else
            {
                throw new Exception("Null variable created");
            }
        }
Example #3
0
        public VisualClassScriptEditorManager(Form1 _form, VisualClass _visualClass) : base(_form)
        {
            visualClass = _visualClass;

            currentNodesPanels      = new List <BaseNodePanel>();
            firstSelectedPin        = null;
            firstSelectedNode       = null;
            firstSelectedVariable   = null;
            firstSelectedFunction   = null;
            firstSelectedNodeOffset = new Size(0, 0);
            SpawnNode(new Point(50, 50), new VisualNodeCreatePanelPart(typeof(ConstructNode))); //Spawns construct node

            UpdateVariableAndFunctionPanel();
        }
Example #4
0
        private void variableAndFunctionpanelPartPressed(BaseVariableAndFunctionPanelPart _panelPressed)
        {
            var CheckVariable = _panelPressed as VariablePanelPart;

            ClearVariableFunctionInfoPanel();


            if (CheckVariable != null) //variable pressed
            {
                VisualVariable variable = CheckVariable.visualVariable;
                firstSelectedVariable = variable;

                TextBox variableNameTextBox = new TextBox();
                form.VariableFunctionInfoPanel.Controls.Add(variableNameTextBox);
                variableNameTextBox.Location   = new Point(5, 5);
                variableNameTextBox.Size       = new Size(90, 13);
                variableNameTextBox.Text       = variable.variableName;
                variableNameTextBox.LostFocus += ChangeVariableNameTextChanged;

                TextBox variableValueTextBox = new TextBox();
                form.VariableFunctionInfoPanel.Controls.Add(variableValueTextBox);
                variableValueTextBox.Location = new Point(5, 30);
                variableValueTextBox.Size     = new Size(90, 13);

                if (variable.variableValue == null)
                {
                    variableValueTextBox.Text = "";
                }
                else
                {
                    variableValueTextBox.Text = variable.variableValue.ToString();
                }

                variableValueTextBox.LostFocus += ChangeVariablevalueTextChanged;

                ComboBox variableTypeComboBox = new ComboBox();
                form.VariableFunctionInfoPanel.Controls.Add(variableTypeComboBox);
                variableTypeComboBox.Location = new Point(5, 48);
                variableTypeComboBox.Size     = new Size(90, 13);
                variableTypeComboBox.Items.AddRange(allVariableTypesToShow.ToArray());
                variableTypeComboBox.SelectedIndex = allVariableTypesToShow.IndexOf(firstSelectedVariable.variableType);

                variableTypeComboBox.SelectedValueChanged += VariableTypeComboBoxSelectedValueChanged;
            }

            if (createNodeSearchBar != null)
            {
                createNodeSearchBar.Dispose();
            }
        }
Example #5
0
        public VisualFunctionScriptEditorManager(Form1 _form, VisualFunction _visualFunction) : base(_form)
        {
            visualFunction = _visualFunction;

            currentNodesPanels      = new List <BaseNodePanel>();
            firstSelectedPin        = null;
            firstSelectedNode       = null;
            firstSelectedVariable   = null;
            firstSelectedFunction   = null;
            firstSelectedNodeOffset = new Size(0, 0);
            SpawnNode(new Point(50, 50), new VisualNodeCreatePanelPart(typeof(FunctionStartNode)));
            SpawnNode(new Point(200, 200), new VisualNodeCreatePanelPart(typeof(FunctionEndNode))); //Spawns starting nodes

            UpdateVariableAndFunctionPanel();
        }
Example #6
0
        void SpawnNode(Point _position, Type _nodeType = null, VisualVariable _visualVariable = null, VisualFunction _visualFunction = null) //Spawn node
        {
            if (_nodeType != null)
            {
                BaseNode newNode = (BaseNode)Activator.CreateInstance(_nodeType);
                MainScriptingPanel.Controls.Add(newNode);
                newNode.Location = _position;

                currentNodes.Add(newNode);

                newNode.MouseDown += StartMovingNode;
                newNode.MouseUp   += StopMovingNode;
                newNode.MouseMove += MainScriptingPanel_MouseMove;

                for (int i = 0; i < newNode.inputPins.Count; i++)
                {
                    newNode.inputPins[i].pinPressed += PinPressed;
                }
                for (int i = 0; i < newNode.outputPins.Count; i++)
                {
                    newNode.outputPins[i].pinPressed += PinPressed;
                }
            }
            else if (_visualVariable != null)
            {
                VisualVariablePanel newVariable = new VisualVariablePanel(_visualVariable);
                MainScriptingPanel.Controls.Add(newVariable);
                newVariable.Location = _position;

                visualVariables.Add(_visualVariable);
                newVariable.outputPin.pinPressed += PinPressed;
            }


            if (createNodeSearchBar != null)
            {
                createNodeSearchBar.Dispose();
            }
        }
        public VisualVariablePanelPart(VisualVariable _visualVariable)
        {
            if (_visualVariable != null)
            {
                visualVariable = _visualVariable;

                this.BackColor = Color.White;
                this.Size      = new Size(200, 10);

                nameLabel = new Label();
                this.Controls.Add(nameLabel);
                nameLabel.Location = new Point(0, 0);
                nameLabel.Size     = new Size(190, 20);
                nameLabel.Text     = visualVariable.variableName;

                nameLabel.Click += VisualVariablePanelPart_Click;
                this.Click      += VisualVariablePanelPart_Click;
            }
            else
            {
                throw new Exception("Null variable created");
            }
        }
        public VisualVariablePanel(VisualVariable _visualVariable)
        {
            if (_visualVariable != null)
            {
                visualVariable = _visualVariable;

                this.BackColor = Color.White;
                this.Size      = new Size(200, 10);

                nameLabel = new Label();
                this.Controls.Add(nameLabel);
                nameLabel.Location = new Point(0, 0);
                nameLabel.Size     = new Size(190, 20);
                nameLabel.Text     = visualVariable.variableName;

                outputPin = new BasePin(visualVariable.variableType, PinRole.Output); //Add parent here
                this.Controls.Add(outputPin);
                outputPin.Location = new Point(190, 0);
            }
            else
            {
                throw new Exception("Null variable created");
            }
        }
        private void VariablePressed(VisualVariable thisVariable)
        {
            MyEventHandler handler = partPressed;

            handler(panelLocation, null, thisVariable);
        }
Example #10
0
        public override void MainScriptingPanelMouseClick(object sender, EventArgs e)
        {
            MouseEventArgs r = (MouseEventArgs)e;

            if (r.Button == MouseButtons.Right)
            {
                if (createNodeSearchBar != null)
                {
                    createNodeSearchBar.Dispose();
                }

                if (firstSelectedPin == null) //Pin not selected
                {
                    createNodeSearchBar = new CreateNodeSearchBar(r.Location, allNodesToShow, visualFunction.visualVariables, new List <VisualFunction>());
                }
                else  //Pin selected
                {
                    List <Type>           newNodesToShow     = new List <Type>();
                    List <VisualVariable> newVariablesToShow = new List <VisualVariable>();
                    List <VisualFunction> newFunctionsToShow = new List <VisualFunction>();

                    if (firstSelectedPin.visualPin.pinRole == PinRole.Input) //Selected Input
                    {
                        foreach (Type t in allNodesToShow)
                        {
                            List <VisualNodeC> outputs = (List <VisualNodeC>)t.GetField("outputs").GetValue(null);
                            foreach (VisualNodeC pin in outputs)
                            {
                                if (pin.type == firstSelectedPin.visualPin.pinType)
                                {
                                    newNodesToShow.Add(t);
                                    break;
                                }
                            }
                        }
                        foreach (VisualVariable v in visualFunction.visualVariables)
                        {
                            if (v.variableType == firstSelectedPin.visualPin.pinType)
                            {
                                newVariablesToShow.Add(v);
                            }
                        }
                    }
                    else //Selected Output
                    {
                        foreach (Type t in allNodesToShow)
                        {
                            List <VisualNodeC> inputs = (List <VisualNodeC>)t.GetField("inputs").GetValue(null);
                            foreach (VisualNodeC pin in inputs)
                            {
                                if (pin.type == firstSelectedPin.visualPin.pinType)
                                {
                                    newNodesToShow.Add(t);
                                    break;
                                }
                            }
                        }
                    }
                    createNodeSearchBar = new CreateNodeSearchBar(r.Location, newNodesToShow, newVariablesToShow, newFunctionsToShow);
                }
                form.MainScriptingPanel.Controls.Add(createNodeSearchBar);
                createNodeSearchBar.partPressed += SpawnNode;

                firstSelectedNode = null;
            }
            else
            {
                firstSelectedNode = null;
                firstSelectedPin  = null;

                if (createNodeSearchBar != null)
                {
                    createNodeSearchBar.Dispose();
                }
                createNodeSearchBar = null;
            }

            ClearVariableFunctionInfoPanel();
            firstSelectedVariable = null;
            firstSelectedFunction = null;

            form.MainScriptingPanel.Refresh();
        }
Example #11
0
 public VariablePanelPart(VisualVariable _visualVariable)
 {
     visualVariable = _visualVariable;
     nameLabel.Text = visualVariable.variableName;
 }