/// <summary> /// Applies balance to target if this is active. /// </summary> public void ForceApplyBalance() { if (_accessor != null) { _accessor.Set(_target, _balance); } }
/// <summary> /// Sets the value. Triggers the <see cref="ReceivedValue"/> event. /// </summary> /// <param name="value">The value.</param> public void SetValue(T value) { _memberAccessor.Set(N.O, value); if (ReceivedValue != null) { ReceivedValue(this, null); } }
public void Set(object target, object value) { //_pimp.Set(_chain.Get(target), value); var obj = _chain.Get(target); //get the value we modify _pimp.Set(obj, value); //modify the value _chain.Set(target, obj); //set it back to the target, this is so structs write correctly }
public void SetValue(object value) { Restart: switch (_status) { case MemberStatus.Unknown: this.InitAccessor(); goto Restart; case MemberStatus.Primitive: _accessor.Set(_target, ConvertUtil.ToPrim(value, _memberType)); break; case MemberStatus.Complex: _accessor.Set(_target, value); break; } }
public void Set(object target, object value) { if (_alternate != null) { _alternate.Set(target, value); } else { _setter(target as Transform, value); } }
public sealed override void Update(object targ, float dt, float t) { var value = GetValueAt(dt, t); if (_accessor == null) { System.Type memberType; _accessor = MemberCurve.GetAccessor(targ, _memberName, out memberType); } _accessor.Set(targ, value); }
public void Set(object target, object value) { _pimp.Set(_chain.Get(target), value); }
void SetUndefinedValue(object p_value) { if (_useSpeedTransformAccessors) { // Use specific accessors // Required for internal functions that use SetValue with untyped _startVal variable if (_setTransformVector3 != null) { _setTransformVector3((Vector3)p_value); } else { _setTransformQuaternion((Quaternion)p_value); } } else { #if MICRO if (propInfo != null) { try { propInfo.SetValue(tweenObj.target, p_value, null); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. propInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value), null); } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int. propInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value), null); } } else { try { fieldInfo.SetValue(tweenObj.target, p_value); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. fieldInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int. fieldInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } } #else if (HOTween.isIOS) { if (propInfo != null) { try { propInfo.SetValue(tweenObj.target, p_value, null); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. propInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value), null); } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int. propInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value), null); } } else { try { fieldInfo.SetValue(tweenObj.target, p_value); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. fieldInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int. fieldInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } } } else { try { valAccessor.Set(tweenObj.target, p_value); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. valAccessor.Set(tweenObj.target, (int)Math.Floor((double)(float)p_value)); // OPTIMIZE store if it's int prior to this, so valAccessor doesn't even have to run to catch the error? } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int, but is also here just to be sure. valAccessor.Set(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } } #endif } }
/// <summary> /// Sets the value of the controlled property. /// Some plugins (like PlugSetColor or PlugQuaterion) might override this to get values from different properties. /// </summary> /// <param name="p_value"> /// The new value. /// </param> protected virtual void SetValue(object p_value) { #if MICRO if (propInfo != null) { try { propInfo.SetValue(tweenObj.target, p_value, null); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. propInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value), null); } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int. propInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value), null); } } else { try { fieldInfo.SetValue(tweenObj.target, p_value); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. fieldInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int. fieldInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } } #else if (HOTween.isIOS) { if (propInfo != null) { try { propInfo.SetValue(tweenObj.target, p_value, null); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. propInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value), null); } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int. propInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value), null); } } else { try { fieldInfo.SetValue(tweenObj.target, p_value); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. fieldInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int. fieldInfo.SetValue(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } } } else { try { valAccessor.Set(tweenObj.target, p_value); } catch (InvalidCastException) { // This happens only if a float is being assigned to an int. valAccessor.Set(tweenObj.target, (int)Math.Floor((double)(float)p_value)); // OPTIMIZE store if it's int prior to this, so valAccessor doesn't even have to run to catch the error? } catch (ArgumentException) { // This happens only on iOS if a float is being assigned to an int, but is also here just to be sure. valAccessor.Set(tweenObj.target, (int)Math.Floor((double)(float)p_value)); } } #endif }