public static TweenAlpha FadeTo(GameObject go, UITweener.Method method, UITweener.Style style,
                                    float duration, float delay, float alphaFrom, float alphaTo)
    {
        if (go == null)
        {
            return(null);
        }

        //go.RemoveComponent<TweenAlpha>();

        TweenAlpha comp = UITweenerUtil.Begin <TweenAlpha>(go, method, style, duration, delay);

        //comp.ResetToBeginning();
        comp.from     = alphaFrom;
        comp.to       = alphaTo;
        comp.duration = duration;
        comp.delay    = delay;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        comp = ResetTween(comp);
        comp.Play(true);
        return(comp);
    }
Beispiel #2
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        NGUIEditorTools.SetLabelWidth(120f);

        TweenAlpha tw = target as TweenAlpha;

        GUI.changed = false;

        float from = EditorGUILayout.Slider("From", tw.from, 0f, 1f);
        float to   = EditorGUILayout.Slider("To", tw.to, 0f, 1f);

        if (GUI.changed)
        {
            NGUIEditorTools.RegisterUndo("Tween Change", tw);
            tw.from = from;
            tw.to   = to;
            if (preview)
            {
                tw.Sample(tw.tweenFactor, false);
            }
            NGUITools.SetDirty(tw);
        }

        DrawCommonProperties();
    }
Beispiel #3
0
    /// <summary>
    /// 开始延迟执行
    /// </summary>
    /// <param name="go"></param>
    /// <param name="delay"></param>
    /// <param name="duration"></param>
    /// <param name="end"></param>
    /// <returns></returns>
    static public TweenAlpha Begin(GameObject go, float delay, float duration, float start, float end)
    {
        UIWidget tmpWidget = go.GetComponent <UIWidget>();
        UIPanel  tmpPanel  = go.GetComponent <UIPanel>();

        if (tmpWidget != null)
        {
            tmpWidget.alpha = start;
        }
        if (tmpPanel != null)
        {
            tmpPanel.alpha = start;
        }

        TweenAlpha comp = UITweener.Begin <TweenAlpha>(go, delay, duration);

        comp.from = start;
        comp.to   = end;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }

        return(comp);
    }
Beispiel #4
0
    void Beginalpha(float duration, float Fromalpha, float Toalpha)
    {
        TweenAlpha comp = UITweener.Begin <TweenAlpha>(gameObject, duration);

        comp.from = Fromalpha;
        comp.to   = Toalpha;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
    }
Beispiel #5
0
    public static TweenAlpha Begin(GameObject go, Single duration, Single alpha)
    {
        TweenAlpha tweenAlpha = UITweener.Begin <TweenAlpha>(go, duration);

        tweenAlpha.from = tweenAlpha.value;
        tweenAlpha.to   = alpha;
        if (duration <= 0f)
        {
            tweenAlpha.Sample(1f, true);
            tweenAlpha.enabled = false;
        }
        return(tweenAlpha);
    }
Beispiel #6
0
    public static TweenAlpha Begin(GameObject go, float duration, float alpha)
    {
        TweenAlpha alpha2 = UITweener.Begin <TweenAlpha>(go, duration);

        alpha2.from = alpha2.alpha;
        alpha2.to   = alpha;
        if (duration <= 0f)
        {
            alpha2.Sample(1f, true);
            alpha2.enabled = false;
        }
        return(alpha2);
    }
Beispiel #7
0
    public static TweenAlpha Begin(GameObject go, float duration, float alpha)
    {
        TweenAlpha tweenAlpha = UITweener.Begin <TweenAlpha>(go, duration, true);

        tweenAlpha.from = tweenAlpha.value;
        tweenAlpha.to   = alpha;
        if (duration <= 0f)
        {
            tweenAlpha.Sample(1f, true);
            tweenAlpha.set_enabled(false);
        }
        return(tweenAlpha);
    }
Beispiel #8
0
	/// <summary>
	/// Start the tweening operation.
	/// </summary>

	static public TweenAlpha Begin (GameObject go, float duration, float alpha, float delay = 0f)
	{
		TweenAlpha comp = UITweener.Begin<TweenAlpha>(go, duration, delay);
		comp.from = comp.value;
		comp.to = alpha;

		if (duration <= 0f)
		{
			comp.Sample(1f, true);
			comp.enabled = false;
		}
		return comp;
	}
