示例#1
0
 private void OnPhotoModeStarted(PhotoCapture.PhotoCaptureResult result)
 {
     if (result.success)
     {       // take the picture
         _photoCaptureObject.TakePhotoAsync(OnCapturedPhotoToMemory);
     }
     else
     {       // couldn't take the picture. Show an error
         InfoPanelTyper.TypeText("ABORT");
         DiagnosticsPanelTyper.TypeText("Say: Unable to start photo mode! Hasta la vista, baby.", true);
     }
 }
示例#2
0
    public void DisplayLine(DialogLine storyLine)
    {
        if (nameText != null && storyLine.character != null)
        {
            nameText.text = textInfo.ToTitleCase(storyLine.character.ToLower());
        }

        if (gameObject.activeInHierarchy && storyLine.line.Length > 0)
        {
            _typer.TypeText(storyLine.line);
        }
    }
示例#3
0
        private void GoNextWord()
        {
            if (m_dialogueLines.Count <= 0)
            {
                return;
            }

            string word = m_dialogueLines.Dequeue();

            m_textController?.TypeText(word);
            m_textControllerUGUI?.SetText(word, 0.05f);
        }
示例#4
0
 public override void Play <T>(T data, System.Action callback)
 {
     if (data is GuideDialogData d)
     {
         ShowComma(DialogCommaType.None);
         textTyper.TypeText(string.Empty);
         if (_coroutine != null)
         {
             StopCoroutine(_coroutine);
         }
         _coroutine = StartCoroutine(LatePlay(d, callback));
     }
 }
示例#5
0
 private void OnPhotoModeStarted(PhotoCapture.PhotoCaptureResult result)
 {
     if (result.success)
     {       // take the picture
         _photoCaptureObject.TakePhotoAsync(OnCapturedPhotoToMemory);
     }
     else
     {       // couldn't take the picture. Show an error
         InfoPanelTyper.TypeText("Cancel");
         DiagnosticsPanelTyper.TypeText("Unable to make a picture", true);
     }
 }
示例#6
0
    IEnumerator RunCutscene()
    {
        if (currentIndex == 0)
        {
            audioSource.PlayOneShot(RadioSound);
            yield return(new WaitForSeconds(RadioSound.length));

            audioSource.pitch = 1.4f;
        }

        if (currentIndex < TextToDisplay.Count)
        {
            typer.TypeText(TextToDisplay[currentIndex], 0);
            currentIndex++;
            newIndex = currentIndex % 2;

            if (newIndex == 0)
            {
                DiegoAnimator.ResetTrigger("Idle");
                DiegoAnimator.SetTrigger("Talk");
            }
            else
            {
                OtaconAnimator.ResetTrigger("Idle");
                OtaconAnimator.SetTrigger("Talk");
            }
        }
        else
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
        }
    }
示例#7
0
    void Start()
    {
        // check if we have all the input we need
        if (AnalysisPanel == null || ThreatAssessmentPanel == null || InfoPanel == null)
        {
            return;
        }

        // get the speech manager
        textToSpeechManager = GetComponent <TextToSpeech>();

        // set the 'typers' for the various output
        InfoPanelTyper             = InfoPanel.GetComponent <TextTyper>();
        AnalysisPanelTyper         = AnalysisPanel.GetComponent <TextTyper>();
        ThreatAssessmentPanelTyper = ThreatAssessmentPanel.GetComponent <TextTyper>();
        DiagnosticsPanelTyper      = DiagnosticPanel.GetComponent <TextTyper>();

        // show initialization in the UI
        AnalysisPanelTyper.TypeText("ANALYSIS:\n**************\nInitializing");
        ThreatAssessmentPanelTyper.TypeText("SCAN MODE XXXXX\nINITIALIZE");
        InfoPanelTyper.TypeText("CONNECTING");

        // Start the picture taking loop
        StartCoroutine(CoroLoop());
    }
示例#8
0
    public void DisplayLoggedText()
    {
        string logAsText = string.Join("\n", actionLog.ToArray());

        // displayText.text = logAsText;
        textTyper.TypeText(logAsText, textSpeed);
    }
示例#9
0
    public IEnumerator ShowText()
    {
        while (_story.canContinue)
        {
            string str = _story.Continue();
            this.printCompleted = false;

            typer.TypeText(str, 0.04f);

            // typing ends when player tries to skip it, or if the print was completed naturally
            yield return(new WaitForEndOfFrame());

            yield return(new WaitUntil(() => this.dialogKeyPressed || this.printCompleted));

            this.dialogKeyPressed = false;

            typer.Skip();

            // end this line after player confirmation
            yield return(new WaitForEndOfFrame());

            yield return(new WaitUntil(() => this.dialogKeyPressed));

            this.dialogKeyPressed = false;
        }
    }
