This commit is contained in:
JA
2026-06-20 19:34:23 +08:00
parent e5031c0068
commit d442805c3f
4136 changed files with 514641 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Events;
namespace Manager
{
class SenceManager:MonoSingleton<SenceManager>
{
UnityAction<float> onProgress = null;
public void LoadScene(int name)
{
StartCoroutine(LoadLevel(name));
}
IEnumerator LoadLevel( int id)
{
Debug.LogFormat("LoadLevel: {0}", name);
AsyncOperation async = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(id);
async.allowSceneActivation = true;
async.completed += LevelLoadCompleted;
//保存数据
PlayerInfo.Instance.info.currentMap=id;
SaveSystem.SaveDate(PlayerInfo.Instance.info.DatePath, PlayerInfo.Instance.info);
while (!async.isDone)
{
if (onProgress != null)
onProgress(async.progress);
yield return null;
}
}
private void LevelLoadCompleted(AsyncOperation obj)
{
if (onProgress != null)
onProgress(1f);
Debug.Log("LevelLoadCompleted:" + obj.progress);
}
}
}