Esempio n. 1
0
        private void OnAddFunction(object e)
        {
            if (CurrentInterface == null)
            {
                return;
            }

            CKlaxScriptInterfaceFunction newFunction = new CKlaxScriptInterfaceFunction();

            newFunction.Name = "NewFunction";
            CInterfaceFunctionViewModel newViewModel = new CInterfaceFunctionViewModel(newFunction, this);

            void Redo()
            {
                CurrentInterface.Functions.Add(newFunction);
                Functions.Add(newViewModel);
            }

            void Undo()
            {
                CurrentInterface.Functions.Remove(newFunction);
                Functions.Remove(newViewModel);
            }

            Redo();
            UndoRedoUtility.Record(new CRelayUndoItem(Undo, Redo));
        }
        public CExecuteInterfaceFunctionNode(CKlaxScriptInterfaceFunction targetFunction)
        {
            TargetFunctionGuid = targetFunction.Guid;

            Name = targetFunction.Name;

            CExecutionPin inPin = new CExecutionPin("In");

            InExecutionPins.Add(inPin);

            CExecutionPin execPin = new CExecutionPin("Next");

            OutExecutionPins.Add(execPin);

            CInputPin targetInput = new CInputPin("Target", typeof(CEntity));

            InputPins.Add(targetInput);

            foreach (var inputParameter in targetFunction.InputParameters)
            {
                CInputPin input = new CInputPin(inputParameter.Name, inputParameter.Type);
                InputPins.Add(input);
            }

            foreach (var returnParameter in targetFunction.OutputParameters)
            {
                COutputPin output = new COutputPin(returnParameter.Name, returnParameter.Type);
                OutputPins.Add(output);
            }
        }
        public CInterfaceFunctionGraph(CKlaxScriptInterfaceFunction interfaceFunction)
        {
            InterfaceFunctionGuid = interfaceFunction.Guid;

            CFunctionGraphEntryNode entryNode = new CFunctionGraphEntryNode(interfaceFunction.InputParameters);

            m_nodes.Add(entryNode);

            CFunctionGraphReturnNode returnNode = new CFunctionGraphReturnNode(interfaceFunction.OutputParameters);

            returnNode.NodePosX = 400;
            m_nodes.Add(returnNode);

            NumInputValues  = interfaceFunction.InputParameters.Count;
            NumOutputValues = interfaceFunction.OutputParameters.Count;
        }
Esempio n. 4
0
        public CInterfaceFunctionViewModel(CKlaxScriptInterfaceFunction interfaceFunction, CInterfaceEditorViewmodel parentViewModel)
        {
            m_parentViewModel   = parentViewModel;
            m_interfaceFunction = interfaceFunction;
            m_name = interfaceFunction.Name;

            foreach (CKlaxVariable inputParameter in m_interfaceFunction.InputParameters)
            {
                AddInput(inputParameter, false);
            }

            foreach (CKlaxVariable outputParameter in m_interfaceFunction.OutputParameters)
            {
                AddOutput(outputParameter, false);
            }

            AddInputCommand  = new CRelayCommand(OnAddInput);
            AddOutputCommand = new CRelayCommand(OnAddOutput);
            DeleteCommand    = new CRelayCommand(OnDelete);
        }