示例#10
0
    public void ProgressConversation()
    {
        if (!textTyper.IsTyping && convoPacket.lineNum <= convoPacket.line.Count - 1)
        {
            if (convoPacket.lineNum == 0)
            {
                ConversationBox.SetActive(true);
            }
            endTextBox.SetActive(false);

            textTyper.TypeText(convoPacket.line[convoPacket.lineNum].speech, 0.02f);
            talkerName.text = convoPacket.line[convoPacket.lineNum].talker;
            convoPacket.lineNum++;
        }
        else
        {
            if (textTyper.IsTyping)
            {
                textTyper.Skip();
            }
            else if (convoPacket.lineNum > convoPacket.line.Count - 1)
            {
                conversationText.text = string.Empty;
                talkerName.text       = string.Empty;
                ConversationBox.SetActive(false);
                endTextBox.SetActive(false);

                FinishedConversation();
            }
        }
    }
示例#11
0
    public void ShowTutorialMessage(int index)
    {
        if (dialogueLines.Length <= 0 || index >= dialogueLines.Length)
        {
            return;
        }

        testTextTyper.TypeText(dialogueLines[index]);
    }
示例#12
0
    IEnumerator RunComputerVision(byte[] image)
    {
        var headers = new Dictionary <string, string>()
        {
            { "Ocp-Apim-Subscription-Key", _computerVisionKey },
            { "Content-Type", "application/octet-stream" }
        };

        WWW www = new WWW(getFacesUrl(), image, headers);

        yield return(www);

        if (www.error != null && www.error != "")
        {       // on error, show information and return
            InfoPanelTyper.TypeText("ABORT");
            DiagnosticsPanelTyper.TypeText("ANALYSIS:\n***************\n\n" + www.error);
            yield break;
        }

        try
        {
            var resultObject = JsonUtility.FromJson <AnalysisResult>(www.text);

            // show all the tags returned
            List <string> tags = new List <string>();
            foreach (var tag in resultObject.tags)
            {
                tags.Add(tag.name);
            }
            AnalysisPanelTyper.TypeText("ANALYSIS:\n***************\n\n" + string.Join("\n", tags.ToArray()));

            // show all the faces with age returned
            List <string> faces = new List <string>();
            foreach (var face in resultObject.faces)
            {
                faces.Add(string.Format("{0} scanned: age {1}.", face.gender, face.age));
            }
            if (faces.Count > 0)
            {
                InfoPanelTyper.TypeText("MATCH");
            }
            else
            {
                InfoPanelTyper.TypeText("ACTIVE SPATIAL MAPPING");
            }
            ThreatAssessmentPanelTyper.TypeText("SCAN MODE 43984\nTHREAT ASSESSMENT\n\n" + string.Join("\n", faces.ToArray()));
        }
        catch (Exception ex)
        {       // show error details in UI
            InfoPanelTyper.TypeText("ABORT");
            DiagnosticsPanelTyper.TypeText("ANALYSIS:\n***************\n\n" + ex.Message);
        }
    }
示例#13
0
    IEnumerator Text()
    {
        container.SetActive(true);
        if (animator)
        {
            animator.SetBool("active", true);
        }

        while (_story.canContinue)
        {
            string str = _story.Continue();
            this.printCompleted = false;

            // start typing
            typer.TypeText(str, 0.02f);
            if (animator)
            {
                animator.SetBool("idle", false);
            }

            // typing ends when player tries to skip it, or if the print was completed naturally
            yield return(new WaitForEndOfFrame());

            yield return(new WaitUntil(() => this.dialogKeyPressed || this.printCompleted));

            this.dialogKeyPressed = false;

            typer.Skip();
            if (animator)
            {
                animator.SetBool("idle", true);
            }

            // end this line after player confirmation
            yield return(new WaitForEndOfFrame());

            yield return(new WaitUntil(() => this.dialogKeyPressed));

            this.dialogKeyPressed = false;
        }

        if (animator)
        {
            animator.SetBool("active", false);
        }
        container.SetActive(false);

        savedJson           = _story.state.ToJson();
        this.printCompleted = false;
        this.currDialog     = null;
        Toggle(false);
    }
示例#14
0
    private IEnumerator TurnOnTexts()
    {
        NameTextTyper.TypeText(myDateStats.Name);
        yield return(new WaitForSeconds(1f));

        LocationTextTyper.TypeText(myDateStats.Distance);
        yield return(new WaitForSeconds(0.4f));

        JobTextTyper.TypeText(myDateStats.JobTitle);
        yield return(new WaitForSeconds(0.45f));

        testTextTyper.TypeText(myDateStats.Description);
    }
示例#15
0
    void Start()
    {
        // set the 'typers' for the various output
        InfoPanelTyper             = InfoPanel.GetComponent <TextTyper>();
        AnalysisPanelTyper         = AnalysisPanel.GetComponent <TextTyper>();
        ThreatAssessmentPanelTyper = ThreatAssessmentPanel.GetComponent <TextTyper>();
        DiagnosticsPanelTyper      = DiagnosticPanel.GetComponent <TextTyper>();


        InfoPanelTyper.TypeText("Connecting to Microsoft AZURE Service");

        // Start the picture taking loop
        StartCoroutine(CoroLoop());
    }
