Пример #1
0
    /* public - [Event] Function
     * 프랜드 객체가 호출(For Friend class call)*/

    // ========================================================================== //

    #region Protected

    /* protected - [abstract & virtual]         */

    /* protected - [Event] Function
     * 자식 객체가 호출(For Child class call)		*/

    /* protected - Override & Unity API         */

    protected override void OnAwake()
    {
        base.OnAwake();

        if (GetComponentInChildren(out _pUIText))
        {
            _eIndicatorType = EIndicatorType.UGUI;
            _pRectTrans     = _pUIText.GetComponent <RectTransform>();
            return;
        }

#if TMPro
        if (GetComponentInChildren(out _pUIText_TMPro))
        {
            _eIndicatorType = EIndicatorType.TextMeshPro;
            _pRectTrans     = _pUIText_TMPro.GetComponent <RectTransform>();
            return;
        }
#endif
#if NGUI
        if (GetComponentInChildren(out _pUILabel))
        {
            _eIndicatorType = EIndicatorType.NGUI;
            return;
        }
#endif
    }
Пример #2
0
    public void showFloatingText(Vector3 itemPosition, string message)
    {
        gameObject.SetActive(true);
        Vector3 newLoc = new Vector3(itemPosition.x, itemPosition.y + 1, itemPosition.z);

        gameObject.transform.position   = newLoc;
        gameObject.transform.localScale = new Vector3(0.5f, 0.5f, 0);
        text.GetComponent <TMPro.TextMeshPro>().text = message;
    }
Пример #3
0
    public void Start()
    {
        text          = transform.Find("Text").GetComponent <TMPro.TextMeshPro>();
        body          = transform.Find("Body").gameObject;
        textTransform = text.GetComponent <RectTransform>();

        text.fontSize = fontSize;

        transform.SetParent(null);
        transform.position = location.position + location.TransformVector(offset);
        transform.rotation = location.rotation;
        size();

        lifeCoroutine = fadeInFadeOutDie();
        StartCoroutine(lifeCoroutine);
    }
Пример #4
0
 public void HideCharacterLifeName()
 {
     _healthBar.transform.position = _hidePosition;
     _fightTitle.GetComponent <PositionBhv>().UpdatePositions();
 }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     text.GetComponent <MeshRenderer>().sortingOrder = 8;
     signFront = transform.FindChild("sign_front").gameObject;
     signBack  = transform.FindChild("sign_back").gameObject;
 }
Пример #6
0
    /// Show a line of dialogue, gradually
    public override IEnumerator RunLine(Yarn.Line line)
    {
        lineText.gameObject.SetActive(false);
        lineText.gameObject.SetActive(true);
        // Reset text
        customTagHandler.StopAllCoroutines();
        customTagHandler.clearClones();
        prevColors.Clear();
        lineText.SetText(customTagHandler.ParseForCustomTags(YarnRTFToTMP(line.text)));
        lineText.ForceMeshUpdate();
        customTagHandler.ApplyTagEffects();

        // Set up teletype by setting alpha to 0
        TMPro.TMP_Text     m_TextComponent = lineText.GetComponent <TMPro.TMP_Text>();
        TMPro.TMP_TextInfo textInfo        = m_TextComponent.textInfo;
        while (textInfo.characterCount == 0)
        {
            yield return(new WaitForSeconds(0.25f));
        }
        Color32[] newVertexColors;
        for (int currentCharacter = 0; currentCharacter < textInfo.characterCount; currentCharacter++)
        {
            int materialIndex = textInfo.characterInfo[currentCharacter].materialReferenceIndex;
            newVertexColors = textInfo.meshInfo[materialIndex].colors32;
            int vertexIndex = textInfo.characterInfo[currentCharacter].vertexIndex;
            // Save prev color
            if (textInfo.characterInfo[currentCharacter].isVisible)
            {
                for (int j = 0; j < 4; j++)
                {
                    prevColors.Add(textInfo.meshInfo[materialIndex].colors32[vertexIndex + j]);
                }
            }
            else
            {
                for (int j = 0; j < 4; j++)
                {
                    prevColors.Add(new Color32(0, 0, 0, 0));
                }
            }
            // Set color to transparent
            if (textInfo.characterInfo[currentCharacter].isVisible)
            {
                for (int j = 0; j < 4; j++)
                {
                    newVertexColors[vertexIndex + j] = new Color32(textInfo.meshInfo[materialIndex].colors32[vertexIndex + j].r, textInfo.meshInfo[materialIndex].colors32[vertexIndex + j].g, textInfo.meshInfo[materialIndex].colors32[vertexIndex + j].b, 0);
                }
                m_TextComponent.UpdateVertexData(TMPro.TMP_VertexDataUpdateFlags.Colors32);
            }
        }

        if (textSpeed > 0.0f)
        {
            // Display the line one character at a time
            for (int i = 0; i < textInfo.characterCount; i++)
            {
                int materialIndex = textInfo.characterInfo[i].materialReferenceIndex;
                newVertexColors = textInfo.meshInfo[materialIndex].colors32;
                int vertexIndex = textInfo.characterInfo[i].vertexIndex;
                if (textInfo.characterInfo[i].isVisible)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        newVertexColors[vertexIndex + j] = prevColors[4 * i + j];
                    }
                    m_TextComponent.UpdateVertexData(TMPro.TMP_VertexDataUpdateFlags.Colors32);
                }
                yield return(new WaitForSeconds(textSpeed));
            }
        }
        else
        {
            // Display the entire line immediately if textSpeed <= 0
            for (int currentCharacter = 0; currentCharacter < textInfo.characterCount; currentCharacter++)
            {
                int materialIndex = textInfo.characterInfo[currentCharacter].materialReferenceIndex;
                newVertexColors = textInfo.meshInfo[materialIndex].colors32;
                int vertexIndex = textInfo.characterInfo[currentCharacter].vertexIndex;
                // Set color back to the color it is supposed to be
                if (textInfo.characterInfo[currentCharacter].isVisible)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        newVertexColors[vertexIndex + j] = prevColors[4 * currentCharacter + j];
                    }
                    m_TextComponent.UpdateVertexData(TMPro.TMP_VertexDataUpdateFlags.Colors32);
                }
            }
        }

        // Reset custom tag runner
        customTagHandler.ClearParsedTags();

        // Show the 'press any key' prompt when done, if we have one
        if (continuePrompt != null)
        {
            continuePrompt.SetActive(true);
        }

        // Wait for trigger press
        while (gameManager.LH_Trigger == false && gameManager.RH_Trigger == false)
        {
            yield return(null);
        }

        // Avoid skipping lines if textSpeed == 0
        yield return(new WaitForEndOfFrame());

        // Hide the text and prompt
        lineText.gameObject.SetActive(false);

        if (continuePrompt != null)
        {
            continuePrompt.SetActive(false);
        }
    }