public void ShowSpeech(DCinematicSpeech speechData)
 {
     this.speechData = speechData;
     Service.Get <EventDispatcher>().AddListener <QuestEvents.MascotAudioComplete>(onMascotAudioComplete);
     MessageText.text = speechData.Text;
     if (!speechData.KeepTextStyle)
     {
         handleTextColor();
         handleTextFont();
         handleTextSize();
     }
     MessageText.supportRichText = speechData.RichText;
     handleBackgroundImage();
     handleButtons();
     handleTimeout();
     handleArrowImage();
     clickToClose = speechData.ClickToClose;
     if (ContinueImage != null)
     {
         ContinueImage.gameObject.SetActive(speechData.ShowContinueImageImmediately);
     }
     CoroutineRunner.Start(handleContentImage(), this, "CinematicSpeechBubble.handleContentImage");
     animator.SetTrigger("OpenBubble");
     setSpeechBubbleVisible(visible: false);
     CoroutineRunner.Start(setVisibleAfterFrame(), this, "");
 }
Example #2
0
    private IEnumerator showSpeech(DCinematicSpeech speechData)
    {
        if (string.IsNullOrEmpty(speechData.MascotName) && Service.Get <QuestService>().ActiveQuest != null)
        {
            speechData.MascotName = Service.Get <QuestService>().ActiveQuest.Mascot.Name;
        }
        GameObject mascotGO = getMascotFromName(speechData.MascotName);

        if (mascotGO != null)
        {
            speechData.MascotTarget = mascotGO;
        }
        else
        {
            speechData.HideTail = true;
        }
        if (string.IsNullOrEmpty(speechData.BubbleContentKey))
        {
            speechData.BubbleContentKey = "Prefabs/Quest/CinematicSpeechBubbles/CinematicSpeechBubbleDynamic";
        }
        AssetRequest <GameObject> assetRequest = Content.LoadAsync <GameObject>(speechData.BubbleContentKey);

        yield return(assetRequest);

        GameObject speechGameObject = Object.Instantiate(assetRequest.Asset);

        speechGameObject.transform.SetParent(canvas.transform, worldPositionStays: false);
        CinematicSpeechBubble cinematicSpeechBubble = speechGameObject.GetComponent <CinematicSpeechBubble>();

        activeSpeechBubbles.Add(cinematicSpeechBubble);
        cinematicSpeechBubble.ShowSpeech(speechData);
        fullScreenButton.SetActive(clickToClose());
    }
Example #3
0
    public void OnShowSpeechClick()
    {
        DCinematicSpeech dCinematicSpeech = new DCinematicSpeech();

        dCinematicSpeech.Text             = Service.Get <Localizer>().GetTokenTranslation(SpeechInput.text);
        dCinematicSpeech.BubbleContentKey = "Prefabs/Quest/CinematicSpeedBubbles/CinematicSpeechBubbleDynamic";
        DButton dButton = new DButton();

        dButton.Text            = "Yes";
        dButton.ButtonPrefabKey = "Prefabs/Buttons/Button_Test";
        DButton dButton2 = new DButton();

        dButton2.Text            = "No";
        dButton2.ButtonPrefabKey = "Prefabs/Buttons/Button_Test";
        dCinematicSpeech.Buttons = new DButton[2]
        {
            dButton,
            dButton2
        };
        DTextStyle dTextStyle = new DTextStyle();

        dTextStyle.ColorHex                 = "08FF08";
        dTextStyle.FontContentKey           = "Fonts/Draculon-Regular";
        dCinematicSpeech.TextStyle          = dTextStyle;
        dCinematicSpeech.BackgroundImageKey = "Sprites/CinematicSpeechBubbles/CinematicSpeachBubble_RockHopper";
        Service.Get <EventDispatcher>().DispatchEvent(new CinematicSpeechEvents.ShowSpeechEvent(dCinematicSpeech));
    }
 public void Awake()
 {
     animator      = GetComponent <Animator>();
     dispatcher    = Service.Get <EventDispatcher>();
     questService  = Service.Get <QuestService>();
     mascotService = Service.Get <MascotService>();
     indicatorData = new DActionIndicator();
     indicatorData.TargetTransform     = base.transform;
     indicatorData.IndicatorContentKey = QuestIndicatorContentKey;
     indicatorData.TargetOffset        = QuestIndicatorOffset;
     speechData = new DCinematicSpeech();
 }
Example #5
0
    private CinematicSpeechBubble speechDataToActiveBubble(DCinematicSpeech speechData)
    {
        CinematicSpeechBubble result = null;

        for (int i = 0; i < activeSpeechBubbles.Count; i++)
        {
            if (activeSpeechBubbles[i].SpeechData == speechData)
            {
                result = activeSpeechBubbles[i];
            }
        }
        return(result);
    }
Example #6
0
        public override void OnEnter()
        {
            dispatcher = Service.Get <EventDispatcher>();
            Dictionary <string, EmoteDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <string, EmoteDefinition> >();
            EmoteDefinition value         = null;
            StringBuilder   stringBuilder = new StringBuilder();

            for (int i = 0; i < Emotes.Length; i++)
            {
                dictionary.TryGetValue(Emotes[i], out value);
                if (value != null)
                {
                    stringBuilder.Append(EmoteManager.GetEmoteString(value));
                }
            }
            DCinematicSpeech dCinematicSpeech = new DCinematicSpeech();

            dCinematicSpeech.Text         = stringBuilder.ToString();
            dCinematicSpeech.Buttons      = null;
            dCinematicSpeech.MascotName   = MascotName;
            dCinematicSpeech.DismissTime  = ((AutoCloseTime > 0f) ? AutoCloseTime : ((float)DismissTime));
            dCinematicSpeech.CenterX      = CenterX;
            dCinematicSpeech.CenterY      = CenterY;
            dCinematicSpeech.OffsetY      = OffsetY;
            dCinematicSpeech.HideTail     = HideTail;
            dCinematicSpeech.ClickToClose = ClickToClose;
            dCinematicSpeech.ShowContinueImageImmediately = ClickToClose;
            dCinematicSpeech.KeepTextStyle    = true;
            dCinematicSpeech.BubbleContentKey = "Prefabs/Quest/CinematicSpeechBubbles/CinematicSpeechBubbleEmote";
            dispatcher.DispatchEvent(new CinematicSpeechEvents.ShowSpeechEvent(dCinematicSpeech));
            dispatcher.AddListener <CinematicSpeechEvents.SpeechCompleteEvent>(OnSpeechComplete);
            if (!WaitForFinish)
            {
                Finish();
            }
        }
 public SpeechCompleteEvent(DCinematicSpeech speechData)
 {
     SpeechData = speechData;
 }
 public HideSpeechEvent(DCinematicSpeech speechData)
 {
     SpeechData = speechData;
 }
 public ShowSpeechEvent(DCinematicSpeech speechData, bool hideQuestHud = true)
 {
     SpeechData   = speechData;
     HideQuestHud = hideQuestHud;
 }
        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();
            }
        }