Exemple #1
0
        static internal int checkDelegate(IntPtr l, int p, out UtilTools.onPlayVideoComplete ua)
        {
            int op = extractFunction(l, p);

            if (LuaDLL.lua_isnil(l, p))
            {
                ua = null;
                return(op);
            }
            else if (LuaDLL.lua_isuserdata(l, p) == 1)
            {
                ua = (UtilTools.onPlayVideoComplete)checkObj(l, p);
                return(op);
            }
            LuaDelegate ld;

            checkType(l, -1, out ld);
            if (ld.d != null)
            {
                ua = (UtilTools.onPlayVideoComplete)ld.d;
                return(op);
            }
            LuaDLL.lua_pop(l, 1);

            l  = LuaState.get(l).L;
            ua = () =>
            {
                int error = pushTry(l);

                ld.pcall(0, error);
                LuaDLL.lua_settop(l, error - 1);
            };
            ld.d = ua;
            return(op);
        }
Exemple #2
0
    //////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// 播放视频
    /// </summary>
    /// <param name="videoName">视频名字</param>
    /// <param name="videoWidth">视频宽度</param>
    /// <param name="videoHeight">视频高度</param>
    /// <param name="screenWidth">屏幕宽度</param>
    /// <param name="screenHeight">屏幕高度</param>
    /// <param name="mode">视屏模式: 1宽高比缩放  2高宽比缩放</param>
    public void playVideo(string videoName, int videoWidth, int videoHeight, int clipCount, int mode, UtilTools.onPlayVideoComplete callback = null)
    {
        if (_javaSysUtilsOptObj != null)
        {
            _javaSysUtilsOptObj.CallStatic("startPlayVideo", videoName, clipCount, videoWidth, videoHeight, Screen.width, Screen.height, mode, gameObject.name);

            // 添加回调
            if (!_videosCallback.ContainsKey(videoName) && callback != null)
            {
                _videosCallback.Add(videoName, callback);
            }
        }
    }