60 lines
1.2 KiB
C#
60 lines
1.2 KiB
C#
using SRF;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Video;
|
|
|
|
[RequireComponent(typeof(VideoPlayer))]
|
|
public class ActionGuideVideoPanel : UIPopupBase
|
|
{
|
|
public VideoPlayer _video;
|
|
private YogaData _data;
|
|
|
|
private void Awake()
|
|
{
|
|
_video = GetComponent<VideoPlayer>();
|
|
}
|
|
|
|
public override void Init(object[] pageData)
|
|
{
|
|
base.Init(pageData);
|
|
_data = pageData[0] as YogaData;
|
|
|
|
//动作引导界面
|
|
Debug.Log(_data.VideoPath);
|
|
var video = Resources.Load<VideoClip>(_data.VideoPath);
|
|
|
|
if (_video == null)
|
|
{
|
|
_video = gameObject.GetComponentOrAdd<VideoPlayer>();
|
|
}
|
|
|
|
_video.clip = video;
|
|
_video.isLooping = true;
|
|
_video.playOnAwake = false;
|
|
_video.Prepare();
|
|
}
|
|
|
|
public void OnOKClicked()
|
|
{
|
|
PageDispose();
|
|
UIManager.Instance.ShowPanel<GuideUI>(_data);
|
|
}
|
|
|
|
private void PageDispose()
|
|
{
|
|
_video.Stop();
|
|
UIManager.Instance.CloseCurrent();
|
|
}
|
|
|
|
public void OnReturnClicked()
|
|
{
|
|
PageDispose();
|
|
LoadingManager.Instance.Load("Boot");
|
|
}
|
|
|
|
public override void OnEnter()
|
|
{
|
|
base.OnEnter();
|
|
_video.Play();
|
|
}
|
|
} |