Files
TuanTuan-Engine/Assets/GameScripts/Preload/PatchWindow.cs

48 lines
1.3 KiB
C#
Raw Normal View History

2025-11-03 00:24:36 +08:00
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
public class PatchWindow : MonoBehaviour
{
public Text statusText;
public Slider progressBar;
public Text downloadSizeText;
public VideoPlayer video;
private void Awake()
{
video.targetCamera = MainUICanvas.Inst.UICamera;
2025-11-03 12:03:21 +08:00
PatchEvent.OnStatusUpdate += OnStatusUpdate;
PatchEvent.OnProgressUpdate += OnProgressUpdate;
PatchEvent.OnDownloadSizeUpdate += OnDownloadSizeUpdate;
2025-11-04 16:19:53 +08:00
PatchEvent.OnClosePatchWindow += OnClosePatchWindow;
2025-11-03 12:03:21 +08:00
}
private void OnDestroy()
{
PatchEvent.OnStatusUpdate -= OnStatusUpdate;
PatchEvent.OnProgressUpdate -= OnProgressUpdate;
PatchEvent.OnDownloadSizeUpdate -= OnDownloadSizeUpdate;
}
private void OnStatusUpdate(string status)
{
if (statusText != null)
statusText.text = status;
}
private void OnProgressUpdate(float progress)
{
if (progressBar != null)
progressBar.value = progress;
}
private void OnDownloadSizeUpdate(string sizeText)
{
if (downloadSizeText != null)
downloadSizeText.text = sizeText;
2025-11-03 00:24:36 +08:00
}
2025-11-04 16:19:53 +08:00
private void OnClosePatchWindow()
{
gameObject.SetActive(false);
}
2025-11-03 00:24:36 +08:00
}