45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
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
|
|
{
|
|
public class Loading : UIToolKitPanel
|
|
{
|
|
[Header(Constant.Header.Providers)]
|
|
[SerializeField, SerializeReference, SubclassSelector]
|
|
private INetClient netClient;
|
|
[SerializeField, SerializeReference, SubclassSelector]
|
|
private INetProvider netProvider;
|
|
[Header(Constant.Header.Components)]
|
|
public UXBar loadBar;
|
|
public UXLabel loadText;
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
netClient.OnStartConnect += OnStartConnect;
|
|
Data.AddListener<IProgress>(OnLoadProgress);
|
|
}
|
|
private void OnDestroy()
|
|
{
|
|
netClient.OnStartConnect -= OnStartConnect;
|
|
Data.RemoveListender<IProgress>(OnLoadProgress);
|
|
}
|
|
|
|
private void OnStartConnect()
|
|
{
|
|
loadBar.SetDirect(0,"正在开始加载");
|
|
Entry();
|
|
}
|
|
private void OnLoadProgress(IProgress progress)
|
|
{
|
|
loadBar.Set(progress.Progress);
|
|
loadText.Set(progress.Message);
|
|
}
|
|
}
|
|
} |