示例#1
0
    public static AnimData Blink(GameObject animObject, float space,

                                 float time             = 0.5f,
                                 float delayTime        = 0,
                                 bool IsIgnoreTimeScale = false,
                                 RepeatType repeatType  = RepeatType.Once,
                                 int repeatCount        = -1,
                                 AnimCallBack callBack  = null,
                                 object[] parameter     = null)
    {
        AnimData l_tmp = new AnimData();;

        l_tmp.m_animType       = AnimType.Blink;
        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_space          = space;

        l_tmp.m_delayTime       = delayTime;
        l_tmp.m_totalTime       = time;
        l_tmp.m_repeatType      = repeatType;
        l_tmp.m_repeatCount     = repeatCount;
        l_tmp.m_callBack        = callBack;
        l_tmp.m_parameter       = parameter;
        l_tmp.m_ignoreTimeScale = IsIgnoreTimeScale;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#2
0
    public static AnimData Scale(GameObject animObject, Vector3?from, Vector3 to,
                                 float time             = 0.5f,
                                 InterpType interp      = InterpType.Default,
                                 bool IsIgnoreTimeScale = false,
                                 RepeatType repeatType  = RepeatType.Once,
                                 int repeatCount        = -1,
                                 float delayTime        = 0,
                                 AnimCallBack callBack  = null, object[] parameter = null)
    {
        Vector3 fromTmp = from ?? animObject.transform.localScale;

        AnimData l_tmp = new AnimData();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.LocalScale;
        l_tmp.m_fromV3         = fromTmp;
        l_tmp.m_toV3           = to;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#3
0
    public static AnimData CustomMethodToVector4(AnimCustomMethodVector4 method, Vector4 from, Vector4 to,
                                                 float time             = 0.5f,
                                                 float delayTime        = 0,
                                                 InterpType interp      = InterpType.Default,
                                                 bool IsIgnoreTimeScale = false,
                                                 RepeatType repeatType  = RepeatType.Once,
                                                 int repeatCount        = -1,
                                                 AnimCallBack callBack  = null, object[] parameter = null)
    {
        AnimData l_tmp = new AnimData();;

        l_tmp.m_animType       = AnimType.Custom_Vector4;
        l_tmp.m_fromV4         = from;
        l_tmp.m_toV4           = to;
        l_tmp.m_customMethodV4 = method;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#4
0
    public static AnimData UguiSizeDelta(GameObject animObject, Vector2?from, Vector2 to,

                                         float time             = 0.5f,
                                         float delayTime        = 0,
                                         InterpType interp      = InterpType.Default,
                                         bool IsIgnoreTimeScale = false,
                                         RepeatType repeatType  = RepeatType.Once,
                                         int repeatCount        = -1,
                                         AnimCallBack callBack  = null,
                                         object[] parameter     = null)
    {
        Vector2 fromTmp = from ?? animObject.GetComponent <RectTransform>().sizeDelta;

        AnimData l_tmp = new AnimData();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.UGUI_SizeDetal;
        l_tmp.m_fromV2         = fromTmp;
        l_tmp.m_toV2           = to;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#5
0
    public static AnimData AlphaTo(GameObject animObject, float from, float to,

                                   float time             = 0.5f,
                                   float delayTime        = 0,
                                   InterpType interp      = InterpType.Default,
                                   bool IsIgnoreTimeScale = false,
                                   RepeatType repeatType  = RepeatType.Once,
                                   int repeatCount        = -1,
                                   bool isChild           = true,
                                   AnimCallBack callBack  = null, object[] parameter = null)
    {
        AnimData l_tmp = new AnimData();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.Alpha;
        l_tmp.m_fromFloat      = from;
        l_tmp.m_toFloat        = to;
        l_tmp.m_isChild        = isChild;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#6
0
    public static AnimData CustomMethodToFloat(AnimCustomMethodFloat method, float from, float to,
                                               float time             = 0.5f,
                                               float delayTime        = 0,
                                               InterpType interp      = InterpType.Default,
                                               bool IsIgnoreTimeScale = false,
                                               RepeatType repeatType  = RepeatType.Once,
                                               int repeatCount        = -1,
                                               AnimCallBack callBack  = null, object[] parameter = null)
    {
        AnimData l_tmp = HeapObjectPool <AnimData> .GetObject();;

        l_tmp.m_animType          = AnimType.Custom_Float;
        l_tmp.m_fromFloat         = from;
        l_tmp.m_toFloat           = to;
        l_tmp.m_customMethodFloat = method;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#7
0
    public static AnimData UguiMove(GameObject animObject, Vector3?from, Vector3 to,
                                    float time             = 0.5f,
                                    float delayTime        = 0,
                                    InterpType interp      = InterpType.Default,
                                    bool IsIgnoreTimeScale = false,
                                    RepeatType repeatType  = RepeatType.Once,
                                    int repeatCount        = -1,
                                    AnimCallBack callBack  = null,
                                    object[] parameter     = null)
    {
        Vector3 fromTmp = from ?? animObject.GetComponent <RectTransform>().anchoredPosition;

        AnimData l_tmp = HeapObjectPool <AnimData> .GetObject();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.UGUI_AnchoredPosition;
        l_tmp.m_fromV3         = fromTmp;
        l_tmp.m_toV3           = to;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
    public static AnimData ColorTo(GameObject animObject, Color from, Color to,

                                   float time             = 0.5f,
                                   float delayTime        = 0,
                                   InterpType interp      = InterpType.Default,
                                   bool isChild           = true,
                                   bool IsIgnoreTimeScale = false,
                                   RepeatType repeatType  = RepeatType.Once,
                                   int repeatCount        = -1,
                                   AnimCallBack callBack  = null,
                                   object[] parameter     = null)
    {
        AnimData l_tmp = HeapObjectPool.GetObject <AnimData>("AnimData");

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.Color;
        l_tmp.m_fromColor      = from;
        l_tmp.m_toColor        = to;
        l_tmp.m_isChild        = isChild;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#9
0
    public static AnimData ValueTo(AnimParamHash l_animHash)
    {
        AnimData l_tmp = l_animHash.GetAnimData();

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);

        return(l_tmp);
    }
示例#10
0
    public static AnimData Rotation(GameObject animObject, Quaternion?from, Quaternion to,

                                    float time             = 0.5f,
                                    float delayTime        = 0,
                                    bool isLocal           = true,
                                    InterpType interp      = InterpType.Default,
                                    bool IsIgnoreTimeScale = false,
                                    RepeatType repeatType  = RepeatType.Once,
                                    int repeatCount        = -1,

                                    AnimCallBack callBack = null, object[] parameter = null)
    {
        AnimType   animType;
        Quaternion fromTmp;

        if (isLocal)
        {
            fromTmp  = from ?? animObject.transform.localRotation;
            animType = AnimType.LocalRotation;
        }
        else
        {
            fromTmp  = from ?? animObject.transform.rotation;
            animType = AnimType.Rotation;
        }

        AnimData l_tmp = new AnimData();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = animType;
        l_tmp.m_fromQ4         = fromTmp;
        l_tmp.m_toQ4           = to;

        l_tmp.m_isLocal = isLocal;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#11
0
    public static AnimData Rotate(GameObject animObject, Vector3?from, Vector3 to,

                                  float time             = 0.5f,
                                  float delayTime        = 0,
                                  bool isLocal           = true,
                                  InterpType interp      = InterpType.Default,
                                  bool IsIgnoreTimeScale = false,
                                  RepeatType repeatType  = RepeatType.Once,
                                  int repeatCount        = -1,

                                  AnimCallBack callBack = null, object[] parameter = null)
    {
        AnimType animType;
        Vector3  fromTmp;

        if (isLocal)
        {
            fromTmp  = from ?? animObject.transform.localEulerAngles;
            animType = AnimType.LocalRotate;
        }
        else
        {
            fromTmp  = from ?? animObject.transform.eulerAngles;
            animType = AnimType.Rotate;
        }

        AnimData l_tmp = HeapObjectPool <AnimData> .GetObject();;

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = animType;
        l_tmp.m_fromV3         = fromTmp;
        l_tmp.m_toV3           = to;

        l_tmp.m_isLocal = isLocal;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#12
0
    public static AnimData BezierMove(GameObject animObject, Vector3?from, Vector3 to,
                                      Vector3[] bezier_contral,
                                      float time              = 0.5f,
                                      float delayTime         = 0,
                                      RepeatType repeatType   = RepeatType.Once,
                                      int repeatCount         = -1,
                                      InterpType interp       = InterpType.Default,
                                      bool isLocal            = true,
                                      PathType bezierMoveType = PathType.Bezier2,

                                      AnimCallBack callBack = null, object[] parameter = null)
    {
        AnimData l_tmp = new AnimData();;

        if (isLocal)
        {
            l_tmp.m_animType = AnimType.LocalPosition;
            l_tmp.m_fromV3   = from ?? animObject.transform.localPosition;
        }
        else
        {
            l_tmp.m_animType = AnimType.Position;
            l_tmp.m_fromV3   = from ?? animObject.transform.position;
        }

        l_tmp.m_animGameObejct = animObject;


        l_tmp.m_toV3      = to;
        l_tmp.m_isLocal   = isLocal;
        l_tmp.m_pathType  = bezierMoveType;
        l_tmp.m_v3Contral = bezier_contral;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#13
0
    /// <summary>
    /// 动画过度到目标颜色
    /// </summary>
    /// <param name="animObject">动画对象</param>
    /// <param name="from">起始颜色(可空)</param>
    /// <param name="to">目标颜色</param>
    /// <param name="time">动画时间</param>
    /// <param name="isChild">是否影响子节点</param>
    /// <param name="interp">插值类型</param>
    /// <param name="IsIgnoreTimeScale">是否忽略时间缩放</param>
    /// <param name="repeatType">重复类型</param>
    /// <param name="repeatCount">重复次数</param>
    /// <param name="callBack">动画完成回调函数</param>
    /// <param name="parameter">动画完成回调函数传参</param>
    /// <returns></returns>
    public static AnimData UguiColor(GameObject animObject, Color?from, Color to,
                                     float time             = 0.5f,
                                     float delayTime        = 0,
                                     InterpType interp      = InterpType.Default,
                                     bool isChild           = true,
                                     bool IsIgnoreTimeScale = false,
                                     RepeatType repeatType  = RepeatType.Once,
                                     int repeatCount        = -1,
                                     AnimCallBack callBack  = null, object[] parameter = null)
    {
        Color fromTmp = from ?? Color.white;

        if (from == null)
        {
            if (animObject.GetComponent <Graphic>() != null)
            {
                fromTmp = from ?? animObject.GetComponent <Graphic>().color;
            }
        }

        AnimData l_tmp = new AnimData();

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.UGUI_Color;
        l_tmp.m_fromColor      = fromTmp;
        l_tmp.m_toColor        = to;
        l_tmp.m_isChild        = isChild;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
    /// <summary>
    /// 动画过度到目标alpha
    /// </summary>
    /// <param name="animObject">动画对象</param>
    /// <param name="from">起始alpha(可空)</param>
    /// <param name="to">目标alpha</param>
    /// <param name="time">动画时间</param>
    /// <param name="isChild">是否影响子节点</param>
    /// <param name="interp">插值类型</param>
    /// <param name="IsIgnoreTimeScale">是否忽略时间缩放</param>
    /// <param name="repeatType">重复类型</param>
    /// <param name="repeatCount">重复次数</param>
    /// <param name="callBack">动画完成回调函数</param>
    /// <param name="parameter">动画完成回调函数传参</param>
    /// <returns></returns>
    public static AnimData UguiAlpha(GameObject animObject, float?from, float to,
                                     float time             = 0.5f,
                                     float delayTime        = 0,
                                     InterpType interp      = InterpType.Default,
                                     bool isChild           = true,
                                     bool IsIgnoreTimeScale = false,
                                     RepeatType repeatType  = RepeatType.Once,
                                     int repeatCount        = -1,
                                     AnimCallBack callBack  = null, object[] parameter = null)
    {
        float fromTmp = from ?? 1;

        if (from == null)
        {
            if (animObject.GetComponent <Graphic>() != null)
            {
                fromTmp = from ?? animObject.GetComponent <Graphic>().color.a;
            }
        }

        AnimData l_tmp = HeapObjectPool.GetObject <AnimData>("AnimData");

        l_tmp.m_animGameObejct = animObject;
        l_tmp.m_animType       = AnimType.UGUI_Alpha;
        l_tmp.m_fromFloat      = fromTmp;
        l_tmp.m_toFloat        = to;
        l_tmp.m_isChild        = isChild;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_ignoreTimeScale   = IsIgnoreTimeScale;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);
        return(l_tmp);
    }
示例#15
0
    //传From,传准确控制点随机范围
    public static AnimData BezierMove(GameObject animObject, Vector3?from, Vector3 to, float time,
                                      float[] t_Bezier_contralRadius,
                                      RepeatType repeatType,
                                      int repeatCount         = -1,
                                      float delayTime         = 0,
                                      InterpType interp       = InterpType.Default,
                                      bool isLocal            = true,
                                      PathType bezierMoveType = PathType.Bezier2,

                                      AnimCallBack callBack = null, object[] parameter = null)
    {
        AnimData l_tmp = new AnimData();;

        if (isLocal)
        {
            l_tmp.m_animType = AnimType.LocalPosition;
            l_tmp.m_fromV3   = from ?? animObject.transform.localPosition;
        }
        else
        {
            l_tmp.m_animType = AnimType.Position;
            l_tmp.m_fromV3   = from ?? animObject.transform.position;
        }

        l_tmp.m_animGameObejct = animObject;

        l_tmp.m_toV3         = to;
        l_tmp.m_isLocal      = isLocal;
        l_tmp.m_pathType     = bezierMoveType;
        l_tmp.m_floatContral = t_Bezier_contralRadius;

        l_tmp.m_delayTime         = delayTime;
        l_tmp.m_totalTime         = time;
        l_tmp.m_interpolationType = interp;
        l_tmp.m_repeatType        = repeatType;
        l_tmp.m_repeatCount       = repeatCount;
        l_tmp.m_callBack          = callBack;
        l_tmp.m_parameter         = parameter;

        l_tmp.Init();

        GetInstance().animList.Add(l_tmp);

        return(l_tmp);


        //AnimType animType;
        //if (isLocal)
        //{
        //    animType = AnimType.LocalPosition;
        //}
        //else
        //{
        //    animType = AnimType.Position;
        //}


        //AnimParamHash animParnHash = HashTemp.SetData(
        //    AnimParamType.GameObj, animObject,
        //    AnimParamType.AnimType, animType,
        //    AnimParamType.FromV3, from,
        //    AnimParamType.ToV3, to,
        //    AnimParamType.Time, time,
        //    AnimParamType.InteType, interp,
        //    AnimParamType.IsLocal, isLocal,
        //    AnimParamType.PathType, bezierMoveType,
        //    AnimParamType.floatControl, t_Bezier_contralRadius,
        //    AnimParamType.RepeatType, repeatType,
        //    AnimParamType.CallBack, callBack,
        //    AnimParamType.CallBackParams, parameter
        //    );

        //return ValueTo(animParnHash);
    }