Example #1
0
        public QuestNode() : base(NodeType.Literal)
        {
            this.Name = NPCChooseEditor.NpcValue.Name;

            // HeaderIconButton action
            this.HeaderIconButton = ReactiveCommand.Create(() =>
            {
                // Call models function
                NPCChooseEditor.NpcSelectNew();
            });

            // Watch models selected value for change. Once changed, update the nodes icon
            this.WhenAnyValue(x => x.NPCChooseEditor.NpcValue).Subscribe(name => { SelectNPC(); });

            OutputB = new CodeGenOutputViewModel <ITypedExpression <bool> >(PortType.Boolean)
            {
                Name   = "Add / Remove (w/ Ctrl) Output",
                Editor = BoolEditor,
                Value  = BoolEditor.ValueChanged.Select(v => new BoolLiteral {
                    Value = v
                }),
            };
            this.Outputs.Add(OutputB);
            this.WhenAnyValue(x => x.BoolEditor.Value).Subscribe(x => ManageOutputs(x)); // Subcribe to every change of the state of the button


            Text = new CodeGenInputViewModel <ITypedExpression <string> >(PortType.String)
            {
                Editor = EditableLabelEditor
            };
            this.Inputs.Add(Text);


            Output = new CodeGenOutputViewModel <ITypedExpression <string> >(PortType.String)
            {
                Name   = "Value1",
                Editor = ValueEditor,
                Value  = ValueEditor.ValueChanged.Select(v => new StringLiteral {
                    Value = v
                })
            };
            this.Outputs.Add(Output);


            Output = new CodeGenOutputViewModel <ITypedExpression <string> >(PortType.String)
            {
                Name   = "Value2",
                Editor = ValueEditor1,
                Value  = ValueEditor.ValueChanged.Select(v => new StringLiteral {
                    Value = v
                })
            };
            this.Outputs.Add(Output);
        }
Example #2
0
 /// <summary>
 /// Adds yet another output port to the node
 /// </summary>
 public void OutputAdd()
 {
     Output = new CodeGenOutputViewModel <ITypedExpression <string> >(PortType.String)
     {
         Name   = "Value" + this.Outputs.Items.Count(), // number the names of the nodes accordingly
         Editor = ValueEditor,
         Value  = ValueEditor.ValueChanged.Select(v => new StringLiteral {
             Value = v
         })
     };
     this.Outputs.Add(Output);
 }