Exemple #1
0
    public static XColorHash Color(Color start, Color end, bool isRelative = false)
    {
        XColorHash hash = XColorHash.New;

        hash.AddColor(start, end, isRelative);
        return(hash);
    }
Exemple #2
0
    public static XColorHash Color(Color color, bool isRelative = false)
    {
        XColorHash hash = XColorHash.New;

        hash.AddColor(color, isRelative);
        return(hash);
    }
Exemple #3
0
    public XColorHash AddAlpha(float start, float end, bool isRelative = false)
    {
        XColorHash hash = this.GetStart();

        hash.Alpha  = start;
        this._start = hash;
        return(AddAlpha(end, isRelative));
    }
Exemple #4
0
    public XColorHash GetStart()
    {
        if (this._start == null)
        {
            this._start = Pool <XColorHash> .Pop();
        }

        return(this._start);
    }
Exemple #5
0
        public static IUpdating Create <T>(T target, string propertyName, XColorHash dest, XColorHash source)
        {
            ColorUpdater <T> updator = new ColorUpdater <T>();

            updator.Target       = target;
            updator.PropertyName = propertyName;
            updator.Start        = source;
            updator.Finish       = dest;
            return(updator);
        }
Exemple #6
0
    public XColorHash AddColor(Color start, Color end, bool isRelative = false)
    {
        XColorHash hash = this.GetStart();

        this.AddRed(start.r, end.r, isRelative);
        this.AddGreen(start.g, end.g, isRelative);
        this.AddBlue(start.b, end.b, isRelative);
        this.AddAlpha(start.a, end.a, isRelative);
        return(this);
    }
Exemple #7
0
 public override void Dispose()
 {
     base.Dispose();
     this._updaterColor.Dispose();
     this._updateCount  = 0;
     this._target       = default(T);
     this._propertyName = null;
     this._col          = default(Color);
     this._start        = null;
     this._finish       = null;
     this._updater      = null;
 }
Exemple #8
0
    //Color Property
    public static IAni To <T>(T target, string colorPropertyName, XColorHash hash, float time = 1.0f, IEasing easing = null, uint frameSkip = 0, bool realTime = false)
    {
        ITimer           tick     = _ticker;
        ITimer           tickReal = _tickerReal;
        ObjectTween      tween    = new ObjectTween(realTime ? tickReal : tick);
        ColorUpdater <T> updater  = (ColorUpdater <T>)UpdaterFactory.Create <T>(target, colorPropertyName, hash, hash.GetStart());

        tween.FrameSkip       = frameSkip;
        tween.updater         = updater;
        tween.ClassicHandlers = hash;
        tween.time            = time;
        tween.easing          = (easing != null) ? easing : Linear.easeNone;
        return(tween);
    }
Exemple #9
0
    //Color Property
    public static IXTween ToColor <T>(T target, string colorPropertyName, XColorHash hash, float time, IEasing easing = null, bool realTime = false)
    {
        ITimer      tick     = _ticker;
        ITimer      tickReal = _tickerReal;
        ObjectTween tween    = Pool <ObjectTween> .Pop();

        ColorUpdater <T> updater = UpdaterFactory.Create <T>(target, colorPropertyName, hash, hash.GetStart());

        tween.Initialize(realTime ? tickReal : tick, 0);
        tween.Updater         = updater;
        tween.ClassicHandlers = hash;
        tween.Time            = time;
        tween.Easing          = (easing != null) ? easing : Linear.easeNone;
        return(tween);
    }
Exemple #10
0
    /************************************************************************
    *	                Coroutine Declaration	                            *
    ************************************************************************/
    protected override IEnumerator CoroutineStart()
    {
        if (this._tween != null)
        {
            this._tween.Stop();
            this._tween = null;
        }
        this.sprite.color = this._color;
        yield return(new WaitForSeconds(0.5f));

        TweenUIData data = this.uiContainer.Data;
        XColorHash  hash = XColorHash.New.AddRed(0.56f).AddGreen(0.83f).AddAlpha(1f);

        this._tween = XTween.To(sprite, hash, data.time, data.Easing);
        this._tween.Play();
    }
