12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using UnityEngine;
- public class TemplateVideo : BaseTemPlate
- {
- private VideoControl m_VideoCtr;
- private AVProVideoPlayer m_Video;
- protected override void OnEnable()
- {
- base.OnEnable();
- //if (GameManager.Instance.IsRuning && string.IsNullOrWhiteSpace(m_VideoCtr.VideoURL))
- //{
- // if (File.Exists(Data.localSavePath))
- // {
- // m_VideoCtr.VideoURL = Data.localSavePath;
- // }
- // else
- // {
- // m_VideoCtr.VideoURL = null;
- // }
- //}
- //m_VideoCtr.m_IsPlaying = false;
- //m_VideoCtr.PlayVideo();
- if (GameManager.Instance.IsRuning && string.IsNullOrWhiteSpace(m_Video.GetUrl()))
- {
- if (File.Exists(Data.localSavePath))
- {
- m_Video.SetUrl(Data.localSavePath);
- }
- else
- {
- m_Video.SetUrl(null);
- }
- }
- m_Video.transform.GetComponent<VideoPlayBtn>().m_IsPlaying = false;
- m_Video.transform.GetComponent<VideoPlayBtn>().PlayVideo();
- }
- protected override void OnAwake()
- {
- base.OnAwake();
- // m_VideoCtr = transform.Find("Screen/Video").GetComponent<Navigator.VideoControl>();
- m_Video = transform.Find("Screen/AVideo").GetComponent<AVProVideoPlayer>();
- HideCollider();
- }
- public override void SetData(MaterialObjValue value, int updateTime)
- {
- base.SetData(value, updateTime);
- if (!GameManager.Instance.IsRuning)
- {
- DownloadManager.Instance.AddDownloadData(Data);
- }
- else
- {
- if (File.Exists(Data.localSavePath))
- {
- // m_VideoCtr.VideoURL = Data.localSavePath;
- m_Video.SetUrl(Data.localSavePath);
- }
- else
- {
- // m_VideoCtr.VideoURL = null;
- m_Video.SetUrl(null);
- }
- }
- }
- public override void HideCollider()
- {
- base.HideCollider();
- }
- }
|