36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using CG.Framework;
|
|
/*******************************************************************************
|
|
*Create By CG
|
|
*Function ·ÇÒì²½³¡¾°¼ÓÔØ¿ØÖÆ
|
|
*******************************************************************************/
|
|
namespace CG.UTility
|
|
{
|
|
public class LoadScenes: MonoSingleton<LoadScenes>
|
|
{
|
|
private System.Action _loadedCall = null;
|
|
protected override void AwakeSelf()
|
|
{
|
|
base.AwakeSelf();
|
|
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
|
|
}
|
|
public void LoadScene(string sceneName, System.Action LoadedCall)
|
|
{
|
|
_loadedCall = LoadedCall;
|
|
SceneManager.LoadScene(sceneName);
|
|
}
|
|
protected override void OnDestroy()
|
|
{
|
|
base.OnDestroy();
|
|
SceneManager.sceneLoaded -= SceneManager_sceneLoaded;
|
|
}
|
|
|
|
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
|
|
{
|
|
_loadedCall?.Invoke();
|
|
}
|
|
}
|
|
} |