net.dreditor.textdisplaying 0.0.0-stage → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CGLineTextDisplayer.cs +13 -0
  2. package/CGLineTextDisplayer.cs.meta +11 -0
  3. package/ClearTextOnLineEnd.cs +18 -0
  4. package/ClearTextOnLineEnd.cs.meta +11 -0
  5. package/ColorByCharacterTextModifier.cs +46 -0
  6. package/ColorByCharacterTextModifier.cs.meta +11 -0
  7. package/DREditor.TextDisplaying.asmdef +20 -0
  8. package/DREditor.TextDisplaying.asmdef.meta +7 -0
  9. package/DialogueLineTextDisplayer.cs +188 -0
  10. package/DialogueLineTextDisplayer.cs.meta +11 -0
  11. package/DisplayFormattedString.cs +69 -0
  12. package/DisplayFormattedString.cs.meta +2 -0
  13. package/DisplayOwnedIntCurrency.cs +57 -0
  14. package/DisplayOwnedIntCurrency.cs.meta +2 -0
  15. package/HighlightTextModifier.cs +71 -0
  16. package/HighlightTextModifier.cs.meta +11 -0
  17. package/ITextDisplayerHandler.cs +23 -0
  18. package/ITextDisplayerHandler.cs.meta +11 -0
  19. package/OptionsTextMessage.cs +54 -0
  20. package/OptionsTextMessage.cs.meta +11 -0
  21. package/OptionsTextSpeedMessage.cs +83 -0
  22. package/OptionsTextSpeedMessage.cs.meta +11 -0
  23. package/RegexEscapeModifier.cs +44 -0
  24. package/RegexEscapeModifier.cs.meta +11 -0
  25. package/ReplaceGroup.cs +34 -0
  26. package/ReplaceGroup.cs.meta +11 -0
  27. package/ReplaceTextModifier.cs +54 -0
  28. package/ReplaceTextModifier.cs.meta +11 -0
  29. package/ReplaceTextModifierBase.cs +19 -0
  30. package/ReplaceTextModifierBase.cs.meta +11 -0
  31. package/Samples/CGDialogueUIVisible.asset +21 -0
  32. package/Samples/CGDialogueUIVisible.asset.meta +8 -0
  33. package/Samples/CGTextBox.asset +21 -0
  34. package/Samples/CGTextBox.asset.meta +8 -0
  35. package/Samples/CG_Line_Text_Displayer.prefab +147 -0
  36. package/Samples/CG_Line_Text_Displayer.prefab.meta +7 -0
  37. package/Samples/Clear_Text_On_Line_End.prefab +46 -0
  38. package/Samples/Clear_Text_On_Line_End.prefab.meta +7 -0
  39. package/Samples/Color_By_Character_Text_Modifier.prefab +51 -0
  40. package/Samples/Color_By_Character_Text_Modifier.prefab.meta +7 -0
  41. package/Samples/DRE_TextDebugging.unity +492 -0
  42. package/Samples/DRE_TextDebugging.unity.meta +7 -0
  43. package/Samples/DialogueTextBox.asset +21 -0
  44. package/Samples/DialogueTextBox.asset.meta +8 -0
  45. package/Samples/Dialogue_Line_Text_Displayer.prefab +142 -0
  46. package/Samples/Dialogue_Line_Text_Displayer.prefab.meta +7 -0
  47. package/Samples/Highlight_Text_Modifier.prefab +49 -0
  48. package/Samples/Highlight_Text_Modifier.prefab.meta +7 -0
  49. package/Samples/Option_Message_UI_ETemplate.prefab +335 -0
  50. package/Samples/Option_Message_UI_ETemplate.prefab.meta +7 -0
  51. package/Samples/OptionsUITextSpeedMessage.asset +21 -0
  52. package/Samples/OptionsUITextSpeedMessage.asset.meta +8 -0
  53. package/Samples/Regex_Escape_Modifier.prefab +47 -0
  54. package/Samples/Regex_Escape_Modifier.prefab.meta +7 -0
  55. package/Samples/Replace_Text_Modifier.prefab +49 -0
  56. package/Samples/Replace_Text_Modifier.prefab.meta +7 -0
  57. package/Samples/Symbol_Color_Text_Modifier.prefab +50 -0
  58. package/Samples/Symbol_Color_Text_Modifier.prefab.meta +7 -0
  59. package/Samples/Symbol_Protag_UI_Modifier.prefab +48 -0
  60. package/Samples/Symbol_Protag_UI_Modifier.prefab.meta +7 -0
  61. package/Samples/Text_Display_Debugger.prefab +467 -0
  62. package/Samples/Text_Display_Debugger.prefab.meta +7 -0
  63. package/Samples/Text_Displayer.prefab +624 -0
  64. package/Samples/Text_Displayer.prefab.meta +7 -0
  65. package/Samples/TrialDialogueTextBox.asset +21 -0
  66. package/Samples/TrialDialogueTextBox.asset.meta +8 -0
  67. package/Samples/Trial_Dialogue_Line_Text_Displayer.prefab +82 -0
  68. package/Samples/Trial_Dialogue_Line_Text_Displayer.prefab.meta +7 -0
  69. package/Samples.meta +8 -0
  70. package/SetTextDisplaySpeed.cs +60 -0
  71. package/SetTextDisplaySpeed.cs.meta +11 -0
  72. package/SymbolColorTextModifier.cs +25 -0
  73. package/SymbolColorTextModifier.cs.meta +11 -0
  74. package/SymbolProtagUIModifier.cs +42 -0
  75. package/SymbolProtagUIModifier.cs.meta +11 -0
  76. package/SymbolTextModifier.cs +48 -0
  77. package/SymbolTextModifier.cs.meta +11 -0
  78. package/TMPMarquee.cs +178 -0
  79. package/TMPMarquee.cs.meta +11 -0
  80. package/TMPMarqueeBase.cs +104 -0
  81. package/TMPMarqueeBase.cs.meta +2 -0
  82. package/TextDisplayDebugger.cs +87 -0
  83. package/TextDisplayDebugger.cs.meta +11 -0
  84. package/TextDisplayModifier.cs +29 -0
  85. package/TextDisplayModifier.cs.meta +11 -0
  86. package/TextDisplayer.cs +255 -0
  87. package/TextDisplayer.cs.meta +11 -0
  88. package/TextDisplayerBase.cs +107 -0
  89. package/TextDisplayerBase.cs.meta +11 -0
  90. package/package.json +37 -6
  91. package/package.json.meta +7 -0
  92. package/README.md +0 -3
