Elin Modding Docs Doc
Loading...
Searching...
No Matches
DramaEventTalk.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x02000111 RID: 273
7{
8 // Token: 0x0600071C RID: 1820 RVA: 0x0002AEE6 File Offset: 0x000290E6
9 public DramaEventTalk()
10 {
11 }
12
13 // Token: 0x0600071D RID: 1821 RVA: 0x0002AEFC File Offset: 0x000290FC
14 public DramaEventTalk(string _idActor, Func<string> func)
15 {
16 if (_idActor.Contains("?"))
17 {
18 this.unknown = true;
19 }
20 this.idActor = _idActor.Replace("?", "");
21 this.funcText = func;
22 }
23
24 // Token: 0x0600071E RID: 1822 RVA: 0x0002AF4C File Offset: 0x0002914C
25 public DramaEventTalk(string _idActor, string _text, List<DramaChoice> listChoice = null)
26 {
27 if (_idActor.Contains("?"))
28 {
29 this.unknown = true;
30 }
31 this.idActor = _idActor.Replace("?", "");
32 this.text = _text;
33 if (listChoice != null)
34 {
35 foreach (DramaChoice choice in listChoice)
36 {
37 this.AddChoice(choice);
38 }
39 }
40 }
41
42 // Token: 0x0600071F RID: 1823 RVA: 0x0002AFE0 File Offset: 0x000291E0
43 public void AddChoice(DramaChoice choice)
44 {
45 this.choices.Add(choice);
46 }
47
48 // Token: 0x06000720 RID: 1824 RVA: 0x0002AFF0 File Offset: 0x000291F0
49 public override bool Play()
50 {
51 if (this.progress == 0)
52 {
53 this.InitDialog();
54 if (this.sequence.firstTalk == null)
55 {
56 this.sequence.firstTalk = this;
57 }
58 this.timer = 0f;
59 this.sequence.dialog.SetActive(true);
60 base.actor.Talk(this.sequence.message + ((this.funcText != null) ? this.funcText() : this.text), this.choices, this.center, this.unknown);
61 this.sequence.message = "";
62 this.progress++;
63 }
64 else
65 {
66 this.timer += Time.deltaTime;
67 if (this.timer < 0.08f)
68 {
69 return false;
70 }
71 if (!this.canCancel || (!EInput.rightMouse.down && !Input.GetKeyDown(KeyCode.Escape) && !Input.GetKeyDown(KeyCode.LeftShift)))
72 {
73 int num = 0;
74 foreach (DramaChoice dramaChoice in this.choices)
75 {
76 if (dramaChoice.activeCondition == null || dramaChoice.activeCondition())
77 {
78 string inputString = Input.inputString;
79 if (dramaChoice.button && inputString == ((num + 1).ToString() ?? ""))
80 {
81 if (dramaChoice.button.soundClick)
82 {
83 SoundManager.current.Play(dramaChoice.button.soundClick);
84 }
85 dramaChoice.button.onClick.Invoke();
86 return false;
87 }
88 num++;
89 }
90 }
91 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)))
92 {
93 return false;
94 }
95 this.ResetDialog();
96 if (!(EClass.ui.GetTopLayer() == base.layer))
97 {
98 return false;
99 }
100 Typewriter typewriter = this.sequence.dialog.textMain.typewriter;
101 if (typewriter && !typewriter.IsFinished)
102 {
103 typewriter.Skip();
104 return false;
105 }
106 base.actor.gameObject.SetActive(false);
107 EClass.Sound.Play("click_chat");
108 if (!this.temp)
109 {
110 if (this.idJump.IsEmpty())
111 {
112 this.sequence.PlayNext();
113 }
114 else
115 {
116 this.sequence.Play(this.idJump);
117 }
118 return false;
119 }
120 this.sequence.tempEvents.Clear();
121 if (!this.idJump.IsEmpty())
122 {
123 this.sequence.Play(this.idJump);
124 return false;
125 }
126 return true;
127 }
128 this.ResetDialog();
129 if (this.temp)
130 {
131 this.sequence.tempEvents.Clear();
132 }
133 EClass.Sound.Play("click_chat");
134 if (this.idCancelJump == "back")
135 {
136 return true;
137 }
138 if (this.idCancelJump.IsEmpty())
139 {
140 this.sequence.Exit();
141 }
142 else
143 {
144 this.sequence.Play(this.idCancelJump);
145 }
146 return false;
147 }
148 return false;
149 }
150
151 // Token: 0x06000721 RID: 1825 RVA: 0x0002B378 File Offset: 0x00029578
152 public void InitDialog()
153 {
154 if (this.idActor == "*")
155 {
156 base.manager.SetDialog("Mono");
157 }
158 if (this.idActor == "*2")
159 {
160 base.manager.SetDialog("Default2");
161 }
162 base.manager.imageBG.color = ((this.idActor == "*") ? new Color(0.6f, 0.6f, 0.6f) : Color.white);
163 }
164
165 // Token: 0x06000722 RID: 1826 RVA: 0x0002B408 File Offset: 0x00029608
166 public void ResetDialog()
167 {
168 base.manager.imageBG.color = Color.white;
169 if (this.idActor == "*" || this.idActor == "*2")
170 {
171 base.manager.SetDialog("Default");
172 }
173 }
174
175 // Token: 0x04000768 RID: 1896
176 public string text;
177
178 // Token: 0x04000769 RID: 1897
179 public string idCancelJump;
180
181 // Token: 0x0400076A RID: 1898
182 public List<DramaChoice> choices = new List<DramaChoice>();
183
184 // Token: 0x0400076B RID: 1899
185 public bool center;
186
187 // Token: 0x0400076C RID: 1900
188 public bool canCancel;
189
190 // Token: 0x0400076D RID: 1901
191 public bool unknown;
192
193 // Token: 0x0400076E RID: 1902
194 public float timer;
195
196 // Token: 0x0400076F RID: 1903
197 public Func<string> funcText;
198}