15 return this.sequence.dialog;
22 this.sequence = _sequence;
25 base.gameObject.SetActive(
false);
29 public void Talk(
string text, List<DramaChoice> choices,
bool center,
bool unknown)
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)
36 this.dialog.portrait.enableFull = this.sequence.fullPortrait;
37 this.dialog.portrait.SetPerson(this.owner);
39 text = this.ConvertAdv(text);
40 text =
GameLang.ConvertDrama(text, this.owner.chara);
41 if (!this.owner.HumanSpeak)
43 if (!text.StartsWith(
"("))
45 text =
"(" + text +
")";
47 text = text.Replace(
"。)",
")");
49 if (chara !=
null && chara.id ==
"adv_gaki")
53 if (this.dialog.goAffinity)
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)
60 this.dialog.transFav.SetActive(chara !=
null && chara.knowFav);
62 if (this.dialog.transRank)
64 this.dialog.transRank.SetActive(flag);
67 this.dialog.textRank.text =
"factionRank2".lang() +
" " + chara.trait.GetAdvRankText();
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)
83 for (
int i = 0; i < num; i++)
85 Util.Instantiate<Transform>(this.dialog.moldInterest, this.dialog.layoutInterest);
87 this.dialog.layoutInterest.RebuildLayout(
false);
88 this.dialog.textNoInterest.SetActive(num <= 0);
89 if (this.dialog.textFav && chara.knowFav)
91 this.dialog.textFav.text = chara.GetFavCat().GetName().ToTitleCase(
false) + Environment.NewLine + chara.GetFavFood().GetName().ToTitleCase(
false);
96 this.dialog.textAffinity.text =
"???";
97 this.dialog.textNoInterest.text =
"???";
100 text = text.Replace(
"((",
"(").Replace(
"))",
")").Replace(
"((",
"(").Replace(
"))",
")");
101 if (this.dialog.glitch)
103 this.dialog.glitch.enabled =
DramaActor.useGlitch;
104 DramaActor.useGlitch =
false;
106 this.dialog.SetText(text.ToTitleCase(
false), center);
107 this.dialog.ClearChoice();
109 for (
int j = 0; j < choices.Count; j++)
111 this.SetChoice(choices[j], j);
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
119 EMono.core.actionsNextFrame.Add(
new Action(UIButton.TryHihlight));
124 private void SetChoice(
DramaChoice item,
int index)
127 if (!item.IF.IsEmpty() && !
DramaOutcome.If(item,
this.owner.chara))
131 if (item.activeCondition !=
null && !item.activeCondition())
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)
141 text = text +
" (" + item.check.GetText(
EMono.pc,
this.owner.chara,
true) +
")";
144 string idJump = item.idJump;
145 string idAction = item.idAction;
146 object[] PARAMS =
null;
147 int? affinity =
null;
148 if (!item.CHECK.IsEmpty())
150 string[] array = item.CHECK.Split(
'/', StringSplitOptions.None);
154 if (!(a ==
"affinity"))
160 check =
Check.Get(array[1], 1f);
163 UIButton uibutton = this.dialog.AddChoice(item, text, delegate
165 this.gameObject.SetActive(
false);
166 DramaChoice.lastChoice = item;
168 if (affinity !=
null)
173 idJump = idJump.Split(
'/', StringSplitOptions.None)[0];
177 idJump = idJump.Split(
'/', StringSplitOptions.None)[1];
179 PARAMS =
new object[]
184 if (!idAction.IsEmpty())
186 typeof(
DramaOutcome).GetMethod(this.sequence.id +
"_" + idAction).Invoke(this.sequence.manager.outcome, PARAMS);
193 if (item.onClick !=
null)
197 this.sequence.tempEvents.Clear();
198 if (item.onJump !=
null)
203 if (idJump.IsEmpty())
205 this.sequence.PlayNext();
208 this.sequence.Play(idJump);
210 if (uibutton.subText)
212 uibutton.subText.SetText(this.choiceIdx.ToString() +
".");
216 uibutton.soundClick =
null;
218 if (item.onTooltip !=
null)
220 uibutton.SetTooltip(item.onTooltip,
true);
222 if (item.forceHighlight)
224 uibutton.DoHighlightTransition(
false);
225 item.forceHighlight =
false;
231 public string ConvertAdv(
string text)
233 StringBuilder stringBuilder =
new StringBuilder(text);
235 if (currentReligion !=
null)
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"));
242 return stringBuilder.ToString();
246 public static bool useGlitch;
258 private int choiceIdx;