예제 #1
0
    public static AnimData UguiAlpha(GameObject animObject, float from, float to,
                                     float time            = 0.5f,
                                     RepeatType repeatType = RepeatType.Once,
                                     InterpType interp     = InterpType.Default,
                                     bool isChild          = true,
                                     AnimCallBack callBack = null, params object[] parameter)
    {
        AnimParamHash animParnHash = new AnimParamHash(
            AnimParamType.GameObj, animObject,
            AnimParamType.AnimType, AnimType.UGUI_Alpha,
            AnimParamType.FromFloat, from,
            AnimParamType.ToFloat, to,
            AnimParamType.Time, time,
            AnimParamType.InteType, interp,
            AnimParamType.IsIncludeChild, isChild,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        return(ValueTo(animParnHash));
    }
예제 #2
0
    //不传From,传准确控制点随机范围
    public static AnimData BezierMove(GameObject animObject, Vector3 to, float time, RepeatType repeatType,
                                      float[] t_Bezier_contralRadius,
                                      InterpType interp       = InterpType.Default,
                                      float delayTime         = 0,
                                      bool isLocal            = true,
                                      PathType bezierMoveType = PathType.Bezier2,

                                      AnimCallBack callBack = null, object[] parameter = null)
    {
        Vector3 from;

        if (isLocal)
        {
            from = animObject.transform.localPosition;
        }
        else
        {
            from = animObject.transform.position;
        }

        return(BezierMove(animObject, from, to, time, t_Bezier_contralRadius, repeatType, 1, delayTime, interp, isLocal, bezierMoveType, callBack, parameter));
    }
예제 #3
0
    static int Move(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 13);
            UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.GameObject));
            System.Nullable <UnityEngine.Vector3> arg1 = (System.Nullable <UnityEngine.Vector3>)ToLua.CheckVarObject(L, 2, typeof(System.Nullable <UnityEngine.Vector3>));
            UnityEngine.Vector3 arg2         = (UnityEngine.Vector3)ToLua.CheckObject(L, 3, typeof(UnityEngine.Vector3));
            float                 arg3       = (float)LuaDLL.luaL_checknumber(L, 4);
            float                 arg4       = (float)LuaDLL.luaL_checknumber(L, 5);
            bool                  arg5       = LuaDLL.luaL_checkboolean(L, 6);
            InterpType            arg6       = (InterpType)ToLua.CheckObject(L, 7, typeof(InterpType));
            bool                  arg7       = LuaDLL.luaL_checkboolean(L, 8);
            RepeatType            arg8       = (RepeatType)ToLua.CheckObject(L, 9, typeof(RepeatType));
            int                   arg9       = (int)LuaDLL.luaL_checknumber(L, 10);
            UnityEngine.Transform arg10      = (UnityEngine.Transform)ToLua.CheckUnityObject(L, 11, typeof(UnityEngine.Transform));
            AnimCallBack          arg11      = null;
            LuaTypes              funcType12 = LuaDLL.lua_type(L, 12);

            if (funcType12 != LuaTypes.LUA_TFUNCTION)
            {
                arg11 = (AnimCallBack)ToLua.CheckObject(L, 12, typeof(AnimCallBack));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 12);
                arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
            }

            object[] arg12 = ToLua.CheckObjectArray(L, 13);
            AnimData o     = AnimSystem.Move(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
            ToLua.PushObject(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #4
0
    /// <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;
            }
        }

        AnimParamHash animParnHash = new AnimParamHash(
            AnimParamType.GameObj, animObject,
            AnimParamType.AnimType, AnimType.UGUI_Alpha,
            AnimParamType.FromFloat, fromTmp,
            AnimParamType.ToFloat, to,
            AnimParamType.Time, time,
            AnimParamType.DelayTime, delayTime,
            AnimParamType.IsIgnoreTimeScale, IsIgnoreTimeScale,
            AnimParamType.RepeatCount, repeatCount,
            AnimParamType.InteType, interp,
            AnimParamType.IsIncludeChild, isChild,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        return(ValueTo(animParnHash));
    }
