Skip to content

Commit

Permalink
added UITweening Methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Cunningham committed Jan 30, 2016
1 parent 74146a6 commit 38fcfe6
Show file tree
Hide file tree
Showing 48 changed files with 2,299 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Assets/UITweening.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/UITweening/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions Assets/UITweening/Editor/TweenCGAlphaEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using UnityEditor;

namespace UnityEngine.UI
{
[CustomEditor(typeof(TweenCGAlpha))]
[CanEditMultipleObjects]
public class TweenCGAlphaEditor : TweenMainEditor
{
private SerializedProperty
_fromProperty,
_fromOffsetProperty,
_toProperty,
_toOffsetProperty;

protected override void OnEnable()
{
base.OnEnable();
_fromProperty = serializedObject.FindProperty("from");
_fromOffsetProperty = serializedObject.FindProperty("fromOffset");
_toProperty = serializedObject.FindProperty("to");
_toOffsetProperty = serializedObject.FindProperty("toOffset");
}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.BeginHorizontal();
EditorGUILayout.Slider(_fromProperty, 0f, 1f);
if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
{
foreach (var i in targets)
{
var self = (TweenCGAlpha) i;
self.FromCurrentValue();
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(_fromOffsetProperty);

EditorGUILayout.BeginHorizontal();
EditorGUILayout.Slider(_toProperty, 0f, 1f);
if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
{
foreach (var i in targets)
{
var self = (TweenCGAlpha) i;
self.ToCurrentValue();
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(_toOffsetProperty);
serializedObject.ApplyModifiedProperties();

EditorGUILayout.Separator();
BaseTweenerProperties();
}
}
}
10 changes: 10 additions & 0 deletions Assets/UITweening/Editor/TweenCGAlphaEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions Assets/UITweening/Editor/TweenColorEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using UnityEditor;

namespace UnityEngine.UI
{
[CustomEditor(typeof(TweenColor))]
[CanEditMultipleObjects]
public class TweenColorEditor : TweenMainEditor
{
private SerializedProperty
_fromProperty,
_toProperty;

protected override void OnEnable()
{
base.OnEnable();
_fromProperty = serializedObject.FindProperty("from");
_toProperty = serializedObject.FindProperty("to");
}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(_fromProperty);
if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
{
foreach (var i in targets)
{
var self = (TweenColor) i;
self.FromCurrentValue();
}
}
EditorGUILayout.EndHorizontal();

EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(_toProperty);
if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
{
foreach (var i in targets)
{
var self = (TweenColor) i;
self.ToCurrentValue();
}
}
EditorGUILayout.EndHorizontal();
serializedObject.ApplyModifiedProperties();

EditorGUILayout.Separator();
BaseTweenerProperties();
}
}
}
10 changes: 10 additions & 0 deletions Assets/UITweening/Editor/TweenColorEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions Assets/UITweening/Editor/TweenMainEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using UnityEditor;

namespace UnityEngine.UI
{
[CustomEditor(typeof(TweenMain), true)]
[CanEditMultipleObjects]
public class TweenMainEditor : Editor
{
protected SerializedProperty
style,
method,
functionCurve,
delay,
duration,
ignoreTimeScale,
onFinished;

private bool tweenerFoldOut = true;

protected virtual void OnEnable()
{
style = serializedObject.FindProperty("style");
method = serializedObject.FindProperty("method");
functionCurve = serializedObject.FindProperty("functionCurve");
ignoreTimeScale = serializedObject.FindProperty("ignoreTimeScale");
delay = serializedObject.FindProperty("delay");
duration = serializedObject.FindProperty("duration");
onFinished = serializedObject.FindProperty("OnFinished");
}

public override void OnInspectorGUI()
{
base.OnInspectorGUI();
BaseTweenerProperties();
}

protected void BaseTweenerProperties()
{
serializedObject.Update();

tweenerFoldOut = EditorGUILayout.Foldout(tweenerFoldOut, "TweenSettings:");
if (tweenerFoldOut)
{
BeginContents();
EditorGUILayout.PropertyField(style, new GUIContent("Tween Style"));
EditorGUILayout.PropertyField(method);
EditorGUILayout.PropertyField(functionCurve, new GUIContent("Curve"), GUILayout.Height(52f));
EditorGUILayout.PropertyField(ignoreTimeScale, new GUIContent("Ignore TimeScale"));
EditorGUILayout.PropertyField(delay);
EditorGUILayout.PropertyField(duration);
EndContents();
}

EditorGUILayout.PropertyField(onFinished, new GUIContent("OnFinished"));
serializedObject.ApplyModifiedProperties();
}

protected void BeginContents()
{
EditorGUILayout.BeginHorizontal(GUILayout.MinHeight(10f));
GUILayout.Space(10f);
GUILayout.BeginVertical();
GUILayout.Space(2f);
}

protected void EndContents()
{
GUILayout.Space(3f);
GUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
}
}
}
10 changes: 10 additions & 0 deletions Assets/UITweening/Editor/TweenMainEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions Assets/UITweening/Editor/TweenPosEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using UnityEditor;

namespace UnityEngine.UI
{
[CustomEditor(typeof(TweenPos))]
[CanEditMultipleObjects]
public class TweenPosEditor : TweenMainEditor
{
private SerializedProperty
_fromProperty,
_fromOffsetProperty,
_toProperty,
_toOffsetProperty,
_cSpaceProperty;

protected override void OnEnable()
{
base.OnEnable();
_fromProperty = serializedObject.FindProperty("from");
_fromOffsetProperty = serializedObject.FindProperty("fromOffset");
_toProperty = serializedObject.FindProperty("to");
_toOffsetProperty = serializedObject.FindProperty("toOffset");
_cSpaceProperty = serializedObject.FindProperty("CSpace");
}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(_fromProperty);
if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
{
foreach (var i in targets)
{
var self = (TweenPos) i;
self.FromCurrentValue();
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(_fromOffsetProperty, new GUIContent("Offset"));

EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(_toProperty);
if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
{
foreach (var i in targets)
{
var self = (TweenPos) i;
self.ToCurrentValue();
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(_toOffsetProperty, new GUIContent("Offset"));
EditorGUILayout.PropertyField(_cSpaceProperty, new GUIContent("Coordinate Space"));
serializedObject.ApplyModifiedProperties();

EditorGUILayout.Separator();
BaseTweenerProperties();
}
}
}
10 changes: 10 additions & 0 deletions Assets/UITweening/Editor/TweenPosEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions Assets/UITweening/Editor/TweenRotEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using UnityEditor;

namespace UnityEngine.UI
{
[CustomEditor(typeof(TweenRot))]
[CanEditMultipleObjects]
public class TweenRotEditor : TweenMainEditor
{
private SerializedProperty
_fromProperty,
_fromOffetProperty,
_toProperty,
_toOffetProperty;

protected override void OnEnable()
{
base.OnEnable();
_fromProperty = serializedObject.FindProperty("from");
_fromOffetProperty = serializedObject.FindProperty("fromOffset");
_toProperty = serializedObject.FindProperty("to");
_toOffetProperty = serializedObject.FindProperty("toOffset");
}

public override void OnInspectorGUI()
{
serializedObject.Update();

EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(_fromProperty);
if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
{
foreach (var i in targets)
{
var self = (TweenRot) i;
self.FromCurrentValue();
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(_fromOffetProperty);

EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(_toProperty);
if (GUILayout.Button("\u25C0", GUILayout.Width(24f)))
{
foreach (var i in targets)
{
var self = (TweenRot) i;
self.ToCurrentValue();
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(_toOffetProperty);
serializedObject.ApplyModifiedProperties();

EditorGUILayout.Separator();
BaseTweenerProperties();
}
}
}
10 changes: 10 additions & 0 deletions Assets/UITweening/Editor/TweenRotEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 38fcfe6

Please sign in to comment.