Ejemplo n.º 1
0
        /// <summary>
        /// 播放马赛克效果
        /// </summary>
        /// <returns>The mosaic.</returns>
        /// <param name="toTileSize">To tile size.</param>
        /// <param name="duration">Duration.</param>
        /// <param name="callback">Callback.</param>
        /// <param name="cam">Cam.</param>
        public static Mosaic PlayMosaic(float toTileSize, float duration, LuaFunction callback = null, Camera cam = null)
        {
            if (cam == null)
            {
                cam = Camera.main;
            }

            Mosaic mosaic = (Mosaic)AddOrGetComponent(cam.gameObject, typeof(Mosaic));

            if (mosaic.shader == null)
            {
                mosaic.shader = (Shader)ResManager.LoadAsset("Shaders/PostEffect/Mosaic.shader", Stage.currentSceneName);
            }

            Action action = null;

            if (callback != null)
            {
                action = () => {
                    callback.BeginPCall();
                    callback.Call();
                    callback.EndPCall();
                }
            }
            ;
            mosaic.Play(toTileSize, duration, action);
            return(mosaic);
        }
Ejemplo n.º 2
0
    static int Play(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3)
            {
                ShibaInu.Mosaic obj  = (ShibaInu.Mosaic)ToLua.CheckObject <ShibaInu.Mosaic>(L, 1);
                float           arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
                float           arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                obj.Play(arg0, arg1);
                return(0);
            }
            else if (count == 4)
            {
                ShibaInu.Mosaic obj  = (ShibaInu.Mosaic)ToLua.CheckObject <ShibaInu.Mosaic>(L, 1);
                float           arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
                float           arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                System.Action   arg2 = (System.Action)ToLua.CheckDelegate <System.Action>(L, 4);
                obj.Play(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: ShibaInu.Mosaic.Play"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }