44 lines
1.0 KiB
C#
44 lines
1.0 KiB
C#
using UnityEngine;
|
|
|
|
namespace Thousandto.UpdateForm.Movie
|
|
{
|
|
/// <summary>
|
|
/// 影片播放器中心
|
|
/// </summary>
|
|
public static class MoviePlayerCenter
|
|
{
|
|
//播放器
|
|
private static IMoviePlayer _player;
|
|
|
|
static MoviePlayerCenter()
|
|
{
|
|
#if UNITY_STANDALONE_WIN
|
|
_player = new PCMoviePlayer();
|
|
|
|
#elif UNITY_ANDROID || UNITY_IPHONE
|
|
_player = new MoblieMoviePlayer();
|
|
#elif UNITY_WEBGL
|
|
_player = new WebMoviePlayer();
|
|
#endif
|
|
}
|
|
|
|
public static void Play(string name, MovieAction onFinishedCallBack)
|
|
{
|
|
if (_player != null)
|
|
{
|
|
_player.Play(name, () =>
|
|
{
|
|
Debug.LogError("播放完毕:" + name);
|
|
if (onFinishedCallBack != null)
|
|
onFinishedCallBack();
|
|
});
|
|
}
|
|
else
|
|
{
|
|
if (onFinishedCallBack != null)
|
|
onFinishedCallBack();
|
|
}
|
|
}
|
|
}
|
|
}
|