@@ -0,0 +1,82 @@
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!1001 &6242507975043742467
4
+ PrefabInstance:
5
+ m_ObjectHideFlags: 0
6
+ serializedVersion: 2
7
+ m_Modification:
8
+ m_TransformParent: {fileID: 0}
9
+ m_Modifications:
10
+ - target: {fileID: 2594651368626609964, guid: a7519ae02f4a947429b862654a93ce4c,
11
+ type: 3}
12
+ propertyPath: globalBox
13
+ value:
14
+ objectReference: {fileID: 11400000, guid: b30fd4470aa2c744984f96e64c9ab1a4,
15
+ type: 2}
16
+ - target: {fileID: 2594651368626609965, guid: a7519ae02f4a947429b862654a93ce4c,
17
+ type: 3}
18
+ propertyPath: m_Name
19
+ value: Trial_Dialogue_Line_Text_Displayer
20
+ objectReference: {fileID: 0}
21
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
22
+ type: 3}
23
+ propertyPath: m_RootOrder
24
+ value: 0
25
+ objectReference: {fileID: 0}
26
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
27
+ type: 3}
28
+ propertyPath: m_LocalPosition.x
29
+ value: 0
30
+ objectReference: {fileID: 0}
31
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
32
+ type: 3}
33
+ propertyPath: m_LocalPosition.y
34
+ value: 0
35
+ objectReference: {fileID: 0}
36
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
37
+ type: 3}
38
+ propertyPath: m_LocalPosition.z
39
+ value: 0
40
+ objectReference: {fileID: 0}
41
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
42
+ type: 3}
43
+ propertyPath: m_LocalRotation.w
44
+ value: 1
45
+ objectReference: {fileID: 0}
46
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
47
+ type: 3}
48
+ propertyPath: m_LocalRotation.x
49
+ value: -0
50
+ objectReference: {fileID: 0}
51
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
52
+ type: 3}
53
+ propertyPath: m_LocalRotation.y
54
+ value: -0
55
+ objectReference: {fileID: 0}
56
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
57
+ type: 3}
58
+ propertyPath: m_LocalRotation.z
59
+ value: -0
60
+ objectReference: {fileID: 0}
61
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
62
+ type: 3}
63
+ propertyPath: m_LocalEulerAnglesHint.x
64
+ value: 0
65
+ objectReference: {fileID: 0}
66
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
67
+ type: 3}
68
+ propertyPath: m_LocalEulerAnglesHint.y
69
+ value: 0
70
+ objectReference: {fileID: 0}
71
+ - target: {fileID: 2594651368626609967, guid: a7519ae02f4a947429b862654a93ce4c,
72
+ type: 3}
73
+ propertyPath: m_LocalEulerAnglesHint.z
74
+ value: 0
75
+ objectReference: {fileID: 0}
76
+ - target: {fileID: 6965695758473656304, guid: a7519ae02f4a947429b862654a93ce4c,
77
+ type: 3}
78
+ propertyPath: Box
79
+ value:
80
+ objectReference: {fileID: 0}
81
+ m_RemovedComponents: []
82
+ m_SourcePrefab: {fileID: 100100000, guid: a7519ae02f4a947429b862654a93ce4c, type: 3}
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 3f079951a19c7f741b67ba65b74903a8
3
+ PrefabImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/Samples.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 2816db62fd2982d45b6ad1b806f20ac6
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,60 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.EventObjects;
3
+ using UnityEngine;
4
+
5
+ namespace DREditor.TextDisplaying
6
+ {
7
+ /// <summary>
8
+ ///
9
+ /// </summary>
10
+ public class SetTextDisplaySpeed : MonoBehaviour
11
+ {
12
+ /// <summary>
13
+ ///
14
+ /// </summary>
15
+ [Tooltip("")]
16
+ [SerializeField] protected TextDisplayerBase textDisplayer = null;
17
+
18
+ /// <summary>
19
+ ///
20
+ /// </summary>
21
+ [Tooltip("")]
22
+ [SerializeField] protected ValueWithEvent<float, FloatEvent> textSpeedSetting = null;
23
+
24
+
25
+ /// <summary>
26
+ ///
27
+ /// </summary>
28
+ protected virtual void Start() => OnTextDisplaySpeedUpdated(textSpeedSetting.Value);
29
+
30
+ /// <summary>
31
+ ///
32
+ /// </summary>
33
+ protected virtual void OnEnable() => SubscribeToSettingChange();
34
+
35
+ /// <summary>
36
+ ///
37
+ /// </summary>
38
+ protected virtual void SubscribeToSettingChange() => textSpeedSetting.AddListener(OnTextDisplaySpeedUpdated);
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ protected virtual void OnDisable() => UnsubscribeToSettingChange();
44
+
45
+ /// <summary>
46
+ ///
47
+ /// </summary>
48
+ protected virtual void UnsubscribeToSettingChange() => textSpeedSetting.RemoveListener(OnTextDisplaySpeedUpdated);
49
+
50
+ /// <summary>
51
+ ///
52
+ /// </summary>
53
+ /// <param name="newSpeed"></param>
54
+ protected virtual void OnTextDisplaySpeedUpdated(float newSpeed)
55
+ {
56
+ if (textDisplayer != null)
57
+ textDisplayer.SetTextDisplaySpeed(newSpeed);
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 8d00bac9ed0a63e4c8ecf9e8f6a0070d
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,25 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using TMPro;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.TextDisplaying
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ [ClassHeader(nameof(SymbolTextModifier) +
12
+ "\n\n")]
13
+ public class SymbolColorTextModifier : SymbolTextModifier
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ [Tooltip("")]
19
+ [SerializeField] Color32 newTextColor = new(77, 193, 250, 255);
20
+
21
+
22
+ /// <inheritdoc/>
23
+ protected override void OnSymbolFound(string text, Line currentLine = null, TMP_Text box = null) => box.color = newTextColor;
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: fa446a4645cb52644b84a5da97134c73
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,42 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using DREditor.Dialogues.LineReading;
4
+ using DREditor.EventObjects;
5
+ using TMPro;
6
+ using UnityEngine;
7
+
8
+ namespace DREditor.TextDisplaying
9
+ {
10
+ /// <summary>
11
+ ///
12
+ /// </summary>
13
+ [ClassHeader(nameof(SymbolTextModifier) + ", " + nameof(ILineRoutine) +
14
+ "\n\n")]
15
+ public class SymbolProtagUIModifier : SymbolTextModifier, ILineRoutine
16
+ {
17
+ /// <summary>
18
+ ///
19
+ /// </summary>
20
+ [Tooltip("")]
21
+ [SerializeField] protected SceneEvent toggleProtagUI = null;
22
+
23
+
24
+ /// <inheritdoc/>
25
+ protected override void OnSymbolFound(string text, Line currentLine = null, TMP_Text box = null) => toggleProtagUI.Raise();
26
+
27
+
28
+ /// <inheritdoc/>
29
+ public virtual bool ShouldProcess(Line currentLine) => currentLine.Text.Contains(startingSymbol);
30
+
31
+ /// <inheritdoc/>
32
+ public override bool SkipLine(Line currentLine)
33
+ {
34
+ bool onlySymbol = string.IsNullOrEmpty(currentLine.Text.Replace(startingSymbol.ToString(), ""));
35
+
36
+ if (onlySymbol)
37
+ OnSymbolFound(currentLine.Text, currentLine, null);
38
+
39
+ return onlySymbol || base.SkipLine(currentLine);
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 2d57bda12c1d4df409e5b7384d59f731
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,48 @@
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ using DREditor.Dialogues;
3
+ using TMPro;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.TextDisplaying
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ public abstract class SymbolTextModifier : TextDisplayModifier
12
+ {
13
+ /// <summary>
14
+ ///
15
+ /// </summary>
16
+ [Tooltip("")]
17
+ [SerializeField] protected char startingSymbol = '$';
18
+
19
+
20
+ /// <inheritdoc/>
21
+ public override string ApplyModification(string text, Line currentLine = null, TMP_Text box = null)
22
+ {
23
+ if (TextStartsWithSymbol(text))
24
+ {
25
+ OnSymbolFound(text, currentLine, box);
26
+
27
+ text = text.Remove(text.IndexOf(startingSymbol), 1);
28
+ }
29
+
30
+ return text;
31
+ }
32
+
33
+ /// <summary>
34
+ ///
35
+ /// </summary>
36
+ /// <param name="text"></param>
37
+ /// <returns></returns>
38
+ protected virtual bool TextStartsWithSymbol(string text) => text.Split(' ')[0].Contains(startingSymbol);
39
+
40
+ /// <summary>
41
+ ///
42
+ /// </summary>
43
+ /// <param name="text"></param>
44
+ /// <param name="currentLine"></param>
45
+ /// <param name="box"></param>
46
+ protected abstract void OnSymbolFound(string text, Line currentLine = null, TMP_Text box = null);
47
+ }
48
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 5587137b550131b4599b2165976968d1
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/TMPMarquee.cs ADDED
@@ -0,0 +1,178 @@
1
+ //OG Author: KHeartz. My Magic Man
2
+ //Edited Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
3
+ using System.Collections;
4
+ using UnityEngine;
5
+
6
+ namespace DREditor.TextDisplaying
7
+ {
8
+ /// <summary>
9
+ ///
10
+ /// </summary>
11
+ [ClassHeader(nameof(TMPMarqueeBase) +
12
+ "\n\n")]
13
+ public class TMPMarquee : TMPMarqueeBase
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ [Tooltip("")]
19
+ [SerializeField] protected float scrollDuration = 5;
20
+
21
+
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ protected float currentWidth;
26
+
27
+ /// <summary>
28
+ ///
29
+ /// </summary>
30
+ protected float startX;
31
+
32
+ /// <summary>
33
+ ///
34
+ /// </summary>
35
+ protected float elapsedSeconds;
36
+
37
+
38
+ /// <inheritdoc/>
39
+ protected override void Initialize()
40
+ {
41
+ ResetPosition();
42
+
43
+ ForceUpdateWidth();
44
+
45
+ ResetCalculatedVariables();
46
+ }
47
+
48
+ /// <summary>
49
+ ///
50
+ /// </summary>
51
+ protected virtual void ResetPosition() => marqueeTransform.localPosition = new(parentMask.rect.xMax, 0, 0);
52
+
53
+ /// <summary>
54
+ ///
55
+ /// </summary>
56
+ protected virtual void ForceUpdateWidth()
57
+ {
58
+ tmp.ForceMeshUpdate();
59
+
60
+ currentWidth = tmp.rectTransform.rect.width;
61
+ }
62
+
63
+ /// <summary>
64
+ ///
65
+ /// </summary>
66
+ protected virtual void ResetCalculatedVariables()
67
+ {
68
+ startX = marqueeTransform.localPosition.x;
69
+
70
+ elapsedSeconds = 0f;
71
+ }
72
+
73
+
74
+ /// <inheritdoc/>
75
+ protected override IEnumerator MarqueeRoutine()
76
+ {
77
+ while (true)
78
+ {
79
+ Initialize();
80
+
81
+ while (MarqueeUpdated())
82
+ yield return null;
83
+ }
84
+ }
85
+
86
+ /// <summary>
87
+ ///
88
+ /// </summary>
89
+ /// <returns></returns>
90
+ /// <remarks></remarks>
91
+ protected virtual bool MarqueeUpdated()
92
+ {
93
+ bool result = ShouldBeScrolling();
94
+
95
+ if (result)
96
+ UpdateScroll();
97
+
98
+ return result;
99
+ }
100
+
101
+ /// <summary>
102
+ ///
103
+ /// </summary>
104
+ /// <returns></returns>
105
+ protected virtual bool ShouldBeScrolling() => elapsedSeconds < scrollDuration;
106
+
107
+
108
+ /// <summary>
109
+ ///
110
+ /// </summary>
111
+ protected virtual void UpdateScroll()
112
+ {
113
+ CheckWidthChanged();
114
+
115
+ TickElapsed();
116
+
117
+ UpdatePosition();
118
+ }
119
+
120
+ /// <summary>
121
+ ///
122
+ /// </summary>
123
+ protected virtual void CheckWidthChanged()
124
+ {
125
+ if (WidthHasChanged())
126
+ {
127
+ ForceUpdateWidth();
128
+
129
+ CalculateElapsedSeconds();
130
+ }
131
+ }
132
+
133
+ /// <summary>
134
+ ///
135
+ /// </summary>
136
+ /// <returns></returns>
137
+ protected virtual bool WidthHasChanged() => Mathf.Abs(tmp.rectTransform.rect.width - currentWidth) > 0.1f;
138
+
139
+ /// <summary>
140
+ ///
141
+ /// </summary>
142
+ protected virtual void CalculateElapsedSeconds()
143
+ {
144
+ float currentX = marqueeTransform.localPosition.x;
145
+
146
+ float totalDistance = startX - ScrollEndXPosition();
147
+
148
+ float remainingDistance = currentX - ScrollEndXPosition();
149
+
150
+ float progress = 1f - (remainingDistance / totalDistance);
151
+
152
+ elapsedSeconds = progress * scrollDuration;
153
+ }
154
+
155
+ /// <summary>
156
+ ///
157
+ /// </summary>
158
+ /// <returns></returns>
159
+ protected virtual float ScrollEndXPosition() => parentMask.rect.xMin - tmp.rectTransform.rect.width;
160
+
161
+ /// <summary>
162
+ ///
163
+ /// </summary>
164
+ protected virtual void TickElapsed() => elapsedSeconds += Time.deltaTime;
165
+
166
+ /// <summary>
167
+ ///
168
+ /// </summary>
169
+ protected virtual void UpdatePosition()
170
+ {
171
+ float interpolationPercentage = Mathf.Clamp01(elapsedSeconds / scrollDuration);
172
+
173
+ float calculatedX = Mathf.Lerp(startX, ScrollEndXPosition(), interpolationPercentage);
174
+
175
+ marqueeTransform.localPosition = new Vector3(calculatedX, 0, 0);
176
+ }
177
+ }
178
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 78221e5b1a4c50a44ac3a897b2e6d4a9
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,104 @@
1
+ //OG Author: KHeartz. My Magic Man
2
+ //Edited Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
3
+ using System.Collections;
4
+ using TMPro;
5
+ using UnityEngine;
6
+
7
+ namespace DREditor.TextDisplaying
8
+ {
9
+ /// <summary>
10
+ ///
11
+ /// </summary>
12
+ [RequireComponent(typeof(RectTransform))]
13
+ public abstract class TMPMarqueeBase : MonoBehaviour
14
+ {
15
+ /// <summary>
16
+ ///
17
+ /// </summary>
18
+ [Tooltip("")]
19
+ [SerializeField] protected TextMeshProUGUI tmp = null;
20
+
21
+
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ protected RectTransform parentMask;
26
+
27
+ /// <summary>
28
+ ///
29
+ /// </summary>
30
+ protected RectTransform marqueeTransform;
31
+
32
+ /// <summary>
33
+ ///
34
+ /// </summary>
35
+ protected Coroutine activeMarqueeRoutine;
36
+
37
+
38
+ protected virtual void Awake()
39
+ {
40
+ marqueeTransform = GetComponent<RectTransform>();
41
+
42
+ parentMask = transform.parent.GetComponent<RectTransform>();
43
+ }
44
+
45
+ protected virtual void OnDisable()
46
+ {
47
+ if (activeMarqueeRoutine != null)
48
+ StopCoroutine(activeMarqueeRoutine);
49
+ }
50
+
51
+ protected virtual void Start() => StartCoroutine(InitialDelay());
52
+
53
+ /// <summary>
54
+ ///
55
+ /// </summary>
56
+ protected virtual IEnumerator InitialDelay()
57
+ {
58
+ yield return null;
59
+
60
+ yield return null;
61
+
62
+ yield return null;
63
+
64
+ Initialize();
65
+
66
+ StartMarqueeLoop();
67
+ }
68
+
69
+ /// <summary>
70
+ ///
71
+ /// </summary>
72
+ protected abstract void Initialize();
73
+
74
+
75
+ /// <summary>
76
+ ///
77
+ /// </summary>
78
+ protected virtual void StartMarqueeLoop()
79
+ {
80
+ StopAlreadyActiveLoop();
81
+
82
+ StartMarqueeRoutine();
83
+ }
84
+
85
+ /// <summary>
86
+ ///
87
+ /// </summary>
88
+ protected virtual void StopAlreadyActiveLoop()
89
+ {
90
+ if (activeMarqueeRoutine != null)
91
+ StopCoroutine(activeMarqueeRoutine);
92
+ }
93
+
94
+ /// <summary>
95
+ ///
96
+ /// </summary>
97
+ protected virtual void StartMarqueeRoutine() => activeMarqueeRoutine = StartCoroutine(MarqueeRoutine());
98
+
99
+ /// <summary>
100
+ ///
101
+ /// </summary>
102
+ protected abstract IEnumerator MarqueeRoutine();
103
+ }
104
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 58f3e0291a24cbf4aa1d4ddb7acfe1cd