Elin Modding Docs Doc
Loading...
Searching...
No Matches
DramaSequence.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x0200011A RID: 282
6public class DramaSequence : EClass
7{
8 // Token: 0x170001C3 RID: 451
9 // (get) Token: 0x06000799 RID: 1945 RVA: 0x0003162C File Offset: 0x0002F82C
10 public DialogDrama dialog
11 {
12 get
13 {
14 return this.manager.dialog;
15 }
16 }
17
18 // Token: 0x0600079A RID: 1946 RVA: 0x00031639 File Offset: 0x0002F839
19 public void Clear()
20 {
21 this.steps.Clear();
22 this.actors.Clear();
23 this.events.Clear();
24 this.tempEvents.Clear();
25 }
26
27 // Token: 0x0600079B RID: 1947 RVA: 0x00031668 File Offset: 0x0002F868
28 public DramaActor GetActor(string id)
29 {
30 if (this.actors.ContainsKey(id))
31 {
32 return this.actors[id];
33 }
34 if (EClass.sources.persons.map.ContainsKey(id))
35 {
36 return this.AddActor(id, new Person(id, null));
37 }
38 if (this.actors.Count <= 0)
39 {
40 return this.GetActor("narrator");
41 }
42 return this.actors.FirstItem<string, DramaActor>();
43 }
44
45 // Token: 0x0600079C RID: 1948 RVA: 0x000316DC File Offset: 0x0002F8DC
46 public T GetEvent<T>(string idStep) where T : DramaEvent
47 {
48 foreach (DramaEvent dramaEvent in this.events)
49 {
50 if (dramaEvent.step == idStep)
51 {
52 return dramaEvent as T;
53 }
54 }
55 return default(T);
56 }
57
58 // Token: 0x0600079D RID: 1949 RVA: 0x00031750 File Offset: 0x0002F950
59 public DramaActor AddActor(string id, Person person)
60 {
61 if (this.actors.ContainsKey(id))
62 {
63 return this.actors[id];
64 }
65 DramaActor dramaActor = Util.Instantiate<DramaActor>(this.manager.moldActor, this.manager.actorPos);
66 dramaActor.Init(this, id, person);
67 this.actors.Add(id, dramaActor);
68 return dramaActor;
69 }
70
71 // Token: 0x0600079E RID: 1950 RVA: 0x000317AB File Offset: 0x0002F9AB
72 public void AddStep(string id)
73 {
74 this.steps.Add(id, this.events.Count);
75 this.events.Add(new DramaEvent
76 {
77 sequence = this,
78 step = id
79 });
80 }
81
82 // Token: 0x0600079F RID: 1951 RVA: 0x000317E2 File Offset: 0x0002F9E2
83 public DramaEvent AddEvent(DramaEvent e)
84 {
85 if (!e.step.IsEmpty())
86 {
87 this.steps.Add(e.step, this.events.Count);
88 }
89 e.sequence = this;
90 this.events.Add(e);
91 return e;
92 }
93
94 // Token: 0x060007A0 RID: 1952 RVA: 0x00031821 File Offset: 0x0002FA21
95 public void PlayNext()
96 {
97 this.Play(this.currentEventID + 1);
98 }
99
100 // Token: 0x060007A1 RID: 1953 RVA: 0x00031834 File Offset: 0x0002FA34
101 public void Play(string id)
102 {
103 if (id == "last")
104 {
105 id = this.lastlastStep;
106 }
107 if (!id.IsEmpty() && !this.steps.ContainsKey(id))
108 {
109 Debug.Log(id);
110 }
111 this.Play(string.IsNullOrEmpty(id) ? 0 : this.steps[id]);
112 }
113
114 // Token: 0x060007A2 RID: 1954 RVA: 0x00031890 File Offset: 0x0002FA90
115 public void Play(int eventID = 0)
116 {
117 if (this.isExited)
118 {
119 return;
120 }
121 if (eventID >= this.events.Count)
122 {
123 if (!this.isLoop)
124 {
125 this.Exit();
126 return;
127 }
128 eventID = 0;
129 }
130 this.currentEventID = eventID;
131 this.currentEvent = this.events[eventID];
132 this.currentEvent.Reset();
133 string str = eventID.ToString() + "/";
134 foreach (KeyValuePair<string, int> keyValuePair in this.steps)
135 {
136 if (keyValuePair.Value == eventID)
137 {
138 str += keyValuePair.Key;
139 }
140 if (keyValuePair.Value == eventID && !keyValuePair.Key.StartsWith("flag"))
141 {
142 this.lastlastStep = this.lastStep;
143 this.lastStep = keyValuePair.Key;
144 break;
145 }
146 }
147 this.OnUpdate();
148 }
149
150 // Token: 0x060007A3 RID: 1955 RVA: 0x00031994 File Offset: 0x0002FB94
151 public void Exit()
152 {
153 this.isExited = true;
154 this.currentEvent = null;
155 this.manager.SetActive(false);
156 }
157
158 // Token: 0x060007A4 RID: 1956 RVA: 0x000319B0 File Offset: 0x0002FBB0
159 public void OnUpdate()
160 {
161 if (this.tempEvents.Count > 0)
162 {
163 if (this.tempEvents[0].Play() && this.tempEvents.Count > 0)
164 {
165 this.tempEvents.RemoveAt(0);
166 }
167 return;
168 }
169 if (this.currentEvent == null)
170 {
171 return;
172 }
173 if (this.currentEvent is DramaEventGoto)
174 {
175 string a = this.currentEvent.idJump;
176 if (a == "*")
177 {
178 if (this.setup.step.IsEmpty())
179 {
180 this.PlayNext();
181 return;
182 }
183 a = this.setup.step;
184 }
185 this.Play(a);
186 return;
187 }
188 if (this.currentEvent.Play())
189 {
190 this.PlayNext();
191 }
192 }
193
194 // Token: 0x0400079D RID: 1949
195 public string id;
196
197 // Token: 0x0400079E RID: 1950
198 public DramaManager manager;
199
200 // Token: 0x0400079F RID: 1951
201 public Dictionary<string, int> steps = new Dictionary<string, int>();
202
203 // Token: 0x040007A0 RID: 1952
204 public Dictionary<string, DramaActor> actors = new Dictionary<string, DramaActor>();
205
206 // Token: 0x040007A1 RID: 1953
207 public List<DramaEvent> events = new List<DramaEvent>();
208
209 // Token: 0x040007A2 RID: 1954
210 public bool isLoop;
211
212 // Token: 0x040007A3 RID: 1955
213 public bool canCancel = true;
214
215 // Token: 0x040007A4 RID: 1956
216 public bool isExited;
217
218 // Token: 0x040007A5 RID: 1957
219 public bool fullPortrait;
220
221 // Token: 0x040007A6 RID: 1958
222 public DramaEventTalk firstTalk;
223
224 // Token: 0x040007A7 RID: 1959
225 public List<DramaEvent> tempEvents = new List<DramaEvent>();
226
227 // Token: 0x040007A8 RID: 1960
228 private DramaEvent currentEvent;
229
230 // Token: 0x040007A9 RID: 1961
231 public string message = "";
232
233 // Token: 0x040007AA RID: 1962
234 public string skipJump;
235
236 // Token: 0x040007AB RID: 1963
237 public string lastStep;
238
239 // Token: 0x040007AC RID: 1964
240 public string lastlastStep;
241
242 // Token: 0x040007AD RID: 1965
243 public DramaSetup setup;
244
245 // Token: 0x040007AE RID: 1966
246 private int currentEventID;
247
248 // Token: 0x0200084B RID: 2123
249 public enum Template
250 {
251 // Token: 0x0400238B RID: 9099
252 Default
253 }
254}