using Cysharp.Threading.Tasks; using Gameplay.Performance; using PhxhSDK; using System.IO; using YooAsset; namespace Gameplay { public partial class CommonUtils { /// /// 根据性能获取视频路径 /// /// public static void GetVideoPathByPerformance(ref string path) { if (!PerformanceManager.instance.data.useLowVideo) return; if (path.Contains("_Low")) return; int dotIndex = path.LastIndexOf('.'); path = path.Insert(dotIndex, "_Low"); } /// /// 获取播放视频的真实路径 /// /// /// public static async UniTask GetRealVideoURL(string videoURL) { string realVideoURL; RawFileHandle rawFileHandle = AssetManager.Instance.LoadRawFileAsync(videoURL); await rawFileHandle; string rawFilePath = rawFileHandle.GetRawFilePath(); if (rawFilePath.EndsWith(".mp4")) realVideoURL = rawFilePath; else realVideoURL = $"{rawFilePath}.mp4"; if (!File.Exists(realVideoURL)) File.Copy(rawFilePath, realVideoURL); return realVideoURL; } } }