public DialogueSystem( ITextPresenter textPresenter, ICoroutineAccessor coroutineAccessor, IDialogueSystemElements elements) { this.textPresenter = textPresenter; this.coroutineAccessor = coroutineAccessor; Elements = elements; }
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); }
public DialogueSystem() { textPresenter = new TextPresenter(); coroutineAccessor = Configurations.GlobalConfiguration.CoroutineAccessor; }