예제 #5
0
    static int AlphaTo(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 12);
            UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.GameObject));
            float        arg1           = (float)LuaDLL.luaL_checknumber(L, 2);
            float        arg2           = (float)LuaDLL.luaL_checknumber(L, 3);
            float        arg3           = (float)LuaDLL.luaL_checknumber(L, 4);
            float        arg4           = (float)LuaDLL.luaL_checknumber(L, 5);
            InterpType   arg5           = (InterpType)ToLua.CheckObject(L, 6, typeof(InterpType));
            bool         arg6           = LuaDLL.luaL_checkboolean(L, 7);
            RepeatType   arg7           = (RepeatType)ToLua.CheckObject(L, 8, typeof(RepeatType));
            int          arg8           = (int)LuaDLL.luaL_checknumber(L, 9);
            bool         arg9           = LuaDLL.luaL_checkboolean(L, 10);
            AnimCallBack arg10          = null;
            LuaTypes     funcType11     = LuaDLL.lua_type(L, 11);

            if (funcType11 != LuaTypes.LUA_TFUNCTION)
            {
                arg10 = (AnimCallBack)ToLua.CheckObject(L, 11, typeof(AnimCallBack));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 11);
                arg10 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
            }

            object[] arg11 = ToLua.CheckObjectArray(L, 12);
            AnimData o     = AnimSystem.AlphaTo(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
            ToLua.PushObject(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #6
0
    public static AnimData BezierMove(GameObject animObject, Vector3 from, Vector3 to,
                                      float time                 = 0.5f,
                                      RepeatType repeatType      = RepeatType.Once,
                                      InterpType interp          = InterpType.Default,
                                      bool isLocal               = true,
                                      PathType bezierMoveType    = PathType.Bezier2,
                                      Vector3[] t_Bezier_contral = null,
                                      AnimCallBack callBack      = null, object[] parameter = null)
    {
        AnimType animType;

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

        AnimParamHash animParnHash = new AnimParamHash(
            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.V3Control, t_Bezier_contral,
            AnimParamType.RepeatType, repeatType,
            AnimParamType.CallBack, callBack,
            AnimParamType.CallBackParams, parameter
            );

        return(ValueTo(animParnHash));
    }
예제 #7
0
        void PaintRectangle(Rectangle area, InterpType interpolation)
        {
            int x_offset = scaled_width < Allocation.Width ? (int)(Allocation.Width - scaled_width) / 2 : -XOffset;
            int y_offset = scaled_height < Allocation.Height ? (int)(Allocation.Height - scaled_height) / 2 : -YOffset;

            //Draw background
            if (y_offset > 0)                   //Top
            {
                PaintBackground(new Rectangle(0, 0, Allocation.Width, y_offset), area);
            }
            if (x_offset > 0)                   //Left
            {
                PaintBackground(new Rectangle(0, y_offset, x_offset, (int)scaled_height), area);
            }
            if (x_offset >= 0)                  //Right
            {
                PaintBackground(new Rectangle(x_offset + (int)scaled_width, y_offset, Allocation.Width - x_offset - (int)scaled_width, (int)scaled_height), area);
            }
            if (y_offset >= 0)                  //Bottom
            {
                PaintBackground(new Rectangle(0, y_offset + (int)scaled_height, Allocation.Width, Allocation.Height - y_offset - (int)scaled_height), area);
            }

            if (Pixbuf == null)
            {
                return;
            }

            area.Intersect(new Rectangle(x_offset, y_offset, (int)scaled_width, (int)scaled_height));

            if (area.Width <= 0 || area.Height <= 0)
            {
                return;
            }

            //Short circuit for 1:1 zoom
            if (zoom == 1.0 &&
                !Pixbuf.HasAlpha &&
                Pixbuf.BitsPerSample == 8 &&
                pixbuf_orientation == ImageOrientation.TopLeft)
            {
                GdkWindow.DrawPixbuf(Style.BlackGC,
                                     Pixbuf,
                                     area.X - x_offset, area.Y - y_offset,
                                     area.X, area.Y,
                                     area.Width, area.Height,
                                     RgbDither.Max,
                                     area.X - x_offset, area.Y - y_offset);
                return;
            }

            Rectangle pixbuf_area = PixbufUtils.TransformOrientation((int)scaled_width,
                                                                     (int)scaled_height,
                                                                     new Rectangle((area.X - x_offset),
                                                                                   (area.Y - y_offset),
                                                                                   area.Width,
                                                                                   area.Height),
                                                                     PixbufUtils.ReverseTransformation(pixbuf_orientation));

            using (Pixbuf temp_pixbuf = new Pixbuf(Colorspace.Rgb, false, 8, pixbuf_area.Width, pixbuf_area.Height)) {
                if (Pixbuf.HasAlpha)
                {
                    temp_pixbuf.Fill(0x00000000);
                }

                Pixbuf.CompositeColor(temp_pixbuf,
                                      0, 0,
                                      pixbuf_area.Width, pixbuf_area.Height,
                                      -pixbuf_area.X, -pixbuf_area.Y,
                                      zoom, zoom,
                                      zoom == 1.0 ? InterpType.Nearest : interpolation, 255,
                                      pixbuf_area.X, pixbuf_area.Y,
                                      CheckPattern.CheckSize, CheckPattern.Color1, CheckPattern.Color2);


                ApplyColorTransform(temp_pixbuf);

                using (var dest_pixbuf = PixbufUtils.TransformOrientation(temp_pixbuf, pixbuf_orientation)) {
                    GdkWindow.DrawPixbuf(Style.BlackGC,
                                         dest_pixbuf,
                                         0, 0,
                                         area.X, area.Y,
                                         area.Width, area.Height,
                                         RgbDither.Max,
                                         area.X - x_offset, area.Y - y_offset);
                }
            }
        }
예제 #8
0
    static int BezierMove(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 10 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(float), typeof(InterpType), typeof(RepeatType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0     = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1     = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                float                 arg2      = (float)LuaDLL.lua_tonumber(L, 3);
                InterpType            arg3      = (InterpType)ToLua.ToObject(L, 4);
                RepeatType            arg4      = (RepeatType)ToLua.ToObject(L, 5);
                bool                  arg5      = LuaDLL.lua_toboolean(L, 6);
                PathType              arg6      = (PathType)ToLua.ToObject(L, 7);
                UnityEngine.Vector3[] arg7      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 8);
                AnimCallBack          arg8      = null;
                LuaTypes              funcType9 = LuaDLL.lua_type(L, 9);

                if (funcType9 != LuaTypes.LUA_TFUNCTION)
                {
                    arg8 = (AnimCallBack)ToLua.ToObject(L, 9);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 9);
                    arg8 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg9 = ToLua.CheckObjectArray(L, 10);
                AnimData o    = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 10 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0     = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1     = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2     = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float                 arg3      = (float)LuaDLL.lua_tonumber(L, 4);
                InterpType            arg4      = (InterpType)ToLua.ToObject(L, 5);
                bool                  arg5      = LuaDLL.lua_toboolean(L, 6);
                PathType              arg6      = (PathType)ToLua.ToObject(L, 7);
                UnityEngine.Vector3[] arg7      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 8);
                AnimCallBack          arg8      = null;
                LuaTypes              funcType9 = LuaDLL.lua_type(L, 9);

                if (funcType9 != LuaTypes.LUA_TFUNCTION)
                {
                    arg8 = (AnimCallBack)ToLua.ToObject(L, 9);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 9);
                    arg8 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg9 = ToLua.CheckObjectArray(L, 10);
                AnimData o    = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 11 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2 = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float        arg3           = (float)LuaDLL.lua_tonumber(L, 4);
                float        arg4           = (float)LuaDLL.lua_tonumber(L, 5);
                InterpType   arg5           = (InterpType)ToLua.ToObject(L, 6);
                bool         arg6           = LuaDLL.lua_toboolean(L, 7);
                PathType     arg7           = (PathType)ToLua.ToObject(L, 8);
                float[]      arg8           = ToLua.CheckNumberArray <float>(L, 9);
                AnimCallBack arg9           = null;
                LuaTypes     funcType10     = LuaDLL.lua_type(L, 10);

                if (funcType10 != LuaTypes.LUA_TFUNCTION)
                {
                    arg9 = (AnimCallBack)ToLua.ToObject(L, 10);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 10);
                    arg9 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg10 = ToLua.CheckObjectArray(L, 11);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 11 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(float), typeof(RepeatType), typeof(InterpType), typeof(float), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                float        arg2           = (float)LuaDLL.lua_tonumber(L, 3);
                RepeatType   arg3           = (RepeatType)ToLua.ToObject(L, 4);
                InterpType   arg4           = (InterpType)ToLua.ToObject(L, 5);
                float        arg5           = (float)LuaDLL.lua_tonumber(L, 6);
                bool         arg6           = LuaDLL.lua_toboolean(L, 7);
                PathType     arg7           = (PathType)ToLua.ToObject(L, 8);
                float[]      arg8           = ToLua.CheckNumberArray <float>(L, 9);
                AnimCallBack arg9           = null;
                LuaTypes     funcType10     = LuaDLL.lua_type(L, 10);

                if (funcType10 != LuaTypes.LUA_TFUNCTION)
                {
                    arg9 = (AnimCallBack)ToLua.ToObject(L, 10);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 10);
                    arg9 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg10 = ToLua.CheckObjectArray(L, 11);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 13 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(float), typeof(RepeatType), typeof(int), typeof(InterpType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0      = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1      = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2      = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float                 arg3       = (float)LuaDLL.lua_tonumber(L, 4);
                float                 arg4       = (float)LuaDLL.lua_tonumber(L, 5);
                RepeatType            arg5       = (RepeatType)ToLua.ToObject(L, 6);
                int                   arg6       = (int)LuaDLL.lua_tonumber(L, 7);
                InterpType            arg7       = (InterpType)ToLua.ToObject(L, 8);
                bool                  arg8       = LuaDLL.lua_toboolean(L, 9);
                PathType              arg9       = (PathType)ToLua.ToObject(L, 10);
                UnityEngine.Vector3[] arg10      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 11);
                AnimCallBack          arg11      = null;
                LuaTypes              funcType12 = LuaDLL.lua_type(L, 12);

                if (funcType12 != LuaTypes.LUA_TFUNCTION)
                {
                    arg11 = (AnimCallBack)ToLua.ToObject(L, 12);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 12);
                    arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg12 = ToLua.CheckObjectArray(L, 13);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 13 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(RepeatType), typeof(int), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2 = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float        arg3           = (float)LuaDLL.lua_tonumber(L, 4);
                RepeatType   arg4           = (RepeatType)ToLua.ToObject(L, 5);
                int          arg5           = (int)LuaDLL.lua_tonumber(L, 6);
                float        arg6           = (float)LuaDLL.lua_tonumber(L, 7);
                InterpType   arg7           = (InterpType)ToLua.ToObject(L, 8);
                bool         arg8           = LuaDLL.lua_toboolean(L, 9);
                PathType     arg9           = (PathType)ToLua.ToObject(L, 10);
                float[]      arg10          = ToLua.CheckNumberArray <float>(L, 11);
                AnimCallBack arg11          = null;
                LuaTypes     funcType12     = LuaDLL.lua_type(L, 12);

                if (funcType12 != LuaTypes.LUA_TFUNCTION)
                {
                    arg11 = (AnimCallBack)ToLua.ToObject(L, 12);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 12);
                    arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg12 = ToLua.CheckObjectArray(L, 13);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: AnimSystem.BezierMove"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #9
0
        private IEnumerator Cr_Timer(object id, Action <Vector3> function, float duration, Vector3 from, Vector3 to, InterpType type, Action endFunction = null)
        {
            float timer = duration;

            while (IsPaused(id))
            {
                yield return(null);
            }

            do
            {
                if (!IsPaused(id))
                {
                    timer -= GetDeltaTime(m_useUnscaledTime);

                    Vector3 val;
                    switch (type)
                    {
                    case InterpType.SMOOTHSTEP:
                        val = Vector3.Lerp(from, to, Mathf.SmoothStep(0f, 1f, 1f - (timer / duration)));
                        break;

                    case InterpType.SINERP:
                        val = Vector3.Lerp(from, to, Utils.Sinerp(0f, 1f, 1f - (timer / duration)));
                        break;

                    case InterpType.COSERP:
                        val = Vector3.Lerp(from, to, Utils.Coserp(0f, 1f, 1f - (timer / duration)));
                        break;

                    case InterpType.BERP:
                        val = Vector3.Lerp(from, to, Utils.Berp(0f, 1f, 1f - (timer / duration)));
                        break;

                    default:
                        val = Vector3.Lerp(from, to, 1f - (timer / duration));
                        break;
                    }

                    function?.Invoke(val);
                }

                yield return(null);
            } while (timer > 0f);

            while (IsPaused(id))
            {
                yield return(null);
            }

            endFunction?.Invoke();
        }
예제 #10
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);
    }
