Beispiel #1
0
        private void MaybeAddDialogues(Dialog dialog, Narrator narrator, Building building)
        {
            var dialogues = this.dialogueRepository.Find(d => d.Narrator == narrator && d.IsParent)
                            .Where(dialogue => dialogue.IsAvailable())
                            .ToList();

            if (dialogues.Count == 0)
            {
                return;
            }

            var label     = I18N.Instance.Get("ui_talk").ToString();
            var character = CharacterManager.Instance.Character;

            if (!dialogues.All(d => character.IsDialogueRead(d)))
            {
                label += " <color=yellow>(?)</color>";
            }

            dialog.AddOption(label, () =>
            {
                Timer.Instance.WaitForFixedUpdate(() =>
                {
                    var inner = Dialog.Instance.Clear();

                    inner.AddTitle(dialog.Title).AddSpace();

                    foreach (var dialogue in dialogues)
                    {
                        var title = dialogue.Title.ToString();

                        if (!character.Data.ReadDialogues.Contains(dialogue.Id))
                        {
                            title += " <color=yellow>(?)</color>";
                        }

                        inner.AddOption(title, () => DialogueView.Instance.Show(dialogue));
                    }

                    inner.AddSpace().AddOption(I18N.Instance.Get("ui_cancel"), null, Color.red);

                    Dialog.Instance.Show();
                });
            });
        }