Exemplo n.º 1
0
        static int load(int L)
        {
            if (!LuaCommon.CheckAndShowArgsError(L, LConst.String))
            {
                Lua.Lua_pushnil(L);
                return(1);
            }

            if (Lua.Lua_isstring(L, -1))
            {
                var    fileName = Lua.Lua_tostring(L, -1).ToString();
                object page     = LuaManager.GetLuaManager(L).DetailV_;
                var    info     = RYTVideo.Load(fileName, string.Empty, null, page);
                Lua.Lua_pushlightuserdata(L, info);
            }
            else
            {
                Lua.Lua_pushnil(L);
            }

            return(1);
        }
Exemplo n.º 2
0
        static int play(int L)
        {
            #region table Frame Size
            RYTFrame frame = null;

            // 特殊的参数判断
            if (!LuaCommon.CheckAndShowArgsError(L, LConst.UserData, LConst.NFuction, LConst.NTable))
            {
                return(0);
            }

            if (Lua.Lua_gettop(L) > 3 && Lua.Lua_istable(L, 4))
            {
                frame = new RYTFrame();
                Lua.Lua_pushnil(L);
                while (Lua.Lua_next(L, 4) != 0)
                {
                    var key   = Lua.Lua_tostring(L, -2).ToString();
                    var value = Lua.Lua_tonumber(L, -1);

                    if (key.Equals("x", StringComparison.CurrentCultureIgnoreCase))
                    {
                        frame.Left = value * LuaManager.WidthScale;
                    }
                    else if (key.Equals("y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        frame.Top = value * LuaManager.HeightScale;
                    }
                    else if (key.Equals("width", StringComparison.CurrentCultureIgnoreCase))
                    {
                        frame.Width = value * LuaManager.WidthScale;
                    }
                    else if (key.Equals("height", StringComparison.CurrentCultureIgnoreCase))
                    {
                        frame.Height = value * LuaManager.HeightScale;
                    }

                    Lua.Lua_pop(L, 1);
                }
            }

            #endregion

            var callbackId = -1;

            RYTVideoInfo info  = null;
            int          count = Lua.Lua_gettop(L);
            if (count == 2)
            {
                info = Lua.Lua_touserdata(L, 0) as RYTVideoInfo;
            }
            else
            {
                info = Lua.Lua_touserdata(L, 2) as RYTVideoInfo;

                callbackId = LuaManager.GetFunctionIDIndex(L);
            }

            // no loop now
            //int loop = Lua.Lua_tointeger(L, 3);
            bool bLoop = false; // = loop == 1 ? true : false;

            if (info != null)
            {
                Action action = () =>
                {
                    if (callbackId != -1)
                    {
                        LuaManager.GetLuaManager(L).ExecuteCallBackFunction(callbackId, false);
                    }
                };

                RYTVideo.Play(info, string.Empty, frame, bLoop, action);
            }

            return(0);
        }
Exemplo n.º 3
0
        static int dispose(int L)
        {
            RYTVideo.Dispose();

            return(0);
        }
Exemplo n.º 4
0
        static int stop(int L)
        {
            RYTVideo.Stop();

            return(0);
        }
Exemplo n.º 5
0
        static int resume(int L)
        {
            RYTVideo.Resume();

            return(0);
        }
Exemplo n.º 6
0
 static int pause(int L)
 {
     RYTVideo.Pause();
     return(0);
 }