2025-05-23 18:26:47 +08:00
|
|
|
|
using System;
|
2025-07-02 10:05:26 +08:00
|
|
|
|
using System.Threading;
|
2025-05-23 18:26:47 +08:00
|
|
|
|
using Stary.Evo;
|
|
|
|
|
|
using Stary.Evo.AudioCore;
|
|
|
|
|
|
using Stary.Evo.UIFarme;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
public interface IVideoSystem : ISystem
|
|
|
|
|
|
{
|
|
|
|
|
|
void PlayVideo(VideoPanel.VideoInfo info);
|
|
|
|
|
|
void StopVideo();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class VideoSystem : AbstractSystem, IVideoSystem
|
|
|
|
|
|
{
|
2025-07-02 10:05:26 +08:00
|
|
|
|
private CancellationTokenSource _cancellationTokenSource;
|
2025-05-23 18:26:47 +08:00
|
|
|
|
protected override void OnInit()
|
|
|
|
|
|
{
|
2025-07-02 10:05:26 +08:00
|
|
|
|
_cancellationTokenSource = new CancellationTokenSource();
|
2025-05-23 18:26:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Dispose()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async void PlayVideo(VideoPanel.VideoInfo info)
|
|
|
|
|
|
{
|
|
|
|
|
|
AudioCoreManager.SetMusicVolume(new AudioData()
|
|
|
|
|
|
{
|
|
|
|
|
|
fadeDuration = 2f,
|
|
|
|
|
|
volume = 0f,
|
|
|
|
|
|
});
|
|
|
|
|
|
await this.GetSystem<IPanelSystem>().PushQueue<VideoPanel>(AppConfig.GetDefaultMainInstance().transform,"Main");
|
|
|
|
|
|
this.GetSystem<IPanelSystem>().SendPanelEvent(ModeType.VideoStart,info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void StopVideo()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.GetSystem<IPanelSystem>().SendPanelEvent(ModeType.VideoEnd);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|