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