Beispiel #1
0
    public void play(string _name, bool _skip, bool _loop, bool _loding = false, bool _clear = true, BGMManager.EBGM_ID _bgm = BGMManager.EBGM_ID.eBGM_INIT, bool _destroy = false)
    {
        //BGM停止
        SoundUtil.StopBGM(false);

        m_loop = _loop;

        UnityUtil.SetObjectEnabledOnce(gameObject, true);

        if (SafeAreaControl.HasInstance)
        {
            SafeAreaControl.Instance.adjustanchoredPosition(m_ImagePanel.GetComponent <RectTransform>());
        }

        m_TitleMovie.m_bPlayMovie = true;

        m_ScrMedia.DeleteVideoTexture();
        m_ScrMedia.Load(_name);
        m_ScrMedia.Play();

        m_ScrMedia.OnEnd += () =>
        {
            if (m_loop == true)
            {
                m_ScrMedia.Play();
            }
            else
            {
                finishMovie();
            }
        };

        m_ScrMedia.OnVideoError += (MediaPlayerCtrl.MEDIAPLAYER_ERROR errorCode, MediaPlayerCtrl.MEDIAPLAYER_ERROR errorCodeExtra) =>
        {
            finishMovie();
        };

        setSkip(_skip);

        if (_loding == false)
        {
            UnityUtil.SetObjectEnabled(m_LodingObject, false);
        }
        UnityUtil.SetObjectEnabled(m_PercentObject, false);

        m_clear   = _clear;
        m_bgmid   = _bgm;
        m_destroy = _destroy;
    }
Beispiel #2
0
    void OnEnable()
    {
        if (Main.Main3DCamera != null)
        {
            Main.Main3DCamera.enabled = false;
        }

        if (_VideoManagerObj != null)
        {
            this.Resize();

            _MediaCtrl = _VideoManagerObj.GetComponent <MediaPlayerCtrl>();
            if (_MediaCtrl == null)
            {
                _MediaCtrl = _VideoManagerObj.AddComponent <MediaPlayerCtrl>();
            }
            _MediaCtrl.m_strFileName = _VideoName;
            _MediaCtrl.m_bFullScreen = true;    //全屏
            _MediaCtrl.m_bLoop       = _IsLoop; //是否循环播放
            _MediaCtrl.m_bAutoPlay   = true;    //自动播放
            _MediaCtrl.OnReady       = OnVideoReady;
            _MediaCtrl.OnEnd         = OnVideoEnd;
            if (_IsPauseOnFirstFrame)
            {
                _MediaCtrl.OnVideoFirstFrameReady = OnVideoFirstFrameReady;
            }
            else
            {
                _MediaCtrl.OnVideoFirstFrameReady = null;
            }
            _MediaCtrl.DeleteVideoTexture();

            _MediaCtrl.Load(_MediaCtrl.m_strFileName);

            _VideoManagerObj.SetActive(true);
        }
    }