Beispiel #9
0
    public static TweenAlpha Begin(GameObject go, float duration, float alpha)
    {
        TweenAlpha tweenAlpha = UITweener.Begin <TweenAlpha>(go, duration);

        tweenAlpha.from = tweenAlpha.alpha;
        tweenAlpha.to   = alpha;
        if (duration <= 0f)
        {
            tweenAlpha.Sample(1f, isFinished: true);
            tweenAlpha.enabled = false;
        }
        return(tweenAlpha);
    }
Beispiel #10
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenAlpha Begin(GameObject go, float duration, float alpha)
    {
        TweenAlpha comp = NGUITweener.Begin <TweenAlpha>(go, duration);

        comp.from = comp.alpha;
        comp.to   = alpha;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Beispiel #11
0
    /// <summary>
    /// Start the tweening operation.
    /// </summary>

    static public TweenAlpha Begin(GameObject go, float duration, float alpha, Method method = Method.Linear)
    {
        TweenAlpha comp = UITweener.Begin <TweenAlpha>(go, duration);

        comp.from   = comp.value;
        comp.to     = alpha;
        comp.method = method;
        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Beispiel #12
0
    /// <summary>
    /// 新增回调  江志祥
    /// </summary>
    /// <param name="go"></param>
    /// <param name="duration"></param>
    /// <param name="alpha"></param>
    /// <returns></returns>
    static public TweenAlpha Begin(GameObject go, float duration, float Fromalpha, float Toalpha, ButtonCallBack CallBack)
    {
        TweenAlpha comp = UITweener.Begin <TweenAlpha>(go, duration);

        comp.from = Fromalpha;
        comp.to   = Toalpha;
        comp.CallBackWhenFinished = CallBack;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Beispiel #13
0
        private void InitPage(int page)
        {
            SkillPage.Left.SetActive(false);
            SkillPage.Right.SetActive(false);
            CatalogPage.Left.SetActive(false);
            CatalogPage.Right.SetActive(false);

            ClearPage();

            BookDummy.Builder.SetPage(page, true);
            BookDummy.Builder.ForceUpdate();
            ChangeState(TurnState.Show);

            alphaAnim.Sample(1f, true);
            alphaAnim.enabled = false;

            logicLastPage = -1;
        }
Beispiel #14
0
    public static TweenAlpha FadeTo(bool reset, GameObject go, UITweener.Method method, UITweener.Style style,
                                    float duration, float delay, float alpha)
    {
        if (go == null)
        {
            return(null);
        }

        if (reset)
        {
            //go.RemoveComponent<TweenAlpha>();
        }

        iTween.Stop(go);

        TweenAlpha comp = UITweenerUtil.Begin <TweenAlpha>(go, method, style, duration, delay);

        if (reset)
        {
            comp = ResetTween(comp);
        }
        comp.from     = comp.alpha;
        comp.to       = alpha;
        comp.duration = duration;
        comp.delay    = delay;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        if (!reset)
        {
            comp = ResetTween(comp);
        }
        comp.Play(true);

        FadeInHandler(go, duration, delay);

        return(comp);
    }
Beispiel #15
0
 public void ResetUIPlayTweenTargetToBegining()
 {
     if (this.NGUIPlayTween != null && this.NGUIPlayTween.tweenTarget != null)
     {
         GameObject    tweenTarget = this.NGUIPlayTween.tweenTarget;
         TweenPosition component   = tweenTarget.GetComponent <TweenPosition>();
         if (component != null)
         {
             component.enabled = false;
             component.ResetToBeginning();
             component.Sample(0f, true);
             component.tweenFactor = 0f;
         }
         TweenAlpha component2 = tweenTarget.GetComponent <TweenAlpha>();
         if (component2 != null)
         {
             component2.ResetToBeginning();
             component2.Sample(0f, true);
             component2.tweenFactor = 0f;
             component2.enabled     = false;
         }
     }
 }