using UnityEngine; using UnityEngine.UI; using UnityEngine.Video; using YooAsset; using GFGGame.Launcher; using System.Collections; namespace GFGGame { public class UICGView : SingletonMonoBase { private const float VideoWidth = 1920f; private const float VideoHeight = 1080f; private GameObject _ui; private AssetHandle handle; private RawFileHandle videoHandle; private RawImage imgVideo; private Button BtnFullScreen; private Button BtnSkipVertical; private Button BtnSkipHorizontal; private VideoPlayer videoPlayer; public void Show() { MusicManager.Instance.Stop(); string path = ResPathUtil.GetUUIPrefabPath("UICG"); // 异步加载UI预制体 var uiLoadOperation = YooAssets.LoadAssetAsync(path); uiLoadOperation.Completed += (op) => { if (op.Status == EOperationStatus.Succeed) { _ui = op.InstantiateSync(UGUIManager.Instance.desktop.transform); InitializeUIComponents(); LoadAndPlayVideo(); } else { Debug.LogError($"Failed to load UI prefab: {path}"); } }; } private void InitializeUIComponents() { imgVideo = _ui.transform.Find("ImgVideo").GetComponent(); Vector2 imgVideoSizeDelta = imgVideo.rectTransform.sizeDelta; imgVideoSizeDelta.x = Screen.width; imgVideoSizeDelta.y = (VideoHeight / VideoWidth) * imgVideoSizeDelta.x; imgVideo.rectTransform.sizeDelta = imgVideoSizeDelta; BtnFullScreen = _ui.transform.Find("BtnFullScreen").GetComponent