public IEnumerator DialogueInterrupt()
        {
            DialogueViewer dlViewer = GameObject
                                      .FindWithTag("EventSystem")
                                      .GetComponent <DialogueViewer>();

            string desiredSpeaker  = "Voice";
            string desiredDialogue = "Hello? Is this thing on? " +
                                     "Good, now that I have your " +
                                     "attention. Wait- NO!";

            dlViewer.PrintDialogue(desiredSpeaker, desiredDialogue);
            yield return(new WaitUntil(() => !dlViewer.getIsTyping()));

            string currentSpeaker = GameObject
                                    .FindWithTag("SpeakerNameText")
                                    .GetComponent <TMPro.TextMeshProUGUI>()
                                    .text;

            Assert.AreEqual(desiredSpeaker, currentSpeaker);

            string currentDialogue = GameObject
                                     .FindWithTag("DialogueText")
                                     .GetComponent <TMPro.TextMeshProUGUI>()
                                     .text;

            Assert.AreEqual(desiredDialogue, currentDialogue);
            yield return(new WaitForSeconds(1f));
        }
    public void EventExecute(DialogueViewer dialogue, ref string code)
    {
        var parseResult = ParseEvent(code);

        code = null;
        switch (parseResult.type)
        {
        case EventType.Quiz:
            Debug.Log("[DEBUG] Execute : LateEventExecute() - Quiz Event");
            quizManager.StartQuiz(dialogue, parseResult.code);
            break;

        case EventType.MoveIndex:
            Debug.Log("[DEBUG] Execute : LateEventExecute() - Move Index");
            break;

        case EventType.ExitDialogue:
            Debug.Log("[DEBUG] Execute : LateEventExecute() - Exit Dialogue");
            dialogue.EndDialogue();
            break;

        default:
            Debug.LogWarning("[WARNING] Execute : LateEventExecute() - Event is invalid");
            break;
        }
    }
Exemple #3
0
        public IEnumerator ShowsText()
        {
            DialogueViewer dlViewer = GameObject
                                      .FindWithTag("EventSystem")
                                      .GetComponent <DialogueViewer>();

            Cutscene currentScene = new Cutscene((cat, null));

            currentScene.show();
            yield return(new WaitUntil(() => !dlViewer.getIsTyping()));

            string currentSpeaker = GameObject
                                    .FindWithTag("SpeakerNameText")
                                    .GetComponent <TMPro.TextMeshProUGUI>()
                                    .text;

            Assert.AreEqual(desiredSpeaker, currentSpeaker);

            string currentDialogue = GameObject
                                     .FindWithTag("DialogueText")
                                     .GetComponent <TMPro.TextMeshProUGUI>()
                                     .text;

            Assert.AreEqual(desiredDialogue, currentDialogue);
        }
        public IEnumerator ClearsText()
        {
            DialogueViewer dlViewer = GameObject
                                      .FindWithTag("EventSystem")
                                      .GetComponent <DialogueViewer>();

            Asset kitten = new Asset("CP [Kitten]",
                                     new Vector3(0, 0),
                                     new Character(desiredSpeaker, desiredDialogue));

            Cutscene currentScene = new Cutscene((kitten, null));

            currentScene.show();
            yield return(new WaitUntil(() => !dlViewer.getIsTyping()));

            dlViewer.clearTextFields();
            yield return(new WaitForSeconds(1f));

            string currentSpeaker = GameObject
                                    .FindWithTag("SpeakerNameText")
                                    .GetComponent <TMPro.TextMeshProUGUI>()
                                    .text;

            Assert.AreEqual("", currentSpeaker);

            string currentDialogue = GameObject
                                     .FindWithTag("DialogueText")
                                     .GetComponent <TMPro.TextMeshProUGUI>()
                                     .text;

            Assert.AreEqual("", currentDialogue);
        }
        public IEnumerator HidesDialoguePanel()
        {
            DialogueViewer dlViewer = GameObject
                                      .FindWithTag("EventSystem")
                                      .GetComponent <DialogueViewer>();

            dlViewer.PrintDialogue(desiredSpeaker, desiredDialogue);
            yield return(new WaitUntil(() => !dlViewer.getIsTyping()));

            GameObject DialoguePanel = GameObject.FindWithTag("DialoguePanel");

            dlViewer.hideDialoguePanel();

            Assert.IsFalse(DialoguePanel.activeSelf);
        }
