首次提交

This commit is contained in:
Bob.Song
2026-03-05 18:07:55 +08:00
commit e125bb869e
4534 changed files with 563920 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System;
using Fantasy.Async;
using NBC;
using UnityEngine.SceneManagement;
namespace NBF
{
public static class SceneHelper
{
public static async FTask LoadScene(string sceneName)
{
try
{
Game.Main.EventComponent.Publish(new SceneChangeStart());
LoadingPanel.Show();
var asyncOperation = SceneManager.LoadSceneAsync(sceneName);
if (asyncOperation == null) throw new Exception($"Scene not found,name={sceneName}");
while (true)
{
await Game.Main.EventComponent.PublishAsync(new LoadingProgress()
{
Progress = asyncOperation.progress
});
LoadingPanel.SetProgress(asyncOperation.progress);
// 等待0.5秒后执行下面的逻辑。
await Game.Main.TimerComponent.Net.WaitAsync(500);
if (asyncOperation.isDone)
{
break;
}
}
}
catch (Exception e)
{
Log.Error(e);
}
}
}
}