/// <summary> /// 异步加载场景。 /// </summary> /// <param name="sceneAssetName">要加载场景资源的名称。</param> /// <param name="loadSceneCallbacks">加载场景回调函数集。</param> /// <param name="userData">用户自定义数据。</param> public void LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks, object userData) { if (string.IsNullOrEmpty(sceneAssetName)) { Log.Error("Scene asset name is invalid."); return; } if (loadSceneCallbacks == null) { Log.Error("Load scene callbacks is invalid."); return; } DateTime startTime = DateTime.Now; #if UNITY_5_5_OR_NEWER AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneAssetName, LoadSceneMode.Additive); #else AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(SceneComponent.GetSceneName(sceneAssetName), LoadSceneMode.Additive); #endif if (asyncOperation == null) { return; } m_LoadSceneInfos.AddLast(new LoadSceneInfo(asyncOperation, sceneAssetName, startTime, loadSceneCallbacks, userData)); }
public LoadSceneInfo(AsyncOperation asyncOperation, string sceneAssetName, DateTime startTime, LoadSceneCallbacks loadSceneCallbacks, object userData) { m_AsyncOperation = asyncOperation; m_SceneAssetName = sceneAssetName; m_StartTime = startTime; m_LoadSceneCallbacks = loadSceneCallbacks; m_UserData = userData; }
public void LoadScene(string name, LoadSceneCallbacks loadSceneCallbacks) { EditorLoadSceneInfo loadInfo = new EditorLoadSceneInfo(); loadInfo.loadSceneCallbacks = loadSceneCallbacks; loadInfo.name = name; m_LoadSceneList.AddFirst(loadInfo); }
public SceneManager() { m_LoadedSceneAssetNames = new List <string>(); m_LoadingSceneAssetNames = new List <string>(); m_UnloadingSceneAssetNames = new List <string>(); m_LoadSceneCallbacks = new LoadSceneCallbacks(LoadSceneSuccessCallback, LoadSceneDependencyAssetCallback, LoadSceneUpdateCallback, LoadSceneFailureCallback); m_UnloadSceneCallbacks = new UnloadSceneCallbacks(UnloadSceneSuccessCallback, UnloadSceneFailureCallback); m_ResourceManager = FrameworkEntry.Instance.GetManager <ResourceManager>(); m_EventManager = FrameworkEntry.Instance.GetManager <EventManager>(); }
/// <summary> /// 异步加载场景。 /// </summary> /// <param name="sceneAssetName">要加载场景资源的名称。</param> /// <param name="priority">加载场景资源的优先级。</param> /// <param name="loadSceneCallbacks">加载场景回调函数集。</param> /// <param name="userData">用户自定义数据。</param> public void LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks, object userData) { if (loadSceneCallbacks == null) { Log.Error("Load scene callbacks is invalid."); return; } if (string.IsNullOrEmpty(sceneAssetName)) { if (loadSceneCallbacks.LoadSceneFailureCallback != null) { loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.NotExist, "Scene asset name is invalid.", userData); } return; } if (!sceneAssetName.StartsWith("Assets/") || !sceneAssetName.EndsWith(".unity")) { if (loadSceneCallbacks.LoadSceneFailureCallback != null) { loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Scene asset name '{0}' is invalid.", sceneAssetName), userData); } return; } if (!HasFile(sceneAssetName)) { if (loadSceneCallbacks.LoadSceneFailureCallback != null) { loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.NotExist, Utility.Text.Format("Scene '{0}' is not exist.", sceneAssetName), userData); } return; } #if UNITY_5_5_OR_NEWER AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneAssetName, LoadSceneMode.Additive); #else AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(SceneComponent.GetSceneName(sceneAssetName), LoadSceneMode.Additive); #endif if (asyncOperation == null) { return; } m_LoadSceneInfos.AddLast(new LoadSceneInfo(asyncOperation, sceneAssetName, priority, DateTime.Now, loadSceneCallbacks, userData)); }
/// <summary> /// 初始化场景管理器的新实例。 /// </summary> public SceneManager() { m_LoadedSceneAssetNames = new List <string>(); m_LoadingSceneAssetNames = new List <string>(); m_UnloadingSceneAssetNames = new List <string>(); m_LoadSceneCallbacks = new LoadSceneCallbacks(LoadSceneSuccessCallback, LoadSceneFailureCallback, LoadSceneUpdateCallback, LoadSceneDependencyAssetCallback); m_UnloadSceneCallbacks = new UnloadSceneCallbacks(UnloadSceneSuccessCallback, UnloadSceneFailureCallback); m_ResourceManager = null; m_LoadSceneSuccessEventHandler = null; m_LoadSceneFailureEventHandler = null; m_LoadSceneUpdateEventHandler = null; m_LoadSceneDependencyAssetEventHandler = null; m_UnloadSceneSuccessEventHandler = null; m_UnloadSceneFailureEventHandler = null; }
/// <summary> /// 异步加载场景。 /// </summary> /// <param name="sceneName">要加载的场景名称。</param> /// <param name="sceneAssetName">要加载场景资源的名称。</param> /// <param name="loadSceneCallbacks">加载场景回调函数集。</param> /// <param name="userData">用户自定义数据。</param> public void LoadScene(string sceneName, string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks, object userData) { if (loadSceneCallbacks == null) { throw new GameFrameworkException("Load scene callbacks is invalid."); } if (string.IsNullOrEmpty(sceneName)) { throw new GameFrameworkException("Scene name is invalid."); } DateTime startTime = DateTime.Now; AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive); if (asyncOperation == null) { return; } m_LoadSceneInfos.Add(new LoadSceneInfo(asyncOperation, sceneName, sceneAssetName, startTime, loadSceneCallbacks, userData)); }
/// <summary> /// 异步加载场景。 /// </summary> /// <param name="sceneAssetName">要加载场景资源的名称。</param> /// <param name="loadSceneCallbacks">加载场景回调函数集。</param> /// <param name="userData">用户自定义数据。</param> public void LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks, object userData) { LoadScene(sceneAssetName, DefaultPriority, loadSceneCallbacks, userData); }
/// <summary> /// 异步加载场景。 /// </summary> /// <param name="sceneAssetName">要加载场景资源的名称。</param> /// <param name="priority">加载场景资源的优先级。</param> /// <param name="loadSceneCallbacks">加载场景回调函数集。</param> public void LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks) { LoadScene(sceneAssetName, priority, loadSceneCallbacks, null); }
/// <summary> /// 异步加载场景。 /// </summary> /// <param name="sceneAssetName">要加载场景资源的名称。</param> /// <param name="loadSceneCallbacks">加载场景回调函数集。</param> public void LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks) { LoadScene(sceneAssetName, DefaultPriority, loadSceneCallbacks, null); }
/// <summary> /// 异步加载场景。 /// </summary> /// <param name="sceneName">要加载的场景名称。</param> /// <param name="sceneAssetName">要加载场景资源的名称。</param> /// <param name="loadSceneCallbacks">加载场景回调函数集。</param> public void LoadScene(string sceneName, string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks) { LoadScene(sceneName, sceneAssetName, loadSceneCallbacks, null); }
public static LoadSceneTask Create(string sceneAssetName, int priority, ResourceInfo resourceInfo, string[] dependencyAssetNames, LoadSceneCallbacks loadSceneCallbacks, object userData) { LoadSceneTask loadSceneTask = ReferencePool.Acquire <LoadSceneTask>(); loadSceneTask.Initialize(sceneAssetName, null, priority, resourceInfo, dependencyAssetNames, userData); loadSceneTask.m_LoadSceneCallbacks = loadSceneCallbacks; return(loadSceneTask); }
public LoadSceneTask(string sceneAssetName, int priority, ResourceInfo resourceInfo, string resourceChildName, string[] dependencyAssetNames, string[] scatteredDependencyAssetNames, LoadSceneCallbacks loadSceneCallbacks, object userData) : base(sceneAssetName, null, priority, resourceInfo, resourceChildName, dependencyAssetNames, scatteredDependencyAssetNames, userData) { m_LoadSceneCallbacks = loadSceneCallbacks; }
public void LoadScene(string name, LoadSceneCallbacks loadSceneCallbacks) { throw new System.NotImplementedException(); }
public void LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks, object userData) { //throw new NotImplementedException(); }
public void LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks) { //throw new NotImplementedException(); }
public void LoadScene(string name, LoadSceneCallbacks callback) { m_FrameManager.LoadScene(name, callback); }
public LoadSceneTask() { m_LoadSceneCallbacks = null; }
/// <summary> /// 异步加载场景 /// </summary> /// <param name="sceneAssetName">要加载场景资源的名称</param> /// <param name="loadSceneCallbacks">加载场景回调函数集</param> /// <param name="userData">用户自定义数据</param> public void LoadScene(string sceneAssetName, LoadSceneCallbacks loadSceneCallbacks, object userData) { LoadScene(sceneAssetName, 0, loadSceneCallbacks, userData); }
public override void Clear() { base.Clear(); m_LoadSceneCallbacks = null; }
public void Initialize(string sceneAssetName, int priority, ResourceInfo resourceInfo, string[] dependencyAssetNames, LoadSceneCallbacks loadSceneCallbacks, object userData) { base.Initialize(sceneAssetName, null, priority, resourceInfo, dependencyAssetNames, userData); m_LoadSceneCallbacks = loadSceneCallbacks; }