示例#16
0
    /// <summary>
    /// Activate and display the dialogue box UI, showing given DialogueValues.
    /// </summary>
    /// <param name="values">The dialogue content, speaker name and portrait, and choices.</param>
    public void DisplayDialogue(DialogueValues values)
    {
        // If it's the last dialogue option, close the dialogue instead of continuing
        if (last)
        {
            foreach (Transform choice in choices.transform)
            {
                choice.gameObject.SetActive(false);
            }
            choices.gameObject.SetActive(false);
            this.gameObject.SetActive(false);
            last = false;
            return;
        }

        this.gameObject.SetActive(true);
        entityName.text = values.entityName;
        content.TypeText(values.content);
        image.sprite = values.portrait;

        // Display choices if there are any
        if (values.choiceOptions != null)
        {
            // Wait until the content has finished typing before showing the choices
            StartCoroutine(DisplayChoicesAfterDialogue(values));
        }
        else
        {
            // Hide choice menu if there aren't any choices
            foreach (Transform choice in choices.transform)
            {
                choice.gameObject.SetActive(false);
            }
            choices.gameObject.SetActive(false);
        }

        // If last has been flagged, set the state of dialogue to last line
        if (values.last)
        {
            last = true;
        }
    }
示例#17
0
文件: TextPlayer.cs 项目: zillix/LD46
    public void PlayText(TextData data, Action onFinishedPlaying)
    {
        currentText = data;


        List <TextTypeNode> blobs = parseText(data);

        if (typer)
        {
            textBox.text = "";

            typer.TypeText(blobs, currentText.doOverrideTypeSpeed ? currentText.typeSpeed : DEFAULT_TYPE_SPEED, onFinishedPlaying);
        }
        else
        {
            textBox.text = currentText.text;

            textBox.onTextStarted();
            onFinishedPlaying();
        }
    }
示例#18
0
    private void InterpretStory()
    {
        ClearButtons();
        SetDialogState();

        //float typeSpeed = 1f / (textSpeed * 10);
        float typeSpeed = (2.5001f - (textSpeed * 2.5f)) / 80;

        log("typeSpeed: " + typeSpeed);


        if (story.canContinue)
        {
            string section = story.Continue();
            if (IsDialog(section))
            {
                for (int i = 0; i < section.Length; i++)
                {
                    if (section[i] == ']')
                    {
                        section = section.Substring(i + 1).TrimStart();
                    }
                }
                SetDialogState();
            }
            else
            {
                SetNarrationState();
            }
            dialogTyper.TypeText(section, typeSpeed);
            dialogTyper.PrintCompleted.RemoveAllListeners();
            dialogTyper.PrintCompleted.AddListener(() => StartCoroutine(DialogHalt()));
            dialogTyper.CharacterPrinted.AddListener((string str) => PlayTypeSound());

            clickArea.onClick.AddListener(() => SkipText());
        }
    }
示例#19
0
 public void UpdateText(string newText)
 {
     textTyper.TypeText(newText, 0.05f);
 }
示例#20
0
 // Start is called before the first frame update
 void Start()
 {
     _textTyper = FindObjectOfType <TextTyper>();
     _textTyper.TypeText(_bossDescription);
     _textTyper.OnTypingEnd += OnBossDescriptionTypeEnd;
 }
示例#21
0
    IEnumerator RunComputerVision(byte[] image)
    {
        var headers = new Dictionary <string, string>()
        {
            { "Ocp-Apim-Subscription-Key", _computerVisionKey },
            { "Content-Type", "application/octet-stream" }
        };

        WWW www = new WWW(getFacesUrl(), image, headers);

        yield return(www);

        if (www.error != null && www.error != "")
        {       // on error, show information and return
            InfoPanelTyper.TypeText("Cancel");
            DiagnosticsPanelTyper.TypeText("ERROR: " + www.error);
            yield break;
        }

        try
        {
            var resultObject = JsonUtility.FromJson <AnalysisResult>(www.text);

            // show all the tags returned
            List <string> tags = new List <string>();
            foreach (var tag in resultObject.tags)
            {
                tags.Add(tag.name);
            }
            AnalysisPanelTyper.TypeText("MESSAGE:\n" + string.Join("\n", tags.ToArray()));

            // Read what has been found be CV
            if (textToSpeechManager != null)
            {
                // Create message
                var msg = string.Format(" {0} ", string.Join("", tags.ToArray()));

                // Speak message
                textToSpeechManager.StartSpeaking(msg);
                InfoPanelTyper.TypeText("TextToSpeech: OK ");
            }


            // show all the faces with age returned
            List <string> faces = new List <string>();
            foreach (var face in resultObject.faces)
            {
                faces.Add(string.Format("{0} AGE {1}.", face.gender, face.age));
            }
            if (faces.Count > 0)
            {
                InfoPanelTyper.TypeText("M A T C H");
            }
            else
            {
                InfoPanelTyper.TypeText("LOOKING FOR OBJECTS");
            }
            ThreatAssessmentPanelTyper.TypeText("DETAILS: " + string.Join("\n", faces.ToArray()));
        }
        catch (Exception ex)
        {       // show error details in UI
            DiagnosticsPanelTyper.TypeText("ANALYSIS:\n" + ex.Message);
        }
    }