public void FadeIn() { Show(); //Debug.Log("Scroller FadeIn"); m_BackgroundLayout.FadeAlpha = 0; m_Tweener.TweenTo(m_BackgroundLayout, "m_FadeAlpha", 1.0f, 0.1f, null, OnFadeInUpdate); }
public virtual void Hide(Tween.Tweener tweener) { if (Alpha > 0.0f) { tweener.TweenTo(this, "Alpha", 0.0f, m_FadeOutTime); } }
public virtual void Show(Tween.Tweener tweener) { if (Alpha < 1.0f) { tweener.TweenTo(this, "Alpha", 1.0f, m_FadeInTime); } }
void UpdateBackground(bool anyScreenVisible, bool force) { if (m_Background == null) { return; } bool display = m_BackgroundCustomVisibility && anyScreenVisible; float tweenFrom = m_Background.FadeAlpha; float tweenTo = 0.0f; m_Tweener.StopTweens(false); if (display == true) { tweenTo = 1.0f; if (m_Background.Visible == false) { m_Background.ShowImmediate(true); } } else if (display == false) { tweenTo = 0.0f; if (force == true) { m_Background.ShowImmediate(false); } } if (force == true) { m_Background.SetFadeAlpha(tweenTo, true); } else { m_BackgroundAlpha = tweenFrom; m_Tweener.TweenTo(this, "m_BackgroundAlpha", tweenTo, 0.15f, Tween.Easing.Linear.EaseNone, (tween, finished) => { m_Background.SetFadeAlpha(m_BackgroundAlpha, true); if (finished == true && m_Background.FadeAlpha == 0.0f) { m_Background.ShowImmediate(false); } }); } }
protected override void OnViewUpdate() { base.OnViewUpdate(); float targetAlpha = m_AnyScreenVisible == false ? 1.0f : 0.0f; if (m_LayoutAlpha != targetAlpha) { m_Tweener.TweenTo(this, "m_LayoutAlpha", targetAlpha, 0.05f, Tween.Easing.Sine.EaseInOut, (tween, finished) => { if (Layout.Visible == false && m_LayoutAlpha > 0.0f) { Layout.Show(true); } else if (Layout.Visible == true && m_LayoutAlpha <= 0.0f) { Layout.Show(false); } Layout.SetFadeAlpha(m_LayoutAlpha, false); Layout.SetModify(true, false); }); } if (m_Tweener.IsTweening == true) { m_Tweener.UpdateTweens(); } UpdateLayout(); Layout.InputEnabled = Layout.FadeAlpha < 1.0f ? false : true; }