예제 #1
0
    public void StartDialogue(DialogueSO dialogueSO)
    {
        if (!dialogueSO.isAvailable)
        {
            return;
        }
        if (ConversationStarted != null)
        {
            ConversationStarted.Raise();
        }
        //animator.SetTrigger("InDialogue");

        playerTextUI.text = null;
        npcTextUI.text    = null;
        HideOptions();
        DialogueUI.SetActive(false);

        dialogue = dialogueSO;
        if (playerNameTxtUI != null)
        {
            playerNameTxtUI.text = playerName.Value;
        }
        currentSentence = dialogue.startingSentence;

        DisplayDialogue();
    }
    public void UpdateDialogue(DialogueSO newDialogue)
    {
        PlayerController.Player.PlayerControllable = false;
        CurrentDialogue           = newDialogue;
        Text.maxVisibleCharacters = 0;
        gameObject.SetActive(true);

        StartCoroutine(PlayDialogue());
    }
예제 #3
0
        private void OnEnable()
        {
            guiFactory = new DialogueEditorFactory(this);

            Selection.selectionChanged += () => {
                if (Selection.activeObject is DialogueSO dialogue)
                {
                    selectedDialogue = dialogue;
                    Repaint();
                }
            };
        }
예제 #4
0
    // METHODS

    public void PlayDialogue(DialogueSO dialogue)
    {
        currentDialogueIndex = 0;
        Text textBox = textBoxes[dialogue.textBoxIndex[currentDialogueIndex]];

        textBox.text = dialogue.dialogueTextElements[currentDialogueIndex];
        textBox.GetComponent <Animator>().Play("Text_Fade_In");

        currentTextBox  = textBox;
        currentDialogue = dialogue;

        TriggerButtons(false);
    }
 public void RefreshDialogueContent(DialogueSO newContent)
 {
     title.text       = newContent.Title;
     description.text = newContent.Description;
     if (CharacterInteraction.Instance != null && newContent.ButtonSprite.Length > 0)
     {
         buttonImage.sprite = newContent.ButtonSprite[CharacterInteraction.Instance.GetControllerId()];
     }
     else
     {
         buttonImage.sprite = null;
     }
 }
예제 #6
0
 public DialogueCsvRow(DialogueSO dialogueSO, DialogueNode dialogueNode)
 {
     DialogueName      = dialogueSO.name;
     DialogueNodeName  = dialogueNode.name;
     SpearkerName      = dialogueNode.Spearker?.name;
     Text              = dialogueNode.Text;
     NextDialogues     = string.Join("|", dialogueNode.NextDialogueNodes);
     PreviousDialogues = string.Join("|", dialogueNode.PreviousDialogueNodes);
     Rect              = string.Join("|", new float[] {
         dialogueNode.Rect.position.x,
         dialogueNode.Rect.position.y,
         dialogueNode.Rect.width,
         dialogueNode.Rect.height
     });
 }
예제 #7
0
    void ConstructToolBar()
    {
        toolbar = new Toolbar();
        //var createNodeBtn = new Button(clickEvent: () => { graphView.RenderNode(graphView.CreateDialogueNode("Dialogue Node")); })
        //{
        //    text = "Create Dialogue Node"
        //};

        var btn = new Button(clickEvent: () =>
        {
            DialogueSO dialogue = (DialogueSO)sentenceField.value;
            startingSentence    = dialogue.startingSentence;
            if (startingSentence != null)
            {
                rootVisualElement.Remove(graphView);
                Construct();
                graphView.AutoGenerateNodes(startingSentence);
            }
        })
        {
            text = "Show Dialogue Graph"
        };

        var saveBtn = new Button(clickEvent: () => { graphView.SaveConnections(); })
        {
            text = "Save"
        };
        var clearBtn = new Button(clickEvent: () => { Clear(); })
        {
            text = "Clear"
        };

        sentenceField            = new ObjectField();
        sentenceField.objectType = typeof(DialogueSO);
        toolbar.Add(sentenceField);
        toolbar.Add(btn);
        toolbar.Add(saveBtn);
        toolbar.Add(clearBtn);


        rootVisualElement.Add(toolbar);
    }
예제 #8
0
 public DialogueCsvHandler(DialogueSO dialogue)
 {
     this.dialogue = dialogue;
 }
 public DialogueEditorStyles(DialogueSO dialogue)
 {
     this.dialogue = dialogue;
 }
 public DialogueRepository(DialogueSO currentDialogue)
 {
     this.currentDialogue = currentDialogue;
 }