예제 #11
0
        private IEnumerator Cr_DelayedStartTimer(float delay, object id, Action <Vector3> function, float duration, Vector3 from, Vector3 to, InterpType type, Action endFunction = null, int animationCurveIndex = -1)
        {
            yield return(StartCoroutine(Cr_Delay(id, delay)));

            StartTimer(id, function, duration, from, to, type, endFunction, animationCurveIndex: animationCurveIndex);
        }
예제 #12
0
        private IEnumerator Cr_Timer(object id, Action <float> function, float duration, float from, float to, InterpType type, Action endFunction = null, int animationCurveIndex = -1)
        {
            float timer = duration;

            while (IsPaused(id))
            {
                yield return(null);
            }

            do
            {
                if (!IsPaused(id))
                {
                    timer -= GetDeltaTime(m_useUnscaledTime);

                    float val;
                    switch (type)
                    {
                    case InterpType.SMOOTHSTEP:
                        val = Mathf.SmoothStep(from, to, 1f - (timer / duration));
                        break;

                    case InterpType.SINERP:
                        val = Utils.Sinerp(from, to, 1f - (timer / duration));
                        break;

                    case InterpType.COSERP:
                        val = Utils.Coserp(from, to, 1f - (timer / duration));
                        break;

                    case InterpType.BERP:
                        val = Utils.Berp(from, to, 1f - (timer / duration));
                        break;

                    default:
                        if (animationCurveIndex >= 0)
                        {
                            val = Mathf.LerpUnclamped(from, to, m_customCurves[animationCurveIndex].Evaluate(1f - (timer / duration)));
                        }
                        else
                        {
                            val = Mathf.Lerp(from, to, 1f - (timer / duration));
                        }
                        break;
                    }

                    function?.Invoke(val);
                }

                yield return(null);
            } while (timer > 0f);

            while (IsPaused(id))
            {
                yield return(null);
            }

            endFunction?.Invoke();
        }
