Files
plugin-library/Assets/UI/Scenes/Launcher.cs
2025-09-18 18:25:40 +08:00

53 lines
1.2 KiB
C#

using SkierFramework;
using System;
using System.Collections;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using UnityEngine;
public class Launcher : MonoBehaviour
{
public GameObject Splash;
void Start()
{
if (Splash == null)
{
Splash = GameObject.Find(nameof(Splash));
}
StartCor();
}
private async void StartCor()
{
var resourceCore = ResourceManager.Instance.GetResourceCore(UIConfig.UIPackageName);
await resourceCore.InitializeAsync(UIConfig.UIPackageName);
await UIManager.Instance.InitUIConfig();
await UIManager.Instance.Preload<UILoadingView>();
Loading.Instance.StartLoading(EnterGameCor);
if (Splash != null)
{
Splash.SetActive(false);
}
}
IEnumerator EnterGameCor(Action<float, string> loadingRefresh)
{
loadingRefresh?.Invoke(0.3f, "loading..........1");
yield return new WaitForSeconds(0.5f);
loadingRefresh?.Invoke(0.6f, "loading..........2");
yield return new WaitForSeconds(0.5f);
loadingRefresh?.Invoke(1, "loading..........3");
yield return new WaitForSeconds(0.5f);
UIManager.Instance.Open<UILoginView>();
}
}