public void AnimateAlpha(float from, float to, float time, EventDelegate.Callback callback, UITweener.Method method = UITweener.Method.Linear, float delay = 0) { backgroundAlpha = to; foregroundAlpha = to; TweenAlphaAdvance tweenAlpha = TweenAlphaAdvance.Begin(this.gameObject, time, to); tweenAlpha.from = from; tweenAlpha.method = method; tweenAlpha.delay = delay; EventDelegate.Add(tweenAlpha.onFinished, callback, true); }
private void PlayGetBonusAnimation() { bonusAnimationObj.SetActive(true); bonusAnimationObj.transform.localPosition = new Vector3(0, 170, 0); bonusAnimationObj.transform.localScale = Vector3.one * 2; NGUIToolsExtend.SetAlphaRecursively(bonusAnimationObj, 1); TweenScale tweenScale = TweenScale.Begin(bonusAnimationObj, 0.3f, Vector3.one); tweenScale.method = UITweener.Method.EaseOutBack; EventDelegate.Add(tweenScale.onFinished, () => { TweenPosition.Begin(bonusAnimationObj, 1.5f, new Vector3(0, 300, 0)).method = UITweener.Method.Linear; TweenAlphaAdvance.Begin(bonusAnimationObj, 1.5f, 0).method = UITweener.Method.EaseIn; }, true); }
public void ShowEnterAnimation(Action callback) { GameSystem.GetInstance().BlockFullScreen = true; NGUIToolsExtend.SetAlphaRecursively(background, 0); NGUIToolsExtend.SetAlphaRecursively(vipState, 0); int lastIndex = modeObjects.Count - 2; if (Config.isMoreGameActive) { lastIndex = modeObjects.Count - 1; } TweenAlphaAdvance.Begin(background, 0.4f + lastIndex * 0.1f, 1); TweenAlphaAdvance.Begin(vipState, 0.4f, 1); Vector3 endPos = title.transform.localPosition; Vector3 startPos = endPos; startPos.y = 600; title.transform.localPosition = startPos; TweenPosition tweenPosition = TweenPosition.Begin(title, 0.4f, endPos); tweenPosition.method = UITweener.Method.EaseOut; endPos = vipButton.transform.localPosition; startPos = endPos; startPos.y = 600; vipButton.transform.localPosition = startPos; tweenPosition = TweenPosition.Begin(vipButton, 1f, endPos); tweenPosition.delay = 0.1f; tweenPosition.method = UITweener.Method.BounceOut; endPos = giftButton.transform.localPosition; startPos = endPos; startPos.y = 600; giftButton.transform.localPosition = startPos; tweenPosition = TweenPosition.Begin(giftButton, 1f, endPos); tweenPosition.delay = 0.1f; tweenPosition.method = UITweener.Method.BounceOut; endPos = toolBar.transform.localPosition; startPos = endPos; startPos.x = -800; toolBar.transform.localPosition = startPos; tweenPosition = TweenPosition.Begin(toolBar, 0.4f, endPos); tweenPosition.method = UITweener.Method.EaseOut; int index = 0; foreach (GameObject modeItem in modeObjects) { endPos = modeItem.transform.localPosition; startPos = endPos; startPos.x = 800; modeItem.transform.localPosition = startPos; tweenPosition = TweenPosition.Begin(modeItem, 0.4f, endPos); tweenPosition.delay = index * 0.1f; tweenPosition.method = UITweener.Method.EaseOut; if (index == lastIndex) { EventDelegate.Add(tweenPosition.onFinished, () => { GameSystem.GetInstance().BlockFullScreen = false; MainMenuEnterAnimFinish(); if (callback != null) { callback(); } }, true); break; } index++; } }