You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
using YooAsset;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Script.FrameWork.UI
|
|
|
|
|
|
{
|
|
|
|
|
|
public class SceneBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public string SceneName { private set; get; }
|
|
|
|
|
|
public bool IsLoaded { private set; get; }
|
|
|
|
|
|
|
|
|
|
|
|
public async UniTask LoadSceneAsync(string sceneName, LoadSceneMode loadSceneMode)
|
|
|
|
|
|
{
|
|
|
|
|
|
IsLoaded = false;
|
|
|
|
|
|
SceneName = sceneName;
|
|
|
|
|
|
OnScenePreLoad();
|
|
|
|
|
|
// await UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName, loadSceneMode).ToUniTask();
|
|
|
|
|
|
await YooAssets.LoadSceneAsync(sceneName);
|
|
|
|
|
|
IsLoaded = true;
|
|
|
|
|
|
OnSceneLoaded();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async UniTask UnLoadSceneAsync()
|
|
|
|
|
|
{
|
|
|
|
|
|
await UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(SceneName).ToUniTask();
|
|
|
|
|
|
IsLoaded = false;
|
|
|
|
|
|
OnSceneUnLoad();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void OnScenePreLoad()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void OnSceneLoaded()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void OnSceneUnLoad()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void OnUpdate()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|