예제 #1
0
    protected virtual void Present()
    {
        if (onAlertViewWillAppear != null)
        {
            onAlertViewWillAppear(this);
        }

        //remove disappear animation tweeners:
        UIMultiAlphaTween multiAlphaTweener = gameObject.GetComponentInChildren <UIMultiAlphaTween>();

        if (multiAlphaTweener != null)
        {
            multiAlphaTweener.Reset();
            multiAlphaTweener.enabled = false;
        }

        isDisappearAnimationPlaying = false;
        isAppearAnimationPlaying    = true;

        //setup appear animation tweeners:
        TweenPosition positionTweener = gameObject.GetComponentInChildren <TweenPosition>();

        if (positionTweener == null)
        {
            positionTweener = gameObject.AddComponent <TweenPosition>();
        }


        positionTweener.from     = transform.localPosition + Vector3.up * 200f;
        positionTweener.to       = transform.localPosition;
        positionTweener.duration = kAppearDuration * 0.5f;
        positionTweener.method   = UITweener.Method.EaseOut;

        TweenScale scaleTweener = gameObject.GetComponentInChildren <TweenScale>();

        if (scaleTweener == null)
        {
            scaleTweener = gameObject.AddComponent <TweenScale>();
        }

        scaleTweener.from             = new Vector3(0.1f, 0.1f, 1f);
        scaleTweener.to               = Vector3.one;
        scaleTweener.duration         = kAppearDuration;
        scaleTweener.method           = UITweener.Method.BounceIn;
        scaleTweener.callWhenFinished = "OnAppear";
        scaleTweener.eventReceiver    = gameObject;

        scaleTweener.Reset();
        scaleTweener.Play(true);
        positionTweener.Reset();
        positionTweener.Play(true);

        //play sfx
//!!!		AudioManager.PlaySfxClip(AudioManager.alert_appear_sfx);
    }
예제 #2
0
    public virtual void Dismiss()
    {
        if (onAlertViewWillDisappear != null)
        {
            onAlertViewWillDisappear(this);
        }
        //remove appear animation tweeners:
        TweenPosition positionTweener = gameObject.GetComponentInChildren <TweenPosition>();

        if (positionTweener != null)
        {
            positionTweener.enabled = false;
        }
        TweenScale scaleTweener = gameObject.GetComponentInChildren <TweenScale>();

        if (scaleTweener != null)
        {
            scaleTweener.enabled = false;
        }

        isAppearAnimationPlaying    = false;
        isDisappearAnimationPlaying = true;

        //setup disappear animation tweeners:
        UIMultiAlphaTween multiAlphaTweener = gameObject.GetComponentInChildren <UIMultiAlphaTween>();

        if (multiAlphaTweener == null)
        {
            multiAlphaTweener = gameObject.AddComponent <UIMultiAlphaTween>();
        }

        multiAlphaTweener.callWhenFinished = "OnDisappear";
        multiAlphaTweener.eventReceiver    = gameObject;
        multiAlphaTweener.from             = 1f;
        multiAlphaTweener.to       = 0.0f;
        multiAlphaTweener.method   = UITweener.Method.EaseIn;
        multiAlphaTweener.duration = kDisappearDuration;
        multiAlphaTweener.Reset();
        multiAlphaTweener.Play(true);
    }