Beispiel #1
0
    /// <summary>
    /// Animation event for fading in a text block.
    /// </summary>
    /// <param name='paramsString'>
    /// Parameters string. Parameters are given as pairs "key=value" separated by ", ".
    /// Required keys:
    ///  target - the target text controller to execute the event.
    ///  block - the name of the text game object
    /// Optional keys:
    ///  time - how much time the fade in animation should last
    /// </param>
    public void Event_FadeOutText(string paramsString)
    {
        Dictionary <string, string> values;

        TextController textController = GetTargetAndValues <TextController>(paramsString, out values);

        if (textController == null)
        {
            Debug.LogError("Event_FadeOutText(" + paramsString + ") does not contain target parameter or target not found. Ignoring event.");
            return;
        }

        if (!values.ContainsKey("block"))
        {
            Debug.LogError("Event_FadeOutText(" + paramsString + ") does not contain text block name parameter. Ignoring event.");
            return;
        }

        float time = TextBlock.DEFAULT_ANIMATION_TIME;

        if (values.ContainsKey("time"))
        {
            if (!float.TryParse(values["time"], out time))
            {
                Debug.LogWarning("Event_FadeOutText(" + paramsString + ") has bad formatting for the time parameter. Ignoring time parameter.");
                time = TextBlock.DEFAULT_ANIMATION_TIME;
            }
        }

        textController.FadeOutText(values["block"], time);
    }
Beispiel #2
0
    public void PauseMenu()
    {
        //Color tempColor = tc.textBox.color;
        float tempAlpha = tc.textBoxBackground.GetComponent <CanvasGroup>().alpha;

        if (GameManager.gameState == GameManager.GameState.Paused)
        {
            pauseUI.GetComponent <CanvasGroup>().alpha = 1f;
            //currentTextColor = tempColor;
            //tc.textBox.color = new Color(tempColor.r, tempColor.g, tempColor.b, 0f);
            currentAlpha = tempAlpha;
            tc.textBoxBackground.GetComponent <CanvasGroup>().alpha = 0f;
        }
        else
        {
            pauseUI.GetComponent <CanvasGroup>().alpha = 0f;
            //tc.textBox.GetComponent<CanvasGroup>().alpha = currentTextColor.a;
            //tc.textBox.color = currentTextColor;
            tc.textBoxBackground.GetComponent <CanvasGroup>().alpha = currentAlpha;
            tc.StartCoroutine(tc.FadeOutText(tc.textBoxBackground, tc.textDelay));
        }
    }