Elin Decompiled Documentation EA 23.358.1 Nightly
Loading...
Searching...
No Matches
DramaEventTalk.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
6{
7 public string text;
8
9 public string idCancelJump;
10
11 public List<DramaChoice> choices = new List<DramaChoice>();
12
13 public bool center;
14
15 public bool canCancel;
16
17 public bool unknown;
18
19 public bool ignoreClickSound;
20
21 public float timer;
22
23 public Func<string> funcText;
24
26 {
27 }
28
29 public DramaEventTalk(string _idActor, Func<string> func)
30 {
31 if (_idActor.Contains("?"))
32 {
33 unknown = true;
34 }
35 idActor = _idActor.Replace("?", "");
36 funcText = func;
37 }
38
39 public DramaEventTalk(string _idActor, string _text, List<DramaChoice> listChoice = null)
40 {
41 if (_idActor.Contains("?"))
42 {
43 unknown = true;
44 }
45 idActor = _idActor.Replace("?", "");
46 text = _text;
47 if (listChoice == null)
48 {
49 return;
50 }
51 foreach (DramaChoice item in listChoice)
52 {
54 }
55 }
56
57 public void AddChoice(DramaChoice choice)
58 {
59 choices.Add(choice);
60 }
61
62 public override bool Play()
63 {
64 if (progress == 0)
65 {
66 InitDialog();
67 if (sequence.firstTalk == null)
68 {
69 sequence.firstTalk = this;
70 }
71 timer = 0f;
72 sequence.dialog.SetActive(enable: true);
73 base.actor.Talk(sequence.message + ((funcText != null) ? funcText() : text), choices, center, unknown);
74 sequence.message = "";
75 progress++;
76 }
77 else
78 {
79 timer += Time.deltaTime;
80 if (timer < 0.08f)
81 {
82 return false;
83 }
84 if (canCancel && (EInput.rightMouse.down || Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.LeftShift)))
85 {
87 if (temp)
88 {
89 sequence.tempEvents.Clear();
90 }
92 {
93 EClass.Sound.Play("click_chat");
94 }
95 if (idCancelJump == "back")
96 {
97 return true;
98 }
99 if (idCancelJump.IsEmpty())
100 {
101 sequence.Exit();
102 }
103 else
104 {
106 }
107 return false;
108 }
109 int num = 0;
110 foreach (DramaChoice choice in choices)
111 {
112 if (choice.activeCondition != null && !choice.activeCondition())
113 {
114 continue;
115 }
116 string inputString = Input.inputString;
117 if ((bool)choice.button && inputString == ((num + 1).ToString() ?? ""))
118 {
119 if ((bool)choice.button.soundClick)
120 {
121 SoundManager.current.Play(choice.button.soundClick);
122 }
123 choice.button.onClick.Invoke();
124 return false;
125 }
126 num++;
127 }
128 if (num == 0 && (EInput.leftMouse.down || EInput.rightMouse.down || Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.LeftControl) || EInput.action == EAction.Confirm || EInput.action == EAction.Wait || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Escape)))
129 {
130 ResetDialog();
131 if (EClass.ui.GetTopLayer() == base.layer)
132 {
134 if ((bool)typewriter && !typewriter.IsFinished)
135 {
136 typewriter.Skip();
137 return false;
138 }
139 base.actor.gameObject.SetActive(value: false);
140 if (!ignoreClickSound)
141 {
142 EClass.Sound.Play("click_chat");
143 }
144 if (temp)
145 {
146 sequence.tempEvents.Clear();
147 if (!idJump.IsEmpty())
148 {
150 return false;
151 }
152 return true;
153 }
154 if (idJump.IsEmpty())
155 {
157 }
158 else
159 {
161 }
162 return false;
163 }
164 }
165 }
166 return false;
167 }
168
169 public void InitDialog()
170 {
171 if (idActor == "*")
172 {
173 base.manager.SetDialog("Mono");
174 }
175 if (idActor == "*2")
176 {
177 base.manager.SetDialog("Default2");
178 }
179 base.manager.imageBG.color = ((idActor == "*") ? new Color(0.6f, 0.6f, 0.6f) : Color.white);
180 }
181
182 public void ResetDialog()
183 {
184 base.manager.imageBG.color = Color.white;
185 if (idActor == "*" || idActor == "*2")
186 {
187 base.manager.SetDialog();
188 }
189 }
190}
EAction
Definition: EAction.cs:2
UIText textMain
Definition: DialogDrama.cs:29
Func< bool > activeCondition
Definition: DramaChoice.cs:29
UIButton button
Definition: DramaChoice.cs:33
void AddChoice(DramaChoice choice)
override bool Play()
string idCancelJump
DramaEventTalk(string _idActor, string _text, List< DramaChoice > listChoice=null)
DramaEventTalk(string _idActor, Func< string > func)
Func< string > funcText
List< DramaChoice > choices
DramaSequence sequence
Definition: DramaEvent.cs:17
string idJump
Definition: DramaEvent.cs:7
string idActor
Definition: DramaEvent.cs:9
bool temp
Definition: DramaEvent.cs:15
int progress
Definition: DramaEvent.cs:5
DramaEventTalk firstTalk
void Play(string id)
DialogDrama dialog
List< DramaEvent > tempEvents
Definition: EClass.cs:6
static SoundManager Sound
Definition: EClass.cs:47
static UI ui
Definition: EClass.cs:17
Definition: EInput.cs:8
static ButtonState leftMouse
Definition: EInput.cs:360
static ButtonState rightMouse
Definition: EInput.cs:362
static EAction action
Definition: EInput.cs:270
void Skip()
Definition: Typewriter.cs:48
bool IsFinished
Definition: Typewriter.cs:22
SoundData soundClick
Definition: UIButton.cs:130
Typewriter typewriter
Definition: UIText.cs:25