private void showDialog(DialogList.Entry dialog, bool clickToClose = true, params string[] args) { dynamicPanels[0].Dialog = dialog; dynamicPanels[0].ClickToClose = clickToClose; dynamicPanels[0].i18nTextArgs = args; showPanels(dynamicPanels); Service.Get <EventDispatcher>().DispatchEvent(default(HudEvents.HideCellPhoneHud)); }
private void updatePanel() { Localizer localizer = Service.Get <Localizer>(); speechData.Text = localizer.GetTokenTranslationFormatted(dialogPanels[activePanelIndex].Dialog.ContentToken, dialogPanels[activePanelIndex].i18nTextArgs); speechData.ClickToClose = dialogPanels[activePanelIndex].ClickToClose; speechData.Buttons = null; dispatcher.DispatchEvent(new CinematicSpeechEvents.ShowSpeechEvent(speechData)); DialogList.Entry dialog = dialogPanels[activePanelIndex].Dialog; if (!string.IsNullOrEmpty(dialog.AudioEventName)) { EventAction eventAction = EventAction.PlaySound; if (dialog.AdvanceSequence) { eventAction = EventAction.AdvanceSequence; } EventManager.Instance.PostEventNotify(dialog.AudioEventName, eventAction, base.gameObject, dialogAudioCallback); StartDialogAnimation(dialog.AudioEventName, dialog.DialogAnimationTrigger, autoStopAnimation: true, dialog.DialogAnimationEndTrigger); } }
public override void OnEnter() { dispatcher = Service.Get <EventDispatcher>(); DCinematicSpeech dCinematicSpeech = new DCinematicSpeech(); DialogList.Entry entry = default(DialogList.Entry); if (!UseDialogList) { dCinematicSpeech.Text = Service.Get <Localizer>().GetTokenTranslation(i18nContents); } else if (DialogList != null) { entry = ((!RandomDialog) ? DialogList.Entries[DialogListItemIndex] : DialogList.Entries[Random.Range(0, DialogList.Entries.Length)]); dCinematicSpeech.Text = Service.Get <Localizer>().GetTokenTranslation(entry.ContentToken); } dCinematicSpeech.BubbleContentKey = DialogPrefabKey; dCinematicSpeech.Buttons = null; dCinematicSpeech.BackgroundImageKey = BackgroundImageKey; dCinematicSpeech.ContentImageKey = ContentImageKey; dCinematicSpeech.TextStyle = TextStyle; dCinematicSpeech.RichText = RichText; dCinematicSpeech.MascotName = (string.IsNullOrEmpty(CustomName) ? MascotName : CustomName); dCinematicSpeech.DismissTime = ((AutoCloseTime > 0f) ? AutoCloseTime : ((float)DismissTime)); dCinematicSpeech.CenterX = CenterX; dCinematicSpeech.CenterY = CenterY; dCinematicSpeech.OffsetY = OffsetY; dCinematicSpeech.OffsetYPercent = OffsetYPercent; dCinematicSpeech.HideTail = HideTail; dCinematicSpeech.ClickToClose = ClickToClose; dispatcher.DispatchEvent(new CinematicSpeechEvents.ShowSpeechEvent(dCinematicSpeech, HideQuestHud)); dispatcher.AddListener <CinematicSpeechEvents.SpeechCompleteEvent>(OnSpeechComplete); string text = ""; string overrideAnimationName = ""; string overrideStopAnimationName = ""; bool flag = false; if (UseDialogList && DialogList != null) { text = entry.AudioEventName; overrideAnimationName = entry.DialogAnimationTrigger; overrideStopAnimationName = entry.DialogAnimationEndTrigger; flag = entry.AdvanceSequence; } else if (!AudioEventName.IsNone) { text = AudioEventName.Value; overrideAnimationName = DialogAnimationOverride.Value; overrideStopAnimationName = EndDialogAnimationOverride.Value; flag = AdvanceSequence; } if (!string.IsNullOrEmpty(text)) { EventAction eventAction = EventAction.PlaySound; if (flag) { eventAction = EventAction.AdvanceSequence; } GameObject mascotObject = Service.Get <MascotService>().GetMascotObject(MascotName); if (mascotObject != null && PlayDialogAnimation) { MascotController component = mascotObject.GetComponent <MascotController>(); EventManager.Instance.PostEventNotify(text, eventAction, base.Owner, component.dialogAudioCallback); component.StartDialogAnimation(text, overrideAnimationName, AutoStopDialogAnimation, overrideStopAnimationName); } else { EventManager.Instance.PostEventNotify(text, eventAction, base.Owner, onMascotAudioComplete); } } if (!WaitForFinish) { Finish(); } }
public override void OnEnter() { dispatcher = Service.Get <EventDispatcher>(); DQuestMessage dQuestMessage = new DQuestMessage(); DialogList.Entry entry = default(DialogList.Entry); if (!UseDialogList) { dQuestMessage.Text = Service.Get <Localizer>().GetTokenTranslation(i18nContents); } else if (DialogList != null) { entry = ((!RandomDialog) ? DialogList.Entries[DialogListItemIndex] : DialogList.Entries[Random.Range(0, DialogList.Entries.Length)]); dQuestMessage.Text = Service.Get <Localizer>().GetTokenTranslation(entry.ContentToken); } dQuestMessage.MascotName = MascotName; dQuestMessage.DismissTime = ((AutoCloseTime > 0f) ? AutoCloseTime : ((float)DismissTime)); dQuestMessage.Buttons = null; dQuestMessage.ContentImageKey = ImageContentKey; dQuestMessage.RichText = RichText; dQuestMessage.ClickToClose = ClickToClose; dispatcher.AddListener <HudEvents.QuestMessageComplete>(OnSpeechComplete); dispatcher.DispatchEvent(new HudEvents.ShowQuestMessage(dQuestMessage)); string text = ""; string overrideAnimationName = ""; string overrideStopAnimationName = ""; bool flag = false; if (UseDialogList && DialogList != null) { text = entry.AudioEventName; overrideAnimationName = entry.DialogAnimationTrigger; overrideStopAnimationName = entry.DialogAnimationEndTrigger; flag = entry.AdvanceSequence; } else if (!AudioEventName.IsNone) { text = AudioEventName.Value; overrideAnimationName = DialogAnimationOverride.Value; overrideStopAnimationName = EndDialogAnimationOverride.Value; flag = AdvanceSequence; } if (!string.IsNullOrEmpty(text)) { EventAction eventAction = EventAction.PlaySound; if (flag) { eventAction = EventAction.AdvanceSequence; } GameObject mascotObject = Service.Get <MascotService>().GetMascotObject(MascotName); if (mascotObject != null && PlayDialogAnimation) { MascotController component = mascotObject.GetComponent <MascotController>(); EventManager.Instance.PostEventNotify(text, eventAction, base.Owner, component.dialogAudioCallback); component.StartDialogAnimation(text, overrideAnimationName, AutoStopDialogAnimation, overrideStopAnimationName); } else { EventManager.Instance.PostEventNotify(text, eventAction, base.Owner, onMascotAudioComplete); } } if (!WaitForFinish) { Finish(); } }