using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using DG.Tweening; using UnityEngine.Video; /// /// 视屏播放面板 /// public class UI_VideoPanel : BasePanel { public CanvasGroup canvasGroup; //屏幕显示 private GameObject Player; public Button CloseBtn; //外围关闭按钮 [Header("播放")] public Button UpPauseBtn; //中间暂停按钮 public Button DownPauseBtn; //下方暂停按钮 public Slider VolumeSlider; //音量进度条 public Sprite[] PauseOrPlaySprite; public VideoPlayer VideoPlayer; //视屏播放 [Header("音量")] public Button SourceBtn; //音量Btn public AudioSource audioSource; public Sprite[] volumeOffOrOn; //声音图标 private bool isMuted = false; private float lastVolume = 1f; private bool isDragging = false; //public Button Btn protected override void Awake() { base.Awake(); OnInit(); } public void OnInit() { canvasGroup = GetComponent(); canvasGroup.alpha = 0f; // 默认隐藏 canvasGroup.interactable = false; canvasGroup.blocksRaycasts = false; // ===== 音频绑定 ===== VideoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource; VideoPlayer.SetTargetAudioSource(0, audioSource); SourceBtn = GetControl