Elin Decompiled Documentation EA 23.189 Nightly
Loading...
Searching...
No Matches
DramaManager.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Globalization;
4using System.Linq;
5using DG.Tweening;
6using UnityEngine;
7using UnityEngine.UI;
8
9public class DramaManager : EMono
10{
11 public static Chara TG;
12
14
15 public CanvasGroup cg;
16
17 public CanvasGroup cgCover;
18
20
21 public Transform actorPos;
22
23 public Transform endroll;
24
26
28
30
32
34
35 public GameObject goSkip;
36
37 public Image imageBG;
38
39 public Image imageCover;
40
41 public Font[] fonts;
42
43 public Person tg;
44
45 public bool bgmChanged;
46
47 private List<DramaEvent> customEvents = new List<DramaEvent>();
48
49 public List<DramaChoice> _choices = new List<DramaChoice>();
50
51 public Dictionary<string, string> customTalkTopics = new Dictionary<string, string>();
52
53 public Dictionary<string, string> dictLocalize = new Dictionary<string, string>();
54
55 public float creditSpeed;
56
57 private string lastIF;
58
59 private string lastIF2;
60
62
63 public bool enableTone;
64
65 public bool customEventsAdded;
66
67 public bool idDefaultPassed;
68
69 public int countLine;
70
71 private string idDefault;
72
73 private string textReplace;
74
75 public static Dictionary<string, ExcelData> dictCache = new Dictionary<string, ExcelData>();
76
78
79 private void Update()
80 {
81 if (sequence != null)
82 {
84 }
85 }
86
88 {
89 this.setup = setup;
90 cgCover.SetActive(enable: false);
91 endroll.SetActive(enable: false);
92 tg = setup.person;
93 SetDialog();
95 {
96 setup = setup,
97 manager = this,
98 id = setup.sheet
99 };
100 Load();
101 sequence.lastStep = (sequence.lastlastStep = setup.step);
102 if (!setup.forceJump.IsEmpty())
103 {
105 }
106 else
107 {
108 sequence.Play();
109 }
110 return sequence;
111 }
112
114 {
115 sequence.Clear();
116 customEvents.Clear();
117 customTalkTopics.Clear();
118 moldActor = actorPos.CreateMold<DramaActor>();
119 if (tg != null)
120 {
121 sequence.AddActor("tg", tg);
122 }
123 sequence.AddActor("pc", new Person(EMono.pc));
124 string text = CorePath.DramaData + setup.book + ".xlsx";
125 ExcelData excelData = dictCache.TryGetValue(text);
126 if (excelData != null && excelData.IsModified())
127 {
128 excelData = null;
129 }
130 if (excelData == null)
131 {
132 excelData = new ExcelData();
133 }
134 excelData.maxEmptyRows = 10;
135 excelData.path = text;
136 List<Dictionary<string, string>> list = excelData.BuildList(setup.sheet);
137 if (!Lang.isBuiltin && dictLocalize.Count == 0)
138 {
139 foreach (Dictionary<string, string> item in new ExcelData
140 {
141 maxEmptyRows = 10,
142 path = CorePath.DramaDataLocal + setup.book + ".xlsx"
144 {
145 string text2 = item["id"];
146 if (!text2.IsEmpty() && !item["text"].IsEmpty())
147 {
148 dictLocalize.Add(text2, item["text"]);
149 }
150 }
151 }
152 dictCache[text] = excelData;
154 lastTalk = null;
156 countLine = 0;
157 for (int i = 0; i < list.Count; i++)
158 {
159 ParseLine(list[i]);
160 countLine++;
161 }
163 sequence.steps["end"] = 99999;
164 sequence.AddActor("narrator", new Person("narrator"));
165 return sequence;
166 }
167
168 public void AddCustomEvents(string idCustom = "Resident")
169 {
171 {
172 return;
173 }
174 DramaCustomSequence dramaCustomSequence = new DramaCustomSequence
175 {
176 manager = this,
178 idCustom = idCustom,
179 events = customEvents,
182 };
183 CustomEvent(delegate
184 {
185 sequence.Exit();
186 });
187 if (tg != null && tg.hasChara)
188 {
189 TG = tg.chara;
190 dramaCustomSequence.Build(tg.chara);
191 }
192 if (!sequence.setup.textData.IsEmpty())
193 {
194 dramaCustomSequence.BuildTextData();
195 }
196 foreach (DramaEvent customEvent in customEvents)
197 {
198 AddEvent(customEvent);
199 }
200 customEventsAdded = true;
201 }
202
203 public void ParseLine(Dictionary<string, string> item)
204 {
205 string[] array = (item.ContainsKey("action") ? item["action"].Split('/') : null);
206 string action = ((array != null) ? array[0] : null);
207 string text2 = (item.ContainsKey("step") ? item["step"] : null);
208 if (text2 == "//")
209 {
210 return;
211 }
212 if (text2 == idDefault)
213 {
214 idDefaultPassed = true;
215 }
216 string actor = (item.ContainsKey("actor") ? item["actor"] : "#1");
217 string[] p = (item.ContainsKey("param") ? item["param"].Split(',') : new string[0]);
218 string p2 = ((p.Length != 0) ? p[0] : "");
219 string p3 = ((p.Length > 1) ? p[1] : "");
220 string p4 = ((p.Length > 2) ? p[2] : "");
221 float.TryParse(p2, out var p0f);
222 float.TryParse(p3, out var result);
223 bool flag = !item["text_JP"].IsEmpty();
224 item.TryGetValue("text_JP");
225 string text = null;
226 if (flag)
227 {
228 if (!Lang.isBuiltin)
229 {
230 string key = item["id"];
231 if (dictLocalize.ContainsKey(key))
232 {
233 text = dictLocalize[key];
234 }
235 else
236 {
237 text = item.TryGetValue("text_EN");
238 }
239 }
240 else
241 {
242 text = item["text_" + Lang.langCode];
243 }
244 }
245 if (flag && text.StartsWith("$") && tg != null && tg.hasChara)
246 {
247 string text3 = text.Split(' ')[0];
248 text = text.Replace(text3, tg.chara.GetTalkText(text3.Remove(0, 1)));
249 }
250 string jump = (item.ContainsKey("jump") ? item["jump"] : null);
251 string text4 = (item.ContainsKey("if") ? item["if"] : null);
252 string iF = (item.ContainsKey("if2") ? item["if2"] : null);
253 string cHECK = (item.ContainsKey("check") ? item["check"] : null);
254 bool flag2 = false;
255 if (text2 != null && !sequence.steps.ContainsKey(text2) && action != "choice" && action != "cancel")
256 {
257 sequence.steps.Add(text2, sequence.events.Count);
258 }
259 if (text4 == "*")
260 {
261 text4 = lastIF;
262 iF = lastIF2;
263 }
264 else
265 {
266 lastIF = text4;
267 lastIF2 = iF;
268 }
269 if (!CheckIF(text4) || !CheckIF(iF))
270 {
271 if (action == "reload")
272 {
273 string id = "flag" + countLine;
274 sequence.AddStep(id);
275 }
276 return;
277 }
278 if (LayerDrama.fromBook && action == "editPlaylist")
279 {
280 action = "BGM";
281 }
282 switch (action)
283 {
284 case "disableFullPortrait":
285 AddEvent(delegate
286 {
287 sequence.fullPortrait = false;
288 });
289 break;
290 case "enableTone":
291 enableTone = true;
292 break;
293 case "canSkip":
294 AddEvent(delegate
295 {
296 sequence.skipJump = p2;
297 });
298 break;
299 case "screenLock":
301 break;
302 case "haltBGM":
303 EMono.Sound.haltUpdate = true;
304 break;
305 case "forceBGM":
306 AddEvent(delegate
307 {
308 SoundManager.ForceBGM();
309 });
310 break;
311 case "setFlag":
312 AddEvent(delegate
313 {
314 if (p2.StartsWith("*"))
315 {
316 Quest quest3 = EMono.game.quests.Get(p2.TrimStart('*'));
317 quest3?.ChangePhase(p3.ToInt(quest3.GetType()));
318 }
319 else
320 {
321 EMono.player.dialogFlags[p2] = (p3.IsEmpty() ? 1 : int.Parse(p3));
322 }
323 });
324 break;
325 case "reload":
326 {
327 string __step = "flag" + countLine;
328 AddEvent(delegate
329 {
330 Load();
331 sequence.Play(jump.IsEmpty(__step));
332 }, 0.01f, halt: true);
333 sequence.AddStep(__step);
334 break;
335 }
336 case "inject":
337 {
338 DramaEventTalk dramaEventTalk = lastTalk;
339 if (idDefaultPassed)
340 {
341 AddCustomEvents(p2);
342 }
343 lastTalk = dramaEventTalk;
344 break;
345 }
346 case "topic":
347 customTalkTopics[p2] = text;
348 break;
349 case "cancel":
350 lastTalk.canCancel = true;
351 lastTalk.idCancelJump = jump;
352 break;
353 case "_choices":
354 foreach (DramaChoice choice in _choices)
355 {
356 lastTalk.AddChoice(choice);
357 }
358 break;
359 case "choice":
360 if (!CheckIF(text4) || !CheckIF(iF))
361 {
362 break;
363 }
364 if (array.Length > 1)
365 {
366 switch (array[1])
367 {
368 case "quest":
369 text = "deQuest".lang();
370 jump = "_quest";
371 break;
372 case "depart":
373 text = "depart".lang();
374 jump = "_depart";
375 break;
376 case "rumor":
377 text = "letsTalk".lang();
378 jump = "_rumor";
379 break;
380 case "buy":
381 text = "daBuy".lang();
382 jump = "_buy";
383 break;
384 case "sell":
385 text = "daSell".lang();
386 jump = "_sell";
387 break;
388 case "give":
389 text = "daGive".lang();
390 jump = "_give";
391 break;
392 case "trade":
393 text = "daTrade".lang();
394 jump = "_trade";
395 break;
396 case "bye":
397 text = "bye".lang();
398 jump = "_bye";
399 break;
400 }
401 }
402 flag2 = true;
403 lastTalk.AddChoice(new DramaChoice(text, jump, p2, cHECK, text4));
404 break;
405 case "addTempActor":
406 {
407 Person person = new Person(actor);
408 Chara chara = EMono.game.cards.globalCharas.Find(actor) ?? EMono._map.FindChara(actor);
409 if (chara != null)
410 {
411 person.SetChara(chara);
412 }
413 sequence.AddActor(actor, person);
414 break;
415 }
416 case "addActor":
417 {
418 if (actor == "god")
419 {
421 break;
422 }
423 DramaActor dramaActor = sequence.AddActor(actor, new Person(actor));
424 if (!text.IsEmpty())
425 {
426 dramaActor.owner.tempName = text;
427 }
428 break;
429 }
430 case "invoke":
432 {
433 break;
434 }
435 if (jump.IsEmpty())
436 {
437 AddEvent(delegate
438 {
439 typeof(DramaOutcome).GetMethod(p[0]).Invoke(outcome, null);
440 });
441 break;
442 }
443 AddEvent(delegate
444 {
445 }, () => (!(bool)typeof(DramaOutcome).GetMethod(p[0]).Invoke(outcome, null)) ? "" : jump);
446 flag2 = true;
447 break;
448 case "refAction1":
449 AddEvent(delegate
450 {
452 });
453 break;
454 case "refAction2":
455 AddEvent(delegate
456 {
458 });
459 break;
460 case "setBG":
461 AddEvent(delegate
462 {
463 if (p2.IsEmpty())
464 {
465 imageBG.enabled = false;
466 }
467 else
468 {
469 imageBG.enabled = true;
470 imageBG.sprite = Resources.Load<Sprite>("Media/Graphics/Image/Drama/" + p2);
471 }
472 });
473 break;
474 case "setBG2":
475 AddEvent(delegate
476 {
477 Util.Instantiate<Transform>("Media/Graphics/Image/Drama/" + p2, layer).SetAsFirstSibling();
478 });
479 break;
480 case "glitch":
481 AddEvent(delegate
482 {
483 DramaActor.useGlitch = true;
484 });
485 break;
486 case "setDialog":
487 AddEvent(delegate
488 {
489 SetDialog(p2);
490 });
491 break;
492 case "Playlist":
493 AddEvent(delegate
494 {
495 LayerDrama.haltPlaylist = false;
496 EMono.Sound.StopBGM();
497 EMono.Sound.currentBGM = null;
498 bgmChanged = true;
499 });
500 break;
501 case "editPlaylist":
502 AddEvent(delegate
503 {
504 List<int> list = new List<int>();
505 string[] array2 = p;
506 foreach (string s in array2)
507 {
508 list.Add(int.Parse(s));
509 }
510 EMono._zone.SetBGM(list);
511 });
512 break;
513 case "BGM":
514 AddEvent(delegate
515 {
516 LayerDrama.haltPlaylist = true;
517 LayerDrama.maxBGMVolume = true;
518 EMono.Sound.PlayBGM(EMono.core.refs.dictBGM[p2.ToInt()]);
519 bgmChanged = true;
520 });
521 break;
522 case "BGMStay":
523 AddEvent(delegate
524 {
525 EMono.Sound.PlayBGM(EMono.core.refs.dictBGM[p2.ToInt()]);
526 });
527 break;
528 case "lastBGM":
529 AddEvent(delegate
530 {
531 EMono.Sound.StopBGM(p0f, playLastBGM: true);
532 });
533 break;
534 case "stopBGM":
535 AddEvent(delegate
536 {
537 LayerDrama.haltPlaylist = true;
538 EMono.Sound.StopBGM(p0f);
539 EMono.Sound.currentBGM = null;
540 });
541 break;
542 case "sound":
543 AddEvent(delegate
544 {
545 if (p3 != "")
546 {
547 SoundManager.current.MuteBGMFor(float.Parse(p3, CultureInfo.InvariantCulture));
548 }
549 EMono.Sound.Play(p2);
550 });
551 break;
552 case "haltPlaylist":
553 LayerDrama.haltPlaylist = true;
554 break;
555 case "keepBGM":
556 LayerDrama.keepBGM = true;
557 break;
558 case "alphaInOut":
559 AddEvent(delegate
560 {
561 DOTween.Kill(cg);
562 cg.alpha = 1f;
563 cg.DOFade(0f, p0f).SetDelay(0.1f);
564 }, p0f, halt: true);
565 AddEvent(new DramaEventWait((result == 0f) ? 0.1f : result));
566 AddEvent(delegate
567 {
568 DOTween.Kill(cg);
569 cg.alpha = 0f;
570 cg.DOFade(1f, p0f).SetDelay(0.1f);
571 }, p0f);
572 break;
573 case "alphaIn":
574 AddEvent(delegate
575 {
576 DOTween.Kill(cg);
577 cg.alpha = 0f;
578 cg.DOFade(1f, p0f).SetDelay(0.1f);
579 }, p0f);
580 break;
581 case "alphaOut":
582 AddEvent(delegate
583 {
584 DOTween.Kill(cg);
585 cg.alpha = 1f;
586 cg.DOFade(0f, p0f).SetDelay(0.1f);
587 }, p0f, halt: true);
588 break;
589 case "fadeIn":
590 AddEvent(delegate
591 {
592 imageCover.color = ((p3 != null && p3 == "white") ? Color.white : Color.black);
593 cgCover.SetActive(enable: true);
594 cgCover.alpha = 1f;
595 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
596 }, p0f);
597 break;
598 case "fadeOut":
599 AddEvent(delegate
600 {
601 imageCover.color = ((p3 != null && p3 == "white") ? Color.white : Color.black);
602 cgCover.SetActive(enable: true);
603 cgCover.alpha = 0f;
604 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
605 }, p0f, halt: true);
606 break;
607 case "fadeInOut":
608 AddEvent(delegate
609 {
610 imageCover.color = ((p4 != null && p4 == "white") ? Color.white : Color.black);
611 cgCover.SetActive(enable: true);
612 cgCover.alpha = 0f;
613 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
614 }, p0f, halt: true);
615 AddEvent(new DramaEventWait((result == 0f) ? 0.1f : result));
616 AddEvent(delegate
617 {
618 imageCover.color = ((p4 != null && p4 == "white") ? Color.white : Color.black);
619 cgCover.SetActive(enable: true);
620 cgCover.alpha = 1f;
621 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
622 }, p0f);
623 break;
624 case "hideUI":
625 AddEvent(delegate
626 {
627 EMono.ui.Hide(p0f);
628 });
629 break;
630 case "hideDialog":
631 AddEvent(delegate
632 {
633 dialog.SetActive(enable: false);
634 });
635 break;
636 case "fadeEnd":
637 if (p0f == 0f)
638 {
639 p0f = 1f;
640 }
641 AddEvent(delegate
642 {
643 imageCover.color = Color.black;
644 cgCover.SetActive(enable: true);
645 cgCover.alpha = 0f;
646 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
647 }, p0f, halt: true);
648 AddEvent(delegate
649 {
650 dialog.SetActive(enable: false);
651 imageBG.enabled = false;
652 });
653 AddEvent(delegate
654 {
655 DOTween.Kill(cg);
656 cg.alpha = 1f;
657 cg.DOFade(0f, p0f).SetDelay(0.1f);
658 }, p0f, halt: true);
659 break;
660 case "endroll":
662 break;
663 case "showSkip":
664 goSkip.SetActive(value: true);
665 break;
666 case "canCancel":
667 AddEvent(delegate
668 {
669 sequence.canCancel = bool.Parse(p2);
670 });
671 break;
672 case "wait":
673 AddEvent(new DramaEventWait(p0f));
674 break;
675 case "end":
677 break;
678 case "acceptQuest":
680 {
681 break;
682 }
683 AddEvent(delegate
684 {
685 Quest quest = EMono.game.quests.globalList.Where((Quest a) => a.source.id == p2).First();
686 EMono.game.quests.globalList.Remove(quest);
687 EMono.game.quests.Start(quest);
688 });
689 break;
690 case "startQuest":
691 AddEvent(delegate
692 {
693 Quest quest2 = Quest.Create(p2);
694 if (!quest2.HasDLC)
695 {
696 Msg.Say("(Failed DLC check)");
697 }
698 else
699 {
700 EMono.game.quests.Start(quest2);
701 LayerDrama.currentQuest = quest2;
702 if (tg != null && tg.chara != null)
703 {
704 Debug.Log("Starting Quest:" + quest2?.ToString() + "/" + tg.chara.quest?.ToString() + "/" + (quest2 == tg.chara.quest));
705 }
706 }
707 });
708 break;
709 case "setQuestClient":
710 AddEvent(delegate
711 {
712 if (LayerDrama.currentQuest != null)
713 {
714 LayerDrama.currentQuest.SetClient(tg.chara, assignQuest: false);
715 }
716 });
717 break;
718 case "updateJournal":
719 AddEvent(delegate
720 {
722 });
723 break;
724 case "addKeyItem":
725 if (!LayerDrama.fromBook)
726 {
727 AddEvent(delegate
728 {
730 });
731 }
732 break;
733 case "drop":
734 if (!LayerDrama.fromBook)
735 {
736 AddEvent(delegate
737 {
738 Msg.Say("dropReward");
740 Thing t = ThingGen.Create(p2);
742 });
743 }
744 break;
745 case "completeQuest":
746 if (!LayerDrama.fromBook)
747 {
748 AddEvent(delegate
749 {
752 });
753 }
754 break;
755 case "nextPhase":
756 if (!LayerDrama.fromBook)
757 {
758 AddEvent(delegate
759 {
760 EMono.game.quests.Get(p2).NextPhase();
761 });
762 }
763 break;
764 case "addResource":
765 AddEvent(delegate
766 {
767 EMono.BranchOrHomeBranch.resources.Get(p2).Mod(p3.ToInt());
768 });
769 break;
770 case "shake":
771 AddEvent(delegate
772 {
774 });
775 break;
776 case "tutorial":
778 {
779 Tutorial.Play(p2);
780 });
781 break;
782 case "slap":
783 AddEvent(delegate
784 {
786 {
787 tg.chara.PlaySound("whip");
788 tg.chara.Say("slap", tg.chara, EMono.pc);
789 EMono.pc.PlayAnime(AnimeID.Shiver);
790 EMono.pc.DamageHP(5 + EClass.rndHalf(EMono.pc.MaxHP / 3), 919, 100, AttackSource.Condition);
792 });
793 });
794 break;
795 case "destroyItem":
796 AddEvent(delegate
797 {
798 EMono.pc.things.Find(p2).Destroy();
799 });
800 break;
801 case "focus":
802 AddEvent(delegate
803 {
805 EMono.scene.screenElin.focusOption = new BaseGameScreen.FocusOption
806 {
807 pos = pos
808 };
809 });
810 break;
811 case "focusChara":
812 AddEvent(delegate
813 {
814 Point pos2 = EMono._map.FindChara(p2).pos.Copy();
816 {
817 pos = pos2,
818 speed = p3.IsEmpty("2").ToFloat()
819 };
820 });
821 break;
822 case "focusPC":
823 AddEvent(delegate
824 {
825 EMono.scene.screenElin.focusOption = new BaseGameScreen.FocusOption
826 {
827 player = true,
828 speed = p2.IsEmpty("2").ToFloat()
829 };
830 });
831 break;
832 case "focusPos":
833 AddEvent(delegate
834 {
835 EMono.scene.screenElin.focusOption = new BaseGameScreen.FocusOption
836 {
837 pos = new Point(p2.ToInt(), p3.ToInt()),
838 speed = p4.IsEmpty("2").ToFloat()
839 };
840 });
841 break;
842 case "unfocus":
843 AddEvent(delegate
844 {
845 EMono.scene.screenElin.focusOption = null;
846 });
847 break;
848 case "setAlwaysVisible":
849 AddEvent(delegate
850 {
851 LayerDrama.alwaysVisible = EMono._map.FindChara(p2);
852 });
853 break;
854 case "effect":
855 AddEvent(delegate
856 {
857 Point from = new Point(p[1].ToInt(), p[2].ToInt());
858 Effect.Get(p2).Play(from);
859 });
860 break;
861 case "effectEmbarkIn":
862 AddEvent(delegate
863 {
865 Util.Instantiate("UI/Layer/LayerEmbark/EmbarkActor_crystal");
866 });
867 break;
868 case "effectEmbarkOut":
869 AddEvent(delegate
870 {
871 UnityEngine.Object.FindObjectOfType<EmbarkActor>().Hide();
872 });
873 break;
874 case "propEnter":
875 AddEvent(delegate
876 {
877 DramaProp component = Util.Instantiate("Media/Drama/Prop/" + p2).GetComponent<DramaProp>();
878 component.name = p2;
879 if (p3.IsEmpty())
880 {
881 component.transform.position = EMono.scene.cam.transform.position;
882 }
883 else
884 {
885 Point point = new Point(p[1].ToInt(), p[2].ToInt());
886 component.transform.position = point.PositionCenter();
887 }
888 component.Enter();
889 });
890 break;
891 case "propLeave":
892 AddEvent(delegate
893 {
894 GameObject.Find(p2).GetComponent<DramaProp>().Leave();
895 });
896 break;
897 case "destroy":
898 AddEvent(delegate
899 {
900 Chara chara2 = EMono._map.FindChara(p2);
901 if (chara2 != null)
902 {
903 chara2.Destroy();
904 }
905 else
906 {
907 Debug.Log("Drama.destroy chara not found:" + p2);
908 }
909 });
910 break;
911 case "bout_win":
912 case "bout_lose":
913 AddEvent(delegate
914 {
916 {
918 if (action == "bout_win")
919 {
921 {
922 target = tg.chara
923 });
924 }
925 EMono.pc.MoveZone(zone);
926 });
927 });
928 break;
929 case "save":
930 AddEvent(delegate
931 {
932 EMono.game.Save(isAutoSave: false, silent: true);
933 });
934 break;
935 case "setHour":
936 AddEvent(delegate
937 {
938 EMono.world.date.hour = (int)p0f;
939 EMono.world.date.min = 0;
943 });
944 break;
945 case "%worship":
946 AddEvent(delegate
947 {
949 Tutorial.Reserve("faith");
950 });
951 break;
952 case "replace":
953 AddEvent(delegate
954 {
955 textReplace = text;
956 });
957 break;
958 default:
959 if (!flag)
960 {
961 break;
962 }
963 lastTalk = AddEvent(new DramaEventTalk(actor, delegate
964 {
965 if (!textReplace.IsEmpty())
966 {
967 text = textReplace;
968 textReplace = null;
969 }
970 if (tg != null && (actor == "tg" || actor.IsEmpty()))
971 {
972 text = (enableTone ? tg.ApplyTone(text) : text);
973 }
974 return text;
975 })) as DramaEventTalk;
976 lastTalk.center = p2 == "center";
977 break;
978 case "new":
979 case "saveBGM":
980 case "addAffinity":
981 case "checkAffinity":
982 break;
983 }
984 if (!string.IsNullOrEmpty(jump) && !flag2)
986 AddEvent(new DramaEventGoto(jump));
987 }
988 }
989
990 public DramaActor GetActor(string id)
991 {
992 return sequence.GetActor(id);
993 }
994
996 {
997 return sequence.AddEvent(e);
998 }
999
1000 public DramaEventMethod AddEvent(Action func, float duration = 0f, bool halt = false)
1001 {
1002 return AddEvent(new DramaEventMethod(func, duration, halt)) as DramaEventMethod;
1003 }
1004
1005 public DramaEventMethod AddEvent(Action func, Func<string> funcJump)
1006 {
1007 return AddEvent(new DramaEventMethod(func)
1009 jumpFunc = funcJump
1010 }) as DramaEventMethod;
1011 }
1012
1013 public DramaEvent CustomEvent(Action func, string step = null, float duration = 0f, bool halt = false)
1014 {
1015 DramaEventMethod dramaEventMethod = new DramaEventMethod(func, duration, halt)
1016 {
1017 step = step
1019 customEvents.Add(dramaEventMethod);
1020 return dramaEventMethod;
1021 }
1022
1023 public void SetDialog(string id = "Default")
1024 {
1025 DialogDrama[] componentsInChildren = GetComponentsInChildren<DialogDrama>(includeInactive: true);
1026 foreach (DialogDrama dialogDrama in componentsInChildren)
1027 {
1028 if ((bool)dialogDrama.portrait)
1029 {
1030 dialogDrama.portrait.imageFull.SetActive(enable: false);
1031 }
1032 dialogDrama.SetActive(enable: false);
1033 if (dialogDrama.name == "Dialog" + id)
1034 {
1035 dialog = dialogDrama;
1036 }
1037 }
1038 }
1039
1040 public bool CheckIF(string IF)
1041 {
1042 if (IF == null || IF.IsEmpty())
1043 {
1044 return true;
1045 }
1046 string[] array = IF.Split(',');
1047 switch (array[0])
1048 {
1049 case "survival":
1050 return EMono.game.IsSurvival;
1051 case "fromBook":
1052 return LayerDrama.fromBook;
1053 case "!fromBook":
1054 return !LayerDrama.fromBook;
1055 case "WindRest":
1056 return EMono._zone is Zone_WindRest;
1057 case "guild_promote":
1058 return Guild.CurrentDrama.relation.exp >= Guild.CurrentDrama.relation.ExpToNext;
1059 case "guild_maxpromote":
1060 return Guild.CurrentDrama.relation.rank >= Guild.CurrentDrama.relation.MaxRank;
1061 case "scratch_check":
1062 return EMono.game.dateScratch > EMono.game.world.date.GetRaw();
1063 case "sister_money":
1064 return EMono.pc.GetCurrency() >= 10000;
1065 case "fiamaPet":
1066 if (EMono.pc.homeBranch != null)
1067 {
1068 foreach (Chara member in EMono.pc.homeBranch.members)
1069 {
1070 if (member.isDead && member.CanRevive() && member.GetInt(100) != 0)
1071 {
1072 return true;
1073 }
1074 }
1075 }
1076 return false;
1077 case "hasMelilithCurse":
1078 return EMono.pc.HasElement(1206);
1079 case "merchant":
1080 return Guild.CurrentDrama == Guild.Merchant;
1081 case "fighter":
1082 return Guild.CurrentDrama == Guild.Fighter;
1083 case "thief":
1084 return Guild.CurrentDrama == Guild.Thief;
1085 case "mage":
1086 return Guild.CurrentDrama == Guild.Mage;
1087 case "hasDLC":
1088 return Steam.HasDLC(array[1].ToEnum<ID_DLC>());
1089 case "hasFlag":
1090 return EMono.player.dialogFlags.TryGetValue(array[1], 0) != 0;
1091 case "!hasFlag":
1092 return EMono.player.dialogFlags.TryGetValue(array[1], 0) == 0;
1093 case "hasItem":
1094 return EMono.pc.things.Find(array[1]) != null;
1095 case "nasuDeliver":
1096 if (EMono.game.quests.GetPhase<QuestNasu>() == 2)
1097 {
1098 return EMono.pc.things.Find("backpack_holding") != null;
1099 }
1100 return false;
1101 case "isCompleted":
1102 return EMono.game.quests.IsCompleted(array[1]);
1103 case "costRecruit":
1104 if (EMono.Branch != null && EMono.Branch.IsRecruit(tg.chara))
1105 {
1106 return EMono.pc.GetCurrency("money2") >= CalcGold.Hire(tg.chara);
1107 }
1108 return true;
1109 case "costRecruitTicket":
1110 if (EMono.Branch != null && EMono.Branch.IsRecruit(tg.chara))
1111 {
1112 return EMono.pc.things.Find("ticket_resident") != null;
1113 }
1114 return false;
1115 case "letterTrial":
1117 {
1118 return EMono.pc.things.Find("letter_trial") != null;
1119 }
1120 return false;
1121 default:
1122 if (array.Length > 2)
1123 {
1124 int value;
1125 bool flag = EMono.player.dialogFlags.TryGetValue(array[1], out value);
1126 int num = 0;
1127 if (array[1].StartsWith("*"))
1128 {
1129 string text = array[1].TrimStart('*');
1130 Quest quest = EMono.game.quests.Get(text);
1131 if (text == "guild")
1132 {
1133 quest = Guild.CurrentQuest;
1134 }
1135 flag = quest != null;
1136 if (!EMono.game.quests.completedIDs.Contains(text))
1137 {
1138 value = quest?.phase ?? (-1);
1139 }
1140 else
1141 {
1142 value = 999;
1143 flag = true;
1144 }
1145 num = ((!int.TryParse(array[2], out var result)) ? ((quest != null) ? array[2].ToInt(quest.GetType()) : 0) : result);
1146 }
1147 else
1148 {
1149 num = int.Parse(array[2]);
1150 }
1151 switch (array[0])
1152 {
1153 case "=":
1154 if (!flag && num == -1)
1155 {
1156 return true;
1157 }
1158 if (flag && value == num)
1159 {
1160 return true;
1161 }
1162 break;
1163 case "!":
1164 if (!flag || value != num)
1165 {
1166 return true;
1167 }
1168 break;
1169 case ">":
1170 if (flag && value > num)
1171 {
1172 return true;
1173 }
1174 break;
1175 case ">=":
1176 if (flag && value >= num)
1177 {
1178 return true;
1179 }
1180 break;
1181 case "<":
1182 if (!flag || value < num)
1183 {
1184 return true;
1185 }
1186 break;
1187 case "<=":
1188 if (!flag || value <= num)
1189 {
1190 return true;
1191 }
1192 break;
1193 }
1194 return false;
1196 return setup.tag == IF;
1197 }
1198 }
1199
1200 public void Show()
1201 {
1202 SE.PopDrama();
1203 layer.SetActive(enable: true);
1204 layer.cg.alpha = 0f;
1205 layer.cg.DOFade(1f, 0.3f);
1206 }
1207
1208 public void Hide()
1209 {
1210 layer.SetActive(enable: false);
1211 }
1212}
AnimeID
Definition: AnimeID.cs:2
AttackSource
Definition: AttackSource.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
FocusOption focusOption
static int Hire(Chara c)
Definition: CalcGold.cs:8
static void SetNormalRarity(bool fixedMat=false)
Chara Find(string id)
Definition: CardManager.cs:20
GlobalCharaList globalCharas
Definition: CardManager.cs:46
void DamageHP(int dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
Definition: Card.cs:3955
bool HasElement(int ele, int req=1)
Definition: Card.cs:5638
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5852
int GetCurrency(string id="money")
Definition: Card.cs:3867
void RecalculateFOV()
Definition: Card.cs:6064
string GetTalkText(string idTopic, bool stripPun=false, bool useDefault=true)
Definition: Card.cs:6526
Point pos
Definition: Card.cs:57
void Destroy()
Definition: Card.cs:4850
ThingContainer things
Definition: Card.cs:36
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:5871
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6499
Definition: Chara.cs:10
void OnInsulted()
Definition: Chara.cs:7793
bool CanRevive()
Definition: Chara.cs:4900
override int MaxHP
Definition: Chara.cs:706
FactionBranch homeBranch
Definition: Chara.cs:1052
bool isDead
Definition: Chara.cs:387
void MoveZone(string alias)
Definition: Chara.cs:3256
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:383
CoreRef refs
Definition: Core.cs:51
int GetRaw(int offsetHours=0)
Definition: Date.cs:322
Portrait portrait
Definition: DialogDrama.cs:41
void AddChoice(DramaChoice choice)
Dictionary< string, string > dictLocalize
Definition: DramaManager.cs:53
DramaSequence sequence
Definition: DramaManager.cs:27
DramaOutcome outcome
Definition: DramaManager.cs:29
bool customEventsAdded
Definition: DramaManager.cs:65
string lastIF2
Definition: DramaManager.cs:59
DramaEventMethod AddEvent(Action func, float duration=0f, bool halt=false)
string textReplace
Definition: DramaManager.cs:73
CanvasGroup cg
Definition: DramaManager.cs:15
DramaEvent CustomEvent(Action func, string step=null, float duration=0f, bool halt=false)
LayerDrama layer
Definition: DramaManager.cs:13
CanvasGroup cgCover
Definition: DramaManager.cs:17
DialogDrama dialog
Definition: DramaManager.cs:31
Font[] fonts
Definition: DramaManager.cs:41
static Dictionary< string, ExcelData > dictCache
Definition: DramaManager.cs:75
DramaSequence Load()
Transform actorPos
Definition: DramaManager.cs:21
bool CheckIF(string IF)
bool idDefaultPassed
Definition: DramaManager.cs:67
void ParseLine(Dictionary< string, string > item)
void AddCustomEvents(string idCustom="Resident")
DramaEventMethod AddEvent(Action func, Func< string > funcJump)
UIDynamicList listCredit
Definition: DramaManager.cs:19
void SetDialog(string id="Default")
List< DramaChoice > _choices
Definition: DramaManager.cs:49
Dictionary< string, string > customTalkTopics
Definition: DramaManager.cs:51
DramaActor moldActor
Definition: DramaManager.cs:25
Image imageCover
Definition: DramaManager.cs:39
string idDefault
Definition: DramaManager.cs:71
List< DramaEvent > customEvents
Definition: DramaManager.cs:47
DramaEventTalk lastTalk
Definition: DramaManager.cs:61
Transform endroll
Definition: DramaManager.cs:23
string lastIF
Definition: DramaManager.cs:57
DramaSequence Play(DramaSetup setup)
Definition: DramaManager.cs:87
float creditSpeed
Definition: DramaManager.cs:55
DramaEvent AddEvent(DramaEvent e)
static Chara TG
Definition: DramaManager.cs:11
void Update()
Definition: DramaManager.cs:79
GameObject goSkip
Definition: DramaManager.cs:35
DramaSetup setup
Definition: DramaManager.cs:33
DramaActor tgActor
Definition: DramaManager.cs:77
void Enter()
Definition: DramaProp.cs:11
DramaSetup setup
List< DramaEvent > events
DramaActor AddActor(string id, Person person)
DramaActor GetActor(string id)
DramaEvent AddEvent(DramaEvent e)
void Play(string id)
void AddStep(string id)
Dictionary< string, int > steps
string sheet
Definition: DramaSetup.cs:5
string step
Definition: DramaSetup.cs:7
Person person
Definition: DramaSetup.cs:19
string textData
Definition: DramaSetup.cs:11
string forceJump
Definition: DramaSetup.cs:13
Definition: EClass.cs:5
static int rndHalf(int a)
Definition: EClass.cs:87
Definition: EMono.cs:4
static Core core
Definition: EMono.cs:5
static Chara pc
Definition: EMono.cs:13
static Player player
Definition: EMono.cs:11
static Zone _zone
Definition: EMono.cs:19
static FactionBranch BranchOrHomeBranch
Definition: EMono.cs:23
static Game game
Definition: EMono.cs:7
static Scene scene
Definition: EMono.cs:27
static UI ui
Definition: EMono.cs:15
static SoundManager Sound
Definition: EMono.cs:39
static FactionBranch Branch
Definition: EMono.cs:21
static Map _map
Definition: EMono.cs:17
Definition: Effect.cs:7
static Effect Get(Effect original)
Definition: Effect.cs:85
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
Definition: Effect.cs:100
bool IsModified()
Definition: ExcelData.cs:72
List< Dictionary< string, string > > BuildList(string sheetName="_default")
Definition: ExcelData.cs:92
bool IsRecruit(Chara c)
List< Chara > members
HomeResourceManager resources
FactionRelation relation
Definition: FACTION.cs:126
bool Save(bool isAutoSave=false, bool silent=false)
Definition: Game.cs:1008
SpatialManager spatials
Definition: Game.cs:152
CardManager cards
Definition: Game.cs:155
bool IsSurvival
Definition: Game.cs:272
new World world
Definition: Game.cs:173
QuestManager quests
Definition: Game.cs:179
Definition: Guild.cs:2
static Guild CurrentDrama
Definition: Guild.cs:24
static GuildMerchant Merchant
Definition: Guild.cs:62
static QuestGuild CurrentQuest
Definition: Guild.cs:64
static GuildMage Mage
Definition: Guild.cs:58
static GuildFighter Fighter
Definition: Guild.cs:56
static GuildThief Thief
Definition: Guild.cs:60
Definition: Hide.cs:4
BaseHomeResource Get(string id)
Definition: Lang.cs:6
static string langCode
Definition: Lang.cs:28
static bool isBuiltin
Definition: Lang.cs:42
CanvasGroup cg
Definition: LayerDrama.cs:30
static LayerDrama Instance
Definition: LayerDrama.cs:20
static bool fromBook
Definition: LayerDrama.cs:16
static Quest currentQuest
Definition: LayerDrama.cs:6
static Religion currentReligion
Definition: LayerDrama.cs:8
static Action refAction2
Definition: LayerDrama.cs:26
static Action refAction1
Definition: LayerDrama.cs:24
void ShowScreenLock(string id)
Definition: Layer.cs:207
Layer SetOnKill(Action action)
Definition: Layer.cs:579
Chara FindChara(string id)
Definition: Map.cs:2568
void RevealAll(bool reveal=true)
Definition: Map.cs:905
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
Definition: Person.cs:6
bool hasChara
Definition: Person.cs:38
void SetChara(Chara c)
Definition: Person.cs:88
Chara chara
Definition: Person.cs:36
Dictionary< string, int > dialogFlags
Definition: Player.cs:960
void ModKeyItem(string alias, int num=1, bool msg=true)
Definition: Player.cs:2032
Definition: Point.cs:9
Point Copy()
Definition: Point.cs:479
Image imageFull
Definition: Portrait.cs:30
HashSet< string > completedIDs
Definition: QuestManager.cs:17
void Complete(Quest q)
Definition: QuestManager.cs:98
bool IsCompleted(string id)
void UpdateJournal()
Quest Start(string id, string idGlobalChara)
Definition: QuestManager.cs:41
List< Quest > globalList
Definition: QuestManager.cs:14
Quest Get(string id)
Definition: Quest.cs:7
virtual bool HasDLC
Definition: Quest.cs:147
int phase
Definition: Quest.cs:40
virtual SourceQuest.Row source
Definition: Quest.cs:107
static Quest Create(string _id, string _idPerson=null, Chara c=null)
Definition: Quest.cs:241
void JoinFaith(Chara c, ConvertType type=ConvertType.Default)
Definition: Religion.cs:386
GameScreen screenElin
Definition: Scene.cs:93
void OnChangeHour()
Definition: Scene.cs:776
Definition: Shaker.cs:5
static void ShakeCam(string id="default", float magnitude=1f)
Definition: Shaker.cs:25
Zone Find(string id)
Definition: Steam.cs:8
static bool HasDLC(ID_DLC id)
Definition: Steam.cs:39
Thing Find(int uid)
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
static void Reserve(string idStep, Action onBeforePlay=null)
Definition: Tutorial.cs:55
static void Play(string idStep)
Definition: Tutorial.cs:7
GameDate date
Definition: World.cs:6
void AddPreEnter(ZonePreEnterEvent e, bool executeIfActiveZone=true)
Definition: Zone.cs:12
void SetBGM(List< int > ids, bool refresh=true)
Definition: Zone.cs:2859
ZoneEventManager events
Definition: Zone.cs:40
ZoneInstance instance
Definition: Zone.cs:52
Card AddCard(Card t, Point point)
Definition: Zone.cs:1935