2023-08-23 01:59:40 +08:00
|
|
|
using System;
|
2023-06-08 14:09:50 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UIElements;
|
|
|
|
using UnityEngine.InputSystem;
|
|
|
|
using BITKit;
|
|
|
|
using BITKit.UX;
|
|
|
|
using BITKit.Entities;
|
|
|
|
namespace BITFALL.UX
|
|
|
|
{
|
2023-08-23 01:59:40 +08:00
|
|
|
public class Loading : UIToolKitPanel
|
2023-06-08 14:09:50 +08:00
|
|
|
{
|
2023-06-17 16:30:53 +08:00
|
|
|
[Header(Constant.Header.Providers)]
|
2023-08-27 02:58:19 +08:00
|
|
|
[SerializeReference, SubclassSelector]
|
2023-06-17 16:30:53 +08:00
|
|
|
private INetClient netClient;
|
2023-08-27 02:58:19 +08:00
|
|
|
[SerializeReference, SubclassSelector]
|
2023-06-17 16:30:53 +08:00
|
|
|
private INetProvider netProvider;
|
|
|
|
[Header(Constant.Header.Components)]
|
2023-06-08 14:09:50 +08:00
|
|
|
public UXBar loadBar;
|
|
|
|
public UXLabel loadText;
|
2023-08-23 01:59:40 +08:00
|
|
|
protected override void Awake()
|
2023-06-08 14:09:50 +08:00
|
|
|
{
|
2023-08-23 01:59:40 +08:00
|
|
|
base.Awake();
|
|
|
|
netClient.OnStartConnect += OnStartConnect;
|
2023-06-08 14:09:50 +08:00
|
|
|
Data.AddListener<IProgress>(OnLoadProgress);
|
|
|
|
}
|
2023-08-23 01:59:40 +08:00
|
|
|
private void OnDestroy()
|
|
|
|
{
|
|
|
|
netClient.OnStartConnect -= OnStartConnect;
|
|
|
|
Data.RemoveListender<IProgress>(OnLoadProgress);
|
|
|
|
}
|
2023-08-12 01:43:24 +08:00
|
|
|
|
2023-06-17 16:30:53 +08:00
|
|
|
private void OnStartConnect()
|
2023-06-08 14:09:50 +08:00
|
|
|
{
|
2023-06-17 16:30:53 +08:00
|
|
|
loadBar.SetDirect(0,"正在开始加载");
|
2023-08-23 01:59:40 +08:00
|
|
|
Entry();
|
2023-06-08 14:09:50 +08:00
|
|
|
}
|
2023-06-17 16:30:53 +08:00
|
|
|
private void OnLoadProgress(IProgress progress)
|
2023-06-08 14:09:50 +08:00
|
|
|
{
|
|
|
|
loadBar.Set(progress.Progress);
|
|
|
|
loadText.Set(progress.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|