Пример #1
0
        public static ITweenJob CreateJob <T>()
        {
            ITweenJob job = null;

            if (typeof(RectTransform) == typeof(T))
            {
                job = new RectTransformJob();
            }
            else if (typeof(UnityEngine.Graphics) == typeof(T))
            {
                job = new GraphicsJob();
            }
            else if (typeof(UnityEngine.UI.Graphic) == typeof(T))
            {
                job = new GraphicsJob();
            }
            else if (typeof(Material) == typeof(T))
            {
                job = new MaterialJob();
            }
            else if (typeof(Transform) == typeof(T))
            {
                job = new TransformJob();
            }
            else if (typeof(CanvasGroup) == typeof(T))
            {
                job = new CanvasGroupJob();
            }

            job?.Initialize(typeof(T));
            return(job);
        }
Пример #2
0
 private static void JobComplete(ITweenJob job)
 {
     if (job.isBelongsToSequence)
     {
         return;
     }
     _jobsInProgress.Remove(job);
     JobPool.DespawnJob(job);
 }
Пример #3
0
 private void Open()
 {
     title.gameObject.SetActive(false);
     bg.SetAlpha(0f);
     _tweenJob = bg.TweenOpacity(0.5f, duration).OnComplete(() =>
     {
         _canClose = true;
         title.gameObject.SetActive(true);
         title.localScale = startScale;
         _tweenJob        = title.TweenScale(Vector2.one, duration / 2f).SetEase(ease).Play();
     })
                 .Play();
 }
Пример #4
0
 public static void DespawnJob(ITweenJob job)
 {
     if (_pool == null)
     {
         _pool = new Dictionary <Type, Queue <ITweenJob> >();
     }
     if (_pool.ContainsKey(job.currentType))
     {
         _pool[job.currentType].Enqueue(job);
         return;
     }
     _pool.Add(job.currentType, new Queue <ITweenJob>());
     _pool[job.currentType].Enqueue(job);
 }