예제 #13
0
    // coroutine to handle movement
    IEnumerator MoveRoutine(Vector3 destination, float timeToMove, int interp = 0)
    {
        // store our starting position
        Vector3 startPosition = transform.position;

        // have we reached our destination?
        bool reachedDestination = false;

        // how much time has passed since we started moving
        float elapsedTime = 0f;

        Color c = new Color(1F, 1F, 1F, 0F);
        Color d = new Color(1F, 1F, 1F, 1F);

        // we are moving the GamePiece
        m_isMoving = true;

        if (interp == 1)
        {
            interpolation = InterpType.Linear;
        }

        // while we have not reached the destination, check to see if we are close enough
        while (!reachedDestination)
        {
            // if we are close enough to destination
            if (Vector3.Distance(transform.position, destination) < 0.01f)
            {
                // we have reached the destination
                reachedDestination = true;

                // explicitly set the GamePiece at the new location in the Board
                if (m_board != null)
                {
                    m_board.PlaceGamePiece(this, (int)destination.x, (int)destination.y);
                }

                break;
            }

            // increment the total running time by the Time elapsed for this frame
            elapsedTime += Time.deltaTime;


            // calculate the Lerp value
            float t = Mathf.Clamp(elapsedTime / timeToMove, 0f, 1f);

            switch (interpolation)
            {
            case InterpType.Linear:
                break;

            case InterpType.EaseOut:
                t = Mathf.Sin(t * Mathf.PI * 0.5f);
                break;

            case InterpType.EaseIn:
                t = 1 - Mathf.Cos(t * Mathf.PI * 0.5f);
                break;

            case InterpType.SmoothStep:
                t = t * t * (3 - 2 * t);
                break;

            case InterpType.SmootherStep:
                t = t * t * t * (t * (t * 6 - 15) + 10);
                break;
            }

            // move the game piece
            transform.position = Vector3.Lerp(startPosition, destination, t);

            if (transform.position.y > m_board.height)
            {
                m_spriteRenderer.color = c;
            }

            else
            {
                m_spriteRenderer.color = d;
            }
            // wait until next frame
            yield return(null);
        }

        // GamePiece is no longer moving
        m_isMoving = false;
    }
