@@ -47,8 +47,11 @@ public class TableVariableChangedEventUnit : VariableChangedEventUnit
4747
4848 public abstract class VariableChangedEventUnit : GleEventUnit < VariableChangedArgs >
4949 {
50- [ DoNotSerialize , PortLabel ( "Value" ) , Inspectable ]
51- public ValueOutput Value { get ; private set ; }
50+ [ DoNotSerialize , PortLabel ( "Old Value" ) , Inspectable ]
51+ public ValueOutput OldValue { get ; private set ; }
52+
53+ [ DoNotSerialize , PortLabel ( "New Value" ) , Inspectable ]
54+ public ValueOutput NewValue { get ; private set ; }
5255
5356 public override EventHook GetHook ( GraphReference reference ) => new ( EventHookName ) ;
5457 protected override bool register => true ;
@@ -65,11 +68,19 @@ protected override void Definition()
6568 return ;
6669 }
6770
68- Value = VariableDefinition . Type switch {
69- VariableType . String => ValueOutput < string > ( nameof ( Value ) ) ,
70- VariableType . Integer => ValueOutput < int > ( nameof ( Value ) ) ,
71- VariableType . Float => ValueOutput < float > ( nameof ( Value ) ) ,
72- VariableType . Boolean => ValueOutput < bool > ( nameof ( Value ) ) ,
71+ OldValue = VariableDefinition . Type switch {
72+ VariableType . String => ValueOutput < string > ( nameof ( OldValue ) ) ,
73+ VariableType . Integer => ValueOutput < int > ( nameof ( OldValue ) ) ,
74+ VariableType . Float => ValueOutput < float > ( nameof ( OldValue ) ) ,
75+ VariableType . Boolean => ValueOutput < bool > ( nameof ( OldValue ) ) ,
76+ _ => throw new ArgumentOutOfRangeException ( )
77+ } ;
78+
79+ NewValue = VariableDefinition . Type switch {
80+ VariableType . String => ValueOutput < string > ( nameof ( NewValue ) ) ,
81+ VariableType . Integer => ValueOutput < int > ( nameof ( NewValue ) ) ,
82+ VariableType . Float => ValueOutput < float > ( nameof ( NewValue ) ) ,
83+ VariableType . Boolean => ValueOutput < bool > ( nameof ( NewValue ) ) ,
7384 _ => throw new ArgumentOutOfRangeException ( )
7485 } ;
7586 }
@@ -87,16 +98,20 @@ protected override void AssignArguments(Flow flow, VariableChangedArgs args)
8798
8899 switch ( VariableDefinition . Type ) {
89100 case VariableType . String :
90- flow . SetValue ( Value , State . Get < string > ( VariableDefinition . Id ) ) ;
101+ flow . SetValue ( OldValue , ( string ) args . OldValue ) ;
102+ flow . SetValue ( NewValue , ( string ) args . NewValue ) ;
91103 break ;
92104 case VariableType . Integer :
93- flow . SetValue ( Value , ( int ) State . Get < Integer > ( VariableDefinition . Id ) ) ;
105+ flow . SetValue ( OldValue , ( int ) ( Integer ) args . OldValue ) ;
106+ flow . SetValue ( NewValue , ( int ) ( Integer ) args . NewValue ) ;
94107 break ;
95108 case VariableType . Float :
96- flow . SetValue ( Value , ( float ) State . Get < Float > ( VariableDefinition . Id ) ) ;
109+ flow . SetValue ( OldValue , ( float ) ( Float ) args . OldValue ) ;
110+ flow . SetValue ( NewValue , ( float ) ( Float ) args . NewValue ) ;
97111 break ;
98112 case VariableType . Boolean :
99- flow . SetValue ( Value , ( bool ) State . Get < Bool > ( VariableDefinition . Id ) ) ;
113+ flow . SetValue ( OldValue , ( bool ) ( Bool ) args . OldValue ) ;
114+ flow . SetValue ( NewValue , ( bool ) ( Bool ) args . NewValue ) ;
100115 break ;
101116 default :
102117 throw new ArgumentOutOfRangeException ( ) ;
0 commit comments