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

        if (cb != null)
        {
            cb.OnFinished();
        }
    }
Ejemplo n.º 2
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;
        }
    }
Ejemplo n.º 3
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();
            }
        }
    }