예제 #14
0
 public void ResizeImage(int width, int height, InterpType interType)
 {
     if (width <= 0 || height <= 0)
         return;
     if (width < MinWidth)
         width = MinWidth;
     if (height < MinHeight)
         height = MinHeight;
     if (width == originalPixbuf.Width && height == originalPixbuf.Height)
         child.Pixbuf = originalPixbuf;
     else
         child.Pixbuf = originalPixbuf.ScaleSimple (width, height, interType);
     child.SetSizeRequest (width, height);
     imageSize.Width = width;
     imageSize.Height = height;
     //QueueDraw ();
 }
예제 #15
0
        public void DrawSurface(Surface surface, RectangleD layout, RectangleD imagePart, InterpType interpolation)
        {
            double x      = layout.X * drawingScaleX;
            double y      = layout.Y * drawingScaleY;
            double width  = layout.Width * drawingScaleX;
            double height = layout.Height * drawingScaleY;

            if (width.IsZero() || height.IsZero())
            {
                return;
            }

            double scaleX = width / imagePart.Width;
            double scaleY = height / imagePart.Height;

            using (Surface scaleFast = surface.ScaleSmooth((int)imagePart.Width, (int)imagePart.Height, scaleX, scaleY, interpolation)) {
                cairoContext.SetSourceSurface(scaleFast, (int)x, (int)y);
                cairoContext.Paint();
            }
        }
