Esempio n. 1
0
    static void onFinished2()
    {
        WndAniCB cb = mWndNow.GetComponent <WndAniCB>();

        if (cb != null)
        {
            cb.OnFinished();
        }
    }
Esempio n. 2
0
    static void onHideFinished2()
    {
        if (TweenAlpha.current.tweenFactor != 0)
        {
            return;
        }

        WndAniCB cb = mWndNow.GetComponent <WndAniCB>();

        if (cb != null)
        {
            cb.OnFinishedHide();
        }
        mWndNow.SetActive(false);
        mWndNow.transform.localPosition = Vector3.zero;
    }
Esempio n. 3
0
    static void onFinished()
    {
        UITweener ts = TweenScale.current;
        WndAniCB  cb = ts.gameObject.GetComponent <WndAniCB>();

        if (ts.duration == mShowDur)
        {
            if (cb != null)
            {
                cb.OnFinished();
            }
        }
        else if (ts.duration == mHideDur)
        {
            if (cb != null)
            {
                cb.OnFinishedHide();
            }
            ts.gameObject.SetActive(false);
            ts.gameObject.transform.localScale    = Vector3.one;
            ts.gameObject.transform.localPosition = Vector3.zero;
        }
    }
Esempio n. 4
0
    public static void ShowWndAni(GameObject objWnd, bool bFullscreen, string strBG, float startX, float startY)
    {
        if (objWnd == null)
        {
            return;
        }
        objWnd.SetActive(true);

        if (bFullscreen)
        {
            sdUICharacter.Instance.ShowFullScreenUI(true);
            WndAniCB cb = objWnd.GetComponent <WndAniCB>();
            if (cb != null)
            {
                cb.OnFinished();
            }
        }
        else
        {
            TweenScale ts = objWnd.GetComponent <TweenScale>();
            if (ts == null)
            {
                ts = objWnd.AddComponent <TweenScale>();
                EventDelegate.Add(ts.onFinished, onFinished);
            }

            // 出现位置..
            TweenPosition tp = null;
            if (startX != 0 || startY != 0)
            {
                tp = objWnd.GetComponent <TweenPosition>();
                if (tp == null)
                {
                    tp = objWnd.AddComponent <TweenPosition>();
                }
            }

            if (strBG != null && strBG != "")
            {
                Transform t = objWnd.transform.FindChild(strBG);
                if (t != null)
                {
                    // 蒙版将以逐变效果出现..
                    t.localScale = new Vector3(1f / mStart.x, 1f / mStart.y, 1f);
                    TweenAlpha ta = t.gameObject.GetComponent <TweenAlpha>();
                    if (ta == null)
                    {
                        ta      = t.gameObject.AddComponent <TweenAlpha>();
                        ta.from = 0f;
                        EventDelegate.Add(ta.onFinished, onAlphaFinished);
                    }
                    ta.duration = mShowDur;
                    ta.PlayForward();
                }
            }

            ts.animationCurve = mWndAni1;
            ts.duration       = mShowDur;
            ts.from           = mStart;
            ts.tweenFactor    = 0;
            ts.PlayForward();

            if (tp != null)
            {
                tp.from        = new Vector3(startX, startY, 0);
                tp.duration    = mShowDur;
                tp.tweenFactor = 0;
                tp.PlayForward();
            }
        }
    }
Esempio n. 5
0
    public static void HideWndAni(GameObject objWnd, bool bFullscreen, string strBG, float startX, float startY)
    {
        if (objWnd == null)
        {
            return;
        }

        if (bFullscreen)
        {
            WndAniCB cb = objWnd.GetComponent <WndAniCB>();
            if (cb != null)
            {
                cb.OnFinishedHide();
            }
            sdUICharacter.Instance.ShowFullScreenUI(false, objWnd);
            objWnd.SetActive(false);
            //objWnd.transform.localScale = Vector3.one;
            //ta.gameObject.transform.localPosition = Vector3.zero;
        }
        else
        {
            TweenScale ts = objWnd.GetComponent <TweenScale>();
            if (ts == null)
            {
                ts = objWnd.AddComponent <TweenScale>();
                EventDelegate.Add(ts.onFinished, onFinished);
            }

            TweenPosition tp = null;
            if (startX != 0 || startY != 0)
            {
                tp = objWnd.GetComponent <TweenPosition>();
                if (tp == null)
                {
                    tp = objWnd.AddComponent <TweenPosition>();
                }
            }

            // 处理蒙版效果,对非全屏窗口,将以逐变效果出现..
            if (strBG != null && strBG != "")
            {
                Transform t = objWnd.transform.FindChild(strBG);
                if (t != null)
                {
                    // 蒙版将以逐变效果出现..
                    t.localScale = new Vector3(1f / mStart.x, 1f / mStart.y, 1f);

                    TweenAlpha ta = t.gameObject.GetComponent <TweenAlpha>();
                    if (ta == null)
                    {
                        ta      = t.gameObject.AddComponent <TweenAlpha>();
                        ta.from = 0f;
                        EventDelegate.Add(ta.onFinished, onAlphaFinished);
                    }
                    ta.duration    = mHideDur;
                    ta.tweenFactor = 1f;
                    ta.PlayReverse();
                }
            }

            ts.duration       = mHideDur;
            ts.from           = mStart;
            ts.animationCurve = mWndAni2;
            ts.tweenFactor    = 1f;
            ts.PlayReverse();

            if (tp != null)
            {
                tp.from        = new Vector3(startX, startY, 0);
                tp.duration    = mHideDur;
                tp.tweenFactor = 1f;
                tp.PlayReverse();
            }
        }
    }