protected void DrawCommonProperties(TweenPRS _tw, TweenPRS.PRSType _type) { if (UIEditorTools.DrawHeader("Tweener", "Tweener_" + _type.ToString())) { UIEditorTools.BeginContents(); UIEditorTools.SetLabelWidth(110f); GUI.changed = false; TweenPRS.Style style = _tw.GetStyle(_type); style = (TweenPRS.Style)EditorGUILayout.EnumPopup("Play Style", style); AnimationCurve curve = _tw.GetAnimationCurve(_type); curve = EditorGUILayout.CurveField("Animation Curve", curve, GUILayout.Width(170), GUILayout.Height(62)); bool useSpeed = _tw.isSpeed(_type); if (style == TweenPRS.Style.Once && _type == TweenPRS.PRSType.Pos) { useSpeed = EditorGUILayout.ToggleLeft("Use Speed", useSpeed); } else { useSpeed = false; } GUILayout.BeginHorizontal(); float dur = _tw.GetDuration(_type); string str = style == TweenPRS.Style.Once ? (useSpeed ? "Speed" : "Duration") : "Duration"; dur = EditorGUILayout.FloatField(str, dur, GUILayout.Width(170f)); str = style == TweenPRS.Style.Once ? (useSpeed ? "unit/s" : "seconds") : "seconds"; GUILayout.Label(str); GUILayout.EndHorizontal(); if (GUI.changed == true) { UIEditorTools.RegisterUndo("Tween Change", _tw); _tw.SetAnimationCurve(_type, curve); _tw.SetDuration(_type, dur); _tw.SetStyle(_type, style); _tw.setEnableSpeed(_type, useSpeed); UnityEditor.EditorUtility.SetDirty(_tw); } UIEditorTools.EndContents(); } UIEditorTools.SetLabelWidth(80f); UIEditorTools.DrawEvents("On Finished", "On Finished_" + _type.ToString(), _tw, _tw.GetOnFinished(_type)); }
/// <summary> /// Draw a list of fields for the specified list of delegates. /// </summary> static public void DrawEvents(string text, string key, Object undoObject, List <EventDelegate> list, string noTarget, string notValid) { if (!UIEditorTools.DrawHeader(text, key)) { return; } UIEditorTools.BeginContents(); EventDelegateEditor.Field(undoObject, list, notValid, notValid); UIEditorTools.EndContents(); }
/// <summary> /// Draw a list of fields for the specified list of delegates. /// </summary> static public void DrawActions(string text, string key, Object undoObject, ref float distance, List <EventDelegate> list, string noTarget, string notValid) { if (!UIEditorTools.DrawHeader(text, key)) { return; } UIEditorTools.BeginContents(); GUILayout.Space(5); distance = EditorGUILayout.FloatField("Trigger Dist", distance); GUILayout.Space(5); EventDelegateEditor.Field(undoObject, list, notValid, notValid); GUILayout.Space(5); UIEditorTools.EndContents(); }
/// <summary> /// Draw a list of fields for the specified list of delegates. /// </summary> static public void DrawActions(string text, string key, Object undoObject, ref Collider collider, List <EventDelegate> list, string noTarget, string notValid) { if (!UIEditorTools.DrawHeader(text, key)) { return; } UIEditorTools.BeginContents(); GUILayout.Space(5); collider = EditorGUILayout.ObjectField("Trigger Rgn", collider, typeof(Collider), true) as Collider; GUILayout.Space(5); EventDelegateEditor.Field(undoObject, list, notValid, notValid); GUILayout.Space(5); UIEditorTools.EndContents(); }
void DrawTweenContents(TweenPRS _tw, TweenPRS.PRSType _type) { if (DrawToggleContent(_tw, _type)) { UIEditorTools.BeginContents(); UIEditorTools.SetLabelWidth(110f); GUI.changed = false; bool enableOffset = DrawOffsetContent(_tw, _type); DrawTweenInfo(_tw, _type, enableOffset); UIEditorTools.BeginContents(); UIEditorTools.SetLabelWidth(100f); DrawCommonProperties(_tw, _type); UIEditorTools.EndContents(); UIEditorTools.EndContents(); } }
protected void DrawCommonProperties() { Tweener tw = target as Tweener; if (UIEditorTools.DrawHeader("Tweener")) { UIEditorTools.BeginContents(); UIEditorTools.SetLabelWidth(110f); GUI.changed = false; Tweener.Style style = (Tweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.m_Style); AnimationCurve curve = EditorGUILayout.CurveField("Animation Curve", tw.m_AnimationCurve, GUILayout.Width(170), GUILayout.Height(62)); GUILayout.BeginHorizontal(); float dur = EditorGUILayout.FloatField("Duration", tw.Duration, GUILayout.Width(170f)); GUILayout.Label("seconds"); GUILayout.EndHorizontal(); if (GUI.changed == true) { UIEditorTools.RegisterUndo("Tween Change", tw); tw.m_AnimationCurve = curve; tw.m_Style = style; tw.Duration = dur; UnityEditor.EditorUtility.SetDirty(tw); } UIEditorTools.EndContents(); } UIEditorTools.SetLabelWidth(80f); UIEditorTools.DrawEvents("On Finished", tw, tw.onFinished); }