private bool CheckEnterConditionsByTags(List <string> tags) { List <string> requireTags = new List <string>(); List <string> withoutTags = new List <string>(); foreach (var tag in tags) { string op, data; StoryScript.StandardizationTag(tag, out op, out data); if (op == "require") { requireTags.Add(data); } else if (op == "after") { requireTags.Add(data); } else if (op == "without") { withoutTags.Add(data); } } return(FlagBag.Instance.HasFlags(requireTags) && FlagBag.Instance.WithoutFlags(withoutTags)); }
private void Update() { if (!nextStep) { return; } if (!firstStep) { for (int i = 0; i < buttons.childCount; i++) { Destroy(buttons.GetChild(i).gameObject); } panelSizedButton.interactable = false; } string sentences = ""; while (inkStory.canContinue) { sentences += inkStory.Continue(); var tags = inkStory.currentTags; if (storyScript) { foreach (var tag in tags) { storyScript.InProcessTag(tag, this, inkStory); } } else if ((inkFile.name == "$cat_whitey") || (inkFile.name == "$cat_cutey")) { foreach (var tag in tags) { string op, data; StoryScript.StandardizationTag(tag, out op, out data); if (op == "upd_info") { PlayerInfo.UpdateFromInkStory(inkStory); } } StoryManager.Instance.refreshFlag = true; } } if (sentences != "") { SetText(sentences); if (speaker) { SetName(speaker.npcName); } else { nameText.text = ""; } LogPanel.Instance.AddLog(nameText.text, sentences.Replace("$", string.Empty), false); } foreach (var choice in inkStory.currentChoices) { panelSizedButton.interactable = true; panelSizedButton.onClick.RemoveAllListeners(); if (choice.text == "n") { var path = choice.pathStringOnChoice; panelSizedButton.onClick.AddListener(() => { ChoicePathSelected(path); }); } else { panelSizedButton.onClick.AddListener( () => { if (!isFinish) { ChoicePathSelected(); } panelSizedButton.interactable = false; } ); var btn = Instantiate(button).GetComponent <Button>(); btn.transform.SetParent(buttons); btn.transform.localScale = Vector3.one; var btnText = btn.GetComponentInChildren <TextMeshProUGUI>(); btnText.text = choice.text; var path = choice.pathStringOnChoice; btn.onClick.AddListener(() => { ChoicePathSelected(path, true, choice.text); }); } } nextStep = false; if (firstStep && sentences == "" && inkStory.currentChoices.Count == 1) { ChoicePathSelected(inkStory.currentChoices[0].pathStringOnChoice, true, inkStory.currentChoices[0].text); } firstStep = false; if (!inkStory.canContinue && inkStory.currentChoices.Count == 0) { EndTalk(); } }