예제 #16
0
        public static Surface ScaleSmooth(this Surface source, int width, int height, double zoomX, double zoomY, InterpType interpolation = InterpType.Hyper)
        {
            ImageSurface tempSurface = new ImageSurface(Format.ARGB32, width, height);
            var          tempContext = new Context(tempSurface);

            tempContext.SetSourceSurface(source, 0, 0);
            tempContext.Paint();

            Pixbuf pbSrc = tempSurface.ToPixbuf();

            tempContext.DisposeAll();

            using (Pixbuf pbDest = new Pixbuf(Colorspace.Rgb, true, 8,
                                              (int)(width * zoomX),
                                              (int)(height * zoomY))) {
                pbSrc.Scale(pbDest, 0, 0, pbDest.Width, pbDest.Height, 0, 0, zoomX, zoomY, interpolation);
                pbSrc.Dispose();

                Surface cache        = new ImageSurface(Format.ARGB32, pbDest.Width, pbDest.Height);
                var     cacheContext = new Context(cache);
                CairoHelper.SetSourcePixbuf(cacheContext, pbDest, 0, 0);
                cacheContext.Paint();
                cacheContext.DisposeContext();

                return(cache);
            }
        }
예제 #17
0
 public CameraAniInfo(Vector3 l_toV3, float l_time, InterpType l_interpType = InterpType.Default)
 {
     toV3       = l_toV3;
     time       = l_time;
     interpType = l_interpType;
 }
예제 #18
0
    public static ValueInterpolater LerpValueInterpolated(InterpType type, float coefficient, float start, float end, float duration, float delay, Action<float> callback)
    {
        GameObject instance = new GameObject();
        instance.name = GAME_OBJECT_NAME;

        ValueInterpolater interpolater = instance.AddComponent<ValueInterpolater>();

        interpolater.interpFunction = sDelegates[type];
        interpolater.coefficient = coefficient;
        interpolater.start = start;
        interpolater.end = end;
        interpolater.duration = duration;
        interpolater.delay = delay;
        interpolater.OnTick = callback;

        interpolater.Start();

        return interpolater;
    }
예제 #19
0
 public static AnimData UguiSizeDelta(GameObject animObject, Vector2 from, Vector2 to, float time,
                                      InterpType interp = InterpType.Default, AnimCallBack callBack = null, params object[] parameter)
 {
     return(UguiSizeDelta(animObject, from, to, time, RepeatType.Once, interp, callBack, parameter));
 }
