Beispiel #1
0
 private void SelectPoint(GradientControlPoint point)
 {
     colorEditor.Tasks.Clear();
     positionEditor.Tasks.Clear();
     selectedPointColorProperty    = new Property <Color4>(point, nameof(GradientControlPoint.Color));
     selectedPointPositionProperty = new Property <float>(point, nameof(GradientControlPoint.Position));
     currentColorString            = selectedPointColorProperty.DistinctUntilChanged().Select(i => i.ToString(Color4.StringPresentation.Dec));
     colorEditor.Tasks.Add(currentColorString.Consume(v => colorEditor.Text = v));
     colorPanel.Color = selectedPointColorProperty.GetValue();
     colorEditor.Tasks.Add(selectedPointColorProperty.DistinctUntilChanged().Consume(v => {
         if (colorPanel.Color != v)
         {
             colorPanel.Color = v;
         }
     }));
     positionEditor.Tasks.Add(selectedPointPositionProperty.DistinctUntilChanged().Consume(v => positionEditor.Text = v.ToString()));
 }
Beispiel #2
0
 public static void AddChangeLateWatcher <T>(this Widget widget, IDataflowProvider <T> provider, Action <T> action)
 {
     widget.LateTasks.Add(provider.DistinctUntilChanged().Consume(action));
 }
Beispiel #3
0
 public static void AddChangeLateWatcher <T>(this Node node, IDataflowProvider <T> provider, Action <T> action)
 {
     node.Components.GetOrAdd <LateConsumeBehaviour>().Add(provider.DistinctUntilChanged().Consume(action));
 }