1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-15 03:21:37 +08:00

Added more GUI Utils used by DOTween Editors

This commit is contained in:
Daniele Giardini 2015-03-22 12:40:26 +01:00
parent 0a7dc5affd
commit 0fc3e3f197
46 changed files with 85 additions and 71 deletions

View File

@ -19,83 +19,81 @@ public class Paths : BrainBase
void Start() void Start()
{ {
return; // Vector3[] path = new[] {
// new Vector3(0,1,0),
// new Vector3(1,2,0),
// new Vector3(2,1,0),
// new Vector3(2,0,0)
// };
Vector3[] path = new[] { // TweenParams tp = new TweenParams()
new Vector3(0,1,0), // .SetEase(ease)
new Vector3(1,2,0), // .SetLoops(-1, loopType);
new Vector3(2,1,0),
new Vector3(2,0,0)
};
TweenParams tp = new TweenParams() // AxisConstraint lockRotation = lockRotation0 | lockRotation1;
.SetEase(ease)
.SetLoops(-1, loopType);
AxisConstraint lockRotation = lockRotation0 | lockRotation1; // // Relative VS non relative
// controller = targets[0].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
// .SetOptions(closePaths, lockPosition, lockRotation)
// .SetLookAt(0.1f, forward)
// .SetAs(tp)
// .SetRelative()
// .Pause();
// targets[1].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[1])
// .SetOptions(closePaths, lockPosition, lockRotation)
// .SetLookAt(targets[2], forward)
// .SetAs(tp)
// .Pause();
// Relative VS non relative // // Linear VS curved
controller = targets[0].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0]) // targets[2].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
.SetOptions(closePaths, lockPosition, lockRotation) // .SetOptions(closePaths, lockPosition, lockRotation)
.SetLookAt(0.1f, forward) // .SetLookAt(new Vector3(3, 0, 0), forward)
.SetAs(tp) // .SetAs(tp)
.SetRelative() // .SetRelative()
.Pause(); // .Pause();
targets[1].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[1]) // targets[3].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
.SetOptions(closePaths, lockPosition, lockRotation) // .SetOptions(closePaths, lockPosition, lockRotation)
.SetLookAt(targets[2], forward) // .SetLookAt(0.1f, forward)
.SetAs(tp) // .SetAs(tp)
.Pause(); // .SetRelative()
// .Pause();
// Linear VS curved // // Linear VS curved no lookAt
targets[2].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0]) // targets[4].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
.SetOptions(closePaths, lockPosition, lockRotation) // .SetOptions(closePaths, lockPosition, lockRotation)
.SetLookAt(new Vector3(3, 0, 0), forward) // .SetAs(tp)
.SetAs(tp) // .SetRelative()
.SetRelative() // .Pause();
.Pause(); // targets[5].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
targets[3].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1]) // .SetOptions(closePaths, lockPosition, lockRotation)
.SetOptions(closePaths, lockPosition, lockRotation) // .SetAs(tp)
.SetLookAt(0.1f, forward) // .SetRelative()
.SetAs(tp) // .Pause();
.SetRelative()
.Pause();
// Linear VS curved no lookAt // // Linear VS curved top-down
targets[4].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0]) // path = new[] {
.SetOptions(closePaths, lockPosition, lockRotation) // new Vector3(0,0,1),
.SetAs(tp) // new Vector3(1,0,2),
.SetRelative() // new Vector3(2,0,1),
.Pause(); // new Vector3(2,0,0)
targets[5].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1]) // };
.SetOptions(closePaths, lockPosition, lockRotation) // targets[6].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
.SetAs(tp) // .SetOptions(closePaths, lockPosition, lockRotation)
.SetRelative() // .SetLookAt(0.1f, forward)
.Pause(); // .SetAs(tp)
// .SetRelative()
// .Pause();
// targets[7].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
// .SetOptions(closePaths, lockPosition, lockRotation)
// .SetLookAt(0.1f, forward)
// .SetAs(tp)
// .SetRelative()
// .Pause();
// Linear VS curved top-down // // Log lengths
path = new[] { // controller.ForceInit();
new Vector3(0,0,1), // Debug.Log("Controller path length: " + controller.PathLength());
new Vector3(1,0,2),
new Vector3(2,0,1),
new Vector3(2,0,0)
};
targets[6].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
.SetOptions(closePaths, lockPosition, lockRotation)
.SetLookAt(0.1f, forward)
.SetAs(tp)
.SetRelative()
.Pause();
targets[7].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
.SetOptions(closePaths, lockPosition, lockRotation)
.SetLookAt(0.1f, forward)
.SetAs(tp)
.SetRelative()
.Pause();
// Log lengths
controller.ForceInit();
Debug.Log("Controller path length: " + controller.PathLength());
} }
void OnGUI() void OnGUI()

View File

@ -21,7 +21,7 @@ namespace DG.Tweening
public class DOTween public class DOTween
{ {
/// <summary>DOTween's version</summary> /// <summary>DOTween's version</summary>
public static readonly string Version = "1.0.325"; public static readonly string Version = "1.0.327";
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Options //////////////////////////////////// // Options ////////////////////////////////////

View File

@ -76,6 +76,22 @@ namespace DG.DOTweenEditor.Core
return stringEaseId == FilteredEaseTypes.Length - 1 ? Ease.INTERNAL_Custom : (Ease)Enum.Parse(typeof(Ease), FilteredEaseTypes[stringEaseId]); return stringEaseId == FilteredEaseTypes.Length - 1 ? Ease.INTERNAL_Custom : (Ease)Enum.Parse(typeof(Ease), FilteredEaseTypes[stringEaseId]);
} }
// A button which works as a toggle
public static bool ToggleButton(bool toggled, GUIContent content, GUIStyle guiStyle = null, params GUILayoutOption[] options)
{
Color orColor = GUI.backgroundColor;
GUI.backgroundColor = toggled ? Color.green : Color.white;
bool clicked = guiStyle == null
? GUILayout.Button(content, options)
: GUILayout.Button(content, guiStyle, options);
if (clicked) {
toggled = !toggled;
GUI.changed = true;
}
GUI.backgroundColor = orColor;
return toggled;
}
public static void SetGUIStyles(Vector2? footerSize = null) public static void SetGUIStyles(Vector2? footerSize = null)
{ {
if (!_additionalStylesSet && footerSize != null) { if (!_additionalStylesSet && footerSize != null) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.