コード例 #1
0
 public DialogueSystem(
     ITextPresenter textPresenter,
     ICoroutineAccessor coroutineAccessor,
     IDialogueSystemElements elements)
 {
     this.textPresenter     = textPresenter;
     this.coroutineAccessor = coroutineAccessor;
     Elements = elements;
 }
コード例 #2
0
        public void Show_ShouldDisplayAllTextInstantly()
        {
            // ARRANGE
            string targetText = "Hello World";

            ITextPresenter textPresenter = Substitute.For <ITextPresenter>();

            textPresenter.CurrentText.Returns(targetText);

            TextMeshProUGUI txtSpeakerName = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>();
            TextMeshProUGUI txtSpeechText  = DialogueTestHelpers.CreateMonoBehaviourObject <TextMeshProUGUI>();
            GameObject      gameObject     = new GameObject();

            string speakerName = string.Empty;
            string speechText  = string.Empty;
            IDialogueSystemElements dialogueSystemElements = Substitute.For <IDialogueSystemElements>();

            dialogueSystemElements.DialoguePanel.Returns(gameObject);
            dialogueSystemElements.SpeakerNameDisplay.Returns(txtSpeakerName);
            dialogueSystemElements.SpeakerNameDisplay.Returns(txtSpeakerName);
            dialogueSystemElements.SpeechTextDisplay.Returns(txtSpeechText);
            dialogueSystemElements.SpeakerText.Returns(speakerName);
            dialogueSystemElements.SpeechText.Returns(speechText);

            ISpeech speech = DialogueTestHelpers.GetMockSpeech(
                targetText,
                DialogueTestHelpers.GetMockSpeechSettings()
                );

            IDialogueSystem dialogueSystem = new DialogueSystem(
                textPresenter,
                DialogueTestHelpers.GetMockCoroutineAccessor(),
                dialogueSystemElements
                );

            // ACT
            dialogueSystem.Show(speech);

            // ASSERT
            Assert.AreEqual(speech.SpeechText, dialogueSystemElements.SpeechText);
        }
コード例 #3
0
 public DialogueSystem()
 {
     textPresenter     = new TextPresenter();
     coroutineAccessor = Configurations.GlobalConfiguration.CoroutineAccessor;
 }