void DrawPreviewSettings(Preview p) { if ((p.settingsFoldout = EditorGUILayout.Foldout(p.settingsFoldout, "Tweens"))) { var settings = p.settings; if (settings != null) { var isEmpty = settings.Count == 0; for (var i = 0; i <= settings.Count; ++i) { if (i < settings.Count) { DrawSettingElement(settings[i], i); } if (i < settings.Count || isEmpty) { DrawSettingControl(settings, ref i, isEmpty); } if (i < settings.Count - 1 || isEmpty) { EditorGUILayout.Space(); EditorGUILayout.Space(); } } } } }
void DrawPreviewSetting(Preview p) { if ((p.commonFoldout = EditorGUILayout.Foldout(p.commonFoldout, "Common"))) { { var d = p.delay; EditScope(p, () => { using (new GUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel("Delay"); d = EditorGUILayout.FloatField(d); } }, () => { p.delay = d; } ); } { var d = p.duration; EditScope(p, () => { using (new GUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel("Duration"); d = EditorGUILayout.FloatField(d); } }, () => { p.duration = d; } ); } { var e = p.easing; EditScope(p, () => { using (new GUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel("Easing"); e = (EasingEnum)EditorGUILayout.EnumPopup(e); } }, () => { p.easing = e; } ); } } }
public Tween Create(GameObject g, Preview p) { if (!enabled) { return(null); } var delay = GetDelay(p.delay); var duration = GetDuration(p.duration); var easing = GetEasing(p.easing); var tween = Add(g, duration, type); { var tv1 = tween as TweenVec1; if (tv1 != null) { if (toEnabled) { tv1.to = to.x; if (toRelative) { tv1.Relative(); } } if (fromEnabled) { if (fromRelative) { tv1.FromRelative(from.x); } else { tv1.From(from.x); } } } var tv2 = tween as TweenVec2; if (tv2 != null) { if (toEnabled) { tv2.to = (Vector2)to; if (toRelative) { tv2.Relative(); } } if (fromEnabled) { if (fromRelative) { tv2.FromRelative((Vector2)from); } else { tv2.From((Vector2)from); } } } var tv3 = tween as TweenVec3; if (tv3 != null) { if (toEnabled) { tv3.to = (Vector3)to; if (toRelative) { tv3.Relative(); } } if (fromEnabled) { if (fromRelative) { tv3.FromRelative((Vector3)from); } else { tv3.From((Vector3)from); } } } var tv4 = tween as TweenVec4; if (tv4 != null) { if (toEnabled) { tv4.to = to; if (toRelative) { tv4.Relative(); } } if (fromEnabled) { if (fromRelative) { tv4.FromRelative(from); } else { tv4.From(from); } } } } tween.DelayTime = delay; tween.Easing = GetEasingClass(easing); return(tween); }