예제 #1
0
    /// <summary>
    /// パネルをフェードアウトさせる
    /// 第二引数を受け取った場合は第一引数のパネルをフェードアウトさせた後に第二引数のパネルをフェードインさせる
    /// </summary>
    /// <param name="customPanel">フェードアウトさせるパネル</param>
    /// <param name="nextCustomPanel">次にフェードインさせるパネル</param>
    /// <returns></returns>
    private IEnumerator FadeOut(UICustomPanel customPanel, UICustomPanel nextCustomPanel = null)
    {
        isFade       = true;
        CGroup.alpha = 1;
        while (true)
        {
            CGroup.alpha -= (1 * Time.deltaTime) / customPanel.fadeOutDuration;
            if (CGroup.alpha <= 0)
            {
                CGroup.alpha = 0;
                customPanel.gameObject.SetActive(false);
                break;
            }
            yield return(new WaitForEndOfFrame());
        }

        if (nextCustomPanel != null)
        {
            StartCoroutine(FadeIn(nextCustomPanel));
        }
        else
        {
            isFade        = false;
            curPanelIndex = -1;
        }
    }
예제 #2
0
    /// <summary>
    /// パネルをフェードインさせる
    /// </summary>
    /// <param name="customPanel">フェードインさせるパネル</param>
    /// <returns></returns>
    private IEnumerator FadeIn(UICustomPanel customPanel)
    {
        isFade       = true;
        CGroup.alpha = 0;
        customPanel.gameObject.SetActive(true);
        while (true)
        {
            CGroup.alpha += (1 * Time.deltaTime) / customPanel.fadeInDuration;
            if (CGroup.alpha >= 1)
            {
                CGroup.alpha = 1;
                break;
            }
            yield return(new WaitForEndOfFrame());
        }
        if (customPanel.fadeOutAuto)
        {
            yield return(new WaitForSeconds(customPanel.waitTime));

            StartCoroutine(FadeOut(customPanel));
        }
        else
        {
            isFade = false;
        }
    }
예제 #3
0
 private void Awake()
 {
     _target = target as UICustomPanel;
 }