Exemple #11
0
    //Color - Property
    public static IXTween ToColor <T>(this T target, string colorPropertyName, float?r, float?g, float?b, float?a, float time, IEasing easing = null, bool realTime = false)
    {
        XColorHash hash = XColorHash.New;

        if (r != null)
        {
            hash.AddRed((float)r);
        }
        if (g != null)
        {
            hash.AddRed((float)g);
        }
        if (b != null)
        {
            hash.AddRed((float)b);
        }
        if (a != null)
        {
            hash.AddRed((float)a);
        }
        return(XTween.ToColor <T>(target, colorPropertyName, hash, time, easing, realTime));
    }
Exemple #12
0
    //Color - UI
    public static IXTween ToColor(this Graphic target, float?r, float?g, float?b, float?a, float time, IEasing easing = null, bool realTime = false)
    {
        XColorHash hash = XColorHash.New;

        if (r != null)
        {
            hash.AddRed((float)r);
        }
        if (g != null)
        {
            hash.AddRed((float)g);
        }
        if (b != null)
        {
            hash.AddRed((float)b);
        }
        if (a != null)
        {
            hash.AddRed((float)a);
        }
        return(XTween.ToColor <Graphic>(target, "color", hash, time, easing, realTime));
    }
Exemple #13
0
    public static XColorHash Color(float?r, float?g, float?b, float?a, bool isRelative = false)
    {
        XColorHash hash = XColorHash.New;

        if (r != null)
        {
            hash.AddRed((float)r, isRelative);
        }
        if (g != null)
        {
            hash.AddGreen((float)g, isRelative);
        }
        if (b != null)
        {
            hash.AddBlue((float)b, isRelative);
        }
        if (a != null)
        {
            hash.AddAlpha((float)a, isRelative);
        }
        return(hash);
    }
Exemple #14
0
 //Color Property
 public static IAni To <T>(this T target, string colorPropertyName, XColorHash hash, float time = 1.0f, IEasing easing = null, uint frameSkip = 0, bool realTime = false)
 {
     return(XTween.To <T>(target, colorPropertyName, hash, time, easing, frameSkip, realTime));
 }
Exemple #15
0
 //UI
 public static IAni To(this Graphic target, XColorHash hash, float time = 1.0f, IEasing easing = null, uint frameSkip = 0, bool realTime = false)
 {
     return(XTween.To <Graphic>(target, "color", hash, time, easing, frameSkip, realTime));
 }
Exemple #16
0
 /*===================================== Color ========================================*/
 //Sprite
 public static IAni To(SpriteRenderer target, XColorHash hash, float time = 1.0f, IEasing easing = null, uint frameSkip = 0, bool realTime = false)
 {
     return(To <SpriteRenderer>(target, "color", hash, time, easing, frameSkip, realTime));
 }
Exemple #17
0
 //Color - Property
 public static IXTween ToColor <T>(this T target, string colorPropertyName, XColorHash hash, float time, IEasing easing = null, bool realTime = false)
 {
     return(XTween.ToColor <T>(target, colorPropertyName, hash, time, easing, realTime));
 }
Exemple #18
0
 //Color - UI
 public static IXTween ToColor(this Graphic target, XColorHash hash, float time, IEasing easing = null, bool realTime = false)
 {
     return(XTween.ToColor <Graphic>(target, "color", hash, time, easing, realTime));
 }
Exemple #19
0
 //Color - Sprite
 public static IXTween ToColor(this SpriteRenderer target, XColorHash hash, float time, IEasing easing = null, bool realTime = false)
 {
     return(XTween.ToColor <SpriteRenderer>(target, "color", hash, time, easing, realTime));
 }