net.dreditor.textdisplaying 0.1.6 → 0.1.7
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
package/.attestation.p7m
ADDED
|
Binary file
|
package/CGLineTextDisplayer.cs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
|
|
3
|
-
namespace DREditor.TextDisplaying
|
|
4
|
-
{
|
|
5
|
-
/// <summary>
|
|
6
|
-
///
|
|
7
|
-
/// </summary>
|
|
8
|
-
public class CGLineTextDisplayer : DialogueLineTextDisplayer
|
|
9
|
-
{
|
|
10
|
-
/// <inheritdoc/>
|
|
11
|
-
protected override bool SkipDisplayingText() => !inCGMode.Value && !inVideoMode.Value;
|
|
12
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
|
|
3
|
+
namespace DREditor.TextDisplaying
|
|
4
|
+
{
|
|
5
|
+
/// <summary>
|
|
6
|
+
///
|
|
7
|
+
/// </summary>
|
|
8
|
+
public class CGLineTextDisplayer : DialogueLineTextDisplayer
|
|
9
|
+
{
|
|
10
|
+
/// <inheritdoc/>
|
|
11
|
+
protected override bool SkipDisplayingText() => !inCGMode.Value && !inVideoMode.Value;
|
|
12
|
+
}
|
|
13
13
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: f0b16ba019dce2e46a13fce9db988961
|
|
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: f0b16ba019dce2e46a13fce9db988961
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/ClearTextOnLineEnd.cs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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.Services;
|
|
5
|
-
|
|
6
|
-
namespace DREditor.TextDisplaying
|
|
7
|
-
{
|
|
8
|
-
/// <summary>
|
|
9
|
-
///
|
|
10
|
-
/// </summary>
|
|
11
|
-
[ClassHeader(nameof(DialogueComponent) + ", " + nameof(ILineEndProcess) +
|
|
12
|
-
"\n\n")]
|
|
13
|
-
public class ClearTextOnLineEnd : DialogueComponent, ILineEndProcess
|
|
14
|
-
{
|
|
15
|
-
/// <inheritdoc/>
|
|
16
|
-
public virtual void LineEndProcess(Line currentLine = null) => ServiceLocator.GetService<ITextDisplayerHandler>().ClearText();
|
|
17
|
-
}
|
|
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.Services;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.TextDisplaying
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[ClassHeader(nameof(DialogueComponent) + ", " + nameof(ILineEndProcess) +
|
|
12
|
+
"\n\n")]
|
|
13
|
+
public class ClearTextOnLineEnd : DialogueComponent, ILineEndProcess
|
|
14
|
+
{
|
|
15
|
+
/// <inheritdoc/>
|
|
16
|
+
public virtual void LineEndProcess(Line currentLine = null) => ServiceLocator.GetService<ITextDisplayerHandler>().ClearText();
|
|
17
|
+
}
|
|
18
18
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 3b9a2ecb3029c2041abab728dee34de5
|
|
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: 3b9a2ecb3029c2041abab728dee34de5
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,46 +1,46 @@
|
|
|
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(TextDisplayModifier) +
|
|
12
|
-
"\n\n")]
|
|
13
|
-
public class ColorByCharacterTextModifier : TextDisplayModifier
|
|
14
|
-
{
|
|
15
|
-
/// <summary>
|
|
16
|
-
///
|
|
17
|
-
/// </summary>
|
|
18
|
-
[Tooltip("")]
|
|
19
|
-
[SerializeField] protected string characterFirstName = "Tutorial";
|
|
20
|
-
|
|
21
|
-
/// <summary>
|
|
22
|
-
///
|
|
23
|
-
/// </summary>
|
|
24
|
-
[Tooltip("")]
|
|
25
|
-
[SerializeField] protected Color characterTextColor = new(0.27776733f, 0.735849023f, 0.136525407f, 255);
|
|
26
|
-
|
|
27
|
-
/// <summary>
|
|
28
|
-
///
|
|
29
|
-
/// </summary>
|
|
30
|
-
[Tooltip("")]
|
|
31
|
-
[SerializeField] protected Color32 normalColor = new(255, 255, 255, 255);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/// <summary>
|
|
35
|
-
///
|
|
36
|
-
/// </summary>
|
|
37
|
-
public override string ApplyModification(string text, Line currentLine = null, TMP_Text box = null)
|
|
38
|
-
{
|
|
39
|
-
bool useTutorialColor = currentLine.Speaker != null && currentLine.Speaker.FirstName.Equals(characterFirstName);
|
|
40
|
-
|
|
41
|
-
box.color = useTutorialColor ? characterTextColor : normalColor;
|
|
42
|
-
|
|
43
|
-
return text;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
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(TextDisplayModifier) +
|
|
12
|
+
"\n\n")]
|
|
13
|
+
public class ColorByCharacterTextModifier : TextDisplayModifier
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[Tooltip("")]
|
|
19
|
+
[SerializeField] protected string characterFirstName = "Tutorial";
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
[Tooltip("")]
|
|
25
|
+
[SerializeField] protected Color characterTextColor = new(0.27776733f, 0.735849023f, 0.136525407f, 255);
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
[Tooltip("")]
|
|
31
|
+
[SerializeField] protected Color32 normalColor = new(255, 255, 255, 255);
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/// <summary>
|
|
35
|
+
///
|
|
36
|
+
/// </summary>
|
|
37
|
+
public override string ApplyModification(string text, Line currentLine = null, TMP_Text box = null)
|
|
38
|
+
{
|
|
39
|
+
bool useTutorialColor = currentLine.Speaker != null && currentLine.Speaker.FirstName.Equals(characterFirstName);
|
|
40
|
+
|
|
41
|
+
box.color = useTutorialColor ? characterTextColor : normalColor;
|
|
42
|
+
|
|
43
|
+
return text;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
46
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 92963a5625e59324eb163635347b713d
|
|
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: 92963a5625e59324eb163635347b713d
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "DREditor.TextDisplaying",
|
|
3
|
-
"rootNamespace": "",
|
|
4
|
-
"references": [
|
|
5
|
-
"Unity.InputSystem",
|
|
6
|
-
"Unity.TextMeshPro",
|
|
7
|
-
"DREditor",
|
|
8
|
-
"DREditor.Input",
|
|
9
|
-
"DREditor.Controls"
|
|
10
|
-
],
|
|
11
|
-
"includePlatforms": [],
|
|
12
|
-
"excludePlatforms": [],
|
|
13
|
-
"allowUnsafeCode": false,
|
|
14
|
-
"overrideReferences": false,
|
|
15
|
-
"precompiledReferences": [],
|
|
16
|
-
"autoReferenced": true,
|
|
17
|
-
"defineConstraints": [],
|
|
18
|
-
"versionDefines": [],
|
|
19
|
-
"noEngineReferences": false
|
|
1
|
+
{
|
|
2
|
+
"name": "DREditor.TextDisplaying",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"Unity.InputSystem",
|
|
6
|
+
"Unity.TextMeshPro",
|
|
7
|
+
"DREditor",
|
|
8
|
+
"DREditor.Input",
|
|
9
|
+
"DREditor.Controls"
|
|
10
|
+
],
|
|
11
|
+
"includePlatforms": [],
|
|
12
|
+
"excludePlatforms": [],
|
|
13
|
+
"allowUnsafeCode": false,
|
|
14
|
+
"overrideReferences": false,
|
|
15
|
+
"precompiledReferences": [],
|
|
16
|
+
"autoReferenced": true,
|
|
17
|
+
"defineConstraints": [],
|
|
18
|
+
"versionDefines": [],
|
|
19
|
+
"noEngineReferences": false
|
|
20
20
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 216ecc2b0f7cee245becf1dd09a18743
|
|
3
|
-
AssemblyDefinitionImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 216ecc2b0f7cee245becf1dd09a18743
|
|
3
|
+
AssemblyDefinitionImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
|
@@ -1,188 +1,188 @@
|
|
|
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 DREditor.Services;
|
|
6
|
-
using System.Collections;
|
|
7
|
-
using TMPro;
|
|
8
|
-
using UnityEngine;
|
|
9
|
-
|
|
10
|
-
namespace DREditor.TextDisplaying
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
[ClassHeader(nameof(DialogueComponent) + ", " + nameof(ITextDisplayerHandler) + ", " + nameof(ILineTextDisplayRoutine) +
|
|
16
|
-
"\n\n")]
|
|
17
|
-
public class DialogueLineTextDisplayer : DialogueComponent, ITextDisplayerHandler, ILineTextDisplayRoutine
|
|
18
|
-
{
|
|
19
|
-
/// <summary>
|
|
20
|
-
///
|
|
21
|
-
/// </summary>
|
|
22
|
-
[Tooltip("")]
|
|
23
|
-
[SerializeField] protected TextDisplayerBase TextDisplayer = null;
|
|
24
|
-
|
|
25
|
-
/// <summary>
|
|
26
|
-
///
|
|
27
|
-
/// </summary>
|
|
28
|
-
[Tooltip("")]
|
|
29
|
-
[SerializeField] protected TextMeshProUGUI dialogueBox = null;
|
|
30
|
-
|
|
31
|
-
/// <summary>
|
|
32
|
-
///
|
|
33
|
-
/// </summary>
|
|
34
|
-
[Tooltip("")]
|
|
35
|
-
[SerializeField] protected GameObjectWithEvent globalBox = null;
|
|
36
|
-
|
|
37
|
-
/// <summary>
|
|
38
|
-
///
|
|
39
|
-
/// </summary>
|
|
40
|
-
[Tooltip("")]
|
|
41
|
-
[SerializeField] protected BoolWithEvent inTrialMode = null;
|
|
42
|
-
|
|
43
|
-
/// <summary>
|
|
44
|
-
///
|
|
45
|
-
/// </summary>
|
|
46
|
-
[Tooltip("")]
|
|
47
|
-
[SerializeField] protected BoolWithEvent inFastForwardMode = null;
|
|
48
|
-
|
|
49
|
-
/// <summary>
|
|
50
|
-
///
|
|
51
|
-
/// </summary>
|
|
52
|
-
[Tooltip("")]
|
|
53
|
-
[SerializeField] protected BoolWithEvent inCGMode = null;
|
|
54
|
-
|
|
55
|
-
/// <summary>
|
|
56
|
-
///
|
|
57
|
-
/// </summary>
|
|
58
|
-
[Tooltip("")]
|
|
59
|
-
[SerializeField] protected BoolWithEvent inVideoMode = null;
|
|
60
|
-
|
|
61
|
-
/// <summary>
|
|
62
|
-
///
|
|
63
|
-
/// </summary>
|
|
64
|
-
[Tooltip("")]
|
|
65
|
-
[SerializeField] protected BoolWithEvent cgDialogueUIVisible = null;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/// <summary>
|
|
69
|
-
///
|
|
70
|
-
/// </summary>
|
|
71
|
-
protected TMP_Text initializedGlobalBox;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
protected virtual void OnEnable()
|
|
75
|
-
{
|
|
76
|
-
if (globalBox != null)
|
|
77
|
-
globalBox.AddListener(OnGlobalBoxUpdated);
|
|
78
|
-
|
|
79
|
-
if (globalBox.Value != null)
|
|
80
|
-
OnGlobalBoxUpdated(globalBox.Value);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
protected virtual void OnDisable()
|
|
84
|
-
{
|
|
85
|
-
if (globalBox != null)
|
|
86
|
-
globalBox.RemoveListener(OnGlobalBoxUpdated);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/// <summary>
|
|
90
|
-
///
|
|
91
|
-
/// </summary>
|
|
92
|
-
/// <param name="globalBox"></param>
|
|
93
|
-
protected virtual void OnGlobalBoxUpdated(GameObject globalBox)
|
|
94
|
-
{
|
|
95
|
-
if (globalBox != null)
|
|
96
|
-
globalBox.TryGetComponent(out initializedGlobalBox);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
/// <inheritdoc/>
|
|
101
|
-
public virtual TMP_Text GetTextBox() => dialogueBox != null ? dialogueBox : initializedGlobalBox;
|
|
102
|
-
|
|
103
|
-
/// <inheritdoc/>
|
|
104
|
-
public virtual void ClearText() => TextDisplayer.ClearText();
|
|
105
|
-
|
|
106
|
-
/// <inheritdoc/>
|
|
107
|
-
public virtual bool ShouldProcess(Line currentLine)
|
|
108
|
-
{
|
|
109
|
-
if (TextDisplayer.ShouldProcess(currentLine))
|
|
110
|
-
return true;
|
|
111
|
-
|
|
112
|
-
bool result = !SkipDisplayingText() && !inFastForwardMode.Value;
|
|
113
|
-
|
|
114
|
-
if (inFastForwardMode.Value && !SkipDisplayingText())
|
|
115
|
-
{
|
|
116
|
-
ForceRegisterActiveService();
|
|
117
|
-
|
|
118
|
-
TextDisplayer.DisplayText(GetTextBox(), currentLine);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/// <inheritdoc/>
|
|
125
|
-
public virtual IEnumerator LineTextDisplay(Line currentLine)
|
|
126
|
-
{
|
|
127
|
-
if (SkipDisplayingText())
|
|
128
|
-
yield break;
|
|
129
|
-
|
|
130
|
-
ForceRegisterActiveService();
|
|
131
|
-
|
|
132
|
-
DisplayTextProcess(currentLine);
|
|
133
|
-
|
|
134
|
-
yield return WaitForTextToFinishDisplaying();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/// <summary>
|
|
138
|
-
///
|
|
139
|
-
/// </summary>
|
|
140
|
-
/// <returns></returns>
|
|
141
|
-
protected virtual bool SkipDisplayingText() => inCGMode.Value || inVideoMode.Value;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/// <summary>
|
|
145
|
-
///
|
|
146
|
-
/// </summary>
|
|
147
|
-
protected virtual void ForceRegisterActiveService()
|
|
148
|
-
{
|
|
149
|
-
if (!ServiceLocator.HasService<ITextDisplayerHandler>())
|
|
150
|
-
ServiceLocator.Register<ITextDisplayerHandler>(this);
|
|
151
|
-
else if (ServiceLocator.GetService<ITextDisplayerHandler>() != (ITextDisplayerHandler)this)
|
|
152
|
-
ReplaceActiveService();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/// <summary>
|
|
156
|
-
///
|
|
157
|
-
/// </summary>
|
|
158
|
-
protected virtual void ReplaceActiveService()
|
|
159
|
-
{
|
|
160
|
-
ServiceLocator.Unregister(ServiceLocator.GetService<ITextDisplayerHandler>());
|
|
161
|
-
|
|
162
|
-
ServiceLocator.Register<ITextDisplayerHandler>(this);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/// <summary>
|
|
166
|
-
///
|
|
167
|
-
/// </summary>
|
|
168
|
-
/// <param name="line"></param>
|
|
169
|
-
protected virtual void DisplayTextProcess(Line line)
|
|
170
|
-
{
|
|
171
|
-
if (!cgDialogueUIVisible.Value && (inCGMode.Value || inVideoMode.Value))
|
|
172
|
-
cgDialogueUIVisible.SetValue(true);
|
|
173
|
-
|
|
174
|
-
TextDisplayer.DisplayText(GetTextBox(), line);
|
|
175
|
-
|
|
176
|
-
TextDisplayer.SetWaitingForClick(true);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/// <summary>
|
|
180
|
-
///
|
|
181
|
-
/// </summary>
|
|
182
|
-
protected virtual IEnumerator WaitForTextToFinishDisplaying()
|
|
183
|
-
{
|
|
184
|
-
while (TextDisplayer.IsWaitingForClick() && !inFastForwardMode.Value)
|
|
185
|
-
yield return null;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
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 DREditor.Services;
|
|
6
|
+
using System.Collections;
|
|
7
|
+
using TMPro;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.TextDisplaying
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[ClassHeader(nameof(DialogueComponent) + ", " + nameof(ITextDisplayerHandler) + ", " + nameof(ILineTextDisplayRoutine) +
|
|
16
|
+
"\n\n")]
|
|
17
|
+
public class DialogueLineTextDisplayer : DialogueComponent, ITextDisplayerHandler, ILineTextDisplayRoutine
|
|
18
|
+
{
|
|
19
|
+
/// <summary>
|
|
20
|
+
///
|
|
21
|
+
/// </summary>
|
|
22
|
+
[Tooltip("")]
|
|
23
|
+
[SerializeField] protected TextDisplayerBase TextDisplayer = null;
|
|
24
|
+
|
|
25
|
+
/// <summary>
|
|
26
|
+
///
|
|
27
|
+
/// </summary>
|
|
28
|
+
[Tooltip("")]
|
|
29
|
+
[SerializeField] protected TextMeshProUGUI dialogueBox = null;
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
///
|
|
33
|
+
/// </summary>
|
|
34
|
+
[Tooltip("")]
|
|
35
|
+
[SerializeField] protected GameObjectWithEvent globalBox = null;
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
///
|
|
39
|
+
/// </summary>
|
|
40
|
+
[Tooltip("")]
|
|
41
|
+
[SerializeField] protected BoolWithEvent inTrialMode = null;
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
///
|
|
45
|
+
/// </summary>
|
|
46
|
+
[Tooltip("")]
|
|
47
|
+
[SerializeField] protected BoolWithEvent inFastForwardMode = null;
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
///
|
|
51
|
+
/// </summary>
|
|
52
|
+
[Tooltip("")]
|
|
53
|
+
[SerializeField] protected BoolWithEvent inCGMode = null;
|
|
54
|
+
|
|
55
|
+
/// <summary>
|
|
56
|
+
///
|
|
57
|
+
/// </summary>
|
|
58
|
+
[Tooltip("")]
|
|
59
|
+
[SerializeField] protected BoolWithEvent inVideoMode = null;
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
///
|
|
63
|
+
/// </summary>
|
|
64
|
+
[Tooltip("")]
|
|
65
|
+
[SerializeField] protected BoolWithEvent cgDialogueUIVisible = null;
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/// <summary>
|
|
69
|
+
///
|
|
70
|
+
/// </summary>
|
|
71
|
+
protected TMP_Text initializedGlobalBox;
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
protected virtual void OnEnable()
|
|
75
|
+
{
|
|
76
|
+
if (globalBox != null)
|
|
77
|
+
globalBox.AddListener(OnGlobalBoxUpdated);
|
|
78
|
+
|
|
79
|
+
if (globalBox.Value != null)
|
|
80
|
+
OnGlobalBoxUpdated(globalBox.Value);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
protected virtual void OnDisable()
|
|
84
|
+
{
|
|
85
|
+
if (globalBox != null)
|
|
86
|
+
globalBox.RemoveListener(OnGlobalBoxUpdated);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/// <summary>
|
|
90
|
+
///
|
|
91
|
+
/// </summary>
|
|
92
|
+
/// <param name="globalBox"></param>
|
|
93
|
+
protected virtual void OnGlobalBoxUpdated(GameObject globalBox)
|
|
94
|
+
{
|
|
95
|
+
if (globalBox != null)
|
|
96
|
+
globalBox.TryGetComponent(out initializedGlobalBox);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
/// <inheritdoc/>
|
|
101
|
+
public virtual TMP_Text GetTextBox() => dialogueBox != null ? dialogueBox : initializedGlobalBox;
|
|
102
|
+
|
|
103
|
+
/// <inheritdoc/>
|
|
104
|
+
public virtual void ClearText() => TextDisplayer.ClearText();
|
|
105
|
+
|
|
106
|
+
/// <inheritdoc/>
|
|
107
|
+
public virtual bool ShouldProcess(Line currentLine)
|
|
108
|
+
{
|
|
109
|
+
if (TextDisplayer.ShouldProcess(currentLine))
|
|
110
|
+
return true;
|
|
111
|
+
|
|
112
|
+
bool result = !SkipDisplayingText() && !inFastForwardMode.Value;
|
|
113
|
+
|
|
114
|
+
if (inFastForwardMode.Value && !SkipDisplayingText())
|
|
115
|
+
{
|
|
116
|
+
ForceRegisterActiveService();
|
|
117
|
+
|
|
118
|
+
TextDisplayer.DisplayText(GetTextBox(), currentLine);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// <inheritdoc/>
|
|
125
|
+
public virtual IEnumerator LineTextDisplay(Line currentLine)
|
|
126
|
+
{
|
|
127
|
+
if (SkipDisplayingText())
|
|
128
|
+
yield break;
|
|
129
|
+
|
|
130
|
+
ForceRegisterActiveService();
|
|
131
|
+
|
|
132
|
+
DisplayTextProcess(currentLine);
|
|
133
|
+
|
|
134
|
+
yield return WaitForTextToFinishDisplaying();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/// <summary>
|
|
138
|
+
///
|
|
139
|
+
/// </summary>
|
|
140
|
+
/// <returns></returns>
|
|
141
|
+
protected virtual bool SkipDisplayingText() => inCGMode.Value || inVideoMode.Value;
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
/// <summary>
|
|
145
|
+
///
|
|
146
|
+
/// </summary>
|
|
147
|
+
protected virtual void ForceRegisterActiveService()
|
|
148
|
+
{
|
|
149
|
+
if (!ServiceLocator.HasService<ITextDisplayerHandler>())
|
|
150
|
+
ServiceLocator.Register<ITextDisplayerHandler>(this);
|
|
151
|
+
else if (ServiceLocator.GetService<ITextDisplayerHandler>() != (ITextDisplayerHandler)this)
|
|
152
|
+
ReplaceActiveService();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/// <summary>
|
|
156
|
+
///
|
|
157
|
+
/// </summary>
|
|
158
|
+
protected virtual void ReplaceActiveService()
|
|
159
|
+
{
|
|
160
|
+
ServiceLocator.Unregister(ServiceLocator.GetService<ITextDisplayerHandler>());
|
|
161
|
+
|
|
162
|
+
ServiceLocator.Register<ITextDisplayerHandler>(this);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/// <summary>
|
|
166
|
+
///
|
|
167
|
+
/// </summary>
|
|
168
|
+
/// <param name="line"></param>
|
|
169
|
+
protected virtual void DisplayTextProcess(Line line)
|
|
170
|
+
{
|
|
171
|
+
if (!cgDialogueUIVisible.Value && (inCGMode.Value || inVideoMode.Value))
|
|
172
|
+
cgDialogueUIVisible.SetValue(true);
|
|
173
|
+
|
|
174
|
+
TextDisplayer.DisplayText(GetTextBox(), line);
|
|
175
|
+
|
|
176
|
+
TextDisplayer.SetWaitingForClick(true);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/// <summary>
|
|
180
|
+
///
|
|
181
|
+
/// </summary>
|
|
182
|
+
protected virtual IEnumerator WaitForTextToFinishDisplaying()
|
|
183
|
+
{
|
|
184
|
+
while (TextDisplayer.IsWaitingForClick() && !inFastForwardMode.Value)
|
|
185
|
+
yield return null;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
188
|
}
|