Elin Decompiled Documentation EA 23.102 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 "addActor":
406 {
407 if (actor == "god")
408 {
410 break;
411 }
412 DramaActor dramaActor = sequence.AddActor(actor, new Person(actor));
413 if (!text.IsEmpty())
414 {
415 dramaActor.owner.tempName = text;
416 }
417 break;
418 }
419 case "invoke":
421 {
422 break;
423 }
424 if (jump.IsEmpty())
425 {
426 AddEvent(delegate
427 {
428 typeof(DramaOutcome).GetMethod(p[0]).Invoke(outcome, null);
429 });
430 break;
431 }
432 AddEvent(delegate
433 {
434 }, () => (!(bool)typeof(DramaOutcome).GetMethod(p[0]).Invoke(outcome, null)) ? "" : jump);
435 flag2 = true;
436 break;
437 case "refAction1":
438 AddEvent(delegate
439 {
441 });
442 break;
443 case "refAction2":
444 AddEvent(delegate
445 {
447 });
448 break;
449 case "setBG":
450 AddEvent(delegate
451 {
452 if (p2.IsEmpty())
453 {
454 imageBG.enabled = false;
455 }
456 else
457 {
458 imageBG.enabled = true;
459 imageBG.sprite = Resources.Load<Sprite>("Media/Graphics/Image/Drama/" + p2);
460 }
461 });
462 break;
463 case "setBG2":
464 AddEvent(delegate
465 {
466 Util.Instantiate<Transform>("Media/Graphics/Image/Drama/" + p2, layer).SetAsFirstSibling();
467 });
468 break;
469 case "glitch":
470 AddEvent(delegate
471 {
472 DramaActor.useGlitch = true;
473 });
474 break;
475 case "setDialog":
476 AddEvent(delegate
477 {
478 SetDialog(p2);
479 });
480 break;
481 case "Playlist":
482 AddEvent(delegate
483 {
484 LayerDrama.haltPlaylist = false;
485 EMono.Sound.StopBGM();
486 EMono.Sound.currentBGM = null;
487 bgmChanged = true;
488 });
489 break;
490 case "editPlaylist":
491 AddEvent(delegate
492 {
493 List<int> list = new List<int>();
494 string[] array2 = p;
495 foreach (string s in array2)
496 {
497 list.Add(int.Parse(s));
498 }
499 EMono._zone.SetBGM(list);
500 });
501 break;
502 case "BGM":
503 AddEvent(delegate
504 {
505 LayerDrama.haltPlaylist = true;
506 LayerDrama.maxBGMVolume = true;
507 EMono.Sound.PlayBGM(EMono.core.refs.dictBGM[p2.ToInt()]);
508 bgmChanged = true;
509 });
510 break;
511 case "BGMStay":
512 AddEvent(delegate
513 {
514 EMono.Sound.PlayBGM(EMono.core.refs.dictBGM[p2.ToInt()]);
515 });
516 break;
517 case "lastBGM":
518 AddEvent(delegate
519 {
520 EMono.Sound.StopBGM(p0f, playLastBGM: true);
521 });
522 break;
523 case "stopBGM":
524 AddEvent(delegate
525 {
526 LayerDrama.haltPlaylist = true;
527 EMono.Sound.StopBGM(p0f);
528 EMono.Sound.currentBGM = null;
529 });
530 break;
531 case "sound":
532 AddEvent(delegate
533 {
534 if (p3 != "")
535 {
536 SoundManager.current.MuteBGMFor(float.Parse(p3, CultureInfo.InvariantCulture));
537 }
538 EMono.Sound.Play(p2);
539 });
540 break;
541 case "haltPlaylist":
542 LayerDrama.haltPlaylist = true;
543 break;
544 case "keepBGM":
545 LayerDrama.keepBGM = true;
546 break;
547 case "alphaInOut":
548 AddEvent(delegate
549 {
550 DOTween.Kill(cg);
551 cg.alpha = 1f;
552 cg.DOFade(0f, p0f).SetDelay(0.1f);
553 }, p0f, halt: true);
554 AddEvent(new DramaEventWait((result == 0f) ? 0.1f : result));
555 AddEvent(delegate
556 {
557 DOTween.Kill(cg);
558 cg.alpha = 0f;
559 cg.DOFade(1f, p0f).SetDelay(0.1f);
560 }, p0f);
561 break;
562 case "alphaIn":
563 AddEvent(delegate
564 {
565 DOTween.Kill(cg);
566 cg.alpha = 0f;
567 cg.DOFade(1f, p0f).SetDelay(0.1f);
568 }, p0f);
569 break;
570 case "alphaOut":
571 AddEvent(delegate
572 {
573 DOTween.Kill(cg);
574 cg.alpha = 1f;
575 cg.DOFade(0f, p0f).SetDelay(0.1f);
576 }, p0f, halt: true);
577 break;
578 case "fadeIn":
579 AddEvent(delegate
580 {
581 imageCover.color = ((p3 != null && p3 == "white") ? Color.white : Color.black);
582 cgCover.SetActive(enable: true);
583 cgCover.alpha = 1f;
584 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
585 }, p0f);
586 break;
587 case "fadeOut":
588 AddEvent(delegate
589 {
590 imageCover.color = ((p3 != null && p3 == "white") ? Color.white : Color.black);
591 cgCover.SetActive(enable: true);
592 cgCover.alpha = 0f;
593 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
594 }, p0f, halt: true);
595 break;
596 case "fadeInOut":
597 AddEvent(delegate
598 {
599 imageCover.color = ((p4 != null && p4 == "white") ? Color.white : Color.black);
600 cgCover.SetActive(enable: true);
601 cgCover.alpha = 0f;
602 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
603 }, p0f, halt: true);
604 AddEvent(new DramaEventWait((result == 0f) ? 0.1f : result));
605 AddEvent(delegate
606 {
607 imageCover.color = ((p4 != null && p4 == "white") ? Color.white : Color.black);
608 cgCover.SetActive(enable: true);
609 cgCover.alpha = 1f;
610 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
611 }, p0f);
612 break;
613 case "hideUI":
614 AddEvent(delegate
615 {
616 EMono.ui.Hide(p0f);
617 });
618 break;
619 case "hideDialog":
620 AddEvent(delegate
621 {
622 dialog.SetActive(enable: false);
623 });
624 break;
625 case "fadeEnd":
626 if (p0f == 0f)
627 {
628 p0f = 1f;
629 }
630 AddEvent(delegate
631 {
632 imageCover.color = Color.black;
633 cgCover.SetActive(enable: true);
634 cgCover.alpha = 0f;
635 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
636 }, p0f, halt: true);
637 AddEvent(delegate
638 {
639 dialog.SetActive(enable: false);
640 imageBG.enabled = false;
641 });
642 AddEvent(delegate
643 {
644 DOTween.Kill(cg);
645 cg.alpha = 1f;
646 cg.DOFade(0f, p0f).SetDelay(0.1f);
647 }, p0f, halt: true);
648 break;
649 case "endroll":
651 break;
652 case "showSkip":
653 goSkip.SetActive(value: true);
654 break;
655 case "canCancel":
656 AddEvent(delegate
657 {
658 sequence.canCancel = bool.Parse(p2);
659 });
660 break;
661 case "wait":
662 AddEvent(new DramaEventWait(p0f));
663 break;
664 case "end":
666 break;
667 case "acceptQuest":
669 {
670 break;
671 }
672 AddEvent(delegate
673 {
674 Quest quest = EMono.game.quests.globalList.Where((Quest a) => a.source.id == p2).First();
675 EMono.game.quests.globalList.Remove(quest);
676 EMono.game.quests.Start(quest);
677 });
678 break;
679 case "startQuest":
680 AddEvent(delegate
681 {
682 Quest quest2 = Quest.Create(p2);
683 if (!quest2.HasDLC)
684 {
685 Msg.Say("(Failed DLC check)");
686 }
687 else
688 {
689 EMono.game.quests.Start(quest2);
690 LayerDrama.currentQuest = quest2;
691 if (tg != null && tg.chara != null)
692 {
693 Debug.Log("Starting Quest:" + quest2?.ToString() + "/" + tg.chara.quest?.ToString() + "/" + (quest2 == tg.chara.quest));
694 }
695 }
696 });
697 break;
698 case "setQuestClient":
699 AddEvent(delegate
700 {
701 if (LayerDrama.currentQuest != null)
702 {
703 LayerDrama.currentQuest.SetClient(tg.chara, assignQuest: false);
704 }
705 });
706 break;
707 case "updateJournal":
708 AddEvent(delegate
709 {
711 });
712 break;
713 case "addKeyItem":
714 if (!LayerDrama.fromBook)
715 {
716 AddEvent(delegate
717 {
719 });
720 }
721 break;
722 case "drop":
723 if (!LayerDrama.fromBook)
724 {
725 AddEvent(delegate
726 {
727 Msg.Say("dropReward");
729 Thing t = ThingGen.Create(p2);
731 });
732 }
733 break;
734 case "completeQuest":
735 if (!LayerDrama.fromBook)
736 {
737 AddEvent(delegate
738 {
741 });
742 }
743 break;
744 case "nextPhase":
745 if (!LayerDrama.fromBook)
746 {
747 AddEvent(delegate
748 {
749 EMono.game.quests.Get(p2).NextPhase();
750 });
751 }
752 break;
753 case "addResource":
754 AddEvent(delegate
755 {
756 EMono.BranchOrHomeBranch.resources.Get(p2).Mod(p3.ToInt());
757 });
758 break;
759 case "shake":
760 AddEvent(delegate
761 {
763 });
764 break;
765 case "tutorial":
767 {
768 Tutorial.Play(p2);
769 });
770 break;
771 case "slap":
772 AddEvent(delegate
773 {
775 {
776 tg.chara.PlaySound("whip");
777 tg.chara.Say("slap", tg.chara, EMono.pc);
778 EMono.pc.PlayAnime(AnimeID.Shiver);
779 EMono.pc.DamageHP(5 + EClass.rndHalf(EMono.pc.MaxHP / 3), 919, 100, AttackSource.Condition);
781 });
782 });
783 break;
784 case "destroyItem":
785 AddEvent(delegate
786 {
787 EMono.pc.things.Find(p2).Destroy();
788 });
789 break;
790 case "focus":
791 AddEvent(delegate
792 {
794 EMono.scene.screenElin.focusOption = new BaseGameScreen.FocusOption
795 {
796 pos = pos
797 };
798 });
799 break;
800 case "focusChara":
801 AddEvent(delegate
802 {
803 Point pos2 = EMono._map.FindChara(p2).pos.Copy();
805 {
806 pos = pos2,
807 speed = p3.IsEmpty("2").ToFloat()
808 };
809 });
810 break;
811 case "focusPC":
812 AddEvent(delegate
813 {
814 EMono.scene.screenElin.focusOption = new BaseGameScreen.FocusOption
815 {
816 player = true,
817 speed = p2.IsEmpty("2").ToFloat()
818 };
819 });
820 break;
821 case "focusPos":
822 AddEvent(delegate
823 {
824 EMono.scene.screenElin.focusOption = new BaseGameScreen.FocusOption
825 {
826 pos = new Point(p2.ToInt(), p3.ToInt()),
827 speed = p4.IsEmpty("2").ToFloat()
828 };
829 });
830 break;
831 case "unfocus":
832 AddEvent(delegate
833 {
834 EMono.scene.screenElin.focusOption = null;
835 });
836 break;
837 case "setAlwaysVisible":
838 AddEvent(delegate
839 {
840 LayerDrama.alwaysVisible = EMono._map.FindChara(p2);
841 });
842 break;
843 case "effect":
844 AddEvent(delegate
845 {
846 Point from = new Point(p[1].ToInt(), p[2].ToInt());
847 Effect.Get(p2).Play(from);
848 });
849 break;
850 case "effectEmbarkIn":
851 AddEvent(delegate
852 {
854 Util.Instantiate("UI/Layer/LayerEmbark/EmbarkActor_crystal");
855 });
856 break;
857 case "effectEmbarkOut":
858 AddEvent(delegate
859 {
860 UnityEngine.Object.FindObjectOfType<EmbarkActor>().Hide();
861 });
862 break;
863 case "propEnter":
864 AddEvent(delegate
865 {
866 DramaProp component = Util.Instantiate("Media/Drama/Prop/" + p2).GetComponent<DramaProp>();
867 component.name = p2;
868 if (p3.IsEmpty())
869 {
870 component.transform.position = EMono.scene.cam.transform.position;
871 }
872 else
873 {
874 Point point = new Point(p[1].ToInt(), p[2].ToInt());
875 component.transform.position = point.PositionCenter();
876 }
877 component.Enter();
878 });
879 break;
880 case "propLeave":
881 AddEvent(delegate
882 {
883 GameObject.Find(p2).GetComponent<DramaProp>().Leave();
884 });
885 break;
886 case "destroy":
887 AddEvent(delegate
888 {
889 Chara chara = EMono._map.FindChara(p2);
890 if (chara != null)
891 {
892 chara.Destroy();
893 }
894 else
895 {
896 Debug.Log("Drama.destroy chara not found:" + p2);
897 }
898 });
899 break;
900 case "bout_win":
901 case "bout_lose":
902 AddEvent(delegate
903 {
905 {
907 if (action == "bout_win")
908 {
910 {
911 target = tg.chara
912 });
913 }
914 EMono.pc.MoveZone(zone);
915 });
916 });
917 break;
918 case "save":
919 AddEvent(delegate
920 {
921 EMono.game.Save(isAutoSave: false, silent: true);
922 });
923 break;
924 case "setHour":
925 AddEvent(delegate
926 {
927 EMono.world.date.hour = (int)p0f;
928 EMono.world.date.min = 0;
932 });
933 break;
934 case "%worship":
935 AddEvent(delegate
936 {
938 Tutorial.Reserve("faith");
939 });
940 break;
941 case "replace":
942 AddEvent(delegate
943 {
944 textReplace = text;
945 });
946 break;
947 default:
948 if (!flag)
949 {
950 break;
951 }
952 lastTalk = AddEvent(new DramaEventTalk(actor, delegate
953 {
954 if (!textReplace.IsEmpty())
955 {
956 text = textReplace;
957 textReplace = null;
958 }
959 if (tg != null && (actor == "tg" || actor.IsEmpty()))
960 {
961 text = tg.ApplyTone(text);
962 }
963 return text;
964 })) as DramaEventTalk;
965 lastTalk.center = p2 == "center";
966 break;
967 case "new":
968 case "saveBGM":
969 case "addAffinity":
970 case "checkAffinity":
971 break;
972 }
973 if (!string.IsNullOrEmpty(jump) && !flag2)
975 AddEvent(new DramaEventGoto(jump));
976 }
977 }
978
979 public DramaActor GetActor(string id)
980 {
981 return sequence.GetActor(id);
982 }
983
985 {
986 return sequence.AddEvent(e);
987 }
988
989 public DramaEventMethod AddEvent(Action func, float duration = 0f, bool halt = false)
990 {
991 return AddEvent(new DramaEventMethod(func, duration, halt)) as DramaEventMethod;
992 }
993
994 public DramaEventMethod AddEvent(Action func, Func<string> funcJump)
995 {
996 return AddEvent(new DramaEventMethod(func)
998 jumpFunc = funcJump
999 }) as DramaEventMethod;
1000 }
1001
1002 public DramaEvent CustomEvent(Action func, string step = null, float duration = 0f, bool halt = false)
1003 {
1004 DramaEventMethod dramaEventMethod = new DramaEventMethod(func, duration, halt)
1005 {
1006 step = step
1008 customEvents.Add(dramaEventMethod);
1009 return dramaEventMethod;
1010 }
1011
1012 public void SetDialog(string id = "Default")
1013 {
1014 DialogDrama[] componentsInChildren = GetComponentsInChildren<DialogDrama>(includeInactive: true);
1015 foreach (DialogDrama dialogDrama in componentsInChildren)
1016 {
1017 if ((bool)dialogDrama.portrait)
1018 {
1019 dialogDrama.portrait.imageFull.SetActive(enable: false);
1020 }
1021 dialogDrama.SetActive(enable: false);
1022 if (dialogDrama.name == "Dialog" + id)
1023 {
1024 dialog = dialogDrama;
1025 }
1026 }
1027 }
1028
1029 public bool CheckIF(string IF)
1030 {
1031 if (IF == null || IF.IsEmpty())
1032 {
1033 return true;
1034 }
1035 string[] array = IF.Split(',');
1036 switch (array[0])
1037 {
1038 case "fromBook":
1039 return LayerDrama.fromBook;
1040 case "!fromBook":
1041 return !LayerDrama.fromBook;
1042 case "WindRest":
1043 return EMono._zone is Zone_WindRest;
1044 case "guild_promote":
1045 return Guild.Current.relation.exp >= Guild.Current.relation.ExpToNext;
1046 case "guild_maxpromote":
1047 return Guild.Current.relation.rank >= Guild.Current.relation.MaxRank;
1048 case "scratch_check":
1049 return EMono.game.dateScratch > EMono.game.world.date.GetRaw();
1050 case "sister_money":
1051 return EMono.pc.GetCurrency() >= 10000;
1052 case "fiamaPet":
1053 if (EMono.pc.homeBranch != null)
1054 {
1055 foreach (Chara member in EMono.pc.homeBranch.members)
1056 {
1057 if (member.isDead && member.CanRevive() && member.GetInt(100) != 0)
1058 {
1059 return true;
1060 }
1061 }
1062 }
1063 return false;
1064 case "hasMelilithCurse":
1065 return EMono.pc.HasElement(1206);
1066 case "merchant":
1067 return Guild.Current == Guild.Merchant;
1068 case "fighter":
1069 return Guild.Current == Guild.Fighter;
1070 case "thief":
1071 return Guild.Current == Guild.Thief;
1072 case "mage":
1073 return Guild.Current == Guild.Mage;
1074 case "hasDLC":
1075 return Steam.HasDLC(array[1].ToEnum<ID_DLC>());
1076 case "hasFlag":
1077 return EMono.player.dialogFlags.TryGetValue(array[1], 0) != 0;
1078 case "!hasFlag":
1079 return EMono.player.dialogFlags.TryGetValue(array[1], 0) == 0;
1080 case "hasItem":
1081 return EMono.pc.things.Find(array[1]) != null;
1082 case "isCompleted":
1083 return EMono.game.quests.IsCompleted(array[1]);
1084 case "costRecruit":
1085 if (EMono.Branch != null && EMono.Branch.IsRecruit(tg.chara))
1086 {
1087 return EMono.pc.GetCurrency("money2") >= CalcGold.Hire(tg.chara);
1088 }
1089 return true;
1090 case "costRecruitTicket":
1091 if (EMono.Branch != null && EMono.Branch.IsRecruit(tg.chara))
1092 {
1093 return EMono.pc.things.Find("ticket_resident") != null;
1094 }
1095 return false;
1096 case "letterTrial":
1098 {
1099 return EMono.pc.things.Find("letter_trial") != null;
1100 }
1101 return false;
1102 default:
1103 if (array.Length > 2)
1104 {
1105 int value;
1106 bool flag = EMono.player.dialogFlags.TryGetValue(array[1], out value);
1107 int num = 0;
1108 if (array[1].StartsWith("*"))
1109 {
1110 string text = array[1].TrimStart('*');
1111 Quest quest = EMono.game.quests.Get(text);
1112 if (text == "guild")
1113 {
1114 quest = Guild.CurrentQuest;
1115 }
1116 flag = quest != null;
1117 if (!EMono.game.quests.completedIDs.Contains(text))
1118 {
1119 value = quest?.phase ?? (-1);
1120 }
1121 else
1122 {
1123 value = 999;
1124 flag = true;
1125 }
1126 num = ((!int.TryParse(array[2], out var result)) ? ((quest != null) ? array[2].ToInt(quest.GetType()) : 0) : result);
1127 }
1128 else
1129 {
1130 num = int.Parse(array[2]);
1131 }
1132 switch (array[0])
1133 {
1134 case "=":
1135 if (!flag && num == -1)
1136 {
1137 return true;
1138 }
1139 if (flag && value == num)
1140 {
1141 return true;
1142 }
1143 break;
1144 case "!":
1145 if (!flag || value != num)
1146 {
1147 return true;
1148 }
1149 break;
1150 case ">":
1151 if (flag && value > num)
1152 {
1153 return true;
1154 }
1155 break;
1156 case ">=":
1157 if (flag && value >= num)
1158 {
1159 return true;
1160 }
1161 break;
1162 case "<":
1163 if (!flag || value < num)
1164 {
1165 return true;
1166 }
1167 break;
1168 case "<=":
1169 if (!flag || value <= num)
1170 {
1171 return true;
1172 }
1173 break;
1174 }
1175 return false;
1177 return setup.tag == IF;
1178 }
1179 }
1180
1181 public void Show()
1182 {
1183 SE.PopDrama();
1184 layer.SetActive(enable: true);
1185 layer.cg.alpha = 0f;
1186 layer.cg.DOFade(1f, 0.3f);
1187 }
1188
1189 public void Hide()
1190 {
1191 layer.SetActive(enable: false);
1192 }
1193}
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)
void DamageHP(int dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
Definition: Card.cs:3735
bool HasElement(int ele, int req=1)
Definition: Card.cs:5214
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5404
int GetCurrency(string id="money")
Definition: Card.cs:3652
void RecalculateFOV()
Definition: Card.cs:5616
string GetTalkText(string idTopic, bool stripPun=false, bool useDefault=true)
Definition: Card.cs:6073
Point pos
Definition: Card.cs:55
void Destroy()
Definition: Card.cs:4538
ThingContainer things
Definition: Card.cs:34
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:5423
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
Definition: Chara.cs:10
void OnInsulted()
Definition: Chara.cs:7408
bool CanRevive()
Definition: Chara.cs:4623
override int MaxHP
Definition: Chara.cs:693
FactionBranch homeBranch
Definition: Chara.cs:889
bool isDead
Definition: Chara.cs:374
void MoveZone(string alias)
Definition: Chara.cs:3010
Dictionary< int, BGMData > dictBGM
Definition: CoreRef.cs:369
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:74
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:124
bool Save(bool isAutoSave=false, bool silent=false)
Definition: Game.cs:960
SpatialManager spatials
Definition: Game.cs:152
new World world
Definition: Game.cs:173
QuestManager quests
Definition: Game.cs:179
Definition: Guild.cs:2
static GuildMerchant Merchant
Definition: Guild.cs:29
static QuestGuild CurrentQuest
Definition: Guild.cs:31
static GuildMage Mage
Definition: Guild.cs:25
static Guild Current
Definition: Guild.cs:4
static GuildFighter Fighter
Definition: Guild.cs:23
static GuildThief Thief
Definition: Guild.cs:27
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:2546
void RevealAll(bool reveal=true)
Definition: Map.cs:899
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
Chara chara
Definition: Person.cs:36
Dictionary< string, int > dialogFlags
Definition: Player.cs:841
void ModKeyItem(string alias, int num=1, bool msg=true)
Definition: Player.cs:1914
Definition: Point.cs:9
Point Copy()
Definition: Point.cs:467
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:89
void OnChangeHour()
Definition: Scene.cs:764
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:2706
ZoneEventManager events
Definition: Zone.cs:40
ZoneInstance instance
Definition: Zone.cs:52
Card AddCard(Card t, Point point)
Definition: Zone.cs:1893