예제 #1
0
 /// <summary>
 /// 异步加载场景
 /// </summary>
 /// <param name="sceneName">场景名</param>
 /// <param name="isSingle">是否使用Single模式加载场景,目前不支持同类型场景的Addtive加载,只支持2D场景中加载3D场景或3D场景加载2D场景时Additive加载</param>
 /// <param name="callback">场景加载完成后的异步回调</param>
 public static void LoadScene(string sceneName, bool isSingle = true, Action callback = null)
 {
     UnityUtility.StartCoroutine(_LoadScene(sceneName, isSingle, callback));
 }
예제 #2
0
 /// <summary>
 /// 异步加载场景
 /// </summary>
 /// <param name="sceneBuildIndex">BuildSetting中场景的索引值</param>
 /// <param name="is3D">是否为3D场景,默认为true。如果是2D场景,则会在Unity中的加载方式为Addtive</param>
 /// <param name="callback">场景加载完成后的异步回调</param>
 public static void LoadScene(int sceneBuildIndex, bool is3D = true, Action callback = null)
 {
     UnityUtility.StartCoroutine(_LoadScene(sceneBuildIndex, is3D, callback));
 }
예제 #3
0
 /// <summary>
 /// 异步加载资源
 /// </summary>
 /// <param name="path">资源路径</param>
 /// <param name="callback">资源加载完毕异步回调</param>
 /// <typeparam name="T">需要被加载的资源类型</typeparam>
 public static void Load <T>(string path, Action <object> callback)
 {
     UnityUtility.StartCoroutine(_Load(path, (result) => {
         callback(result);
     }));
 }
예제 #4
0
 /// <summary>
 /// 异步加载路径下指定类型的所有资源
 /// </summary>
 /// <param name="path">资源路径</param>
 /// <param name="callback">所有资源加载完毕异步回调</param>
 /// <typeparam name="T">需要被加载的资源类型</typeparam>
 public static void LoadAll <T>(string path, Action <UnityEngine.Object[]> callback)
 {
     UnityUtility.StartCoroutine(_LoadAll(path, typeof(T), (result) => {
         callback(result);
     }));
 }
예제 #5
0
 /// <summary>
 /// 异步加载prefab资源
 ///
 /// 用例: MiniGameAdaptor.Resources.Load("path/to/prefab", "{ cacheable: true }", (prefab) => { // DO SOMETHING });
 /// </summary>
 /// <param name="path">prefab路径</param>
 /// <param name="callback">prefab加载完毕异步回调</param>
 /// <param name="options">加载参数,默认为空,此项参数只会在小游戏中生效(注意{}也需填写)。此处可填:
 /// {
 ///
 ///     tolerateDependenciesFail?: boolean;
 ///
 ///     preload?: boolean;
 ///
 ///     cacheable?: boolean;
 ///
 ///     httpRetryCount?: number;
 ///
 ///     httpPriority?: number;
 ///
 /// }
 /// </param>
 public static void Load(string path, Action <object> callback, string options = "")
 {
     UnityUtility.StartCoroutine(_Load(path, callback));
 }