Beispiel #1
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void FadeOut(float _ratio)
    {
        exUIRatioEvent ratioEvent = new exUIRatioEvent();

        ratioEvent.bubbles = false;
        ratioEvent.ratio   = _ratio;
        OnFadeOut(ratioEvent);
    }
Beispiel #2
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void Init()
    {
        if (inited)
        {
            return;
        }

        panel     = GetComponent <exUIPanel>();
        colorCtrl = GetComponent <exSpriteColorController>();

        if (panel)
        {
            panel.AddEventListener("onStartFadeIn",
                                   delegate(exUIEvent _event) {
                panel.gameObject.SetActive(true);
                if (colorCtrl)
                {
                    colorCtrl.color = new Color(1.0f, 1.0f, 1.0f, 0.0f);
                }
            });
            panel.AddEventListener("onFinishFadeOut",
                                   delegate(exUIEvent _event) {
                panel.gameObject.SetActive(false);
            });
            panel.AddEventListener("onFadeIn",
                                   delegate(exUIEvent _event) {
                exUIRatioEvent ratioEvent = _event as exUIRatioEvent;
                if (colorCtrl)
                {
                    colorCtrl.color = new Color(1.0f, 1.0f, 1.0f, ratioEvent.ratio);
                }
            });
            panel.AddEventListener("onFadeOut",
                                   delegate(exUIEvent _event) {
                exUIRatioEvent ratioEvent = _event as exUIRatioEvent;
                if (colorCtrl)
                {
                    colorCtrl.color = new Color(1.0f, 1.0f, 1.0f, 1.0f - ratioEvent.ratio);
                }
            });
        }

        inited = true;
    }
Beispiel #3
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void Awake()
    {
        exUIPanel panel = GetComponent <exUIPanel>();

        if (panel)
        {
            panel.AddEventListener("onStartFadeIn",
                                   delegate(exUIEvent _event) {
                transform.position = Vector3.zero;
                panel.gameObject.SetActive(true);
            });
            panel.AddEventListener("onFinishFadeOut",
                                   delegate(exUIEvent _event) {
                transform.position = new Vector3(2000, 2000, 0);
                panel.gameObject.SetActive(false);
            });

            if (useLeftToRight)
            {
                panel.AddEventListener("onFadeIn",
                                       delegate(exUIEvent _event) {
                    exUIRatioEvent ratioEvent = _event as exUIRatioEvent;
                    transform.position        = Vector3.Lerp(new Vector3(-1000, 0, 0),
                                                             new Vector3(0, 0, 0),
                                                             ratioEvent.ratio);
                });
                panel.AddEventListener("onFadeOut",
                                       delegate(exUIEvent _event) {
                    exUIRatioEvent ratioEvent = _event as exUIRatioEvent;
                    transform.position        = Vector3.Lerp(new Vector3(0, 0, 0),
                                                             new Vector3(1000, 0, 0),
                                                             ratioEvent.ratio);
                });
            }
        }
    }
Beispiel #4
0
 // ------------------------------------------------------------------
 // Desc:
 // ------------------------------------------------------------------
 public void FadeOut( float _ratio )
 {
     exUIRatioEvent ratioEvent = new exUIRatioEvent();
     ratioEvent.bubbles = false;
     ratioEvent.ratio = _ratio;
     OnFadeOut (ratioEvent);
 }