Files
plugin-library/Assets/00.StaryEvoTools/Runtime/VideoSystemPanel/VideoSystem.cs

37 lines
991 B
C#
Raw Normal View History

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)
{
2025-12-31 15:56:05 +08:00
AudioCoreManager.SetMusicVolume(2f, 0f);
2025-09-04 11:43:35 +08:00
await this.GetSystem<IPanelSystem>().PushQueue<VideoPanel>(parent:AppConfig.GetDefaultMainInstance().transform,packageName:"Main");
2025-05-23 18:26:47 +08:00
this.GetSystem<IPanelSystem>().SendPanelEvent(ModeType.VideoStart,info);
}
public void StopVideo()
{
this.GetSystem<IPanelSystem>().SendPanelEvent(ModeType.VideoEnd);
}
}