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>();
75 public static Dictionary<string, ExcelData>
dictCache =
new Dictionary<string, ExcelData>();
90 cgCover.SetActive(enable:
false);
91 endroll.SetActive(enable:
false);
101 sequence.lastStep = (sequence.lastlastStep =
setup.
step);
124 string text = CorePath.DramaData + setup.book +
".xlsx";
126 if (excelData !=
null && excelData.
IsModified())
130 if (excelData ==
null)
134 excelData.maxEmptyRows = 10;
135 excelData.path = text;
142 path = CorePath.DramaDataLocal + setup.book +
".xlsx"
145 string text2 =
item[
"id"];
146 if (!text2.IsEmpty() && !
item[
"text"].IsEmpty())
157 for (
int i = 0; i < list.Count; i++)
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);
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");
230 string key =
item[
"id"];
237 text =
item.TryGetValue(
"text_EN");
245 if (flag && text.StartsWith(
"$") &&
tg !=
null &&
tg.
hasChara)
247 string text3 = text.Split(
' ')[0];
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);
255 if (text2 !=
null && !
sequence.
steps.ContainsKey(text2) && action !=
"choice" && action !=
"cancel")
271 if (action ==
"reload")
284 case "disableFullPortrait":
287 sequence.fullPortrait =
false;
296 sequence.skipJump = p2;
303 EMono.Sound.haltUpdate =
true;
308 SoundManager.ForceBGM();
314 if (p2.StartsWith(
"*"))
316 Quest quest3 = EMono.game.quests.Get(p2.TrimStart(
'*'));
317 quest3?.ChangePhase(p3.ToInt(quest3.GetType()));
321 EMono.player.dialogFlags[p2] = (p3.IsEmpty() ? 1 : int.Parse(p3));
332 }, 0.01f, halt:
true);
350 lastTalk.canCancel =
true;
351 lastTalk.idCancelJump = jump;
364 if (array.Length > 1)
369 text =
"deQuest".lang();
373 text =
"depart".lang();
377 text =
"letsTalk".lang();
381 text =
"daBuy".lang();
385 text =
"daSell".lang();
389 text =
"daGive".lang();
393 text =
"daTrade".lang();
426 dramaActor.owner.tempName = text;
465 imageBG.enabled = false;
469 imageBG.enabled = true;
470 imageBG.sprite = Resources.Load<Sprite>(
"Media/Graphics/Image/Drama/" + p2);
477 Util.Instantiate<Transform>(
"Media/Graphics/Image/Drama/" + p2,
layer).SetAsFirstSibling();
483 DramaActor.useGlitch =
true;
495 LayerDrama.haltPlaylist =
false;
497 EMono.Sound.currentBGM =
null;
504 List<int> list =
new List<int>();
506 foreach (
string s
in array2)
508 list.Add(
int.Parse(s));
516 LayerDrama.haltPlaylist =
true;
517 LayerDrama.maxBGMVolume =
true;
537 LayerDrama.haltPlaylist =
true;
539 EMono.Sound.currentBGM =
null;
547 SoundManager.current.MuteBGMFor(
float.Parse(p3, CultureInfo.InvariantCulture));
553 LayerDrama.haltPlaylist =
true;
556 LayerDrama.keepBGM =
true;
563 cg.DOFade(0f, p0f).SetDelay(0.1f);
570 cg.DOFade(1f, p0f).SetDelay(0.1f);
578 cg.DOFade(1f, p0f).SetDelay(0.1f);
586 cg.DOFade(0f, p0f).SetDelay(0.1f);
592 imageCover.color = ((p3 !=
null && p3 ==
"white") ?
Color.white :
Color.black);
593 cgCover.SetActive(enable:
true);
595 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
601 imageCover.color = ((p3 !=
null && p3 ==
"white") ?
Color.white :
Color.black);
602 cgCover.SetActive(enable:
true);
604 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
610 imageCover.color = ((p4 !=
null && p4 ==
"white") ?
Color.white :
Color.black);
611 cgCover.SetActive(enable:
true);
613 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
618 imageCover.color = ((p4 !=
null && p4 ==
"white") ?
Color.white :
Color.black);
619 cgCover.SetActive(enable:
true);
621 cgCover.DOFade(0f, p0f).SetDelay(0.1f);
633 dialog.SetActive(enable:
false);
643 imageCover.color =
Color.black;
644 cgCover.SetActive(enable:
true);
646 cgCover.DOFade(1f, p0f).SetDelay(0.1f);
650 dialog.SetActive(enable:
false);
651 imageBG.enabled =
false;
657 cg.DOFade(0f, p0f).SetDelay(0.1f);
664 goSkip.SetActive(value:
true);
669 sequence.canCancel =
bool.Parse(p2);
696 Msg.Say(
"(Failed DLC check)");
700 EMono.game.quests.Start(quest2);
701 LayerDrama.currentQuest = quest2;
702 if (tg != null && tg.chara != null)
704 Debug.Log(
"Starting Quest:" + quest2?.ToString() +
"/" + tg.chara.quest?.ToString() +
"/" + (quest2 == tg.chara.quest));
709 case "setQuestClient":
714 LayerDrama.currentQuest.SetClient(tg.chara, assignQuest: false);
718 case "updateJournal":
745 case "completeQuest":
827 speed = p3.IsEmpty(
"2").ToFloat()
837 speed = p2.IsEmpty(
"2").ToFloat()
846 pos =
new Point(p2.ToInt(), p3.ToInt()),
847 speed = p4.IsEmpty(
"2").ToFloat()
854 EMono.scene.screenElin.focusOption =
null;
857 case "setAlwaysVisible":
866 Point from =
new Point(p[1].ToInt(), p[2].ToInt());
870 case "effectEmbarkIn":
874 Util.Instantiate(
"UI/Layer/LayerEmbark/EmbarkActor_crystal");
877 case "effectEmbarkOut":
886 DramaProp component =
Util.Instantiate(
"Media/Drama/Prop/" + p2).GetComponent<DramaProp>();
890 component.transform.position = EMono.scene.cam.transform.position;
894 Point point = new Point(p[1].ToInt(), p[2].ToInt());
895 component.transform.position = point.PositionCenter();
903 GameObject.Find(p2).GetComponent<DramaProp>().Leave();
916 Debug.Log(
"Drama.destroy chara not found:" + p2);
927 if (action ==
"bout_win")
947 EMono.world.date.hour = (int)p0f;
948 EMono.world.date.min = 0;
979 if (
tg !=
null && (actor ==
"tg" || actor.IsEmpty()))
981 text = (enableTone ? tg.ApplyTone(text) : text);
985 lastTalk.center = p2 ==
"center";
990 case "checkAffinity":
993 if (!
string.IsNullOrEmpty(jump) && !flag2)
1022 public DramaEvent CustomEvent(Action func,
string step =
null,
float duration = 0f,
bool halt =
false)
1028 customEvents.Add(dramaEventMethod);
1029 return dramaEventMethod;
1032 public void SetDialog(
string id =
"Default")
1034 DialogDrama[] componentsInChildren = GetComponentsInChildren<DialogDrama>(includeInactive:
true);
1035 foreach (
DialogDrama dialogDrama
in componentsInChildren)
1041 dialogDrama.SetActive(enable:
false);
1042 if (dialogDrama.name ==
"Dialog" +
id)
1044 dialog = dialogDrama;
1049 public bool CheckIF(
string IF)
1051 if (IF ==
null || IF.IsEmpty())
1055 string[] array = IF.Split(
',');
1058 case "duponne_mino":
1060 case "duponne_rescued":
1066 case "duponne_gone":
1072 case "duponne_killed":
1088 case "guild_promote":
1090 case "guild_maxpromote":
1092 case "scratch_check":
1094 case "sister_money":
1108 case "hasMelilithCurse":
1117 return Guild.CurrentDrama ==
Guild.
Mage;
1140 case "costRecruitTicket":
1153 if (array.Length > 2)
1158 if (array[1].StartsWith(
"*"))
1160 string text = array[1].TrimStart(
'*');
1162 if (text ==
"guild")
1166 flag = quest !=
null;
1169 value = quest?.
phase ?? (-1);
1176 num = ((!
int.TryParse(array[2], out var result)) ? ((quest !=
null) ? array[2].ToInt(quest.GetType()) : 0) : result);
1180 num =
int.Parse(array[2]);
1185 if (!flag && num == -1)
1189 if (flag && value == num)
1195 if (!flag || value != num)
1201 if (flag && value > num)
1207 if (flag && value >= num)
1213 if (!flag || value < num)
1219 if (!flag || value <= num)
1227 return setup.tag == IF;
1234 layer.SetActive(enable:
true);
1235 layer.cg.alpha = 0f;
1236 layer.
cg.DOFade(1f, 0.3f);
1241 layer.SetActive(enable:
false);
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
int GetInt(int id, int? defaultInt=null)
static void SetNormalRarity(bool fixedMat=false)
GlobalCharaList globalCharas
void DamageHP(int dmg, AttackSource attackSource=AttackSource.None, Card origin=null)
bool HasElement(int ele, int req=1)
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
int GetCurrency(string id="money")
string GetTalkText(string idTopic, bool stripPun=false, bool useDefault=true)
void PlayAnime(AnimeID id, bool force=false)
void Say(string lang, string ref1=null, string ref2=null)
void MoveZone(string alias)
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 int rndHalf(int a)
static FactionBranch BranchOrHomeBranch
static SoundManager Sound
static FactionBranch Branch
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)
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)
virtual SourceQuest.Row source
static Quest Create(string _id, string _idPerson=null, Chara c=null)
void JoinFaith(Chara c, ConvertType type=ConvertType.Default)
static void ShakeCam(string id="default", float magnitude=1f)
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)
void AddPreEnter(ZonePreEnterEvent e, bool executeIfActiveZone=true)
void SetBGM(List< int > ids, bool refresh=true)
Card AddCard(Card t, Point point)