예제 #20
0
파일: ImageView.cs 프로젝트: hbons/f-spot
        void PaintRectangle(Rectangle area, InterpType interpolation)
        {
            int x_offset = scaled_width < Allocation.Width ? (int)(Allocation.Width - scaled_width) / 2 : -XOffset;
            int y_offset = scaled_height < Allocation.Height ? (int)(Allocation.Height - scaled_height) / 2 : -YOffset;
            //Draw background
            if (y_offset > 0) 	//Top
                PaintBackground (new Rectangle (0, 0, Allocation.Width, y_offset), area);
            if (x_offset > 0) 	//Left
                PaintBackground (new Rectangle (0, y_offset, x_offset, (int)scaled_height), area);
            if (x_offset >= 0)	//Right
                PaintBackground (new Rectangle (x_offset + (int)scaled_width, y_offset, Allocation.Width - x_offset - (int)scaled_width, (int)scaled_height), area);
            if (y_offset >= 0)	//Bottom
                PaintBackground (new Rectangle (0, y_offset + (int)scaled_height, Allocation.Width, Allocation.Height - y_offset - (int)scaled_height), area);

            if (Pixbuf == null)
                return;

            area.Intersect (new Rectangle (x_offset, y_offset, (int)scaled_width, (int)scaled_height));

            if (area.Width <= 0  || area.Height <= 0)
                return;

            //Short circuit for 1:1 zoom
            if (zoom == 1.0 &&
                !Pixbuf.HasAlpha &&
                Pixbuf.BitsPerSample == 8 &&
                pixbuf_orientation == ImageOrientation.TopLeft) {
                GdkWindow.DrawPixbuf (Style.BlackGC,
                              Pixbuf,
                              area.X - x_offset, area.Y - y_offset,
                              area.X, area.Y,
                              area.Width, area.Height,
                              RgbDither.Max,
                              area.X - x_offset, area.Y - y_offset);
                return;
            }

            Rectangle pixbuf_area = PixbufUtils.TransformOrientation ((int)scaled_width,
                                          (int)scaled_height,
                                          new Rectangle ((area.X - x_offset),
                                                 (area.Y - y_offset),
                                                 area.Width,
                                                 area.Height),
                                          PixbufUtils.ReverseTransformation (pixbuf_orientation));
            using (Pixbuf temp_pixbuf = new Pixbuf (Colorspace.Rgb, false, 8, pixbuf_area.Width, pixbuf_area.Height)) {
                if (Pixbuf.HasAlpha)
                    temp_pixbuf.Fill (0x00000000);

                Pixbuf.CompositeColor (temp_pixbuf,
                               0, 0,
                               pixbuf_area.Width, pixbuf_area.Height,
                               -pixbuf_area.X, -pixbuf_area.Y,
                               zoom, zoom,
                               zoom == 1.0 ? InterpType.Nearest : interpolation, 255,
                               pixbuf_area.X, pixbuf_area.Y,
                               CheckPattern.CheckSize, CheckPattern.Color1, CheckPattern.Color2);

                ApplyColorTransform (temp_pixbuf);

                using (var dest_pixbuf = PixbufUtils.TransformOrientation (temp_pixbuf, pixbuf_orientation)) {
                    GdkWindow.DrawPixbuf (Style.BlackGC,
                                  dest_pixbuf,
                                  0, 0,
                                  area.X, area.Y,
                                  area.Width, area.Height,
                                  RgbDither.Max,
                                  area.X - x_offset, area.Y - y_offset);
                }
            }
        }
예제 #21
0
        private void StartTimer(object id, Action <Vector3> function, float duration, Vector3 from, Vector3 to, InterpType type, Action endFunction = null, float delayStart = 0f, int animationCurveIndex = -1)
        {
            StopTimer(id);

            if (!gameObject.activeInHierarchy)
            {
                return;
            }

            if (delayStart <= 0f)
            {
                AddCoroutine(id, StartCoroutine(Cr_Timer(id, function, duration, from, to, type, endFunction)));
            }
            else
            {
                StartCoroutine(Cr_DelayedStartTimer(delayStart, id, function, duration, from, to, type, endFunction));
            }
        }