Skip to content

Commit

Permalink
Fixed StringPlugin (DOText) not calculating SpeedBased duration corre…
Browse files Browse the repository at this point in the history
…ctly in case of rich text
  • Loading branch information
Demigiant committed Dec 5, 2015
1 parent 9d99649 commit 28cf80f
Show file tree
Hide file tree
Showing 55 changed files with 88 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ExternalPluginsTestsAndExamples*
*.Unity*/Assets/-tk2d*
*.Unity*/Assets/Console*Pro*
*.Unity*/Assets/Text*Mesh*Pro*
*.Unity*/Assets/CodeStage
.vs
*HOPoolOperator*
*HOTools*
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween43.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween46.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll
Binary file not shown.
Binary file modified UnityTests.Unity4/Assets/Demigiant/DOTween/DOTween50.dll.mdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween43.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween46.dll.mdb
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween50.dll.mdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions UnityTests.Unity5/Assets/_Tests PRO/TempPro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ void Update()
{
if (Input.GetKeyDown(KeyCode.Space)) anime.DORestart(true);
}

public void OnCreated()
{
Debug.Log("Tween created > " + anime.tween);
}
}
Binary file modified UnityTests.Unity5/Assets/_Tests PRO/TempPro.unity
Binary file not shown.
22 changes: 22 additions & 0 deletions UnityTests.Unity5/Assets/_Tests/RichText.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using DG.Tweening;

public class RichText : BrainBase
{
public float duration = 6;
public bool speedBased = true;
public ScrambleMode scrambleMode;
public Text txtRichA, txtA;

IEnumerator Start()
{
yield return new WaitForSeconds(0.6f);

TweenParams tp = new TweenParams().SetEase(Ease.Linear);
tp.SetSpeedBased(speedBased);
txtRichA.DOText("This is a <color=#ff0000>colored <color=#00ff00>text</color></color> and normal text", duration, true, scrambleMode).SetAs(tp);
txtA.DOText("This is a colored text and normal text", duration, true, scrambleMode).SetAs(tp);
}
}
12 changes: 12 additions & 0 deletions UnityTests.Unity5/Assets/_Tests/RichText.cs.meta

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

Binary file added UnityTests.Unity5/Assets/_Tests/RichText.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions UnityTests.Unity5/Assets/_Tests/RichText.unity.meta

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

16 changes: 16 additions & 0 deletions UnityTests.Unity5/Assets/_Tests/ShakeInverse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using UnityEngine;
using System.Collections;
using DG.Tweening;

public class ShakeInverse : MonoBehaviour
{
public Transform trans;

IEnumerator Start()
{
yield return new WaitForSeconds(0.6f);
Tween t = trans.DOShakePosition(4, 2).SetAutoKill(false);
t.Complete();
t.PlayBackwards();
}
}
12 changes: 12 additions & 0 deletions UnityTests.Unity5/Assets/_Tests/ShakeInverse.cs.meta

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

Binary file not shown.
8 changes: 8 additions & 0 deletions UnityTests.Unity5/Assets/_Tests/ShakeInverse.unity.meta

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

Binary file modified UnityTests.Unity5/ProjectSettings/ProjectSettings.asset
Binary file not shown.
2 changes: 1 addition & 1 deletion UnityTests.Unity5/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 5.2.2f1
m_EditorVersion: 5.2.3f1
m_StandardAssetsVersion: 0
2 changes: 1 addition & 1 deletion _DOTween.Assembly/DOTween/DOTween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.115";
public static readonly string Version = "1.1.120";

///////////////////////////////////////////////
// Options ////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion _DOTween.Assembly/DOTween/Plugins/StringPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public override void SetChangeValue(TweenerCore<string, string, StringOptions> t

public override float GetSpeedBasedDuration(StringOptions options, float unitsXSecond, string changeValue)
{
float res = changeValue.Length / unitsXSecond;
// float res = changeValue.Length / unitsXSecond;
float res = (options.richTextEnabled ? options.changeValueStrippedLength : changeValue.Length) / unitsXSecond;
if (res < 0) res = -res;
return res;
}
Expand Down
Binary file modified _DOTween.Assembly/bin/DOTween.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween43.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween43.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween46.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween46.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween50.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween50.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/Editor/DOTweenEditor.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb
Binary file not shown.

0 comments on commit 28cf80f

Please sign in to comment.