public static ISubscription bind( this IObservable <ValueWithStorage> subject, dfLabel control ) { return(withTween(set => subject.subscribe(value => set(Go.to( TF.a( () => ValueWithStorage.parse(control.Text).AsVector2(), v => control.Text = new ValueWithStorage(v).AsString() ), TWEEN_DURATION, tCfg.vector2Prop(TF.Prop, value.AsVector2()) ))))); }
public static ISubscription bind( this IObservable <uint> subject, dfLabel control ) { return(withTween(set => subject.subscribe(value => { set(Go.to( TF.a( () => (int)uintComapper(control.Text), v => control.Text = v.ToString() ), TWEEN_DURATION, tCfg.intProp(TF.Prop, (int)value) )); control.Text = value.ToString(); }))); }
public static ISubscription bind( this IObservable <ValueWithStorage> subject, dfProgressBar control ) { return(withTween(set => subject.subscribe(value => { control.MinValue = 0; // 0 out of 0 yields full progress bar which is not what we want. control.MaxValue = value.value == 0 && value.storage == 0 ? 1 : value.storage; set(Go.to( TF.a(() => control.Value, v => control.Value = v), TWEEN_DURATION, tCfg.floatProp(TF.Prop, value.value) )); }))); }