Exemple #6
0
    /// <summary>
    /// 새로운 퀴즈를 준비하고 시작하는 함수. DialogueManager 에서 Code를 감지하고 실행하게 됨.
    /// </summary>
    /// <param name="dialogue"> 호출한 Dialogue 오브젝트 </param>
    /// <param name="pos"> Quiz Bubble UI position </param>
    /// <param name="id"> Quiz ID </param>
    public void StartQuiz(DialogueViewer dialogue, int code)
    {
        Debug.Log("[DEBUG] Execute : StartQuiz()");
        if (!inProgress)
        {
            inProgress = true;

            callDialogueViewer = dialogue;
            var tempQuiz = quizData.Find(quiz => quiz.code == code);
            uiBubble.SetQuizUI(tempQuiz);
            currentQuiz = tempQuiz;
            dialogue.ActiveBubble(false);
            uiBubble.ActiveBubble(true);
        }
    }
        public IEnumerator OneFail()
        {
            Asset failKitten = new Asset("CP [Kitten]",
                                         new Vector3(0, 0),
                                         new Character("Kitten", "We're missing an important item."));

            Cutscene      nextScene    = new Cutscene((passKitten, null), backgrounds[0]);
            Cutscene      errorScene   = new Cutscene((failKitten, null), backgrounds[1]);
            Asset         asset        = new Asset(assetName, assetPosition, new PaCElement(nextScene));
            PointandClick currentScene = new PointandClick(new List <Asset> {
                asset
            }, backgrounds[1]);

            GameObject aPanel      = GameObject.FindWithTag("AssetsPanel");
            GameObject eventSystem = GameObject.FindWithTag("EventSystem");

            SceneNavigator sNavi    = eventSystem.GetComponent <SceneNavigator>();
            AssetViewer    aViewer  = eventSystem.GetComponent <AssetViewer>();
            DialogueViewer dlViewer = eventSystem.GetComponent <DialogueViewer>();

            currentScene.show();
            sNavi.setCurrentScene(currentScene);

            HasBeenClicked     clickedCondition = new HasBeenClicked(asset);
            List <Conditional> conditionals     = new List <Conditional> {
                clickedCondition
            };

            sNavi.addConditions(asset, conditionals);
            sNavi.addErrorScene(asset, clickedCondition, errorScene);

            yield return(new WaitForSeconds(1f));

            sNavi.changeSceneIfSatisfied(aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject));

            yield return(new WaitForSeconds(3f));

            Assert.AreEqual(errorScene, sNavi.getCurrentScene());

            Asset navButton = dlViewer.getNavButton();

            navButton.getState().Click(navButton);

            Assert.AreEqual(currentScene, sNavi.getCurrentScene());

            yield return(new WaitForSeconds(3f));
        }
