public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        NGUIEditorTools.SetLabelWidth(120f);

        TweenColor tw = target as TweenColor;

        GUI.changed = false;

        Color from = EditorGUILayout.ColorField("From", tw.from);
        Color to   = EditorGUILayout.ColorField("To", tw.to);

        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 #2
0
    public static TweenColor Begin(GameObject go, float duration, Color color)
    {
        TweenColor color2 = UITweener.Begin <TweenColor>(go, duration);

        color2.from = color2.color;
        color2.to   = color;
        if (duration <= 0f)
        {
            color2.Sample(1f, true);
            color2.enabled = false;
        }
        return(color2);
    }
    // Token: 0x0600028E RID: 654 RVA: 0x00021418 File Offset: 0x0001F618
    public static TweenColor Begin(GameObject go, float duration, Color color)
    {
        TweenColor tweenColor = UITweener.Begin <TweenColor>(go, duration);

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

    static public TweenColor Begin(GameObject go, float duration, float colorLerp)
    {
        TweenColor comp = UITweener.Begin <TweenColor>(go, duration);

        comp.from = comp.Color;
        comp.to   = comp.GetColor(colorLerp);

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
Beispiel #5
0
    static public TweenColor Begin2(GameObject go, float duration, Color from, Color to)
    {
        TweenColor comp = UITweener.Begin <TweenColor>(go, duration);

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

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
    public static TweenColor Begin(GameObject go, float duration, Color color)
    {
        //IL_000b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0010: Unknown result type (might be due to invalid IL or missing references)
        //IL_0016: Unknown result type (might be due to invalid IL or missing references)
        //IL_0017: Unknown result type (might be due to invalid IL or missing references)
        TweenColor tweenColor = UITweener.Begin <TweenColor>(go, duration, true);

        tweenColor.from = tweenColor.value;
        tweenColor.to   = color;
        if (duration <= 0f)
        {
            tweenColor.Sample(1f, true);
            tweenColor.set_enabled(false);
        }
        return(tweenColor);
    }
Beispiel #7
0
    static public TweenColor Begin3(GameObject go, float duration, Color from, Color to)
    {
        TweenColor comp = UITweener.Begin <TweenColor>(go, duration);

        comp.from  = from;
        comp.to    = to;
        comp.style = Style.Once;

        comp.animationCurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(0.5f, 1f), new Keyframe(1f, 0f));

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

    static public TweenColor Begin(GameObject go, float duration, Color color)
    {
#if UNITY_EDITOR
        if (!Application.isPlaying)
        {
            return(null);
        }
#endif
        TweenColor comp = UITweener.Begin <TweenColor>(go, duration);
        comp.from = comp.value;
        comp.to   = color;
        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        return(comp);
    }
    public static TweenColor ColorTo(bool reset, GameObject go, UITweener.Method method, UITweener.Style style,
                                     float duration, float delay, Color colorTo)
    {
        if (go == null)
        {
            return(null);
        }

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

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

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

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            comp.enabled = false;
        }
        if (!reset)
        {
            comp = ResetTween(comp);
        }
        comp.Play(true);
        return(comp);
    }
Beispiel #10
0
    public override void UpdateColor(bool shouldBeEnabled, bool immediate)
    {
        if (!mStarted)
        {
            mStarted = true;
            Init();
        }

        float duration = 0.2f;

        foreach (UIWidget tweenTarget_ in _widgetColors.Keys)
        {
            if (tweenTarget_ != null && NGUITools.GetActive(tweenTarget_.gameObject))
            {
                Color      c  = shouldBeEnabled ? _widgetColors[tweenTarget_]: _widgetColors[tweenTarget_] * disabledColor;
                TweenColor tc = TweenColor.Begin(tweenTarget_.gameObject, duration, c);
                if (immediate)
                {
                    tc.Sample(1.0f, true);
                    tc.enabled = false;
                }
            }
        }
    }