示例#1
0
        /// <summary>
        /// Called from voice action or text action, to display text content on dialogBoard, and record a new history dialog into historyDialogs
        /// </summary>
        /// <param name="shownName">Character's name</param>
        /// <param name="content">Dialog text content</param>
        /// <param name="voiceSrc">Character's voice source name</param>
        public void writeOnDialogBoard(string shownName, string content, string voiceSrc)
        {
            //Display dialog
            if (currentAnimateText != null) {
                //Clear last animateText
                StopCoroutine(currentAnimateText);
            }
            currentAnimateText = animateText(shownName, content);
            StartCoroutine(currentAnimateText);

            //save new dialog for Back Log, and up to 100
            Dialog newDialog = new Dialog(shownName, content, voiceSrc);
            //Debug.Log ("newDialog.voiceSrc: "+newDialog.voiceSrc);
            historyDialogs.Add(newDialog);
            if (historyDialogs.Count > GameConstants.HISTORY_DIALOG_MAX) {
                historyDialogs.RemoveAt(0);
            }
            //Debug.Log ("writeOnDialogBoard: "+content);
        }
示例#2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="dialog">The dialog to display on the logTextButton</param>
 /// <returns>GameObject pointer to the new created LogTextButton</returns>
 public GameObject createLogTextButton(Dialog dialog)
 {
     GameObject newLogTextButton = Instantiate(logTextPrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
     newLogTextButton.transform.SetParent(this.backLogContent.transform);
     newLogTextButton.transform.localPosition = new Vector3(0, -newLogTextButton.GetComponent<RectTransform>().rect.height, 0);
     string dialogText = "";
     if (dialog.shownName != "") {
         dialogText = dialogText + dialog.shownName + ": ";
     }
     dialogText = dialogText + dialog.content;
     newLogTextButton.GetComponentInChildren<Text>().text = dialogText;
     return newLogTextButton;
 }