/// <summary> /// Sets option /// </summary> /// <param name="option"></param> /// <returns></returns> public TweenBase SetOption(TweenOption option) { TweenUtil.ApplyOptions(this, new[] { option }); return this; }
/// <summary> /// Sets option /// </summary> /// <param name="option"></param> /// <returns></returns> public TweenBase SetOption(TweenOption option) { TweenUtil.ApplyOptions(this, new[] { option }); return(this); }
internal static void ApplyOptions(TweenBase animation, TweenOption[] options) { //Debug.Log("ApplyOptions"); if (options == null) { return; } ITween tween = animation as ITween; int len = options.Length; for (int i = 0; i < len; i++) { TweenOption option = options[i]; #if DEBUG if (DebugMode) { Debug.Log("Option: " + option); } #endif switch (option.Type) { case TweenOptionType.Target: animation.Target = option.Value; break; case TweenOptionType.Property: animation.Property = (string)option.Value; break; case TweenOptionType.Duration: animation.Duration = (float)option.Value; break; case TweenOptionType.Easer: if (null != tween) { tween.Easer = (Tween.EasingFunction)option.Value; } break; case TweenOptionType.Interpolator: if (null != tween) { tween.Interpolator = (IInterpolator)option.Value; } break; case TweenOptionType.StartValue: if (null != tween) { tween.StartValue = option.Value; } break; case TweenOptionType.StartValueReader: if (null != tween) { tween.StartValueReader = (PropertyReader)option.Value; } break; case TweenOptionType.StartValueReaderFunction: if (null != tween) { tween.StartValueReaderFunction = (Tween.PropertyReaderFunction)option.Value; } break; case TweenOptionType.EndValue: if (null != tween) { tween.EndValue = option.Value; } break; case TweenOptionType.EndValueReader: if (null != tween) { tween.EndValueReader = (PropertyReader)option.Value; } break; case TweenOptionType.EndValueReaderFunction: if (null != tween) { tween.EndValueReaderFunction = (Tween.PropertyReaderFunction)option.Value; } break; case TweenOptionType.Callback: animation.Callback = (Tween.CallbackFunction)option.Value; break; case TweenOptionType.Proxy: animation.Proxy = (ISetterProxy)option.Value; break; default: throw new Exception(string.Format(@"Unknown tween option type ""{0}""", option.Value)); } } }
internal static void ApplyOptions(TweenBase animation, TweenOption[] options) { //Debug.Log("ApplyOptions"); if (options == null) return; ITween tween = animation as ITween; int len = options.Length; for (int i = 0; i < len; i++) { TweenOption option = options[i]; #if DEBUG if (DebugMode) Debug.Log("Option: " + option); #endif switch (option.Type) { case TweenOptionType.Target: animation.Target = option.Value; break; case TweenOptionType.Property: animation.Property = (string)option.Value; break; case TweenOptionType.Duration: animation.Duration = (float)option.Value; break; case TweenOptionType.Easer: if (null != tween) tween.Easer = (Tween.EasingFunction)option.Value; break; case TweenOptionType.Interpolator: if (null != tween) tween.Interpolator = (IInterpolator)option.Value; break; case TweenOptionType.StartValue: if (null != tween) tween.StartValue = option.Value; break; case TweenOptionType.StartValueReader: if (null != tween) tween.StartValueReader = (PropertyReader)option.Value; break; case TweenOptionType.StartValueReaderFunction: if (null != tween) tween.StartValueReaderFunction = (Tween.PropertyReaderFunction)option.Value; break; case TweenOptionType.EndValue: if (null != tween) tween.EndValue = option.Value; break; case TweenOptionType.EndValueReader: if (null != tween) tween.EndValueReader = (PropertyReader)option.Value; break; case TweenOptionType.EndValueReaderFunction: if (null != tween) tween.EndValueReaderFunction = (Tween.PropertyReaderFunction)option.Value; break; case TweenOptionType.Callback: animation.Callback = (Tween.CallbackFunction)option.Value; break; case TweenOptionType.Proxy: animation.Proxy = (ISetterProxy)option.Value; break; default: throw new Exception(string.Format(@"Unknown tween option type ""{0}""", option.Value)); } } }