public override void OnEnter()
        {
            MascotController component = Mascot.Value.GetComponent <MascotController>();

            if (component != null)
            {
                Service.Get <EventDispatcher>().DispatchEvent(new CinematicSpeechEvents.PlayMascotAnimation(component, AnimationTrigger.Value));
            }
            Finish();
        }
Example #2
0
        public override void OnEnter()
        {
            GameObject mascotObject = Service.Get <MascotService>().GetMascotObject(MascotName);

            if (mascotObject != null)
            {
                MascotController component = mascotObject.GetComponent <MascotController>();
                component.AutoStopDialog = false;
                if (!string.IsNullOrEmpty(AnimTriggerToReset))
                {
                    component.GetComponent <Animator>().ResetTrigger(AnimTriggerToReset);
                }
            }
            Finish();
        }
        protected override void OnEnable()
        {
            if (!Owner.CompareTag("Player"))
            {
                return;
            }
            EventDispatcher  eventDispatcher   = Service.Get <EventDispatcher>();
            MascotController componentInParent = SceneRefs.ActionSequencer.GetTrigger(Owner).GetComponentInParent <MascotController>();

            mascot = componentInParent.Mascot;
            if (mascot.InteractionBehaviours.ZoomOut && Controller != null)
            {
                CinematographyEvents.CameraLogicResetEvent evt = default(CinematographyEvents.CameraLogicResetEvent);
                evt.Controller = Controller;
                eventDispatcher.DispatchEvent(evt);
            }
            if (mascot.InteractionBehaviours.RestoreTray)
            {
                GameObject gameObject = GameObject.FindWithTag(UIConstants.Tags.UI_Tray_Root);
                if (gameObject != null)
                {
                    StateMachineContext component = gameObject.GetComponent <StateMachineContext>();
                    component.SendEvent(new ExternalEvent("Root", "exit_cinematic"));
                    if (!string.IsNullOrEmpty(ScreenName))
                    {
                        component.SendEvent(new ExternalEvent("ScreenContainerContent", ScreenName));
                    }
                }
                eventDispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: true));
                eventDispatcher.DispatchEvent(new UIDisablerEvents.EnableUIElementGroup("MainNavButtons"));
            }
            if (mascot.InteractionBehaviours.RestoreQuestNotifier)
            {
                eventDispatcher.DispatchEvent(new HudEvents.SuppressQuestNotifier(suppress: false));
            }
        }
        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();
            }
        }