-
Notifications
You must be signed in to change notification settings - Fork 0
/
Say3D.cs
73 lines (60 loc) · 2.31 KB
/
Say3D.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine;
namespace Fungus
{
/// <summary>
/// Writes text in a dialog box.
/// </summary>
[CommandInfo("Opendream",
"Say3D",
"Writes text in a dialog box.")]
[AddComponentMenu("")]
public class Say3D : Say
{
[SerializeField] protected string animationName;
public override void OnEnter()
{
if (!showAlways && executionCount >= showCount)
{
Continue();
return;
}
executionCount++;
// Override the active say dialog if needed
if (character != null && character.SetSayDialog != null)
{
SayDialog.ActiveSayDialog = character.SetSayDialog;
}
if (setSayDialog != null)
{
SayDialog.ActiveSayDialog = setSayDialog;
}
Say3DDialog sayDialog = (Say3DDialog)SayDialog.GetSayDialog();
if (sayDialog == null)
{
Continue();
return;
}
var flowchart = GetFlowchart();
sayDialog.SetActive(true);
sayDialog.SetCharacter(character);
sayDialog.SetCharacterImage(portrait);
string displayText = storyText;
var activeCustomTags = CustomTag.activeCustomTags;
for (int i = 0; i < activeCustomTags.Count; i++)
{
var ct = activeCustomTags[i];
displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith);
if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "")
{
displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith);
}
}
string subbedText = flowchart.SubstituteVariables(displayText);
sayDialog.Say3D(subbedText, !extendPrevious, waitForClick, fadeWhenDone, stopVoiceover, waitForVO, voiceOverClip, delegate {
Continue();
}, animationName);
}
}
}