Exemple #8
0
        public IEnumerator HidesDialoguePanel()
        {
            DialogueViewer dlViewer = GameObject
                                      .FindWithTag("EventSystem")
                                      .GetComponent <DialogueViewer>();

            Cutscene currentScene = new Cutscene((cat, null));

            currentScene.show();
            yield return(new WaitUntil(() => !dlViewer.getIsTyping()));

            GameObject DialoguePanel = GameObject.FindWithTag("DialoguePanel");

            currentScene.hide();

            Assert.IsFalse(DialoguePanel.activeSelf);
        }
    public void FinishEdit()
    {
        string path = input.text;

        if (!File.Exists(path))
        {
            string msg = String.Format("File Path: {0} does not exist. Make sure this path leads to a tome file" +
                                       "\n A path looks like: C:\\some\\folders\\add\\stuff\\text.file", path);
            Text errorConsole = errorBox.GetComponentInChildren <Text>();
            errorConsole.text = msg;
        }
        else
        {
            DialogueViewer viewer = tomeRunner.GetComponent <DialogueViewer>();
            viewer.Run(path);
            gameObject.SetActive(false);
        }
    }
        public IEnumerator CutsceneToPaC()
        {
            GameObject     eventSystem = GameObject.FindWithTag("EventSystem");
            DialogueViewer dlViewer    = eventSystem.GetComponent <DialogueViewer>();
            SceneNavigator sNavi       = eventSystem.GetComponent <SceneNavigator>();

            PointandClick secondScene = new PointandClick(assets1, backgrounds[0]);
            Cutscene      firstScene  = new Cutscene((kitten, cat), backgrounds[1], secondScene);

            sNavi.setCurrentScene(firstScene);

            firstScene.show();
            yield return(new WaitUntil(() => dlViewer.getNavButton().getState().isClicked()));

            yield return(new WaitForSeconds(2f));

            Assert.Inconclusive("Does the transition look smooth?");
        }
        public IEnumerator PaCToCutscene()
        {
            DialogueViewer dlViewer = GameObject
                                      .FindWithTag("EventSystem")
                                      .GetComponent <DialogueViewer>();

            Cutscene      secondScene = new Cutscene((kitten, null), backgrounds[1]);
            PointandClick firstScene  = new PointandClick(assets1, backgrounds[0]);

            firstScene.show();
            yield return(new WaitForSeconds(2f));

            firstScene.hide();
            secondScene.show();
            yield return(new WaitUntil(() => !dlViewer.getIsTyping()));

            yield return(new WaitForSeconds(1f));

            Assert.Inconclusive("Does the transition look smooth?");
        }
        public IEnumerator PrintsDialogue()
        {
            DialogueViewer dlViewer = GameObject
                                      .FindWithTag("EventSystem")
                                      .GetComponent <DialogueViewer>();

            dlViewer.PrintDialogue(desiredSpeaker, desiredDialogue);
            yield return(new WaitUntil(() => !dlViewer.getIsTyping()));

            string currentSpeaker = GameObject
                                    .FindWithTag("SpeakerNameText")
                                    .GetComponent <TMPro.TextMeshProUGUI>()
                                    .text;

            Assert.AreEqual(desiredSpeaker, currentSpeaker);

            string currentDialogue = GameObject
                                     .FindWithTag("DialogueText")
                                     .GetComponent <TMPro.TextMeshProUGUI>()
                                     .text;

            Assert.AreEqual(desiredDialogue, currentDialogue);
        }
        public IEnumerator OnePassOneFail()
        {
            Asset e1kitten = new Asset("CP [Kitten]",
                                       new Vector3(0, 0),
                                       new Character("Kitten", "I should not be here."));

            Asset e2kitten = new Asset("CP [Kitten]",
                                       new Vector3(50, 0),
                                       new Character("Kitten", "Oops!"));

            List <Cutscene> errorScenes = new List <Cutscene>
            {
                new Cutscene((e1kitten, null), backgrounds[1]),
                new Cutscene((e2kitten, null), backgrounds[1])
            };

            Asset passingAsset = new Asset(
                assetName,
                assetPosition,
                new PaCElement(null));

            Asset placeholderAsset = new Asset(
                assetName,
                new Vector3(275, 147),
                new PaCElement(null));

            List <Asset> assets = new List <Asset>()
            {
                passingAsset,
                placeholderAsset
            };

            PointandClick currentScene = new PointandClick(assets, backgrounds[1]);

            GameObject aPanel      = GameObject.FindWithTag("AssetsPanel");
            GameObject eventSystem = GameObject.FindWithTag("EventSystem");

            SceneNavigator sNavi    = eventSystem.GetComponent <SceneNavigator>();
            AssetViewer    aViewer  = eventSystem.GetComponent <AssetViewer>();
            DialogueViewer dlViewer = eventSystem.GetComponent <DialogueViewer>();

            currentScene.show();
            sNavi.setCurrentScene(currentScene);

            HasBeenClicked     passingCondition = new HasBeenClicked(passingAsset);
            HasBeenClicked     failingCondition = new HasBeenClicked(placeholderAsset);
            List <Conditional> conditionals     = new List <Conditional>
            {
                passingCondition,
                failingCondition
            };

            sNavi.addConditions(passingAsset, conditionals);

            sNavi.addErrorScene(passingAsset, passingCondition, errorScenes[0]);
            sNavi.addErrorScene(passingAsset, failingCondition, errorScenes[1]);

            yield return(new WaitForSeconds(1f));

            Asset sceneAsset = aViewer.getSceneAssetFrom(aPanel.transform.GetChild(0).gameObject);

            sceneAsset.getState().Click(sceneAsset);

            yield return(new WaitForSeconds(3f));

            Assert.AreEqual(errorScenes[1], sNavi.getCurrentScene());

            Asset navButton = dlViewer.getNavButton();

            navButton.getState().Click(navButton);

            Assert.AreEqual(currentScene, sNavi.getCurrentScene());

            yield return(new WaitForSeconds(3f));
        }
Exemple #14
0
 private void ResetQuizManager()
 {
     inProgress         = false;
     currentQuiz        = null;
     callDialogueViewer = null;
 }