public void Init(TalkableCharacter _char, NarrativeDialog dialog) { character = _char; type = dialog.type; if (m_text != null) { m_text.DOKill(); m_text.text = dialog.word; // m_text.DOText( dialog.word , dialog.word.Length * 0.06f + 0.3f ); m_text.DOFade(1f, showUpTime); } if (m_backImage != null) { m_backImage.transform.localScale = Vector3.one * 0.01f; m_backImage.transform.DOScale(1f, showUpTime); m_backImage.DOFade(backImageOriginalAlpha, showUpTime); } if (m_arrow != null) { m_arrow.DOFade(backImageOriginalAlpha, showUpTime); } UpdateDialogFramePosition(); }
void EndDisplay() { if (m_isDisplaying) { if (m_text != null) { m_text.DOFade(0, showUpTime); } if (m_backImage != null) { m_backImage.transform.DOScale(0, showUpTime); } if (m_arrow != null) { m_arrow.DOFade(0, showUpTime * 0.5f); } temSpeaker = null; temDialog = null; m_isDisplaying = false; Debug.Log("End Display"); dialogTimer = -1f; } }
void SwitchToNext() { // if there is not plot to show if (temPlot == null) { EndDisplay(); } else { NarrativeDialog dialog = temPlot.NextDialog(); if (dialog == null) { EndDisplayPlot(temPlot); PlotArray.Remove(temPlot); if (temPlot == null) { EndDisplay(); return; } dialog = temPlot.NextDialog(); } DisplayDialog(dialog, temPlot); } }
void DisplayUnimportantDialog(NarrativeDialog dialog, DisplayPlot plot) { if (m_test_ShowDialog) { plot.otherSpeaker.clip = dialog.clip; plot.otherSpeaker.Play(); GameObject smallDialog = Instantiate(smallDialogPrefab) as GameObject; smallDialog.transform.SetParent(UIManager.Instance.transform); Dialog dialogCom = smallDialog.GetComponent <Dialog> (); if (dialogCom != null) { dialogCom.Init(plot.character, dialog); } } }
void DisplayDialog(NarrativeDialog dialog, DisplayPlot plot) { if (m_text != null) { m_text.DOKill(); m_text.text = dialog.word; // m_text.DOText( dialog.word , dialog.word.Length * 0.06f + 0.3f ); m_text.DOFade(1f, showUpTime); } if (m_backImage != null) { m_backImage.DOKill(); m_backImage.color = GetDialogColorFromType(dialog.type); m_backImage.transform.localScale = Vector3.one * 0.01f; m_backImage.transform.DOScale(1f, showUpTime); m_backImage.DOFade(backImageOriginalAlpha, showUpTime); } if (m_arrow != null) { m_arrow.DOKill(); m_arrow.DOFade(backImageOriginalAlpha, showUpTime); } if (temSpeaker != null) { temSpeaker.Stop(); } switch (dialog.type) { case NarrativeDialog.SpeakerType.ThisCharacter: case NarrativeDialog.SpeakerType.Girl: temSpeaker = plot.otherSpeaker; break; case NarrativeDialog.SpeakerType.MainCharacter: temSpeaker = mainCharacterSpeaker; break; default: break; } ; if (dialog.clip != null) { temSpeaker.clip = dialog.clip; temSpeaker.Play(); } temDialog = dialog; UpdateDialogFramePosition(); LogicArg arg = new LogicArg(this); arg.AddMessage("word", dialog.word); arg.AddMessage("character", dialog.type.ToString()); arg.AddMessage("important", plot.plot.important); M_Event.FireLogicEvent(LogicEvents.DisplayNextDialog, arg); dialogTimer = 0; }