Elin Modding Docs Doc
Loading...
Searching...
No Matches
DramaActor.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using UnityEngine;
5
6// Token: 0x0200010B RID: 267
7public class DramaActor : EMono
8{
9 // Token: 0x170001B8 RID: 440
10 // (get) Token: 0x06000703 RID: 1795 RVA: 0x0002A3CF File Offset: 0x000285CF
11 public DialogDrama dialog
12 {
13 get
14 {
15 return this.sequence.dialog;
16 }
17 }
18
19 // Token: 0x06000704 RID: 1796 RVA: 0x0002A3DC File Offset: 0x000285DC
20 public void Init(DramaSequence _sequence, string _id, Person _owner)
21 {
22 this.sequence = _sequence;
23 this.id = _id;
24 this.owner = _owner;
25 base.gameObject.SetActive(false);
26 }
27
28 // Token: 0x06000705 RID: 1797 RVA: 0x0002A400 File Offset: 0x00028600
29 public void Talk(string text, List<DramaChoice> choices, bool center, bool unknown)
30 {
31 Chara chara = this.owner.chara;
32 this.dialog.gameObject.SetActive(true);
33 this.dialog.textName.text = (unknown ? "???" : this.owner.GetDramaTitle());
34 if (this.dialog.portrait)
35 {
36 this.dialog.portrait.enableFull = this.sequence.fullPortrait;
37 this.dialog.portrait.SetPerson(this.owner);
38 }
39 text = this.ConvertAdv(text);
40 text = GameLang.ConvertDrama(text, this.owner.chara);
41 if (!this.owner.HumanSpeak)
42 {
43 if (!text.StartsWith("("))
44 {
45 text = "(" + text + ")";
46 }
47 text = text.Replace("。)", ")");
48 }
49 if (chara != null && chara.id == "adv_gaki")
50 {
51 BackerContent.GakiConvert(ref text);
52 }
53 if (this.dialog.goAffinity)
54 {
55 this.dialog.layoutInterest.SetActive(chara != null);
56 this.dialog.textNoInterest.SetActive(chara == null);
57 bool flag = chara != null && chara.trait.ShowAdvRank;
58 if (this.dialog.transFav)
59 {
60 this.dialog.transFav.SetActive(chara != null && chara.knowFav);
61 }
62 if (this.dialog.transRank)
63 {
64 this.dialog.transRank.SetActive(flag);
65 if (flag)
66 {
67 this.dialog.textRank.text = "factionRank2".lang() + " " + chara.trait.GetAdvRankText();
68 }
69 }
70 if (chara != null)
71 {
72 this.dialog.textAffinity.text = chara.affinity.Name + "(" + chara._affinity.ToString() + ")";
73 this.dialog.layoutInterest.DestroyChildren(false, true);
74 int num = chara.interest / 10 + 1;
75 if (chara.interest <= 0)
76 {
77 num = 0;
78 }
79 if (num > 10)
80 {
81 num = 10;
82 }
83 for (int i = 0; i < num; i++)
84 {
85 Util.Instantiate<Transform>(this.dialog.moldInterest, this.dialog.layoutInterest);
86 }
87 this.dialog.layoutInterest.RebuildLayout(false);
88 this.dialog.textNoInterest.SetActive(num <= 0);
89 if (this.dialog.textFav && chara.knowFav)
90 {
91 this.dialog.textFav.text = chara.GetFavCat().GetName().ToTitleCase(false) + Environment.NewLine + chara.GetFavFood().GetName().ToTitleCase(false);
92 }
93 }
94 else
95 {
96 this.dialog.textAffinity.text = "???";
97 this.dialog.textNoInterest.text = "???";
98 }
99 }
100 text = text.Replace("((", "(").Replace("))", ")").Replace("((", "(").Replace("))", ")");
101 if (this.dialog.glitch)
102 {
103 this.dialog.glitch.enabled = DramaActor.useGlitch;
104 DramaActor.useGlitch = false;
105 }
106 this.dialog.SetText(text.ToTitleCase(false), center);
107 this.dialog.ClearChoice();
108 this.choiceIdx = 1;
109 for (int j = 0; j < choices.Count; j++)
110 {
111 this.SetChoice(choices[j], j);
112 }
113 this.dialog.transChoices.RebuildLayout(true);
114 this.dialog.iconNext.SetActive(this.choiceIdx == 1);
115 UIButton.TryHihlight();
116 EMono.core.actionsNextFrame.Add(new Action(UIButton.TryHihlight));
117 EMono.core.actionsNextFrame.Add(delegate
118 {
119 EMono.core.actionsNextFrame.Add(new Action(UIButton.TryHihlight));
120 });
121 }
122
123 // Token: 0x06000706 RID: 1798 RVA: 0x0002A850 File Offset: 0x00028A50
124 private void SetChoice(DramaChoice item, int index)
125 {
126 item.index = index;
127 if (!item.IF.IsEmpty() && !DramaOutcome.If(item, this.owner.chara))
128 {
129 return;
130 }
131 if (item.activeCondition != null && !item.activeCondition())
132 {
133 return;
134 }
135 DramaOutcome.idJump = null;
136 string text = item.text.TrimEnd(Environment.NewLine.ToCharArray());
137 text = this.ConvertAdv(text);
138 text = GameLang.ConvertDrama(text, this.owner.chara);
139 if (item.check != null && EMono.debug.logDice)
140 {
141 text = text + " (" + item.check.GetText(EMono.pc, this.owner.chara, true) + ")";
142 }
143 Check check = null;
144 string idJump = item.idJump;
145 string idAction = item.idAction;
146 object[] PARAMS = null;
147 int? affinity = null;
148 if (!item.CHECK.IsEmpty())
149 {
150 string[] array = item.CHECK.Split('/', StringSplitOptions.None);
151 string a = array[0];
152 if (!(a == "check"))
153 {
154 if (!(a == "affinity"))
155 {
156 }
157 }
158 else
159 {
160 check = Check.Get(array[1], 1f);
161 }
162 }
163 UIButton uibutton = this.dialog.AddChoice(item, text, delegate
164 {
165 this.gameObject.SetActive(false);
166 DramaChoice.lastChoice = item;
167 Check check = check;
168 if (affinity != null)
169 {
170 bool flag = true;
171 if (flag)
172 {
173 idJump = idJump.Split('/', StringSplitOptions.None)[0];
174 }
175 else
176 {
177 idJump = idJump.Split('/', StringSplitOptions.None)[1];
178 }
179 PARAMS = new object[]
180 {
181 flag
182 };
183 }
184 if (!idAction.IsEmpty())
185 {
186 typeof(DramaOutcome).GetMethod(this.sequence.id + "_" + idAction).Invoke(this.sequence.manager.outcome, PARAMS);
187 if (DramaOutcome.idJump != null)
188 {
189 this.sequence.Play(DramaOutcome.idJump);
190 return;
191 }
192 }
193 if (item.onClick != null)
194 {
195 item.onClick();
196 }
197 this.sequence.tempEvents.Clear();
198 if (item.onJump != null)
199 {
200 item.onJump();
201 return;
202 }
203 if (idJump.IsEmpty())
204 {
205 this.sequence.PlayNext();
206 return;
207 }
208 this.sequence.Play(idJump);
209 }, true);
210 if (uibutton.subText)
211 {
212 uibutton.subText.SetText(this.choiceIdx.ToString() + ".");
213 }
214 if (!item.sound)
215 {
216 uibutton.soundClick = null;
217 }
218 if (item.onTooltip != null)
219 {
220 uibutton.SetTooltip(item.onTooltip, true);
221 }
222 if (item.forceHighlight)
223 {
224 uibutton.DoHighlightTransition(false);
225 item.forceHighlight = false;
226 }
227 this.choiceIdx++;
228 }
229
230 // Token: 0x06000707 RID: 1799 RVA: 0x0002AA94 File Offset: 0x00028C94
231 public string ConvertAdv(string text)
232 {
233 StringBuilder stringBuilder = new StringBuilder(text);
234 Religion currentReligion = LayerDrama.currentReligion;
235 if (currentReligion != null)
236 {
237 stringBuilder.Replace("#god_name", currentReligion.Name);
238 stringBuilder.Replace("#god_desc", currentReligion.source.GetDetail());
239 stringBuilder.Replace("#god_benefit", currentReligion.GetTextBenefit());
240 stringBuilder.Replace("#godtalk_worship", currentReligion.GetGodTalk("worship"));
241 }
242 return stringBuilder.ToString();
243 }
244
245 // Token: 0x04000747 RID: 1863
246 public static bool useGlitch;
247
248 // Token: 0x04000748 RID: 1864
249 public string id;
250
251 // Token: 0x04000749 RID: 1865
252 public Person owner;
253
254 // Token: 0x0400074A RID: 1866
255 public DramaSequence sequence;
256
257 // Token: 0x0400074B RID: 1867
258 private int choiceIdx;
259}
Definition Chara.cs:12
Definition Check.cs:6
Definition EMono.cs:6