2using System.Collections.Generic;
3using System.Globalization;
15 public CanvasGroup
cg;
49 public List<DramaChoice>
_choices =
new List<DramaChoice>();
53 public Dictionary<string, string>
dictLocalize =
new Dictionary<string, string>();
77 public static Dictionary<string, ExcelData>
dictCache =
new Dictionary<string, ExcelData>();
94 cgCover.SetActive(enable:
false);
95 endroll.SetActive(enable:
false);
105 sequence.lastStep = (sequence.lastlastStep =
setup.
step);
128 string text = PackageIterator.GetFiles(
"Dialog/Drama/" +
setup.
book +
".xlsx").LastOrDefault()?.FullName ?? (CorePath.DramaData + setup.book +
".xlsx");
130 if (excelData !=
null && excelData.
IsModified())
134 if (excelData ==
null)
138 excelData.maxEmptyRows = 10;
139 excelData.path = text;
149 string text2 =
item[
"id"];
150 if (!text2.IsEmpty())
156 dictLocalize[text2] = (
"[DUPLICATE ID '" + text2 +
"']\n").TagColor(
Color.red) + text4;
157 Debug.LogError(
"#drama duplicate id '" + text2 +
"' at " + text +
"\n" + text4 +
" -> " + text3);
167 for (
int i = 0; i < list.Count; i++)
215 string[] array = (
item.ContainsKey(
"action") ?
item[
"action"].Split(
'/') :
null);
216 string action = ((array !=
null) ? array[0] :
null);
217 string text2 = (
item.ContainsKey(
"step") ?
item[
"step"] :
null);
226 string actor = (
item.ContainsKey(
"actor") ?
item[
"actor"] :
"#1");
227 string[] p = (
item.ContainsKey(
"param") ?
item[
"param"].Split(
',') :
new string[0]);
228 string p2 = ((p.Length != 0) ? p[0] :
"");
229 string p3 = ((p.Length > 1) ? p[1] :
"");
230 string p4 = ((p.Length > 2) ? p[2] :
"");
231 float.TryParse(p2, out var p0f);
232 float.TryParse(p3, out var result);
233 bool flag = !
item[
"text_JP"].IsEmpty();
234 item.TryGetValue(
"text_JP");
240 string key =
item[
"id"];
247 text =
item.TryGetValue(
"text_EN");
255 if (flag && text.StartsWith(
"$") &&
tg !=
null &&
tg.
hasChara)
257 string text3 = text.Split(
' ')[0];
260 string jump = (
item.ContainsKey(
"jump") ?
item[
"jump"] :
null);
261 string text4 = (
item.ContainsKey(
"if") ?
item[
"if"] :
null);
262 string iF = (
item.ContainsKey(
"if2") ?
item[
"if2"] :
null);
263 string cHECK = (
item.ContainsKey(
"check") ?
item[
"check"] :
null);
265 if (text2 !=
null && !
sequence.
steps.ContainsKey(text2) && action !=
"choice" && action !=
"cancel")
281 if (action ==
"reload")
294 case "disableFullPortrait":
297 sequence.fullPortrait =
false;
306 sequence.skipJump = p2;
313 EMono.Sound.haltUpdate =
true;
318 SoundManager.ForceBGM();
324 if (p2.StartsWith(
"*"))
326 Quest quest3 = EMono.game.quests.Get(p2.TrimStart(
'*'));
327 quest3?.ChangePhase(p3.ToInt(quest3.GetType()));
331 EMono.player.dialogFlags[p2] = (p3.IsEmpty() ? 1 : int.Parse(p3));
342 }, 0.01f, halt:
true);
360 lastTalk.canCancel =
true;
361 lastTalk.idCancelJump = jump;
374 if (array.Length > 1)
379 text =
"deQuest".lang();
383 text =
"depart".lang();
387 text =
"letsTalk".lang();
391 text =
"daBuy".lang();
395 text =
"daSell".lang();
399 text =
"daGive".lang();
403 text =
"daTrade".lang();
436 dramaActor.owner.tempName = text;
475 imageBG.enabled = false;
479 imageBG.enabled = true;
480 imageBG.sprite = Resources.Load<Sprite>(
"Media/Graphics/Image/Drama/" + p2);
487 Util.Instantiate<Transform>(
"Media/Graphics/Image/Drama/" + p2,
layer).SetAsFirstSibling();
495 dialog.imageBgAdv.enabled = false;
499 dialog.imageBgAdv.enabled = true;
500 dialog.imageBgAdv.sprite = Resources.Load<Sprite>(
"Media/Graphics/Image/Drama/" + p2);
507 DramaActor.useGlitch =
true;
519 LayerDrama.haltPlaylist =
false;
521 EMono.Sound.currentBGM =
null;
528 List<int> list =
new List<int>();
530 foreach (
string s
in array2)
532 list.Add(
int.Parse(s));
540 LayerDrama.haltPlaylist =
true;
541 LayerDrama.maxBGMVolume =
true;
561 LayerDrama.haltPlaylist =
true;
563 EMono.Sound.currentBGM =
null;
571 SoundManager.current.MuteBGMFor(
float.Parse(p3, CultureInfo.InvariantCulture));
578 LayerDrama.haltPlaylist =
true;
581 LayerDrama.keepBGM =
true;
588 cg.DOFade(0f, p0f).SetDelay(0.1f);
595 cg.DOFade(1f, p0f).SetDelay(0.1f);
603 cg.DOFade(1f, p0f).SetDelay(0.1f);
611 cg.DOFade(0f, p0f).SetDelay(0.1f);
617 imageCover.color = ((p3 !=
null && p3 ==
"white") ?
Color.white :
Color.black);
618 cgCover.SetActive(enable:
true);
620 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
626 imageCover.color = ((p3 !=
null && p3 ==
"white") ?
Color.white :
Color.black);
627 cgCover.SetActive(enable:
true);
629 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
635 imageCover.color = ((p4 !=
null && p4 ==
"white") ?
Color.white :
Color.black);
636 cgCover.SetActive(enable:
true);
638 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
643 imageCover.color = ((p4 !=
null && p4 ==
"white") ?
Color.white :
Color.black);
644 cgCover.SetActive(enable:
true);
646 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
658 dialog.SetActive(enable:
false);
668 imageCover.color =
Color.black;
669 cgCover.SetActive(enable:
true);
671 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
675 dialog.SetActive(enable:
false);
676 imageBG.enabled =
false;
682 cg.DOFade(0f, p0f).SetDelay(0.1f);
689 goSkip.SetActive(value:
true);
694 sequence.canCancel =
bool.Parse(p2);
706 int num =
int.Parse(p2);
732 Msg.Say(
"(Failed DLC check)");
736 EMono.game.quests.Start(quest2);
737 LayerDrama.currentQuest = quest2;
738 if (tg != null && tg.chara != null)
740 Debug.Log(
"Starting Quest:" + quest2?.ToString() +
"/" + tg.chara.quest?.ToString() +
"/" + (quest2 == tg.chara.quest));
745 case "setQuestClient":
750 LayerDrama.currentQuest.SetClient(tg.chara, assignQuest: false);
754 case "updateJournal":
765 int num2 = p3.ToInt();
782 case "completeQuest":
816 case "getAchievement":
819 if (
new string[2] {
"ONEV",
"NERUN2" }.Contains(p2))
832 chara3.renderer.ShowBossText();
862 int num3 = p3.ToInt();
863 thing?.
ModNum((num3 == 0) ? (-1) : (-num3));
889 speed = p3.IsEmpty(
"2").ToFloat()
899 speed = p2.IsEmpty(
"2").ToFloat()
908 pos =
new Point(p2.ToInt(), p3.ToInt()),
909 speed = p4.IsEmpty(
"2").ToFloat()
916 EMono.scene.screenElin.focusOption =
null;
919 case "setAlwaysVisible":
928 Point from =
new Point(p[1].ToInt(), p[2].ToInt());
932 case "effectEmbarkIn":
939 case "effectEmbarkOut":
952 component.transform.position = EMono.scene.cam.transform.position;
956 Point point = new Point(p[1].ToInt(), p[2].ToInt());
957 component.transform.position = point.PositionCenter();
965 GameObject.Find(p2).GetComponent<DramaProp>().Leave();
978 Debug.Log(
"Drama.destroy chara not found:" + p2);
989 if (action ==
"bout_win")
1015 EMono.world.date.hour = (int)p0f;
1016 EMono.world.date.min = 0;
1042 elinDramaParseActionEventArgs.
SetData(action);
1044 if (elinDramaParseActionEventArgs.
IsUsed)
1059 if (
tg !=
null && (actor ==
"tg" || actor.IsEmpty()))
1061 text = (enableTone ? tg.ApplyTone(text) : text);
1065 lastTalk.center = p2 ==
"center";
1070 case "checkAffinity":
1073 if (!
string.IsNullOrEmpty(jump) && !flag2)
1102 public DramaEvent CustomEvent(Action func,
string step =
null,
float duration = 0f,
bool halt =
false)
1108 customEvents.Add(dramaEventMethod);
1109 return dramaEventMethod;
1112 public void SetDialog(
string id =
"Default")
1114 DialogDrama[] componentsInChildren = GetComponentsInChildren<DialogDrama>(includeInactive:
true);
1115 foreach (
DialogDrama dialogDrama
in componentsInChildren)
1121 dialogDrama.SetActive(enable:
false);
1122 if (dialogDrama.name ==
"Dialog" +
id)
1124 dialog = dialogDrama;
1129 public bool CheckIF(
string IF)
1131 if (IF ==
null || IF.IsEmpty())
1135 string[] array = IF.Split(
',');
1138 case "garden_bloom":
1147 case "wedding_whoring":
1149 case "duponne_mino":
1151 case "duponne_rescued":
1157 case "duponne_gone":
1163 case "duponne_killed":
1175 case "nerun_nadenade":
1178 return EMono.player.stats.death2 == 0;
1181 case "nerun_nadenade2":
1183 return EMono.player.stats.death2 >= 100;
1188 case "guild_promote":
1190 case "guild_maxpromote":
1192 case "scratch_check":
1194 case "sister_money":
1208 case "hasMelilithCurse":
1217 return Guild.CurrentDrama ==
Guild.
Mage;
1224 case "!hasMiscreation":
1242 case "costRecruitTicket":
1255 if (array.Length > 2)
1260 if (array[1].StartsWith(
"*"))
1262 string text = array[1].TrimStart(
'*');
1264 if (text ==
"guild")
1268 flag = quest !=
null;
1271 value = quest?.
phase ?? (-1);
1278 num = ((!
int.TryParse(array[2], out var result)) ? ((quest !=
null) ? array[2].ToInt(quest.GetType()) : 0) : result);
1282 num =
int.Parse(array[2]);
1287 if (!flag && num == -1)
1291 if (flag && value == num)
1297 if (!flag || value != num)
1303 if (flag && value > num)
1309 if (flag && value >= num)
1315 if (!flag || value < num)
1321 if (!flag || value <= num)
1329 return setup.tag == IF;
1336 layer.SetActive(enable:
true);
1337 layer.cg.alpha = 0f;
1338 layer.
cg.DOFade(1f, 0.3f);
1343 layer.SetActive(enable:
false);
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
int GetInt(int id, int? defaultInt=null)
static void PublishEvent(string eventId, object data=null)
static void SetNormalRarity(bool fixedMat=false)
GlobalCharaList globalCharas
int GetCurrency(string id="money")
string GetTalkText(string idTopic, bool stripPun=false, bool useDefault=true)
void ModNum(int a, bool notify=true)
bool HasElement(int ele, bool includeNagative=false)
void ModAffinity(Chara c, int a, bool show=true, bool showOnlyEmo=false)
void Slap(Chara c, bool slapToDeath=false)
void MoveZone(string alias)
static string DramaDataLocal
Dictionary< int, BGMData > dictBGM
int GetRaw(int offsetHours=0)
void AddChoice(DramaChoice choice)
Dictionary< string, string > dictLocalize
DramaEventMethod AddEvent(Action func, float duration=0f, bool halt=false)
DramaEvent CustomEvent(Action func, string step=null, float duration=0f, bool halt=false)
static Dictionary< string, ExcelData > dictCache
void ParseLine(Dictionary< string, string > item)
void AddCustomEvents(string idCustom="Resident")
DramaEventMethod AddEvent(Action func, Func< string > funcJump)
void SetDialog(string id="Default")
List< DramaChoice > _choices
Dictionary< string, string > customTalkTopics
List< DramaEvent > customEvents
DramaSequence Play(DramaSetup setup)
DramaEvent AddEvent(DramaEvent e)
List< DramaEvent > events
DramaActor AddActor(string id, Person person)
DramaActor GetActor(string id)
DramaEvent AddEvent(DramaEvent e)
Dictionary< string, int > steps
static FactionBranch BranchOrHomeBranch
static SoundManager Sound
static FactionBranch Branch
virtual void SetData(T newData)
static Effect Get(Effect original)
void Play(float delay, Point from, float fixY=0f, Point to=null, Sprite sprite=null)
List< Dictionary< string, string > > BuildList(string sheetName="_default")
HomeResourceManager resources
bool Save(bool isAutoSave=false, bool silent=false)
static Guild CurrentDrama
static GuildMerchant Merchant
static QuestGuild CurrentQuest
static GuildFighter Fighter
BaseHomeResource Get(string id)
static LayerDrama Instance
static Quest currentQuest
static Religion currentReligion
void ShowScreenLock(string id)
Layer SetOnKill(Action action)
Chara FindChara(string id)
void RevealAll(bool reveal=true)
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
bool HasElement(int ele, bool excludePC=false)
Dictionary< string, int > dialogFlags
void ModKeyItem(string alias, int num=1, bool msg=true)
HashSet< string > completedIDs
bool IsCompleted(string id)
Quest Start(string id, string idGlobalChara)
static Quest Create(string _id, string _idPerson=null, Chara c=null, bool assignQuest=true)
virtual SourceQuest.Row source
void JoinFaith(Chara c, ConvertType type=ConvertType.Default)
static void ShakeCam(string id="default", float magnitude=1f)
static void GetAchievement(ID_Achievement id)
static bool HasDLC(ID_DLC id)
static Thing Create(string id, int idMat=-1, int lv=-1)
static void Reserve(string idStep, Action onBeforePlay=null)
static void Play(string idStep)
static Transform Instantiate(string path, Component parent=null)
void AddPreEnter(ZonePreEnterEvent e, bool executeIfActiveZone=true)
void SetBGM(List< int > ids, bool refresh=true, float fadeDuration=0f)
Card AddCard(Card t, Point point)
bool IsBelow(int _major, int _minor, int _batch)