mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 01:06:02 +08:00
Fixed StringPlugin (DOText) not calculating SpeedBased duration correctly in case of rich text
This commit is contained in:
parent
9d99649725
commit
28cf80f3cd
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,6 +21,7 @@ ExternalPluginsTestsAndExamples*
|
||||
*.Unity*/Assets/-tk2d*
|
||||
*.Unity*/Assets/Console*Pro*
|
||||
*.Unity*/Assets/Text*Mesh*Pro*
|
||||
*.Unity*/Assets/CodeStage
|
||||
.vs
|
||||
*HOPoolOperator*
|
||||
*HOTools*
|
||||
|
||||
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 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 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.
@ -10,4 +10,9 @@ public class TempPro : MonoBehaviour
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Space)) anime.DORestart(true);
|
||||
}
|
||||
|
||||
public void OnCreated()
|
||||
{
|
||||
Debug.Log("Tween created > " + anime.tween);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
22
UnityTests.Unity5/Assets/_Tests/RichText.cs
Normal file
22
UnityTests.Unity5/Assets/_Tests/RichText.cs
Normal file
@ -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
UnityTests.Unity5/Assets/_Tests/RichText.cs.meta
Normal file
12
UnityTests.Unity5/Assets/_Tests/RichText.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 423ce3c43b35c2b4da118113d92a8d71
|
||||
timeCreated: 1449307086
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
UnityTests.Unity5/Assets/_Tests/RichText.unity
Normal file
BIN
UnityTests.Unity5/Assets/_Tests/RichText.unity
Normal file
Binary file not shown.
8
UnityTests.Unity5/Assets/_Tests/RichText.unity.meta
Normal file
8
UnityTests.Unity5/Assets/_Tests/RichText.unity.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 054d4febe89456b4ea2e1f9ee294a824
|
||||
timeCreated: 1449307077
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
UnityTests.Unity5/Assets/_Tests/ShakeInverse.cs
Normal file
16
UnityTests.Unity5/Assets/_Tests/ShakeInverse.cs
Normal file
@ -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
UnityTests.Unity5/Assets/_Tests/ShakeInverse.cs.meta
Normal file
12
UnityTests.Unity5/Assets/_Tests/ShakeInverse.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc24d72cc01112842b4a52a27d12b95a
|
||||
timeCreated: 1448968725
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
UnityTests.Unity5/Assets/_Tests/ShakeInverse.unity
Normal file
BIN
UnityTests.Unity5/Assets/_Tests/ShakeInverse.unity
Normal file
Binary file not shown.
8
UnityTests.Unity5/Assets/_Tests/ShakeInverse.unity.meta
Normal file
8
UnityTests.Unity5/Assets/_Tests/ShakeInverse.unity.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e0097dc8e625664cbc7b40704b6ea45
|
||||
timeCreated: 1448968716
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 5.2.2f1
|
||||
m_EditorVersion: 5.2.3f1
|
||||
m_StandardAssetsVersion: 0
|
||||
|
||||
@ -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 ////////////////////////////////////
|
||||
|
||||
@ -59,7 +59,8 @@ namespace DG.Tweening.Plugins
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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.
Loading…
x
Reference in New Issue
Block a user