1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-09 08:38:45 +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()
{
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[] {
new Vector3(0,1,0),
new Vector3(1,2,0),
new Vector3(2,1,0),
new Vector3(2,0,0)
};
// TweenParams tp = new TweenParams()
// .SetEase(ease)
// .SetLoops(-1, loopType);
TweenParams tp = new TweenParams()
.SetEase(ease)
.SetLoops(-1, loopType);
// AxisConstraint lockRotation = lockRotation0 | lockRotation1;
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
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();
// // Linear VS curved
// targets[2].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
// .SetOptions(closePaths, lockPosition, lockRotation)
// .SetLookAt(new Vector3(3, 0, 0), forward)
// .SetAs(tp)
// .SetRelative()
// .Pause();
// targets[3].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
// .SetOptions(closePaths, lockPosition, lockRotation)
// .SetLookAt(0.1f, forward)
// .SetAs(tp)
// .SetRelative()
// .Pause();
// Linear VS curved
targets[2].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
.SetOptions(closePaths, lockPosition, lockRotation)
.SetLookAt(new Vector3(3, 0, 0), forward)
.SetAs(tp)
.SetRelative()
.Pause();
targets[3].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
.SetOptions(closePaths, lockPosition, lockRotation)
.SetLookAt(0.1f, forward)
.SetAs(tp)
.SetRelative()
.Pause();
// // Linear VS curved no lookAt
// targets[4].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
// .SetOptions(closePaths, lockPosition, lockRotation)
// .SetAs(tp)
// .SetRelative()
// .Pause();
// targets[5].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
// .SetOptions(closePaths, lockPosition, lockRotation)
// .SetAs(tp)
// .SetRelative()
// .Pause();
// Linear VS curved no lookAt
targets[4].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
.SetOptions(closePaths, lockPosition, lockRotation)
.SetAs(tp)
.SetRelative()
.Pause();
targets[5].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
.SetOptions(closePaths, lockPosition, lockRotation)
.SetAs(tp)
.SetRelative()
.Pause();
// // Linear VS curved top-down
// path = new[] {
// new Vector3(0,0,1),
// 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();
// Linear VS curved top-down
path = new[] {
new Vector3(0,0,1),
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());
// // Log lengths
// controller.ForceInit();
// Debug.Log("Controller path length: " + controller.PathLength());
}
void OnGUI()

View File

@ -21,7 +21,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.0.325";
public static readonly string Version = "1.0.327";
///////////////////////////////////////////////
// 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]);
}
// 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)
{
if (!_additionalStylesSet && footerSize != null) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.