예제 #1
0
 public DialogueResponse(string aText, float aLoyaltyEffect, string followUpText = "")
 {
     text          = aText;
     loyaltyEffect = aLoyaltyEffect;
     if (followUpText.Length > 0)
     {
         followUpMoment = new TextDialogueMoment(followUpText);
     }
 }
    public void DialogResponsePicked(int responseIndex)
    {
        DialogueResponse dialogueResponse = ((ResponseDialogueMoment)selectedDialogue.dialogMoments[momentIndex]).responses[responseIndex];
        float            loyaltyChange    = dialogueResponse.loyaltyEffect;

        selectedCharacter.ChangeLoyalty(loyaltyChange);

        DialogueMoment followUpMoment = dialogueResponse.followUpMoment;

        Delegates.Instance.ContinueDialogueListeners(followUpMoment);
    }
    public void LoadDialogueMoment(Character selectedCharacter, DialogueMoment dialogueMoment, bool newDialogue)
    {
        if (newDialogue)
        {
            textButton.interactable = true;
            advisorAdvice           = "Now that the formalities are out of the way. Let's get down to business.";
            advisorAdvice          += "\n\nTalk to a character and try to persuade them to join your cause.";
        }

        if (dialogueMoment == null)
        {
            LoadAdvisorText();
            return;
        }

        SwapCharacterPanels(selectedCharacter, dialogueMoment.userMoment);
        bool isTextMoment     = dialogueMoment is TextDialogueMoment;
        bool isResponseMoment = dialogueMoment is ResponseDialogueMoment;

        if (isTextMoment)
        {
            textBox.text = ((TextDialogueMoment)dialogueMoment).text;
        }
        else if (isResponseMoment)
        {
            DialogueResponse[] dialogueResponses = ((ResponseDialogueMoment)dialogueMoment).responses;
            for (int i = 0; i < buttonTexts.Length; ++i)
            {
                if (i < dialogueResponses.Length)
                {
                    buttonTexts[i].transform.parent.gameObject.SetActive(true);
                    buttonTexts[i].text = dialogueResponses[i].text;
                }
                else
                {
                    buttonTexts[i].transform.parent.gameObject.SetActive(false);
                }
            }
        }

        textPanel.Show(isTextMoment);
        responsesPanel.Show(isResponseMoment);
    }
    public void ContinueDialoguePicked(DialogueMoment followUpMoment)
    {
        // Happens on initial load
        if (selectedDialogue == null)
        {
            return;
        }

        if (followUpMoment != null)
        {
            Delegates.Instance.LoadDialogueMomentListeners(selectedCharacter, followUpMoment, false);
            return;
        }

        ++momentIndex;
        DialogueMoment nextMoment = null;

        if (momentIndex < selectedDialogue.dialogMoments.Length)
        {
            nextMoment = selectedDialogue.dialogMoments[momentIndex];
        }
        Delegates.Instance.LoadDialogueMomentListeners(selectedCharacter, nextMoment, false);

        if (nextMoment == null)
        {
            // Finished with conversation with loyal advisor
            if (selectedCharacter.name == GameManager.Instance.advisor.name)
            {
                // TODO: Move load characters to character select
                GameManager.Instance.LoadCharacters();
                Delegates.Instance.ScreenSelectListeners(Delegates.ScreenType.DOSSIER);
            }
            else
            {
                Delegates.Instance.ConversationOverListeners(selectedCharacter);
            }
        }
    }