Esempio n. 1
0
    private void updateSpeechBubblePosition(CinematicSpeechBubble bubble)
    {
        if (bubble.SpeechData.MascotTarget == null)
        {
            float x = canvas.pixelRect.width / 2f * (1f / canvas.scaleFactor);
            float y = canvas.pixelRect.height / 2f * (1f / canvas.scaleFactor);
            bubble.RectTransform.anchoredPosition = new Vector2(x, y);
            return;
        }
        Vector3          vector    = bubble.SpeechData.MascotTarget.transform.position;
        MascotController component = bubble.SpeechData.MascotTarget.GetComponent <MascotController>();

        if (component != null)
        {
            vector += component.QuestIndicatorOffset * 0.6f;
        }
        vector.y += (float)Screen.height * bubble.SpeechData.OffsetYPercent + bubble.SpeechData.OffsetY;
        vector    = gameCamera.WorldToScreenPoint(vector);
        vector.z  = 0f;
        if (bubble.SpeechData.CenterX)
        {
            vector.x = (float)Screen.width * 0.5f;
        }
        if (bubble.SpeechData.CenterY)
        {
            vector.y = (float)Screen.height * 0.5f + (float)Screen.height * bubble.SpeechData.OffsetYPercent + bubble.SpeechData.OffsetY;
        }
        vector.x *= 1f / canvas.scaleFactor;
        vector.y *= 1f / canvas.scaleFactor;
        bubble.RectTransform.anchoredPosition = vector;
    }
Esempio n. 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());
    }
Esempio n. 3
0
    private bool onHideCinematicSpeech(CinematicSpeechEvents.HideSpeechEvent evt)
    {
        CinematicSpeechBubble cinematicSpeechBubble = speechDataToActiveBubble(evt.SpeechData);

        if (cinematicSpeechBubble != null)
        {
            cinematicSpeechBubble.HideSpeech();
        }
        return(false);
    }
Esempio n. 4
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);
    }
Esempio n. 5
0
 private void clearSpeechBubble(CinematicSpeechBubble speechBubble)
 {
     activeSpeechBubbles.Remove(speechBubble);
     Object.Destroy(speechBubble.gameObject);
     fullScreenButton.SetActive(clickToClose());
 }