net.dreditor.textdisplaying 0.1.6 → 0.1.8
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.
- package/.attestation.p7m +0 -0
- package/CGLineTextDisplayer.cs +12 -12
- package/CGLineTextDisplayer.cs.meta +11 -11
- package/ClearTextOnLineEnd.cs +17 -17
- package/ClearTextOnLineEnd.cs.meta +11 -11
- package/ColorByCharacterTextModifier.cs +45 -45
- package/ColorByCharacterTextModifier.cs.meta +11 -11
- package/DREditor.TextDisplaying.asmdef +19 -19
- package/DREditor.TextDisplaying.asmdef.meta +7 -7
- package/DialogueLineTextDisplayer.cs +187 -187
- package/DialogueLineTextDisplayer.cs.meta +11 -11
- package/DisplayFormattedString.cs +68 -68
- package/DisplayFormattedString.cs.meta +1 -1
- package/DisplayOwnedIntCurrency.cs +56 -56
- package/DisplayOwnedIntCurrency.cs.meta +1 -1
- package/HighlightTextModifier.cs +70 -70
- package/HighlightTextModifier.cs.meta +11 -11
- package/ITextDisplayerHandler.cs +22 -22
- package/ITextDisplayerHandler.cs.meta +11 -11
- package/OptionsTextMessage.cs +53 -53
- package/OptionsTextMessage.cs.meta +11 -11
- package/OptionsTextSpeedMessage.cs +82 -82
- package/OptionsTextSpeedMessage.cs.meta +11 -11
- package/RegexEscapeModifier.cs +43 -43
- package/RegexEscapeModifier.cs.meta +11 -11
- package/ReplaceGroup.cs +33 -33
- package/ReplaceGroup.cs.meta +11 -11
- package/ReplaceTextModifier.cs +53 -53
- package/ReplaceTextModifier.cs.meta +11 -11
- package/ReplaceTextModifierBase.cs +18 -18
- package/ReplaceTextModifierBase.cs.meta +11 -11
- package/{Samples → Samples~}/CGDialogueUIVisible.asset +21 -21
- package/{Samples → Samples~}/CGDialogueUIVisible.asset.meta +8 -8
- package/{Samples → Samples~}/CGTextBox.asset +21 -21
- package/{Samples → Samples~}/CGTextBox.asset.meta +8 -8
- package/{Samples → Samples~}/CG_Line_Text_Displayer.prefab +147 -147
- package/{Samples → Samples~}/CG_Line_Text_Displayer.prefab.meta +7 -7
- package/{Samples → Samples~}/Clear_Text_On_Line_End.prefab +46 -46
- package/{Samples → Samples~}/Clear_Text_On_Line_End.prefab.meta +7 -7
- package/{Samples → Samples~}/Color_By_Character_Text_Modifier.prefab +51 -51
- package/{Samples → Samples~}/Color_By_Character_Text_Modifier.prefab.meta +7 -7
- package/{Samples → Samples~}/DRE_TextDebugging.unity +492 -492
- package/{Samples → Samples~}/DRE_TextDebugging.unity.meta +7 -7
- package/{Samples → Samples~}/DialogueTextBox.asset +21 -21
- package/{Samples → Samples~}/DialogueTextBox.asset.meta +8 -8
- package/{Samples → Samples~}/Dialogue_Line_Text_Displayer.prefab +142 -142
- package/{Samples → Samples~}/Dialogue_Line_Text_Displayer.prefab.meta +7 -7
- package/{Samples → Samples~}/Highlight_Text_Modifier.prefab +49 -49
- package/{Samples → Samples~}/Highlight_Text_Modifier.prefab.meta +7 -7
- package/{Samples → Samples~}/Option_Message_UI_ETemplate.prefab +335 -335
- package/{Samples → Samples~}/Option_Message_UI_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/OptionsUITextSpeedMessage.asset +21 -21
- package/{Samples → Samples~}/OptionsUITextSpeedMessage.asset.meta +8 -8
- package/{Samples → Samples~}/Regex_Escape_Modifier.prefab +47 -47
- package/{Samples → Samples~}/Regex_Escape_Modifier.prefab.meta +7 -7
- package/{Samples → Samples~}/Replace_Text_Modifier.prefab +49 -49
- package/{Samples → Samples~}/Replace_Text_Modifier.prefab.meta +7 -7
- package/{Samples → Samples~}/Symbol_Color_Text_Modifier.prefab +50 -50
- package/{Samples → Samples~}/Symbol_Color_Text_Modifier.prefab.meta +7 -7
- package/{Samples → Samples~}/Symbol_Protag_UI_Modifier.prefab +48 -48
- package/{Samples → Samples~}/Symbol_Protag_UI_Modifier.prefab.meta +7 -7
- package/{Samples → Samples~}/Text_Display_Debugger.prefab +467 -467
- package/{Samples → Samples~}/Text_Display_Debugger.prefab.meta +7 -7
- package/{Samples → Samples~}/Text_Displayer.prefab +624 -624
- package/{Samples → Samples~}/Text_Displayer.prefab.meta +7 -7
- package/{Samples → Samples~}/TrialDialogueTextBox.asset +21 -21
- package/{Samples → Samples~}/TrialDialogueTextBox.asset.meta +8 -8
- package/{Samples → Samples~}/Trial_Dialogue_Line_Text_Displayer.prefab +82 -82
- package/{Samples → Samples~}/Trial_Dialogue_Line_Text_Displayer.prefab.meta +7 -7
- package/SetTextDisplaySpeed.cs +59 -59
- package/SetTextDisplaySpeed.cs.meta +11 -11
- package/SymbolColorTextModifier.cs +24 -24
- package/SymbolColorTextModifier.cs.meta +11 -11
- package/SymbolProtagUIModifier.cs +41 -41
- package/SymbolProtagUIModifier.cs.meta +11 -11
- package/SymbolTextModifier.cs +47 -47
- package/SymbolTextModifier.cs.meta +11 -11
- package/TMPMarquee.cs +177 -177
- package/TMPMarquee.cs.meta +11 -11
- package/TMPMarqueeBase.cs +103 -103
- package/TMPMarqueeBase.cs.meta +1 -1
- package/TextDisplayDebugger.cs +86 -86
- package/TextDisplayDebugger.cs.meta +11 -11
- package/TextDisplayModifier.cs +28 -28
- package/TextDisplayModifier.cs.meta +11 -11
- package/TextDisplayer.cs +254 -254
- package/TextDisplayer.cs.meta +11 -11
- package/TextDisplayerBase.cs +106 -106
- package/TextDisplayerBase.cs.meta +11 -11
- package/package.json +42 -37
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 80ebbfee83d738742b144efe2750262f
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 80ebbfee83d738742b144efe2750262f
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using TMPro;
|
|
3
|
-
using UnityEngine;
|
|
4
|
-
|
|
5
|
-
namespace DREditor.TextDisplaying
|
|
6
|
-
{
|
|
7
|
-
/// <summary>
|
|
8
|
-
///
|
|
9
|
-
/// </summary>
|
|
10
|
-
public abstract class DisplayFormattedString : MonoBehaviour
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
[Header("")]
|
|
16
|
-
[Space]
|
|
17
|
-
[Tooltip("")]
|
|
18
|
-
[SerializeField] protected TMP_Text display;
|
|
19
|
-
|
|
20
|
-
/// <summary>
|
|
21
|
-
///
|
|
22
|
-
/// </summary>
|
|
23
|
-
[Tooltip("")]
|
|
24
|
-
[SerializeField] protected string prefix = "x";
|
|
25
|
-
|
|
26
|
-
/// <summary>
|
|
27
|
-
///
|
|
28
|
-
/// </summary>
|
|
29
|
-
[Tooltip("")]
|
|
30
|
-
[SerializeField] protected string format = "{0:000}";
|
|
31
|
-
|
|
32
|
-
/// <summary>
|
|
33
|
-
///
|
|
34
|
-
/// </summary>
|
|
35
|
-
[Tooltip("")]
|
|
36
|
-
[SerializeField] protected string suffix = "";
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
protected virtual void Awake()
|
|
40
|
-
{
|
|
41
|
-
if (display == null)
|
|
42
|
-
UnityEngine.Debug.LogError($"ALERT: The {nameof(display)} field must be assigned to!");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/// <summary>
|
|
47
|
-
///
|
|
48
|
-
/// </summary>
|
|
49
|
-
public virtual void Display() => display.SetText(CreateDisplayString());
|
|
50
|
-
|
|
51
|
-
/// <summary>
|
|
52
|
-
///
|
|
53
|
-
/// </summary>
|
|
54
|
-
/// <returns></returns>
|
|
55
|
-
protected virtual string CreateDisplayString() => prefix + CreateFormattedString() + suffix;
|
|
56
|
-
|
|
57
|
-
/// <summary>
|
|
58
|
-
///
|
|
59
|
-
/// </summary>
|
|
60
|
-
/// <returns></returns>
|
|
61
|
-
protected virtual string CreateFormattedString() => string.Format(format, GetObjectToBeFormatted());
|
|
62
|
-
|
|
63
|
-
/// <summary>
|
|
64
|
-
///
|
|
65
|
-
/// </summary>
|
|
66
|
-
/// <returns></returns>
|
|
67
|
-
protected abstract object GetObjectToBeFormatted();
|
|
68
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using TMPro;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace DREditor.TextDisplaying
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
///
|
|
9
|
+
/// </summary>
|
|
10
|
+
public abstract class DisplayFormattedString : MonoBehaviour
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[Header("")]
|
|
16
|
+
[Space]
|
|
17
|
+
[Tooltip("")]
|
|
18
|
+
[SerializeField] protected TMP_Text display;
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected string prefix = "x";
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
[Tooltip("")]
|
|
30
|
+
[SerializeField] protected string format = "{0:000}";
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
[Tooltip("")]
|
|
36
|
+
[SerializeField] protected string suffix = "";
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
protected virtual void Awake()
|
|
40
|
+
{
|
|
41
|
+
if (display == null)
|
|
42
|
+
UnityEngine.Debug.LogError($"ALERT: The {nameof(display)} field must be assigned to!");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
///
|
|
48
|
+
/// </summary>
|
|
49
|
+
public virtual void Display() => display.SetText(CreateDisplayString());
|
|
50
|
+
|
|
51
|
+
/// <summary>
|
|
52
|
+
///
|
|
53
|
+
/// </summary>
|
|
54
|
+
/// <returns></returns>
|
|
55
|
+
protected virtual string CreateDisplayString() => prefix + CreateFormattedString() + suffix;
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
///
|
|
59
|
+
/// </summary>
|
|
60
|
+
/// <returns></returns>
|
|
61
|
+
protected virtual string CreateFormattedString() => string.Format(format, GetObjectToBeFormatted());
|
|
62
|
+
|
|
63
|
+
/// <summary>
|
|
64
|
+
///
|
|
65
|
+
/// </summary>
|
|
66
|
+
/// <returns></returns>
|
|
67
|
+
protected abstract object GetObjectToBeFormatted();
|
|
68
|
+
}
|
|
69
69
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
1
|
+
fileFormatVersion: 2
|
|
2
2
|
guid: fa600db7f523048429f25592f07c7b26
|
|
@@ -1,57 +1,57 @@
|
|
|
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
|
-
[ClassHeader(nameof(DisplayFormattedString) +
|
|
11
|
-
"\n\n")]
|
|
12
|
-
public class DisplayOwnedIntCurrency : DisplayFormattedString
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
[Header("")]
|
|
18
|
-
[Divider]
|
|
19
|
-
[Tooltip("")]
|
|
20
|
-
[SerializeField] protected IntWithEvent currency = null;
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
[Tooltip("")]
|
|
26
|
-
[SerializeField] protected IntWithEvent paidAmount = null;
|
|
27
|
-
|
|
28
|
-
/// <summary>
|
|
29
|
-
///
|
|
30
|
-
/// </summary>
|
|
31
|
-
[Tooltip("")]
|
|
32
|
-
[SerializeField] protected bool neverNegative = true;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/// <summary>
|
|
36
|
-
///
|
|
37
|
-
/// </summary>
|
|
38
|
-
protected readonly int Zero = 0;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/// <inheritdoc/>
|
|
42
|
-
protected override object GetObjectToBeFormatted() => ResultIsInBounds() ? RemovedFromCurrency() : Zero;
|
|
43
|
-
|
|
44
|
-
/// <summary>
|
|
45
|
-
///
|
|
46
|
-
/// </summary>
|
|
47
|
-
/// <returns></returns>
|
|
48
|
-
protected virtual bool ResultIsInBounds() => !neverNegative || paidAmount.Value <= currency.Value;
|
|
49
|
-
|
|
50
|
-
/// <summary>
|
|
51
|
-
///
|
|
52
|
-
/// </summary>
|
|
53
|
-
/// <returns></returns>
|
|
54
|
-
protected virtual float RemovedFromCurrency() => currency.Value - paidAmount.Value;
|
|
55
|
-
|
|
56
|
-
}
|
|
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
|
+
[ClassHeader(nameof(DisplayFormattedString) +
|
|
11
|
+
"\n\n")]
|
|
12
|
+
public class DisplayOwnedIntCurrency : DisplayFormattedString
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Header("")]
|
|
18
|
+
[Divider]
|
|
19
|
+
[Tooltip("")]
|
|
20
|
+
[SerializeField] protected IntWithEvent currency = null;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected IntWithEvent paidAmount = null;
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
///
|
|
30
|
+
/// </summary>
|
|
31
|
+
[Tooltip("")]
|
|
32
|
+
[SerializeField] protected bool neverNegative = true;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
protected readonly int Zero = 0;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/// <inheritdoc/>
|
|
42
|
+
protected override object GetObjectToBeFormatted() => ResultIsInBounds() ? RemovedFromCurrency() : Zero;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
///
|
|
46
|
+
/// </summary>
|
|
47
|
+
/// <returns></returns>
|
|
48
|
+
protected virtual bool ResultIsInBounds() => !neverNegative || paidAmount.Value <= currency.Value;
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
/// <returns></returns>
|
|
54
|
+
protected virtual float RemovedFromCurrency() => currency.Value - paidAmount.Value;
|
|
55
|
+
|
|
56
|
+
}
|
|
57
57
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
1
|
+
fileFormatVersion: 2
|
|
2
2
|
guid: ee3553ffb29dec64a90c5e4e9bf355af
|
package/HighlightTextModifier.cs
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Dialogues;
|
|
3
|
-
using System.Linq;
|
|
4
|
-
using System.Text.RegularExpressions;
|
|
5
|
-
using TMPro;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.TextDisplaying
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
[ClassHeader(nameof(TextDisplayModifier) +
|
|
14
|
-
"\n\n")]
|
|
15
|
-
public class HighlightTextModifier : TextDisplayModifier
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
///
|
|
19
|
-
/// </summary>
|
|
20
|
-
[Tooltip("")]
|
|
21
|
-
[SerializeField] protected char encapsulateSymbol = '@';
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
///
|
|
25
|
-
/// </summary>
|
|
26
|
-
[Tooltip("")]
|
|
27
|
-
[SerializeField] protected string highlightTextStartTag = "<gradient=\"HitText\">";
|
|
28
|
-
|
|
29
|
-
/// <summary>
|
|
30
|
-
///
|
|
31
|
-
/// </summary>
|
|
32
|
-
[Tooltip("")]
|
|
33
|
-
[SerializeField] protected string highlightTextEndTag = "</gradient>";
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/// <inheritdoc/>
|
|
37
|
-
public override string ApplyModification(string text, Line currentLine = null, TMP_Text box = null)
|
|
38
|
-
=> HighlightPair(text, text.Count(x => x == encapsulateSymbol));
|
|
39
|
-
|
|
40
|
-
/// <summary>
|
|
41
|
-
///
|
|
42
|
-
/// </summary>
|
|
43
|
-
/// <param name="text"></param>
|
|
44
|
-
/// <param name="totalSymbolCount"></param>
|
|
45
|
-
/// <returns></returns>
|
|
46
|
-
protected virtual string HighlightPair(string text, int totalSymbolCount)
|
|
47
|
-
{
|
|
48
|
-
// Apply the highlighted color to the text using HTML tags
|
|
49
|
-
for (int i = 0; i < totalSymbolCount; i++)
|
|
50
|
-
text = TextColorInator(text, !(i % 2 == 0));
|
|
51
|
-
|
|
52
|
-
return text;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/// <summary>
|
|
56
|
-
///
|
|
57
|
-
/// </summary>
|
|
58
|
-
/// <param name="text"></param>
|
|
59
|
-
/// <param name="isEndEncapsulationSymbol"></param>
|
|
60
|
-
/// <returns></returns>
|
|
61
|
-
/// <remarks></remarks>
|
|
62
|
-
protected virtual string TextColorInator(string text, bool isEndEncapsulationSymbol)
|
|
63
|
-
{
|
|
64
|
-
var regex = new Regex(Regex.Escape(encapsulateSymbol.ToString()));
|
|
65
|
-
|
|
66
|
-
string tagReplaceString = !isEndEncapsulationSymbol ? highlightTextStartTag : highlightTextEndTag;
|
|
67
|
-
|
|
68
|
-
return regex.Replace(text, tagReplaceString, 1);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using System.Linq;
|
|
4
|
+
using System.Text.RegularExpressions;
|
|
5
|
+
using TMPro;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.TextDisplaying
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[ClassHeader(nameof(TextDisplayModifier) +
|
|
14
|
+
"\n\n")]
|
|
15
|
+
public class HighlightTextModifier : TextDisplayModifier
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[Tooltip("")]
|
|
21
|
+
[SerializeField] protected char encapsulateSymbol = '@';
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
///
|
|
25
|
+
/// </summary>
|
|
26
|
+
[Tooltip("")]
|
|
27
|
+
[SerializeField] protected string highlightTextStartTag = "<gradient=\"HitText\">";
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
[Tooltip("")]
|
|
33
|
+
[SerializeField] protected string highlightTextEndTag = "</gradient>";
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/// <inheritdoc/>
|
|
37
|
+
public override string ApplyModification(string text, Line currentLine = null, TMP_Text box = null)
|
|
38
|
+
=> HighlightPair(text, text.Count(x => x == encapsulateSymbol));
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
///
|
|
42
|
+
/// </summary>
|
|
43
|
+
/// <param name="text"></param>
|
|
44
|
+
/// <param name="totalSymbolCount"></param>
|
|
45
|
+
/// <returns></returns>
|
|
46
|
+
protected virtual string HighlightPair(string text, int totalSymbolCount)
|
|
47
|
+
{
|
|
48
|
+
// Apply the highlighted color to the text using HTML tags
|
|
49
|
+
for (int i = 0; i < totalSymbolCount; i++)
|
|
50
|
+
text = TextColorInator(text, !(i % 2 == 0));
|
|
51
|
+
|
|
52
|
+
return text;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// <summary>
|
|
56
|
+
///
|
|
57
|
+
/// </summary>
|
|
58
|
+
/// <param name="text"></param>
|
|
59
|
+
/// <param name="isEndEncapsulationSymbol"></param>
|
|
60
|
+
/// <returns></returns>
|
|
61
|
+
/// <remarks></remarks>
|
|
62
|
+
protected virtual string TextColorInator(string text, bool isEndEncapsulationSymbol)
|
|
63
|
+
{
|
|
64
|
+
var regex = new Regex(Regex.Escape(encapsulateSymbol.ToString()));
|
|
65
|
+
|
|
66
|
+
string tagReplaceString = !isEndEncapsulationSymbol ? highlightTextStartTag : highlightTextEndTag;
|
|
67
|
+
|
|
68
|
+
return regex.Replace(text, tagReplaceString, 1);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
71
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 01c131ddf9d18854295107a7b31f06aa
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 01c131ddf9d18854295107a7b31f06aa
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/ITextDisplayerHandler.cs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using TMPro;
|
|
3
|
-
|
|
4
|
-
namespace DREditor.TextDisplaying
|
|
5
|
-
{
|
|
6
|
-
/// <summary>
|
|
7
|
-
///
|
|
8
|
-
/// </summary>
|
|
9
|
-
/// <remarks></remarks>
|
|
10
|
-
public interface ITextDisplayerHandler
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
/// <returns></returns>
|
|
16
|
-
TMP_Text GetTextBox();
|
|
17
|
-
|
|
18
|
-
/// <summary>
|
|
19
|
-
///
|
|
20
|
-
/// </summary>
|
|
21
|
-
void ClearText();
|
|
22
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using TMPro;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.TextDisplaying
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
/// <remarks></remarks>
|
|
10
|
+
public interface ITextDisplayerHandler
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
/// <returns></returns>
|
|
16
|
+
TMP_Text GetTextBox();
|
|
17
|
+
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
void ClearText();
|
|
22
|
+
}
|
|
23
23
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: c78501e66bf6c3f4d86b0244ef9b4a7a
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: c78501e66bf6c3f4d86b0244ef9b4a7a
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/OptionsTextMessage.cs
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.EventObjects;
|
|
3
|
-
using TMPro;
|
|
4
|
-
using UnityEngine;
|
|
5
|
-
|
|
6
|
-
namespace DREditor.TextDisplaying
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
///
|
|
10
|
-
/// </summary>
|
|
11
|
-
[ClassHeader("")]
|
|
12
|
-
public class OptionsTextMessage : MonoBehaviour
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
[Tooltip("")]
|
|
18
|
-
[SerializeField] protected StringWithEvent optionsUIMessage = null;
|
|
19
|
-
|
|
20
|
-
/// <summary>
|
|
21
|
-
///
|
|
22
|
-
/// </summary>
|
|
23
|
-
[Tooltip("")]
|
|
24
|
-
[SerializeField] protected TextMeshProUGUI box = null;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/// <summary>
|
|
28
|
-
///
|
|
29
|
-
/// </summary>
|
|
30
|
-
protected virtual void OnEnable() => optionsUIMessage.AddListener(PlayMessage);
|
|
31
|
-
|
|
32
|
-
/// <summary>
|
|
33
|
-
///
|
|
34
|
-
/// </summary>
|
|
35
|
-
protected virtual void OnDisable() => optionsUIMessage.RemoveListener(PlayMessage);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/// <summary>
|
|
39
|
-
///
|
|
40
|
-
/// </summary>
|
|
41
|
-
/// <param name="message"></param>
|
|
42
|
-
public virtual void PlayMessage(string message)
|
|
43
|
-
{
|
|
44
|
-
ClearBox();
|
|
45
|
-
|
|
46
|
-
box.text = message;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/// <summary>
|
|
50
|
-
///
|
|
51
|
-
/// </summary>
|
|
52
|
-
protected virtual void ClearBox() => box.text = "";
|
|
53
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using TMPro;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.TextDisplaying
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[ClassHeader("")]
|
|
12
|
+
public class OptionsTextMessage : MonoBehaviour
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Tooltip("")]
|
|
18
|
+
[SerializeField] protected StringWithEvent optionsUIMessage = null;
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected TextMeshProUGUI box = null;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
protected virtual void OnEnable() => optionsUIMessage.AddListener(PlayMessage);
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
protected virtual void OnDisable() => optionsUIMessage.RemoveListener(PlayMessage);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
///
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <param name="message"></param>
|
|
42
|
+
public virtual void PlayMessage(string message)
|
|
43
|
+
{
|
|
44
|
+
ClearBox();
|
|
45
|
+
|
|
46
|
+
box.text = message;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
///
|
|
51
|
+
/// </summary>
|
|
52
|
+
protected virtual void ClearBox() => box.text = "";
|
|
53
|
+
}
|
|
54
54
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: ae378698f532cdf4e98c664bc41fd6f8
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: ae378698f532cdf4e98c664bc41fd6f8
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|