示例#1
0
 public void DisplayNextSentence()
 {
     if (sentences.Count > 0)
     {
         nextLine      = sentences.Dequeue();
         nextLine.text = nextLine.text.Replace("(игрок)", GameMaster.GM.characters.playerName);
         if (nextLine.speaker == "Игрок")
         {
             nextLine.speaker = GameMaster.GM.characters.playerName;
         }
         phaseController.DialogueAction(dialogue1.DialogueID, nextLine.lineId);
         nameBox.text    = nextLine.speaker;
         imageBox.sprite = speakerFaces.GetFaceFromID(nextLine.faceId);
         StartCoroutine(TextDisplayer(nextLine.text, nextLine.speed));
         choiceBox.SetActive(false);
     }
     else if (dialogue1.options == 1)
     {
         StopAllCoroutines();
         playingDialogue = false;
         Display(dialogue1.nextDialogues[0]);
     }
     else if (dialogue1.options > 0)
     {
         choiceBox.SetActive(true);
         textChoice.text = dialogue1.choiceName;
         foreach (GameObject cho in choicesList)
         {
             cho.SetActive(false);
         }
         for (int i = 0; i < dialogue1.options; i++)
         {
             choicesList[i].GetComponent <UnityEngine.UI.Button>().onClick.RemoveAllListeners();
             choicesList[i].SetActive(true);
             choicesList[i].GetComponentInChildren <TextMeshProUGUI>().text = dialogue1.choiceText[i];
             int tempInt = i;
             choicesList[i].GetComponent <UnityEngine.UI.Button>().onClick.AddListener(delegate { Display(dialogue1.nextDialogues[tempInt]); });
         }
         StopAllCoroutines();
         playingDialogue = false;
     }
     else
     {
         phaseController.DialogueAction(dialogue1.DialogueID, -1);
         StopAllCoroutines();
         choiceBox.SetActive(false);
         playingDialogue = false;
         dialogueBox.SetActive(false);
         healthBars.SetActive(true);
         foreach (Transform transform in buttons.transform)
         {
             transform.GetComponent <UnityEngine.UI.RawImage>().enabled = GameMaster.GM.progress.enabledButtons;
         }
         GameMaster.enabledMovement = true;
     }
 }