Ejemplo n.º 1
0
        public override void Set(Element element, int index)
        {
            if (element.target != null)
            {
                T target             = element.GetTarget <T>();
                ElementStateData esd = element.stateData[index];
                if (esd.isSmooth)
                {
                    SmoothData sd = new SmoothData();
                    InitBySmooth(target, sd);
                    esd.AddFrameUpdate((object p) =>
                    {
                        if (target == null)
                        {
                            return(false);
                        }

#if UNITY_EDITOR
                        if (!Application.isPlaying)
                        {
                            sd.esc_timer += 0.011f;
                        }
                        else
#endif
                        {
                            float deltaTime = Time.deltaTime;
                            sd.esc_timer   += deltaTime;
                        }

                        bool isend     = false;
                        float progress = 1f;
                        if (sd.esc_timer >= esd.smoothTime)
                        {
                            isend = true;
                        }
                        else
                        {
                            progress = sd.esc_timer / esd.smoothTime;
                        }

                        SetBySmooth(target, sd, esd, progress);

#if UNITY_EDITOR
                        EditorUtility.SetDirty(target);
#endif
                        return(!isend);
                    }, null);
                }
                else
                {
                    SetBySmooth(target, null, esd, -1f);
                }

#if UNITY_EDITOR
                EditorUtility.SetDirty(target);
#endif
            }
        }
Ejemplo n.º 2
0
 public override void SetBySmooth(MaskableGraphic target, SmoothData sd, ElementStateData esd, float progress)
 {
     if (sd == null)
     {
         target.color = esd.color32;
     }
     else
     {
         target.color = sd.Get(esd.color32, progress);
     }
 }
Ejemplo n.º 3
0
 public override void SetBySmooth(Transform target, SmoothData sd, ElementStateData esd, float progress)
 {
     if (sd == null)
     {
         target.localPosition = esd.vector3;
     }
     else
     {
         target.localPosition = sd.Get(esd.vector3, progress);
     }
 }
Ejemplo n.º 4
0
 public override void SetBySmooth(RectTransform target, SmoothData sd, ElementStateData esd, float progress)
 {
     if (sd == null)
     {
         target.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, esd.vector3.x);
     }
     else
     {
         target.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, sd.Get(esd.vector3.x, progress));
     }
 }
Ejemplo n.º 5
0
 public override void SetBySmooth(CanvasGroup target, SmoothData sd, ElementStateData esd, float progress)
 {
     if (sd == null)
     {
         target.alpha = esd.vector3.x;
     }
     else
     {
         target.alpha = sd.Get(esd.vector3.x, progress);
     }
 }
Ejemplo n.º 6
0
 public override void SetBySmooth(MaskableGraphic target, SmoothData sd, ElementStateData esd, float progress)
 {
     if (sd == null)
     {
         Color color = target.color;
         color.a      = esd.vector3.x;
         target.color = color;
     }
     else
     {
         Color color = target.color;
         color.a      = sd.Get(esd.vector3.x, progress);
         target.color = color;
     }
 }
Ejemplo n.º 7
0
 public abstract void SetBySmooth(T target, SmoothData sd, ElementStateData esd, float progress);
Ejemplo n.º 8
0
        }                                                      // 是否允许渐变

        public abstract void InitBySmooth(T target, SmoothData sd);
Ejemplo n.º 9
0
 public override void InitBySmooth(MaskableGraphic target, SmoothData sd)
 {
     sd.color32 = target.color;
 }
Ejemplo n.º 10
0
 public override void InitBySmooth(MaskableGraphic target, SmoothData sd)
 {
     sd.vector3.x = target.color.a;
 }
Ejemplo n.º 11
0
 public override void InitBySmooth(Transform target, SmoothData sd)
 {
     sd.vector3 = target.localPosition;
 }
Ejemplo n.º 12
0
 public override void InitBySmooth(Transform target, SmoothData sd)
 {
     sd.vector3 = target.localEulerAngles;
 }
Ejemplo n.º 13
0
 public override void InitBySmooth(RectTransform target, SmoothData sd)
 {
     sd.vector3.x = target.rect.width;
 }
Ejemplo n.º 14
0
 public override void InitBySmooth(RectTransform target, SmoothData sd)
 {
     sd.vector3 = target.anchoredPosition;
 }
Ejemplo n.º 15
0
 public override void InitBySmooth(CanvasGroup target, SmoothData sd)
 {
     sd.vector3.x = target.alpha;
 }